import axios from '@/common/services/axios-instance'

class RiskIdentificationService {
  // 获取当前用户风控机构
  findIamOrgId(deptId, moduleId = 'riskLibraryVersion') {
    // const params = {
    //   findFkOrgId: deptId,
    //   moduleId,
    // }
    return axios({
      method: 'post',
      url: `api/xcoa-mobile/v1/riskdutie/findFkOrgId`,
      // params,
    })
  }

  // 获取当前人所属公司

  getCompany() {
    return axios({
      method: 'post',
      url: `api/xcoa-mobile/v1/icmtxversion/getBelongUnit`,
    })
  }

  // 分配识别人
  setIdentifyUser(data) {
    return axios({
      method: 'get',
      url: `api/xcoa-mobile/v1/riskidentify/getContactsAccount?userAccounts=${data.account}&taskId=${data.taskId}&identifyId=${data.identifyId}`,
    })
  }

  // 获取风险事项内容
  getRiskEventInfo(id) {
    return axios({
      method: 'get',
      url: `api/framework/v1/page/wp/risk/event/riskEvent?id=${id}`,
    })
  }

  // 获取风险识别新增子表
  getRiskAddChildInfo(data) {
    return axios({
      method: 'post',
      url: `api/xcoa-mobile/v1/riskidentifyinsertmatter/getInsertMatterBean`,
      data,
    })
  }

  // 获取风险识别修改子表
  getRiskUpdateChildInfo(data) {
    return axios({
      method: 'post',
      url: `api/xcoa-mobile/v1/riskidentifyupdatematter/getUpdateMatterBean`,
      data,
    })
  }

  // 获取风险识别废弃子表
  getRiskRemoveChildInfo(data) {
    return axios({
      method: 'post',
      url: `api/xcoa-mobile/v1/riskidentifydeletematter/getDeleteMatterBean`,
      data,
    })
  }

  // 检查编号唯一
  checkMeasurecode(eventCode) {
    return axios({
      method: 'get',
      url: 'api/xcoa-mobile/v1/riskidentifyinsertmatter/findEventCode',
      params: {
        eventCode: eventCode,
      },
    })
  }

  // 保存修改事项子表
  saveUpdateMatter(list, identifyId) {
    return axios({
      method: 'post',
      url: 'api/xcoa-mobile/v1/riskidentifyupdatematter/saveUpdateMatter?identifyId=' + identifyId,
      data: list,
    })
  }

  // 保存废弃事项子表
  saveRemoveMatter(list, identifyId) {
    return axios({
      method: 'post',
      url: 'api/xcoa-mobile/v1/riskidentifydeletematter/saveRemoveMatter?identifyId=' + identifyId,
      data: list,
    })
  }

  // 删除识别
  deletIdentify(params, formId) {
    return axios({
      url: `api/xcoa-mobile/v1/riskidentify/${formId}`,
      method: 'delete',
      params,
    })
  }
}

export default new RiskIdentificationService()
