import request from '@/utils/request'
//联动点详情
export function pointDel (linkageStrategyId) {
  return request({
    url: '/patrol/strategy/' + linkageStrategyId,
    method: 'get',
  })
}
//修改联动点位
export function editPoint (data) {
  return request({
    url: '/patrol/strategy/edit',
    method: 'post',
    data: data
  })
}
//  删除检修区域（批量)
export function delPoint (linkagestrategyIds) {
  return request({
    url: '/patrol/strategy/remove/' + linkagestrategyIds,
    method: 'post',
  })
}
//删除检修区域（批量)
export function delmaintenanceArea (lineIds) {
  return request({
    url: '/patrol/maintarea/remove/' + lineIds,
    method: 'post',
  })
}
//添加联动点位
export function addPoint (data) {
  return request({
    url: '/patrol/strategy',
    method: 'post',
    data: data
  })
}
//联动新增-查询巡检点
export function getaddPoint (query) {
  return request({
    url: '/patrol/linkage/patrolpoint',
    method: 'get',
    params: query
  })
}
//获取联动点位列表
export function getPoints (query) {
  return request({
    url: '/patrol/strategy/list',
    method: 'get',
    params: query
  })
}
//添加检修区域
export function addTarea (data) {
  return request({
    url: '/patrol/maintarea',
    method: 'post',
    data: data
  })
}
//修改巡检任务
export function editSave (data) {
  return request({
    url: '/patrol/task/save',
    method: 'post',
    data: data
  })
}
//主设备下巡检点和巡检点巡检设备树（巡视任务回显）
export function editList (query) {
  return request({
    url: '/basedata/prodevmnt/device/treeProMainDevicePatrolEquSelectByEqookCode',
    method: 'get',
    params: query
  })
}
// 巡视任务编辑回显
export function editTask (taskId) {
  return request({
    url: '/patrol/task/' + taskId,
    method: 'get',
  })
}
// 复制巡检任务
export function copyTask (query) {
  return request({
    url: '/patrol/task/copyTask',
    method: 'get',
    params: query
  })
}
// 删除巡检任务（批量）
export function delTask (taskIds) {
  return request({
    url: 'patrol/task/remove/' + taskIds,
    method: 'post'
  })
}



// 下发巡检任务
export function issue (query) {
  return request({
    url: '/patrol/task/issue',
    method: 'get',
    params: query
  })
}



// 立即执行任务
export function controlChange (id) {
  return request({
    url: '/patrol/taskstatus/controlChange?taskId=' + id,
    method: 'get',
  })
}
//巡视任务列表修改任务状态（列表开关）
export function changeStatus (query) {
  return request({
    url: '/patrol/task/changeStatus',
    method: 'get',
    params: query
  })
}

// 新建/修改巡检任务
export function addPatrol (data) {
  return request({
    url: '/patrol/task/add',
    method: 'post',
    data: data
  })
}
// 巡视任务管理列表
export function taskPatrol (query) {
  return request({
    url: 'patrol/task/list',
    method: 'get',
    params: query
  })
}
// 主设备下巡检点和巡检点巡检设备树
export function equSelect (query) {
  return request({
    url: '/basedata/prodevmnt/device/treeProMainDevicePatrolEquSelect',
    method: 'get',
    params: query
  })
}
// 生产设备树
export function equipmentree (query = {}) {
  return request({
    url: '/basedata/prodevmnt/device/getProDeviceTreeSelect',
    method: 'get',
    params: query
  })
}
// 添加设备类型
export function addDevicetype (data) {
  return request({
    url: '/basedata/devicetype/add',
    method: 'post',
    data: data
  })
}
// 标准点位列表
export function standardPoint (query) {
  return request({
    url: '/basedata/patrolpointmnt/stdpatrolpoint/list',
    method: 'get',
    params: query
  })
}
// 联动点位管理列表
export function linkageAdmin (query) {
  return request({
    url: '/patrol/linkage/list',
    method: 'get',
    params: query
  })
}
// 联动点位管理设备类型列表
export function linkageStyle () {
  return request({
    url: '/basedata/devicetype/list',
    method: 'get'
  })
}
// 获取生产设备树(包含区域、类型、部件模板)
export function productionEquipment () {
  return request({
    url: '/basedata/prodevmnt/device/treeAreaDeviceSelect',
    method: 'get'
  })
}
// 删除联动点位（批量）
export function dellinkPoint (linkagePosIds) {
  return request({
    url: '/patrol/linkage/' + linkagePosIds,
    method: 'delete'
  })
}
// 设备类型管理修改
export function modifyEquipment (data) {
  return request({
    url: '/basedata/devicetype/update',
    method: 'post',
    data: data
  })
}

// 生产区域管理导出
export function exportarea (query) {
  return request({
    url: '/api/area/exportarea',
    method: 'get',
    params: query
  })
}
// 查询部门列表
export function listArea (query) {
  return request({
    url: '/basedata/area/list',
    method: 'get',
    params: query
  })
}

// 查询部门列表（排除节点）
export function listAreaExcludeChild (areaId) {
  return request({
    url: '/basedata/area/list/exclude/' + areaId,
    method: 'get'
  })
}

// 查询部门详细
export function getArea (areaId) {
  return request({
    url: '/basedata/area/' + areaId,
    method: 'get'
  })
}

// 查询部门下拉树结构
export function treeselect (query) {
  return request({
    url: '/basedata/area/treeselect',
    method: 'get',
    params: query
  })
}

// 根据角色ID查询部门树结构
export function roleAreaTreeselect (roleId) {
  return request({
    url: '/basedata/area/roleAreaTreeselect/' + roleId,
    method: 'get'
  })
}

// 新增部门
export function addArea (data) {
  return request({
    url: '/basedata/area',
    method: 'post',
    data: data
  })
}
// 生产新增部门
export function addArea1 (data) {
  return request({
    url: '/basedata/area/add',
    method: 'post',
    data: data
  })
}

// 修改部门
export function updateArea (data) {
  return request({
    url: '/basedata/area',
    method: 'post',
    data: data
  })
}

// 修改生产部门
export function updateArea1 (data) {
  return request({
    url: '/basedata/area/update',
    method: 'post',
    data: data
  })
}

// 删除部门
export function delArea (areaId) {
  return request({
    url: '/basedata/area/remove/' + areaId,
    method: 'post'
  })
}
// 联动点位参数列表
export function linkage (query) {
  return request({
    url: '/system/config/list',
    params: query
  })
}
// 保存联动参数
export function saveLinkage (data) {
  return request({
    url: '/patrol/linkage/action',
    method: 'post',
    data: data
  })
}
// 添加联动点位
export function addLinkage (data) {
  return request({
    url: '/patrol/linkage',
    method: 'post',
    data: data
  })
}
// 获取所属专业
export function professionType () {
  return request({
    url: '/system/dict/data/type/profession_type',
    method: 'get'
  })
}
// 获取检修区域列表
export function maintenanceArea (query) {
  return request({
    url: '/patrol/maintarea/list',
    method: 'get',
    params: query
  })
}
// 添加设备类型
export function addDevice (data) {
  return request({
    url: '/basedata/devicetype/add',
    method: 'post',
    data: data
  })
}
// 删除设备类型
export function deleteDevice (params) {
  return request({
    url: '/basedata/devicetype/delete/' + params,
    method: 'post'
  })
}
// 修改设备类型
export function editDevice (data) {
  return request({
    url: '/basedata/devicetype/update',
    method: 'post',
    data: data
  })
}
// 设备类型列表树
export function deviceTrees (data) {
  return request({
    url: '/basedata/devicetype/getProDeviceTypeTreeSelect',
    method: 'get'
  })
}
// 查询点位列表
export function dotList () {
  return request({
    url: '/basedata/patrolpointmnt/stdpatrolpoint/list',
    method: 'get'
  })
}
// 生产点位管理左侧列表树
export function proDotManTrees () {
  return request({
    url: '/basedata/prodevmnt/device/getProDeviceTreeSelect',
    method: 'get'
  })
}
// 生产点位管理中间列表
export function proDotManTable (params) {
  return request({
    url: '/basedata/patrolpointmnt/patrolpoint/list/monitor',
    method: 'get',
    params: params
  })
}
// 生产点位管理单条、多条数据删除
export function proDotTableDeleteSin (deleteid) {
  return request({
    url: '/basedata/patrolpointmnt/patrolpoint/remove/' + deleteid,
    method: 'post'
  })
}
// 生产点位管理单条数据新增
export function proDotTableAddSin (data) {
  return request({
    url: '/basedata/patrolpointmnt/patrolpoint',
    method: 'post',
    data: data
  })
}
// 生产点位管理单条数据修改
export function proDotTableEditSin (data) {
  return request({
    url: '/basedata/patrolpointmnt/patrolpoint/edit',
    method: 'post',
    data: data
  })
}
// 查询监控列表(预置点)
export function bindingMonitorDotList (channelType) {
  return request({
    url: '/patrol/preset/camera/' + channelType,
    method: 'get'
  })
}
// 预置点下发
export function presetDotDistribute (params) {
  return request({
    url: '/patrol/preset/issue',
    method: 'get',
    params: params
  })
}
// 转到预置点
export function convertPresetDot (params) {
  return request({
    url: '/patrol/preset/goto',
    method: 'get',
    params: params
  })
}
// 拍照
export function photograph (params) {
  return request({
    url: '/patrol/videotape/snap',
    method: 'get',
    params: params
  })
}
// 云台控制
export function cloudControl (params) {
  return request({
    url: '/patrol/videotape/ptz',
    method: 'get',
    params: params
  })
}
// 实时直播
export function realLive (params) {
  return request({
    url: '/patrol/video/realtime',
    method: 'get',
    params: params
  })
}
// 录像列表
export function recordList (params) {
  return request({
    url: '/patrol/videotape/record/list',
    method: 'get',
    params: params
  })
}
// 录像
export function record (params) {
  return request({
    url: '/patrol/videotape/record',
    method: 'get',
    params: params
  })
}
// 回放开始
export function reviewStart (params) {
  return request({
    url: '/patrol/videotape/review/start',
    method: 'get',
    params: params
  })
}
// 回放结束
export function reviewStop (params) {
  return request({
    url: '/patrol/videotape/review/stop',
    method: 'get',
    params: params
  })
}
// 回放控制
export function reviewControl (params) {
  return request({
    url: '/patrol/videotape/review/control',
    method: 'get',
    params: params
  })
}
// 焦距光圈
export function focalAperture (params) {
  return request({
    url: '/patrol/videotape/ptz/fi',
    method: 'get',
    params: params
  })
}
// 绑定预置点
export function bindingPreset (data) {
  return request({
    url: '/patrol/preset',
    method: 'post',
    data: data
  })
}

// 设置预置位点
export function issueUpdate (params) {
  console.log('0000000',params)
  return request({
    url: '/patrol/preset/issueUpdate',
    method: 'get',
    params: params
  })
}

// 修改生产设备
export function editProEquip (data) {
  return request({
    url: '/basedata/prodevmnt/device/update',
    method: 'post',
    data: data
  })
}
// 获取生产设备树(包含区域、设备、部件)
export function getProEquipTree () {
  return request({
    url: '/basedata/prodevmnt/device/getProDeviceTreeSelect',
    method: 'get'
  })
}
// 获取生产设备详情
export function getProEquipShow (deviceId) {
  return request({
    url: '/basedata/prodevmnt/device/' + deviceId,
    method: 'get'
  })
}
// 查询点位列表
export function searchDotsList (params) {
  return request({
    url: '/basedata/patrolpointmnt/stdpatrolpoint/list',
    method: 'get',
    params
  })
}
// 获取主设备类型下的部件类型
export function getMainEquipPartType (params) {
  return request({
    url: '/basedata/devicetype/getCommpTypeTreeSelectByMainDevicetypeId',
    method: 'get',
    params: params
  })
}
// 获取算法列表
export function getAlgList () {
  return request({
    url: '/basedata/alg/list',
    method: 'get'
  })
}
// 获取算法子类型
export function getAlgPartType () {
  return request({
    url: '/basedata/subtype/list',
    method: 'get'
  })
}
// 保存标准巡检点位
export function saveStaDot (data) {
  return request({
    url: '/basedata/patrolpointmnt/stdpatrolpoint/addBatchList',
    method: 'post',
    data: data
  })
}
// 获取主设备类型
export function getMainEquipType (params) {
  return request({
    url: '/basedata/devicetype/list',
    method: 'get',
    params: { 'powerMainEquFlag': 'Yes' }
  })
}


// 添加生产设备
export function insertMainDeviceAndCommByDeviceType (data) {
  return request({
    url: '/basedata/prodevmnt/device/insertMainDeviceAndCommByDeviceType',
    method: 'post',
    data: data
  })
}

// 获取生产设备详情
export function getEquInfo (id) {
  return request({
    url: '/basedata/prodevmnt/device/' + id,
    method: 'get',
    params: { id }
  })
}

export function getStationNameList (params) {
  return request({
    url: '/basedata/station/getStationNameList',
    method: 'get',
    params
  })
}

// 获取检修区域树
export function getRepairAreaTree (params = {}) {
  return request({
    url: '/basedata/prodevmnt/device/treeAreaDeviceSelectAgain',
    method: 'get',
    params
  })
}

// 获取检修区域树
export function updateRepairAreaStatus (id, enable) {
  return request({
    url: '/patrol/maintarea/update',
    method: 'get',
    params: {
      lineId: id,
      enable
    }
  })
}
// 批量下发检修区域
export function downAreas (ids) {
  return request({
    url: '/patrol/maintarea/issue',
    method: 'get',
    params: {
      ids
    }
  })
}
