import axios from '@/common/services/axios-instance'
class AuditModelService {
  // 获取分类树
  getAuditModelTreeAll(data = { parentId: 0 }) {
    return axios({
      url: 'api/xcoa-mobile/v1/iammodelowncate/all',
      method: 'get',
    })
    // 获取表单详情
  }

  // 删除时检查分类
  deleteCheckCategory(ids) {
    return axios
      .get('api/xcoa-mobile/v1/iammodelowncate/delete-check-category?ids=' + ids)
      .then(function(res) {
        return res.data
      })
  }

  // 删除时分类
  deleteCategory(ids) {
    return axios
      .delete('api/xcoa-mobile/v1/iammodelowncate/delete-category?ids=' + ids)
      .then(function(res) {
        return res.data
      })
  }

  // 新增模型
  saveModelData(data) {
    return axios({
      url: 'api/xcoa-mobile/v1/iammodelmaintain/selfModelSave?type=' + data.creatModelType,
      method: 'post',
      data: data,
    })
  }

  // 触发模型调度
  triggerModel(data) {
    return axios({
      url: 'api/xcoa-mobile/v1/iammodelmaintain/listJM',
      method: 'post',
    })
  }

  //  查询建木地址
  getBuildUrl(id) {
    return axios({
      url: 'api/xcoa-mobile/v1/iammodelmaintain/findJMModel?id=' + id,
      method: 'post',
    })
  }

  // 跳转固定仪表板
  getFixedDashboard(id) {
    return axios({
      url: 'api/xcoa-mobile/v1/iammodelmaintain/appearanceJM?id=' + id,
      method: 'post',
    })
  }

  // 撤销共享
  revokeShare(data) {
    return axios({
      url: 'api/xcoa-mobile/v1 /iammodelmaintain/cancelShare?ids=' + data.id,
      method: 'post',
      data,
    })
  }

  // 删除模型
  // api/xcoa-mobile/v1/iam-page/iamModelMaintain?ids
  deleteModel(ids) {
    return axios({
      url: 'api/xcoa-mobile/v1/iam-page/iamModelMaintain?ids=' + ids,
      method: 'delete',
    })
  }

  // 获取表单数据详情
  getModelDetail(id) {
    return axios({
      url: 'api/framework/v1/page/wp/audit/maintain/iamModelMaintain',
      method: 'post',
      data: { id: id },
    })
  }

  // 获取模型市场
  getModelMarket(data) {
    return axios({
      url: 'api/xcoa-mobile/v1/iammodelmaintain/modelMarketQueryList',
      method: 'post',
      data: data,
    })
  }

  // 点赞0 /modellike/save-update 取消点赞1/modellike/cancelLike
  likeModel(data) {
    return axios({
      url: 'api/xcoa-mobile/v1/modellike/save-update',
      method: 'post',
      data: data,
    })
  }

  unlikeModel(data) {
    return axios({
      url: 'api/xcoa-mobile/v1/modellike/cancelLike?modelId=' + data.modelId,
      method: 'post',
      data: data,
    })
  }

  // 获取模型详情
  getModelListDetail(data) {
    return axios({
      url: 'api/xcoa-mobile/v1/iammodelmaintain/iamModelQueryList',
      method: 'post',
      data: data,
    })
  }

  handleData(data) {
    return axios({
      url: 'api/framework/v1/page/handleData',
      method: 'post',
      data: data,
    })
  }

  getHandleData(data) {
    return axios({
      url: 'api/framework/v1/page/wp/audit/maintain/iamModelDomainUserRel',
      method: 'post',
      data: data,
    })
  }
}
export default new AuditModelService()
