import request from '@/utils/request'

// 查询隐患列表
export function listObjHidd(query) {
  return request({
    url: '/hidd/objhidd/list',
    method: 'get',
    params: query
  })
}

// 查询隐患详细
export function getObjHidd(guid) {
  return request({
    url: '/hidd/objhidd/' + guid,
    method: 'get'
  })
}

// 工程/非工程隐患聚合查询
export function getHiddGroupBy(query) {
  return request({
    url: '/hidd/objhidd/groupBy',
    method: 'get',
    params: query
  })
}

// 新增隐患
export function addObjHidd(data) {
  return request({
    url: '/hidd/objhidd',
    method: 'post',
    data: data
  })
}

// 复合保存隐患
export function compoundSaveHidd(data) {
  return request({
    url: '/hidd/objhidd/compoundSave',
    method: 'post',
    data: data
  })
}

// 修改隐患
export function updateObjHidd(data) {
  return request({
    url: '/hidd/objhidd',
    method: 'put',
    data: data
  })
}

// 删除隐患
export function delObjHidd(guids) {
  return request({
    url: '/hidd/objhidd/' + guids,
    method: 'delete'
  })
}

// 查询隐患排查信息列表
export function listBisHiddInve(query) {
  return request({
    url: '/hidd/inve/list',
    method: 'get',
    params: query
  })
}

// 查询隐患排查信息详细
export function getBisHiddInve(guid) {
  return request({
    url: '/hidd/inve/' + guid,
    method: 'get'
  })
}

// 新增隐患排查信息
export function addBisHiddInve(data) {
  return request({
    url: '/hidd/inve',
    method: 'post',
    data: data
  })
}

// 修改隐患排查信息
export function updateBisHiddInve(data) {
  return request({
    url: '/hidd/inve',
    method: 'put',
    data: data
  })
}

// 删除隐患排查信息
export function delBisHiddInve(guids) {
  return request({
    url: '/hidd/inve/' + guids,
    method: 'delete'
  })
}

// 查询整改落实信息列表
export function listBisHiddRectImpl(query) {
  return request({
    url: '/hidd/rectimpl/list',
    method: 'get',
    params: query
  })
}

// 查询整改落实信息详细
export function getBisHiddRectImpl(guid) {
  return request({
    url: '/hidd/rectimpl/' + guid,
    method: 'get'
  })
}

// 新增整改落实信息
export function addBisHiddRectImpl(data) {
  return request({
    url: '/hidd/rectimpl',
    method: 'post',
    data: data
  })
}

// 修改整改落实信息
export function updateBisHiddRectImpl(data) {
  return request({
    url: '/hidd/rectimpl',
    method: 'put',
    data: data
  })
}

// 删除整改落实信息
export function delBisHiddRectImpl(guids) {
  return request({
    url: '/hidd/rectimpl/' + guids,
    method: 'delete'
  })
}

// 查询整改验收信息列表
export function listBisHiddRectAcce(query) {
  return request({
    url: '/hidd/rectacce/list',
    method: 'get',
    params: query
  })
}

// 查询整改验收信息详细
export function getBisHiddRectAcce(guid) {
  return request({
    url: '/hidd/rectacce/' + guid,
    method: 'get'
  })
}

// 新增整改验收信息
export function addBisHiddRectAcce(data) {
  return request({
    url: '/hidd/rectacce',
    method: 'post',
    data: data
  })
}

// 修改整改验收信息
export function updateBisHiddRectAcce(data) {
  return request({
    url: '/hidd/rectacce',
    method: 'put',
    data: data
  })
}

// 删除整改验收信息
export function delBisHiddRectAcce(guids) {
  return request({
    url: '/hidd/rectacce/' + guids,
    method: 'delete'
  })
}

// 查询整改进展信息列表
export function listBisHiddRectProg(query) {
  return request({
    url: '/hidd/rectprog/list',
    method: 'get',
    params: query
  })
}

// 查询整改进展信息详细
export function getBisHiddRectProg(guid) {
  return request({
    url: '/hidd/rectprog/' + guid,
    method: 'get'
  })
}

// 新增整改进展信息
export function addBisHiddRectProg(data) {
  return request({
    url: '/hidd/rectprog',
    method: 'post',
    data: data
  })
}

// 修改整改进展信息
export function updateBisHiddRectProg(data) {
  return request({
    url: '/hidd/rectprog',
    method: 'put',
    data: data
  })
}

// 删除整改进展信息
export function delBisHiddRectProg(guids) {
  return request({
    url: '/hidd/rectprog/' + guids,
    method: 'delete'
  })
}

// 查询隐患记录上报列表
export function listBisHiddRecRep(query) {
  return request({
    url: '/hidd/recrep/list',
    method: 'get',
    params: query
  })
}

// 查询月报隐患列表（含隐患名称、等级等）
export function listBisHiddRecRepWithHidd(repGuid) {
  return request({
    url: '/hidd/recrep/withHidd/' + repGuid,
    method: 'get'
  })
}

// 查询隐患记录上报详细
export function getBisHiddRecRep(guid) {
  return request({
    url: '/hidd/recrep/' + guid,
    method: 'get'
  })
}

// 新增隐患记录上报
export function addBisHiddRecRep(data) {
  return request({
    url: '/hidd/recrep',
    method: 'post',
    data: data
  })
}

// 修改隐患记录上报
export function updateBisHiddRecRep(data) {
  return request({
    url: '/hidd/recrep',
    method: 'put',
    data: data
  })
}

// 删除隐患记录上报
export function delBisHiddRecRep(guids) {
  return request({
    url: '/hidd/recrep/' + guids,
    method: 'delete'
  })
}

// 查询重大隐患督办列表
export function listBisMajHiddSup(query) {
  return request({
    url: '/hidd/majhiddsup/list',
    method: 'get',
    params: query
  })
}

// 查询重大隐患督办详细
export function getBisMajHiddSup(guid) {
  return request({
    url: '/hidd/majhiddsup/' + guid,
    method: 'get'
  })
}

// 新增重大隐患督办
export function addBisMajHiddSup(data) {
  return request({
    url: '/hidd/majhiddsup',
    method: 'post',
    data: data
  })
}

// 修改重大隐患督办
export function updateBisMajHiddSup(data) {
  return request({
    url: '/hidd/majhiddsup',
    method: 'put',
    data: data
  })
}

// 删除重大隐患督办
export function delBisMajHiddSup(guids) {
  return request({
    url: '/hidd/majhiddsup/' + guids,
    method: 'delete'
  })
}

// 隐患督办销号
export function writeOffBisMajHiddSup(data) {
  return request({
    url: '/hidd/majhiddsup/writeOff',
    method: 'put',
    data: data
  })
}

// 撤销隐患督办
export function cancelBisMajHiddSup(guid) {
  return request({
    url: '/hidd/majhiddsup/cancel/' + guid,
    method: 'delete'
  })
}

// 查询重大隐患核实列表
export function listBisHiddMajVeri(query) {
  return request({
    url: '/hidd/majveri/list',
    method: 'get',
    params: query
  })
}

// 查询重大隐患核实详细
export function getBisHiddMajVeri(guid) {
  return request({
    url: '/hidd/majveri/' + guid,
    method: 'get'
  })
}

// 新增重大隐患核实
export function addBisHiddMajVeri(data) {
  return request({
    url: '/hidd/majveri',
    method: 'post',
    data: data
  })
}

// 修改重大隐患核实
export function updateBisHiddMajVeri(data) {
  return request({
    url: '/hidd/majveri',
    method: 'put',
    data: data
  })
}

// 删除重大隐患核实
export function delBisHiddMajVeri(guids) {
  return request({
    url: '/hidd/majveri/' + guids,
    method: 'delete'
  })
}

// 查询月报期间列表
export function listBisOrgMonRepPeri(query) {
  return request({
    url: '/hidd/monrepperi/list',
    method: 'get',
    params: query
  })
}

// 查询月报期间详细
export function getBisOrgMonRepPeri(guid) {
  return request({
    url: '/hidd/monrepperi/' + guid,
    method: 'get'
  })
}

// 新增月报期间
export function addBisOrgMonRepPeri(data) {
  return request({
    url: '/hidd/monrepperi',
    method: 'post',
    data: data
  })
}

// 修改月报期间
export function updateBisOrgMonRepPeri(data) {
  return request({
    url: '/hidd/monrepperi',
    method: 'put',
    data: data
  })
}

// 删除月报期间
export function delBisOrgMonRepPeri(guids) {
  return request({
    url: '/hidd/monrepperi/' + guids,
    method: 'delete'
  })
}

// 查询月报修订列表
export function listBisOrgMonRepRevo(query) {
  return request({
    url: '/hidd/monreprevo/list',
    method: 'get',
    params: query
  })
}

// 查询月报修订详细
export function getBisOrgMonRepRevo(guid) {
  return request({
    url: '/hidd/monreprevo/' + guid,
    method: 'get'
  })
}

// 新增月报修订
export function addBisOrgMonRepRevo(data) {
  return request({
    url: '/hidd/monreprevo',
    method: 'post',
    data: data
  })
}

// 修改月报修订
export function updateBisOrgMonRepRevo(data) {
  return request({
    url: '/hidd/monreprevo',
    method: 'put',
    data: data
  })
}

// 删除月报修订
export function delBisOrgMonRevo(guids) {
  return request({
    url: '/hidd/monreprevo/' + guids,
    method: 'delete'
  })
}

// 查询隐患统计列表
export function listTBusiHiddCount(query) {
  return request({
    url: '/hidd/count/list',
    method: 'get',
    params: query
  })
}

// 查询隐患月度统计列表
export function listTBusiHiddCountMon(query) {
  return request({
    url: '/hidd/countmon/list',
    method: 'get',
    params: query
  })
}

// 隐患月报上报率图表
export function getReportRateChart(repTime) {
  return request({
    url: '/hidd/count/reportRateChart',
    method: 'get',
    params: { repTime: repTime }
  })
}

// 隐患整改率图表
export function getRectifyRateChart(repTime) {
  return request({
    url: '/hidd/count/rectifyRateChart',
    method: 'get',
    params: { repTime: repTime }
  })
}

// 查询隐患评估统计列表
export function listTBusiHiddEva(query) {
  return request({
    url: '/hidd/eva/list',
    method: 'get',
    params: query
  })
}

// 查询隐患威胁评估统计列表
export function listTBusiHiddThrEva(query) {
  return request({
    url: '/hidd/threva/list',
    method: 'get',
    params: query
  })
}

// 查询隐患考核列表
export function listBisHiddAssess(query) {
  return request({
    url: '/hidd/assess/list',
    method: 'get',
    params: query
  })
}

// 查询隐患考核详细
export function getBisHiddAssess(guid) {
  return request({
    url: '/hidd/assess/' + guid,
    method: 'get'
  })
}

// 新增隐患考核
export function addBisHiddAssess(data) {
  return request({
    url: '/hidd/assess',
    method: 'post',
    data: data
  })
}

// 修改隐患考核
export function updateBisHiddAssess(data) {
  return request({
    url: '/hidd/assess',
    method: 'put',
    data: data
  })
}

// 删除隐患考核
export function delBisHiddAssess(guids) {
  return request({
    url: '/hidd/assess/' + guids,
    method: 'delete'
  })
}

// 查询隐患考核记录列表
export function listBisHiddAssessRec(query) {
  return request({
    url: '/hidd/assessrec/list',
    method: 'get',
    params: query
  })
}

// 查询隐患考核记录详细
export function getBisHiddAssessRec(guid) {
  return request({
    url: '/hidd/assessrec/' + guid,
    method: 'get'
  })
}

// 新增隐患考核记录
export function addBisHiddAssessRec(data) {
  return request({
    url: '/hidd/assessrec',
    method: 'post',
    data: data
  })
}

// 修改隐患考核记录
export function updateBisHiddAssessRec(data) {
  return request({
    url: '/hidd/assessrec',
    method: 'put',
    data: data
  })
}

// 删除隐患考核记录
export function delBisHiddAssessRec(guids) {
  return request({
    url: '/hidd/assessrec/' + guids,
    method: 'delete'
  })
}

// 查询零报告考核列表
export function listBisHiddZeroAssess(query) {
  return request({
    url: '/hidd/zeroassess/list',
    method: 'get',
    params: query
  })
}

// 查询零报告考核详细
export function getBisHiddZeroAssess(guid) {
  return request({
    url: '/hidd/zeroassess/' + guid,
    method: 'get'
  })
}

// 新增零报告考核
export function addBisHiddZeroAssess(data) {
  return request({
    url: '/hidd/zeroassess',
    method: 'post',
    data: data
  })
}

// 修改零报告考核
export function updateBisHiddZeroAssess(data) {
  return request({
    url: '/hidd/zeroassess',
    method: 'put',
    data: data
  })
}

// 删除零报告考核
export function delBisHiddZeroAssess(guids) {
  return request({
    url: '/hidd/zeroassess/' + guids,
    method: 'delete'
  })
}

// 查询零报告考核记录列表
export function listBisHiddZeroAssessRec(query) {
  return request({
    url: '/hidd/zeroassessrec/list',
    method: 'get',
    params: query
  })
}

// 查询零报告考核记录详细
export function getBisHiddZeroAssessRec(guid) {
  return request({
    url: '/hidd/zeroassessrec/' + guid,
    method: 'get'
  })
}

// 新增零报告考核记录
export function addBisHiddZeroAssessRec(data) {
  return request({
    url: '/hidd/zeroassessrec',
    method: 'post',
    data: data
  })
}

// 修改零报告考核记录
export function updateBisHiddZeroAssessRec(data) {
  return request({
    url: '/hidd/zeroassessrec',
    method: 'put',
    data: data
  })
}

// 删除零报告考核记录
export function delBisHiddZeroAssessRec(guids) {
  return request({
    url: '/hidd/zeroassessrec/' + guids,
    method: 'delete'
  })
}

// 查询隐患工程字典列表
export function listTDictHiddEng(query) {
  return request({
    url: '/hidd/dict/list',
    method: 'get',
    params: query
  })
}

// 查询隐患工程字典详细
export function getTDictHiddEng(guid) {
  return request({
    url: '/hidd/dict/' + guid,
    method: 'get'
  })
}

// 新增隐患工程字典
export function addTDictHiddEng(data) {
  return request({
    url: '/hidd/dict',
    method: 'post',
    data: data
  })
}

// 修改隐患工程字典
export function updateTDictHiddEng(data) {
  return request({
    url: '/hidd/dict',
    method: 'put',
    data: data
  })
}

// 删除隐患工程字典
export function delTDictHiddEng(guids) {
  return request({
    url: '/hidd/dict/' + guids,
    method: 'delete'
  })
}

// 查询多媒体附件列表
export function listAttMedBase(query) {
  return request({
    url: '/hidd/medbase/list',
    method: 'get',
    params: query
  })
}

// 查询多媒体附件详细
export function getAttMedBase(guid) {
  return request({
    url: '/hidd/medbase/' + guid,
    method: 'get'
  })
}

// 新增多媒体附件
export function addAttMedBase(data) {
  return request({
    url: '/hidd/medbase',
    method: 'post',
    data: data
  })
}

// 修改多媒体附件
export function updateAttMedBase(data) {
  return request({
    url: '/hidd/medbase',
    method: 'put',
    data: data
  })
}

// 删除多媒体附件
export function delAttMedBase(guids) {
  return request({
    url: '/hidd/medbase/' + guids,
    method: 'delete'
  })
}

// ========== 机构基础信息 ==========

// 查询机构基础信息列表
export function listAttOrgBase(query) {
  return request({
    url: '/hidd/orgbase/list',
    method: 'get',
    params: query
  })
}

// ========== 移动端接口 ==========

// 移动端月报新增
export function mobileSaveMonth(data) {
  return request({
    url: '/hidd/mobile/saveMonth',
    method: 'post',
    data: data
  })
}

// 移动端月报撤回
export function mobileSaveRevoc(data) {
  return request({
    url: '/hidd/mobile/saveRevoc',
    method: 'post',
    data: data
  })
}

// 移动端隐患新增
export function mobileSaveHidd(data) {
  return request({
    url: '/hidd/mobile/save',
    method: 'post',
    data: data
  })
}

// 移动端隐患列表
export function mobileListHidd(query) {
  return request({
    url: '/hidd/mobile/list',
    method: 'get',
    params: query
  })
}

// ========== 下级单位接口 ==========

// 下级隐患保存
export function saveNextHidd(data) {
  return request({
    url: '/hidd/objhidd/saveNextHidd',
    method: 'post',
    data: data
  })
}

// 下级单位隐患列表
export function listNextDepHidd(query) {
  return request({
    url: '/hidd/objhidd/nextDepList',
    method: 'get',
    params: query
  })
}

// ========== 名称匹配查询 ==========

// 隐患名称匹配查询
export function getHiddListByName(query) {
  return request({
    url: '/hidd/objhidd/listByName',
    method: 'get',
    params: query
  })
}

// ========== 树形数据接口 ==========

// 月报树形数据
export function getRepTreeData(query) {
  return request({
    url: '/hidd/month/reptree',
    method: 'get',
    params: query
  })
}

// 快速录入树形数据
export function getFastRepTreeData(query) {
  return request({
    url: '/hidd/fast/reptree',
    method: 'get',
    params: query
  })
}

// ========== 会商信息接口 ==========

// 查询隐患会商信息列表
export function listObjCons(query) {
  return request({
    url: '/hidd/cons/list',
    method: 'get',
    params: query
  })
}

// 查询隐患会商信息详细
export function getObjCons(guid) {
  return request({
    url: '/hidd/cons/' + guid,
    method: 'get'
  })
}

// 新增隐患会商信息
export function addObjCons(data) {
  return request({
    url: '/hidd/cons',
    method: 'post',
    data: data
  })
}

// 修改隐患会商信息
export function updateObjCons(data) {
  return request({
    url: '/hidd/cons',
    method: 'put',
    data: data
  })
}

// 删除隐患会商信息
export function delObjCons(guids) {
  return request({
    url: '/hidd/cons/' + guids,
    method: 'delete'
  })
}

// 查询月报列表统计（按单位分组）
export function getMonthListStats(query) {
  return request({
    url: '/hidd/monrepperi/monthListStats',
    method: 'get',
    params: query
  })
}

// 查询月报汇总
export function getMonthTotalList(query) {
  return request({
    url: '/hidd/monrepperi/monthTotalList',
    method: 'get',
    params: query
  })
}

// 月报上报
export function submitMonth(guid, hiddGuids) {
  return request({
    url: '/hidd/monrepperi/submit',
    method: 'post',
    params: { guid: guid, hiddGuids: hiddGuids.join(',') }
  })
}

// 月报退回
export function returnMonth(guid, returnDesc) {
  return request({
    url: '/hidd/monrepperi/return',
    method: 'put',
    params: { guid: guid, returnDesc: returnDesc }
  })
}

// 月报撤销
export function revokeMonth(guid, revocDesc) {
  return request({
    url: '/hidd/monrepperi/revoke',
    method: 'put',
    params: { guid: guid, revocDesc: revocDesc }
  })
}

// 检查是否可以撤销
export function checkCanRevoke(month) {
  return request({
    url: '/hidd/monrepperi/checkCanRevoke',
    method: 'get',
    params: { month: month, type: '0' }
  })
}

// 月报撤销审核
export function approveRevoke(guid, approved, opinion) {
  return request({
    url: '/hidd/monrepperi/approveRevoke',
    method: 'put',
    params: { guid: guid, approved: approved, opinion: opinion }
  })
}

// 待审批列表
export function revokeApproveList(query) {
  return request({
    url: '/hidd/monreprevo/list',
    method: 'get',
    params: query
  })
}

// 月报批量解锁
export function batchUnlock(guids) {
  return request({
    url: '/hidd/monrepperi/batchUnlock',
    method: 'put',
    params: { guids: guids }
  })
}

// 督促上报
export function urgeReport(orgGuid, repMonth) {
  return request({
    url: '/hidd/monrepperi/urge',
    method: 'post',
    params: { orgGuid: orgGuid, repMonth: repMonth, notType: '1' }
  })
}


