import createAxios from '@/utils/request'
import { useAdminInfo } from '@/stores/adminInfo'
//获取变电站下面的母线列表
export function getBusBarSelect(params: any) {
    return createAxios({
        url: '/device-boot/substation/getBusBarSelect',
        method: 'GET',
        params
    })
}
//获取变电站下面监测点
export function getMonitorSelect(params: any) {
    return createAxios({
        url: '/device-boot/substation/getMonitorSelect',
        method: 'GET',
        params
    })
}
//获取谐波源特性字典列表
export function characteristicList(data: any) {
    return createAxios({
        url: '/advance-boot/assessDicHarmonicCharacter/list',
        method: 'Post',
        data
    })
}
//新增谐波源特性字典
export function characteristicAdd(data: any) {
    return createAxios({
        url: '/advance-boot/assessDicHarmonicCharacter/add',
        method: 'Post',
        data
    })
}
//删除谐波源特性字典
export function characteristicDelete(data: any) {
    return createAxios({
        url: '/advance-boot/assessDicHarmonicCharacter/delete',
        method: 'Post',
        data
    })
}
//修改谐波源特性字典
export function characteristicEdit(data: any) {
    return createAxios({
        url: '/advance-boot/assessDicHarmonicCharacter/edit',
        method: 'Post',
        data
    })
}
//新增线缆类型字典
export function cableAdd(data: any) {
    return createAxios({
        url: '/advance-boot/assessDicCableType/add',
        method: 'Post',
        data
    })
}
//获取线缆类型字典列表
export function cableList(data: any) {
    return createAxios({
        url: '/advance-boot/assessDicCableType/list',
        method: 'Post',
        data
    })
}
//修改线缆类型字典
export function cableEdit(data: any) {
    return createAxios({
        url: '/advance-boot/assessDicCableType/edit',
        method: 'Post',
        data
    })
}
//删除线缆类型字典
export function cableDelete(data: any) {
    return createAxios({
        url: '/advance-boot/assessDicCableType/delete',
        method: 'Post',
        data
    })
}
//新增变压器参数
export function transformerAdd(data: any) {
    return createAxios({
        url: '/advance-boot/assessDicTransformer/add',
        method: 'Post',
        data
    })
}
//修改变压器参数
export function transformerEdit(data: any) {
    return createAxios({
        url: '/advance-boot/assessDicTransformer/edit',
        method: 'Post',
        data
    })
}
//删除变压器参数
export function transformerDelete(data: any) {
    return createAxios({
        url: '/advance-boot/assessDicTransformer/delete',
        method: 'Post',
        data
    })
}
//获取冲击负荷字典
export function loadList(data: any) {
    return createAxios({
        url: '/advance-boot/assessDicShockLoad/list',
        method: 'Post',
        data
    })
}
//新增冲击负荷字典
export function loadAdd(data: any) {
    return createAxios({
        url: '/advance-boot/assessDicShockLoad/add',
        method: 'Post',
        data
    })
}
//删除冲击负荷字典
export function loadDelete(data: any) {
    return createAxios({
        url: '/advance-boot/assessDicShockLoad/delete',
        method: 'Post',
        data
    })
}
//编辑冲击负荷字典
export function loadEdit(data: any) {
    return createAxios({
        url: '/advance-boot/assessDicShockLoad/edit',
        method: 'Post',
        data
    })
}
//新增评估用户
export function userAdd(data: any) {
    return createAxios({
        url: '/advance-boot/assessUser/add',
        method: 'Post',
        data
    })
}
//修改评估用户
export function userEdit(data: any) {
    return createAxios({
        url: '/advance-boot/assessUser/edit',
        method: 'Post',
        data
    })
}
//删除评估用户
export function batchDel(data: any) {
    return createAxios({
        url: '/advance-boot/assessUser/batchDel',
        method: 'Post',
        data
    })
}
//获取评估用户
export function userGetInfo(params: any) {
    return createAxios({
        url: '/advance-boot/assessUser/getInfo',
        method: 'get',
        params
    })
}
//获取变压器参数字典列表
export function transformerList(data: any) {
    return createAxios({
        url: '/advance-boot/assessDicTransformer/list',
        method: 'post',
        data
    })
}
//新增评估变压器参数
export function assessTransformerParamAdd(data: any) {
    return createAxios({
        url: '/advance-boot/assessTransformerParam/add',
        method: 'post',
        data
    })
}
//获取评估变压器参数列表
export function assessTransformerParamList(data: any) {
    return createAxios({
        url: '/advance-boot/assessTransformerParam/list',
        method: 'post',
        data
    })
}
//修改评估变压器参数
export function assessTransformerParamEdit(data: any) {
    return createAxios({
        url: '/advance-boot/assessTransformerParam/edit',
        method: 'post',
        data
    })
}
//删除评估变压器参数
export function assessTransformerParamDelete(data: any) {
    return createAxios({
        url: '/advance-boot/assessTransformerParam/delete',
        method: 'post',
        data
    })
}
//获取评估电容器参数列表
export function capacitorList(data: any) {
    return createAxios({
        url: '/advance-boot/assessCapacitorParam/list',
        method: 'post',
        data
    })
}
//新增评估电容器参数
export function capacitorAdd(data: any) {
    return createAxios({
        url: '/advance-boot/assessCapacitorParam/add',
        method: 'post',
        data
    })
}
//删除评估电容器参数
export function capacitorDelete(data: any) {
    return createAxios({
        url: '/advance-boot/assessCapacitorParam/delete',
        method: 'post',
        data
    })
}
//修改评估电容器参数
export function capacitorEdit(data: any) {
    return createAxios({
        url: '/advance-boot/assessCapacitorParam/edit',
        method: 'post',
        data
    })
}

//获取风电场类负荷参数列表
export function windPowerList(data: any) {
    return createAxios({
        url: '/advance-boot/assessWindLoadParam/list',
        method: 'post',
        data
    })
}
//新增风电场类负荷参数
export function windPowerAdd(data: any) {
    return createAxios({
        url: '/advance-boot/assessWindLoadParam/add',
        method: 'post',
        data
    })
}
//删除风电场类负荷参数
export function windPowerDelete(data: any) {
    return createAxios({
        url: '/advance-boot/assessWindLoadParam/delete',
        method: 'post',
        data
    })
}
//修改风电场类负荷参数
export function windPowerDdit(data: any) {
    return createAxios({
        url: '/advance-boot/assessWindLoadParam/edit',
        method: 'post',
        data
    })
}
//获取评估用户负荷参数列表
export function loadParamList(data: any) {
    return createAxios({
        url: '/advance-boot/assessLoadParam/list',
        method: 'post',
        data
    })
}
//新增评估用户负荷参数
export function loadParamAdd(data: any) {
    return createAxios({
        url: '/advance-boot/assessLoadParam/add',
        method: 'post',
        data
    })
}
//删除评估用户负荷参数
export function loadParamDelete(data: any) {
    return createAxios({
        url: '/advance-boot/assessLoadParam/delete',
        method: 'post',
        data
    })
}
//修改评估用户负荷参数
export function loadParamEdit(data: any) {
    return createAxios({
        url: '/advance-boot/assessLoadParam/edit',
        method: 'post',
        data
    })
}

//获取评估用户冲击负荷参数列表
export function shockList(data: any) {
    return createAxios({
        url: '/advance-boot/assessShockLoadParam/list',
        method: 'post',
        data
    })
}
//新增评估用户冲击负荷参数
export function shockAdd(data: any) {
    return createAxios({
        url: '/advance-boot/assessShockLoadParam/add',
        method: 'post',
        data
    })
}
//修改评估用户冲击负荷参数
export function shockEdit(data: any) {
    return createAxios({
        url: '/advance-boot/assessShockLoadParam/edit',
        method: 'post',
        data
    })
}
//删除评估用户冲击负荷参数
export function shockDelete(data: any) {
    return createAxios({
        url: '/advance-boot/assessShockLoadParam/delete',
        method: 'post',
        data
    })
}
//获取评估树
export function getTree(data: any) {
    const adminInfo = useAdminInfo()
    return createAxios({
        url: '/advance-boot/secondaryEvaluation/evaluationTree?deptId=' + adminInfo.deptIndex,
        method: 'post',
        data
    })
}
//获取评估结果
export function getResult(data: any, assessId?: string | number) {
    return createAxios({
        url: `/advance-boot/secondaryEvaluation/assessResult${assessId ? `?assessId=${assessId}` : ''}`,
        method: 'post',
        data
    });
}

//导出评估结果
export function exportResult(data: any, assessId?: string | number) {
    return createAxios({
        url: `/advance-boot/secondaryEvaluation/downAssessResult${assessId ? `?assessId=${assessId}` : ''}`,
        method: 'get',
        responseType: 'blob'
    });
}


//导入评估
export const evaluation = (assessId: string, file: File) => {
    const formData = new FormData()
    formData.append('assessId', assessId)
    formData.append('file', file)
    
    return createAxios({
      url: '/advance-boot/secondaryEvaluation/evaluation',
      method: 'post',
      data: formData,
      headers: {
        'Content-Type': 'multipart/form-data'
      }
    })
  }

//直接评估
export function assessResult(data: {
    assessId: string | number,
    endTime: string,
    id: string | number,
    startTime: string
  }) {
    return createAxios({
      url: `/advance-boot/secondaryEvaluation/lineEvaluation`,
      method: 'post',
      data
    });
  }

//下载模板
export const downloadAssessTemplate = () => {
    return createAxios({
        url: '/advance-boot/secondaryEvaluation/downTemplateAssessResult',
        method: 'get',
        responseType: 'blob'
    })
}