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

class AuditOperatePaperService {
  // 复制工作底稿
  fnCopyPaper(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/iam-work-paper/copyPaper',
      method: 'post',
      data: params,
    }).then((res) => {
      const flag = res.data.flag
      if (flag === 'true') {
        axios({
          url: 'api/xcoa-mobile/v1/iam-work-paper/callBack',
          method: 'post',
          data: res.data,
        })
      }

      return res
    })
  }

  // 重新起草
  fnRestart(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/iam-work-paper/againFlow',
      method: 'post',
      data: params,
    }).then((res) => {
      return res
    })
  }

  // 变更分类
  fnChangeCate(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/iam-work-paper/changeFrameClass',
      method: 'post',
      data: params,
    }).then((res) => {
      return res
    })
  }

  // 变更编辑人
  fnChangeeditor(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/iam-work-paper/changeCreator',
      method: 'post',
      data: params,
    }).then((res) => {
      return res
    })
  }

  // 获取审计发现数据
  getAuditFindData(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/iam-audit-discover/paperFindBean',
      method: 'post',
      data: params,
    }).then((res) => {
      return res
    })
  }

  // 获取审计取证单
  getAuditGetPaperFind(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/iam-audit-discover/evidence',
      method: 'post',
      data: params,
    }).then((res) => {
      return res
    })
  }

  // 获取自动编号
  getAutoBh(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/iam-audit-discover/nextNumber',
      method: 'post',
      data: params,
    }).then((res) => {
      return res
    })
  }

  // 查看审计发现是否已被确认
  checkOperateFind(id) {
    return axios({
      url: 'api/xcoa-mobile/v1/iam-audit-discover/needAffirm?id=' + id,
      method: 'get',
    }).then((res) => {
      return res
    })
  }

  // 批量提交
  fnPlSubmit(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/iam-work-paper/manySubmit',
      method: 'post',
      data: params,
    }).then((res) => {
      return res
    })
  }
  // 获取角色

  fngetrole(projectId) {
    return axios({
      url: 'api/xcoa-mobile/v1/iamprojectuser/userProject?projectId=' + projectId,
      method: 'get',
    }).then((res) => {
      return res
    })
  }
}
export default new AuditOperatePaperService()
