import request from '@/utils/request'


export function gettasklist(query) {
  return request({
    url: '/supervision/task/',
    method: 'get',
    params: query
  })
}

export function gettask(id) {
  return request({
    url: `/supervision/task/${id}/`,
    method: 'get'
  })
}

export function createtask(data) {
  return request({
    url: '/supervision/task/',
    method: 'post',
    data
  })
}

export function updatetask(id, data) {
  return request({
    url: `/supervision/task/${id}/`,
    method: 'put',
    data
  })
}

export function deletetask(id, data) {
  return request({
    url: `/supervision/task/${id}/`,
    method: 'delete',
    data
  })
}

export function inittask(id, data) {
  return request({
    url: `/supervision/task/${id}/init/`,
    method: 'post',
    data
  })
}

export function appendtask(id, data) {
  return request({
    url: `/supervision/task/${id}/append/`,
    method: 'post',
    data
  })
}

export function gettaskcontents(id) {
  return request({
    url: `/supervision/task/${id}/contents/`,
    method: 'get'
  })
}

export function gettaskdepts(id) {
  return request({
    url: `/supervision/task/${id}/depts/`,
    method: 'get'
  })
}

export function starttask(id) {
  return request({
    url: `/supervision/task/${id}/start/`,
    method: 'put'
  })
}

export function closetask(id) {
  return request({
    url: `/supervision/task/${id}/close/`,
    method: 'put'
  })
}

export function gettaskdeptall(id) {
  return request({
    url: `/supervision/task/${id}/deptall/`,
    method: 'get'
  })
}
export function getmytasklist(query) {
  return request({
    url: '/supervision/task/self/',
    method: 'get',
    params: query
  })
}

export function confirmTaskdept(id) {
  return request({
    url: `/supervision/taskdept/${id}/confirm/`,
    method: 'put'
  })
}
export function updateTaskdept(id,data) {
  return request({
    url: `/supervision/taskdept/${id}/`,
    method: 'put',
    data
  })
}

export function deleteTaskdept(id) {
  return request({
    url: `/supervision/taskdept/${id}/`,
    method: 'delete'
  })
}


// 集团目标
export function getPgoalList(query) {
  return request({
    url: '/supervision/pgoal/',
    method: 'get',
    params: query
  })
}
export function createPgoal(data) {
  return request({
    url: '/supervision/pgoal/',
    method: 'post',
    data
  })
}
export function getPgoal(id) {
  return request({
    url: `/supervision/pgoal/${id}/`,
    method: 'get'
  })
}
export function updatePgoal(id, data) {
  return request({
    url: `/supervision/pgoal/${id}/`,
    method: 'put',
    data
  })
}
export function deletePgoal(id) {
  return request({
    url: `/supervision/pgoal/${id}/`,
    method: 'delete'
  })
}
//部门目标
export function getPgoalDeptList(query) {
  return request({
    url: '/supervision/pgoaldept/',
    method: 'get',
    params: query
  })
}
export function createPgoalDept(data) {
  return request({
    url: '/supervision/pgoaldept/',
    method: 'post',
    data
  })
}
export function getPgoalDept(id) {
  return request({
    url: `/supervision/pgoaldept/${id}/`,
    method: 'get'
  })
}
export function updatePgoalDept(id, data) {
  return request({
    url: `/supervision/pgoaldept/${id}/`,
    method: 'put',
    data
  })
}
export function deletePgoalDept(id) {
  return request({
    url: `/supervision/pgoaldept/${id}/`,
    method: 'delete'
  })
}
//任务
export function getTask2List(query) {
  return request({
    url: '/supervision/task2/',
    method: 'get',
    params: query
  })
}

export function getTask2(id) {
  return request({
    url: `/supervision/task2/${id}/`,
    method: 'get'
  })
}

export function createTask2(data) {
  return request({
    url: '/supervision/task2/',
    method: 'post',
    data
  })
}
export function addDeptsTask2(id,data) {
  return request({
    url: `/supervision/task2/${id}/add_depts/`,
    method: 'post',
    data
  })
}

export function updateTask2(id, data) {
  return request({
    url: `/supervision/task2/${id}/`,
    method: 'put',
    data
  })
}
export function startTask2(id) {
  return request({
    url: `/supervision/task2/${id}/start/`,
    method: 'put'
  })
}
export function closeTask2(id) {
  return request({
    url: `/supervision/task2/${id}/close/`,
    method: 'put'
  })
}
export function deleteTask2(id, data) {
  return request({
    url: `/supervision/task2/${id}/`,
    method: 'delete',
    data
  })
}
//获取该任务下的执行组织
export function getTask2Do(query) {
  return request({
    url: '/supervision/task2do/',
    method: 'get',
    params: query
  })
}
//我的任务
export function getMyTask2Do(query) {
  return request({
    url: '/supervision/task2do/my/',
    method: 'get',
    params: query
  })
}
//删除该任务下的执行组织
export function deleteTask2Do(id) {
  return request({
    url: `/supervision/task2do/${id}/`,
    method: 'delete'
  })
}
//pt
export function getPtList(query) {
  return request({
    url: '/supervision/pt/',
    method: 'get',
    params: query
  })
}
export function createPt(data) {
  return request({
    url: '/supervision/pt/',
    method: 'post',
    data
  })
}
export function getPt(id) {
  return request({
    url: `/supervision/pt/${id}/`,
    method: 'get'
  })
}
export function updatePt(id, data) {
  return request({
    url: `/supervision/pt/${id}/`,
    method: 'put',
    data
  })
}
export function deletePt(id) {
  return request({
    url: `/supervision/pt/${id}/`,
    method: 'delete'
  })
}
export function impPt(data) {
  return request({
    url: '/supervision/pt/imp/',
    method: 'post',
    data
  })
}
//rc
export function getRcList(query) {
  return request({
    url: '/supervision/rc/',
    method: 'get',
    params: query
  })
}
export function createRc(data) {
  return request({
    url: '/supervision/rc/',
    method: 'post',
    data
  })
}
export function getRc(id) {
  return request({
    url: `/supervision/rc/${id}/`,
    method: 'get'
  })
}
export function updateRc(id, data) {
  return request({
    url: `/supervision/rc/${id}/`,
    method: 'put',
    data
  })
}
export function deleteRc(id) {
  return request({
    url: `/supervision/rc/${id}/`,
    method: 'delete'
  })
}
export function impRc(data) {
  return request({
    url: '/supervision/rc/imp_error/',
    method: 'post',
    data
  })
}
export function impOverdue(data) {
  return request({
    url: '/supervision/rc/imp_overdue/',
    method: 'post',
    data
  })
}
///Risk
export function getRiskList(query) {
  return request({
    url: '/supervision/risk/',
    method: 'get',
    params: query
  })
}
export function createRisk(data) {
  return request({
    url: '/supervision/risk/',
    method: 'post',
    data
  })
}
export function getRisk(id) {
  return request({
    url: `/supervision/risk/${id}/`,
    method: 'get'
  })
}
export function updateRisk(id, data) {
  return request({
    url: `/supervision/risk/${id}/`,
    method: 'put',
    data
  })
}
export function deleteRisk(id) {
  return request({
    url: `/supervision/risk/${id}/`,
    method: 'delete'
  })
}
export function impRisk(data) {
  return request({
    url: '/supervision/risk/imp/',
    method: 'post',
    data
  })
}
///Complaint
export function getComplaintList(query) {
  return request({
    url: '/supervision/complaint/',
    method: 'get',
    params: query
  })
}
export function createComplaint(data) {
  return request({
    url: '/supervision/complaint/',
    method: 'post',
    data
  })
}
export function getComplaint(id) {
  return request({
    url: `/supervision/complaint/${id}/`,
    method: 'get'
  })
}
export function updateComplaint(id, data) {
  return request({
    url: `/supervision/complaint/${id}/`,
    method: 'put',
    data
  })
}
export function deleteComplaint(id) {
  return request({
    url: `/supervision/complaint/${id}/`,
    method: 'delete'
  })
}
export function impComplaint(data) {
  return request({
    url: '/supervision/complaint/imp/',
    method: 'post',
    data
  })
}
//Oinspect
export function getOinspectList(query) {
  return request({
    url: '/supervision/oinspect/',
    method: 'get',
    params: query
  })
}
export function createOinspect(data) {
  return request({
    url: '/supervision/oinspect/',
    method: 'post',
    data
  })
}
export function getOinspect(id) {
  return request({
    url: `/supervision/oinspect/${id}/`,
    method: 'get'
  })
}
export function updateOinspect(id, data) {
  return request({
    url: `/supervision/oinspect/${id}/`,
    method: 'put',
    data
  })
}
export function deleteOinspect(id) {
  return request({
    url: `/supervision/oinspect/${id}/`,
    method: 'delete'
  })
}
export function impOinspect(data) {
  return request({
    url: '/supervision/oinspect/imp/',
    method: 'post',
    data
  })
}
//supervision/task2do/save_num/
export function saveNum(id,data) {
  return request({
    url: `/supervision/task2do/${id}/save_num/`,
    method: 'put',
    data
  })
}
export function noNum(id,data) {
  return request({
    url: `/supervision/task2do/${id}/no_record/`,
    method: 'put',
    data
  })
}
export function taskAnalyse(data) {
  return request({
    url: '/supervision/analyse/group_by_dept/',
    method: 'post',
    data
  })
}