import Request from '@/utils/request'
import { business, dict, User, integration, workflow, auth, report } from '@/api/index'

let times = new Date().getTime();

/* --------------------------------------机构信息 Start---------------------*/
//  人员_编辑_民族 数据字典接口
export function nation() {
    return Request({
        url: `${dict}/dataDictionary/getSubDataDictionarysByGroupId/${7674}`,
        method: 'get'
    })
}

//  机构_新增_所属单位 数据字典接口
export function subordinateUnit() {
    return Request({
        url: `${dict}/dataDictionary/getDataGroupId/${43466}`,
        // url: `${User}/custom/getUserOrgInfoTree/1/10`,
        method: 'get'
    })
}

// 机构信息分页
export function qualityList(data, organizationVO) {
    return Request({
        url: `${business}/Organization/findByPage/${data.page}/${data.size}`,
        method: 'post',
        data: organizationVO
    })
}

// 人员分 页
export function personList(data, personnelManagementVO) {
    return Request({
        url: `${business}/PersonnelManagement/findByPage/${data.page}/${data.size}`,
        method: 'post',
        data: personnelManagementVO
    })
}
// 设备分页
export function equipmentList(data, equipmentVO) {
    return Request({
        url: `${business}/Equipment/findByPage/${data.page}/${data.size}`,
        method: 'post',
        data: equipmentVO
    })
}

// 机构信息详情
export function qualityDetails(id) {
    return Request({
        url: `${business}/Organization/findById/${id}`,
        method: 'get'
    })
}
// 人员信息详情
export function personDetails(id) {
    return Request({
        url: `${business}/PersonnelManagement/findById/${id}`,
        method: 'get'
    })
}
// 设备信息
export function equipmentDetails(id) {
    return Request({
        url: `${business}/Equipment/findById/${id}`,
        method: 'get'
    })
}
// 机构信息修改
export function qualityUpdata(data) {
    return Request({
        url: `${business}/Organization/update`,
        method: 'post',
        data: data
    })
}
// 设备信息修改
export function equipmentUpdata(data) {
    return Request({
        url: `${business}/Equipment/update`,
        method: 'post',
        data: data
    })
}
export function personnelManagementUpdata(data) {
    return Request({
        url: `${business}/PersonnelManagement/update`,
        method: 'post',
        data: data
    })
}

// 机构信息新增
export function qualityAdd(data) {
    return Request({
        url: `${business}/Organization/save`,
        method: 'post',
        data: data
    })
}

// 人员信息新增/PersonnelManagement/save
export function personAdd(data) {
    return Request({
        url: `${business}/PersonnelManagement/save`,
        method: 'post',
        data: data
    })
}

// /Equipment/save
// 设备新增
export function equipmentAdd(data) {
    return Request({
        url: `${business}/Equipment/save`,
        method: 'post',
        data: data
    })
}

export function qualityDel(id) {
    return Request({
        url: `${business}/Organization/deletes`,
        method: 'post',
        data: id
    })
}
// 删除
export function equipmentDel(id) {
    return Request({
        url: `${business}/Equipment/deletes`,
        method: 'post',
        data: id
    })
}

// 人员删除
export function personDel(id) {
    return Request({
        url: `${business}/PersonnelManagement/deletes`,
        method: 'post',
        data: id
    })
}

/* --------------------------------------机构信息 End--------------------------*/

/* ----------------------------------实际分解登统表 Start-----------------------*/

// 实际分解登统查询所有企业
export function actualDecomp(data, compSelfCheckVO) {
    return Request({
        url: `${business}/compCheCheck/findByPage1/${data.page}/${data.size}`,
        method: 'post',
        data: compSelfCheckVO
    })
}
// 实际分解登统表查看
export function iport(sampUnitId, bbq, rid) {
    return Request({
        url: `${integration}/sso/openIrpt/${sampUnitId}/${bbq}/${rid}`,
        method: 'get'
    })
}
// 数据字典接口 可公用
export function dataDictioPub(data) {
    return Request({
        url: `${dict}/dataDictionary/getDataGroupId/${data}`,
        method: 'get'
    })
}

/* ----------------------------------实际分解登统表 End-----------------------*/

/* ----------------------------------企业自查 Start-----------------------*/
// 企业自查列表数据
export function selfExami(data, compSelfCheckVO) {
    return Request({
        url: `${business}/compCheCheck/findByPage/${data.page}/${data.size}`,
        method: 'post',
        data: compSelfCheckVO
    })
}

/* ----------------------------------企业自查 end-----------------------*/

/* ----------------------------------人才库管理 Start-----------------------*/
// 人才库管理列表数据
export function searchAllTalents(data, AnAblePersonVO) {
    return Request({
        url: `${business}/chkWrkGrpExpert/findByPage/${data.page}/${data.size}`,
        method: 'post',
        data: AnAblePersonVO
    })
}

// 人才库管理_所属地区字典树
export function searchTree() {
    return Request({
        url: `${dict}/dataDictionary/getDataTree/AREA_CODE/140000`,
        method: 'get'
    })
}

// 人才库管理列表数据_导出
export function searchAllTalentsEX(total, AnAblePersonVO) {
    return Request({
        url: `${business}/chkWrkGrpExpert/findByPage/${1}/${total}`,
        method: 'post',
        data: AnAblePersonVO
    })
}


// 人才库管理保存
export function talentInventorySave(data) {
    return Request({
        url: `${business}/chkWrkGrpExpert/save`,
        method: 'post',
        data: data
    })
}

// 人才库管理_审核状态 数据字典接口
export function reviewStatusData() {
    return Request({
        url: `${dict}/dataDictionary/getDataTree/EXP_REV_SUB_STS`,
        method: 'get'
    })
}
// 人才库管理删除
export function talPolManDelete(ids) {
    return Request({
        url: `${business}/chkWrkGrpExpert/deletes`,
        method: 'delete',
        data: ids
    })
}
// 人才库管理修改
export function talPolManUpdata(data) {
    return Request({
        url: `${business}/chkWrkGrpExpert/update`,
        method: 'post',
        data: data
    })
}
// 人才库管理_新增_专业方向 数据字典接口
export function profDirec() {
    return Request({
        url: `${dict}/dataDictionary/findByGroupId/${8004}`,
        method: 'get'
    })
}
// 人才库管理提交
export function submission(wfType, taskType, bizId, account) {
    return Request({
        url: `${workflow}/workflow/startWorkflow/${wfType}/${taskType}/${bizId}?userAccount=${account}`,
        method: 'post'
    })
}
// 人才库管理需要的  用户信息  省市县 所在单位id
export function userInfo() {
    return Request({
        url: `${User}/user/getUserInfo?time=${times}`,
        method: 'get'
    })
}
// 人才库管理 禁用
export function prohibit(ids) {
    return Request({
        url: `${business}/chkWrkGrpExpert/unableExpert`,
        method: 'post',
        data: ids
    })
}
// 人才库管理 启用
export function enable(ids) {
    return Request({
        url: `${business}/chkWrkGrpExpert/enableExpert`,
        method: 'post',
        data: ids
    })
}
// 人才库管理 审核
export function talentPoolToExamine(ids) {
    return Request({
        url: `${business}/chkWrkGrpExpert/enableExpert`,
        method: 'post',
        data: ids
    })
}
// 根据id查询人才 双随机
export function doubleRandomId(data) {
    return Request({
        url: `${business}/chkWrkGrpExpert/findById/${data}`,
        method: 'get'
    })
}

//查询某业务审批状态
export function getApproval(id) {
    return Request({
        url: `${workflow}/workflow/getApprovalList/${id}`,
        method: 'get'
    })
}

//审批是否同意
export function checkAgree(id, data) {
    return Request({
        url: `${business}/workflow/approveWorkflow/${id}`,
        method: 'post',
        data: data
    })
}

//列表提交
export function listSubmit(wfType, taskType, id, start) {
    return Request({
        url: `${business}/workflow/startWorkflow/${wfType}/${taskType}/${id}/${start}`,
        method: 'post'
    })
}
/* ----------------------------------人才库管理 end-----------------------*/

/* ----------------------------------政务首页 Start-----------------------*/
// 管理首页_统计审核
export function AdminIindxStAu() {
    return Request({
        url: `${business}/businessHome/queryAudits/`,
        method: 'post'
    })
}

// 管理首页_数据统计
export function AdminIindxDaSt() {
    return Request({
        url: `${business}/businessHome/dataCounts/`,
        method: 'get'
    })
}

// 监督检查_检查统计
export function SupAndStatistics() {
    return Request({
        url: `${business}/businessHome/statistics/`,
        method: 'post'
    })
}

// 监督检查_山西省粮食企业库存检查情况
export function SupAndInsInSit() {
    return Request({
        url: `${business}/businessHome/companyCounts/`,
        method: 'post'
    })
}

// 监督检查_山西省粮食企业存在安全隐患数量占比图
export function SupAndHidDan() {
    return Request({
        url: `${business}/businessHome/hiddenDanger/`,
        method: 'post'
    })
}

//重新刷token
export function refreshToken(token) {
    return Request({
        url: `${auth}/auth/refresh/token/${token}`,
        method: 'get'
    })
}

/* ----------------------------------政务首页 end-----------------------*/



/* ----------------------------------任务管理 Start-----------------------*/

// 1催报管理_列表数据
export function remiManagListData(data, AnAblePersonVO) {
    return Request({
        url: `${report}/urge/queryStatisticalRptInfo/${data.page}/${data.size}`,
        method: 'post',
        data: AnAblePersonVO
    })
}

// 1催报管理_一键催报
export function remiManagOnekey(ids) {
    return Request({
        url: `${business}/irptSystemInfo/findByIrptSystemId`,
        method: 'post',
        data: ids
    })
}

// 1催报管理_同步数据
export function synchrData() {
    return Request({
        url: `${business}/irptSystem/findBySynch/1`,
        method: 'post'
    })
}

// 2催报管理_查看明细_列表数据
export function remiManagChanListDat(data, bizSysIrptInfoPageVO) {
    return Request({
        url: `${report}/urge/queryStatisticalInfoForCompany/${data.page}/${data.size}`,
        method: 'post',
        data: bizSysIrptInfoPageVO
    })
}

// 2催报管理_查看明细_所属单位
export function getCompany() {
    return Request({
        //  url: `${selectUrl}/department/findDeptByUnit/${1}`,
        url: `${User}/department/findDeptByUnit/${1}`,
        method: 'get'
    })
}

// 2／3／查看明细／往期_一键催报
export function remiManagSeePaPe(ids) {
    return Request({
        url: `${report}/urge/sendUrgeLetter`,
        method: 'post',
        data: ids
    })
}

// 3催报管理_往期催报_报表期
export function remiManTime(time) {
    return Request({
        url: `${business}/irptSystemInfo/findBbq/${time}`,
        method: 'post'
    })
}


/* ----------------------------------任务管理 end-----------------------*/


/* ----------------------------------安全生产监督管理 Start-----------------------*/

// 安全生产监督管理_工作情况_分页
export function saProWorSitList(data, organizationVO) {
    return Request({
        url: `${business}/securitySupervise/queryWork/${data.page}/${data.size}`,
        method: 'post',
        data: organizationVO
    })
}

// 安全生产监督管理_工作情况_根据条件查询工作情况
export function saProWorId(securitySuperviseFilterVO) {
    return Request({
        url: `${business}/securitySupervise/findWorkById`,
        method: 'post',
        data: securitySuperviseFilterVO
    })
}

// 安全生产监督管理_工作情况_新增
export function saProAdd(data) {
    return Request({
        url: `${business}/securitySupervise/saveWork`,
        method: 'post',
        data: data
    })
}

// 安全生产监督管理_工作情况_新增_盟市
export function saProZhouShi() {
    return Request({
        url: `${dict}/dataDictionary/findByGroupId/AREA_CODE`,
        method: 'get'
    })
}



// 安全生产监督管理_工作情况_删除_管理端
export function saProDelete(data) {
    return Request({
        url: `${business}/securitySupervise/deleteByWorkId`,
        method: 'delete',
        data: data
    })
}

// 安全生产监督管理_工作情况_修改
export function saProModify(data) {
    return Request({
        url: `${business}/securitySupervise/updateWork`,
        method: 'post',
        data: data
    })
}

// 安全生产监督管理_人员管理_分页
export function saProListR(data, organizationVO) {
    return Request({
        url: `${business}/securitySupervise/queryContact/${data.page}/${data.size}`,
        method: 'post',
        data: organizationVO
    })
}

// 安全生产监督管理_人员管理_根据条件查询联络人
export function saProWorIdR(securitySuperviseFilterVO) {
    return Request({
        url: `${business}/securitySupervise/findContactById`,
        method: 'post',
        data: securitySuperviseFilterVO
    })
}

// 安全生产监督管理_人员管理_新增
export function saProAddR(data) {
    return Request({
        url: `${business}/securitySupervise/saveContact`,
        method: 'post',
        data: data
    })
}

// 安全生产监督管理_人员管理_删除_管理端
export function saProDeleteR(data) {
    return Request({
        url: `${business}/securitySupervise/deleteByContactId`,
        method: 'delete',
        data: data
    })
}

// 安全生产监督管理_人员管理_修改
export function saProModifyR(data) {
    return Request({
        url: `${business}/securitySupervise/updateContact`,
        method: 'post',
        data: data
    })
}

export function stateList(num) {
    return Request({
        // url: `${Login}/dict/findByGroupId/${num}`,
        url: `${dict}/dataDictionary/getDataGroupId/${num}`,
        method: 'get'
    })
}


/* ----------------------------------安全生产监督管理 end-----------------------*/