import createAxios from '@/utils/request'

// 新增菜单接口
export function addNode(data: any) {
    return createAxios({
        url: '/device-boot/node/addNode',
        method: 'post',
        data: data
    })
}

//修改前置机
export function updateNode(data: any) {
    return createAxios({
        url: '/device-boot/node/updateNode',
        method: 'put',
        data: data
    })
}

//删除前置机
export function delNode(data: any) {
    return createAxios({
        url: '/device-boot/node/delNode',
        method: 'post',
        params: { id: data }
    })
}

//终端台账树
export function getTerminalTree() {
    return createAxios({
        url: '/device-boot/terminalTree/getTerminalTree',
        method: 'get'
    })
}
//请求前置重启进程
export function askRestartProcess(data: any) {
    return createAxios({
        url: '/device-boot/device/askRestartProcess',
        method: 'post',
        data
    })
}

/**
 * 总计出3层，提供给表单选择具体的终端、母线、监测点
 * 终端台账树
 * 等级：0-项目名称；1- 用户名称；2-单位；3-部门；4-终端；5-母线；6-监测点
 */
export function getTerminalSelectTree(level: number) {
    return createAxios({
        url: '/device-boot/terminalTree/getTerminalSelectTree?level=' + level,
        method: 'get'
    })
}

//查询节点内容
export function queryTerminal(data: any) {
    return createAxios({
        url: `/device-boot/device/queryTerminal`,
        method: 'get',
        params: data
    })
}

//删除终端
export function delTerminal(data: any) {
    return createAxios({
        url: `/device-boot/device/delTerminal`,
        method: 'delete',
        params: data
    })
}

//获取前置机
export function nodeAllList() {
    return createAxios({
        url: '/device-boot/node/nodeAllList',
        method: 'get'
    })
}

//修改数据
export function updateTerminal(query: any) {
    return createAxios({
        url: `/device-boot/device/updateTerminal`,
        method: 'put',
        data: {
            ...query
        }
    })
}

//提交数据
export function addTerminal(query: any) {
    return createAxios({
        url: '/device-boot/device/addTerminal',
        method: 'post',
        data: {
            ...query
        }
    })
}

//查询终端程序版本升级日志
export function getTerminalUpLog(data: any) {
    return createAxios({
        url: '/device-boot/version/getTerminalUpLog',
        method: 'post',
        params: data
    })
}
//查询新能源场站
export function selectDown() {
    return createAxios({
        url: '/device-boot/newStation/selectDown',
        method: 'get'
    })
}
//获取用户大类小类
export function queryAllByType(params: any) {
    return createAxios({
        url: '/system-boot/dictTree/queryAllByType',
        method: 'get',
        params
    })
}
//获取用户
export function selectUserList(data: any) {
    return createAxios({
        url: '/device-boot/userReport/selectUserList',
        method: 'post',
        data
    })
}
//获取用户
export function selectUserAssessMentList(data: any) {
    return createAxios({
        url: '/supervision-boot/userReport/selectUserAssessMentList',
        method: 'post',
        data
    })
}
//绑定用户
export function bindAssessmentId(data: any) {
    return createAxios({
        url: '/supervision-boot/userReport/bindAssessmentId',
        method: 'get',
        params: data
    })
}
//查询列表
export function getStatusManageList(data: any) {
    return createAxios({
        url: '/device-boot/maintain/getStatusManageList',
        method: 'post',
        data
    })
}
//设置终端状态
export function updateRunFlagManage(data: any) {
    return createAxios({
        url: '/device-boot/maintain/updateRunFlagManage',
        method: 'post',
        data
    })
}
//设置终端日志
export function getList(data: any) {
    return createAxios({
        url: '/device-boot/pqsTerminalLogs/getList',
        method: 'post',
        data
    })
}
//查询前置-进程-设备-设备树
export function nodeDeviceTree(data: any) {
    return createAxios({
        url: '/device-boot/nodeDevice/nodeDeviceTree',
        method: 'post',
        params: data
    })
}
//更新设备进程号
export function updateDeviceProcess(data: any) {
    return createAxios({
        url: '/device-boot/nodeDevice/updateDeviceProcess',
        method: 'post',
        data
    })
}
//导出台账模板
export function downTerminalTemplate() {
    return createAxios({
        url: '/device-boot/device/downTerminalTemplate',
        method: 'get',
        responseType: 'blob'
    })
}
//导出台账信息
export function exportTerminalBase() {
    return createAxios({
        url: '/device-boot/device/exportTerminalBase',
        method: 'get',
        responseType: 'blob'
    })
}
//一键分配终端
export function allotTerminal(data: any) {
    return createAxios({
        url: '/device-boot/nodeDevice/oneKeyDistribution',
        method: 'post',
        params: data
    })
}
