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

class MtxEvaluationService {
  // 拖拽功能
  dragNode(data) {
    return axios({
      method: 'post',
      url: 'api/xcoa-mobile/v1/icmtxprocess/drage',
      data: data,
    })
  }

  // 删除工作底稿列表数据
  delete(params, formId) {
    return axios({
      url: `api/xcoa-mobile/v1/icevaluationcontrol/${formId}`,
      method: 'delete',
      params,
    })
  }

  // 控制节点生成底稿
  savecontrol(planId, ids) {
    return axios
      .get(
        'api/xcoa-mobile/v1/icevaluationcontrol/icEvaluationControlEntitySave?planId=' +
          planId +
          '&ids=' +
          ids
      )
      .then(function(res) {
        return res.data
      })
  }

  // 设置控制测试人员
  setControlTestor(accout, ids) {
    return axios
      .get(
        'api/xcoa-mobile/v1/icevaluationcontrol/icEvaluationControlEntityIssued?userAccount=' +
          accout +
          '&ids=' +
          ids
      )
      .then(function(res) {
        return res.data
      })
  }

  // 控制获取所有措施ids
  getAllcontrolLids(planId) {
    return axios
      .get('api/xcoa-mobile/v1/icevaluationcontrol/getAllcontrollistids?planId=' + planId)
      .then(function(res) {
        return res.data
      })
  }

  // 穿行节点生成底稿
  savecross(planId, ids) {
    return axios
      .get(
        'api/xcoa-mobile/v1/icevaluationcross/icEvaluationCrossEntitySave?planId=' +
          planId +
          '&ids=' +
          ids
      )
      .then(function(res) {
        return res.data
      })
  }

  // 穿行控制测试人员
  setCrossTestor(accout, ids) {
    return axios
      .get(
        'api/xcoa-mobile/v1/icevaluationcross/icEvaluationCrossEntityIssued?userAccount=' +
          accout +
          '&ids=' +
          ids
      )
      .then(function(res) {
        return res.data
      })
  }

  // 控制获取所有措施ids
  getAllcrossLids(planId) {
    return axios
      .get('api/xcoa-mobile/v1/icevaluationcross/getAllcrosslistids?planId=' + planId)
      .then(function(res) {
        return res.data
      })
  }

  getUserChangeLogInfo(id) {
    return axios({
      url: `api/xcoa-mobile/v1/icevaluationuser/getPlanUserChangeInfo?planId=` + id,
    })
  }

  getList(data) {
    return axios({
      method: 'post',
      url: 'api/xcoa-mobile/v1/icevaluationconfirm/getMeasureList',
      data: data,
    })
  }

  getplaninfo(planId) {
    return axios({
      url: `api/framework/v1/page/wp/ic/evaluation/plan/icEvaluationPlan?id=` + planId,
    })
  }

  findIamOrgId(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/iamorg/findIamOrgId',
      method: 'post',
      params,
    })
  }

  getQdidsList(controlIds, crossIds) {
    return axios
      .get(
        'api/xcoa-mobile/v1/icevaluationconfirm/getMeasuresByIds?controlIds=' +
          controlIds +
          '&crossIds=' +
          crossIds
      )
      .then(function(res) {
        return res
      })
  }

  fndeleteTodo(id) {
    return axios.get('api/xcoa-mobile/v1/icevaluationplan/deleteTodo?id=' + id).then(function(res) {
      return res
    })
  }
}

export default new MtxEvaluationService()
