import request from '@/utils/request'


// 任务管理顶部接口
export function getPageTopdata(data) {
    return request({
        url: `/maintenancePlan/devOpsAnalyse`,
        method: 'post',
        data
    })
}

// 任务管理顶部接口
export function getPageList(data) {
    return request({
        url: `/maintenancePlan/devOpsTask`,
        method: 'post',
        data
    })
}

// 任务管理顶部接口
export function addTask(data) {
    return request({
        url: `/maintenancePlan/releaseTask`,
        method: 'post',
        data
    })
}


// 修改任务
export function putTask(data) {
    return request({
        url: `/maintenancePlan/devOpsTaskModify`,
        method: 'post',
        data
    })
}


// 发布任务关联设备下拉1
export function correlationList1() {
    return request({
        url: `/iot/product/allList`,
        method: 'get'
    })
}

// 发布任务关联设备下拉2
export function correlationList2(query) {
    return request({
        url: `/iot/device/shortList`,
        method: 'get',
        params: query
    })
}

// 发布任务关联路线下拉1
export function getRouteList(data) {
    return request({
        url: `/device/findInspectionRoute`,
        method: 'post',
        data
    })
}

// 发布任务关联路线下拉1
export function getSpareParts(data) {
    return request({
        url: `/spareParts/queryByPageList`,
        method: 'post',
        data
    })
}

// 任务开始
export function beginTask(data) {
    return request({
        url: `/maintenancePlan/devOpsTaskStart`,
        method: 'post',
        data
    })
}


// 任务完成
export function endTask(data) {
    return request({
        url: `/maintenancePlan/devOpsTaskFinish`,
        method: 'post',
        data
    })
}

// 处理意见
export function dealOpinions(data) {
    return request({
        url: `/maintenancePlan/devOpsTaskHandling`,
        method: 'post',
        data
    })
}

// 设备运维-任务详情
export function getDetails(data) {
    return request({
        url: `/maintenancePlan/devOpsTaskDetails`,
        method: 'post',
        data
    })
}


// 巡检任务记录列表
export function getInspectionList(data) {
    return request({
        url: `/device/findTaskRecord`,
        method: 'post',
        params: data,
        data
    })
}


// 保养、维修任务记录列表
export function getMaintenanceList(data) {
    return request({
        url: `/maintenancePlan/devOpsTaskRecord`,
        method: 'post',
        data
    })
}


// 能源占比跟运维任务
export function getEnergyConsump() {
    return request({
        url: `/energy/monitoring/consumptionProportion2`,
        method: 'post'
    })
}


// 告警数量
export function getAlarmInfo() {
    return request({
        url: `/iot/alertLog/countAlertNumber`,
        method: 'get'
    })
}

// 摄像头人数
export function getCameraData() {
    return request({
        url: `/system/user/camera`,
        method: 'get'
    })
}


// 控制次数
export function controlFrequency() {
    return request({
        url: `/iot/deviceLog/findControlFrequency`,
        method: 'post'
    })
}


// 获取任务列表
export function taskList(params) {
    return request({
        url: `/maintenancePlan/taskList`,
        method: 'get',
        params
    })
}

// 删除任务
export function deleteTaskByIds(id) {
    return request({
        url: '/maintenancePlan/deleteTaskByIds/' + id,
        method: 'delete'
    })
}


// 保养项目列表
export function taskItemsList(params) {
    return request({
        url: `/maintenancePlan/taskItemsList`,
        method: 'get',
        params
    })
}

// 查询设备保养项目详细
export function getTaskItems(id) {
    return request({
        url: '/maintenancePlan/taskItems/' + id,
        method: 'get'
    })
}

// 新增设备保养项目
export function addTaskItems(data) {
    return request({
        url: '/maintenancePlan/taskItemsAdd',
        method: 'post',
        data: data
    })
}

// 修改设备保养项目
export function updateTaskItems(data) {
    return request({
        url: '/maintenancePlan/taskItemsEdit',
        method: 'put',
        data: data
    })
}

// 删除设备保养项目
export function delTaskItems(id) {
    return request({
        url: '/maintenancePlan/taskItemsDelete/' + id,
        method: 'delete'
    })
}

export function maintainImgs(query) {
    return request({
        url: '/maintenancePlan/maintain-imgs',
        method: 'get',
        params: query
    })
}


// 修改备件图片列表
export function saveMaintainImgs(data) {
    return request({
        url: '/maintenancePlan/maintain-imgs',
        method: 'post',
        data
    })
}


export function inspectionImgs(query) {
    return request({
        url: '/maintenancePlan/inspection-imgs',
        method: 'get',
        params: query
    })
}


// 修改备件图片列表
export function saveInspectionImgs(data) {
    return request({
        url: '/maintenancePlan/inspection-imgs',
        method: 'post',
        data
    })
}


// 修改备件图片列表
export function findInspectionTaskRouteLog(params) {
    return request({
        url: '/device/findInspectionTaskRouteLog',
        method: 'get',
        params
    })
}


// 修改备件图片列表
export function updateInspectionTaskRouteLog(data) {
    return request({
        url: '/device/updateInspectionTaskRouteLog',
        method: 'post',
        data
    })
}

export function devcioeUpdatelifeCycle(data) {
    return request({
        url: '/maintenancePlan/devcioeUpdatelifeCycle',
        method: 'post',
        data
    })
}

export function selectMaintainLogList(params) {
    return request({
        url: '/maintenancePlan/selectMaintainLogList',
        method: 'get',
        params
    })
}
