import axios from '@/common/services/axios-instance'
class AuditTreeService {
  // 业务类型分类树
  getCategoryTree(parentId, params) {
    return axios({
      url: `api/xcoa-mobile/v1/iam-choose/findTreeNodeById/${params.configId}/${parentId}`,
      method: 'post',
      data: null,
    }).then((res) => {
      res.data.forEach((item) => (item.isLeaf = item.leaf))
      return res
    })
  }

  // 拖拽功能
  dragNode(params) {
    return axios({
      url: `api/xcoa-mobile/v1/iam-tree/moveTreeNode/${params.configId}/${params.id}/${params.targetId}/${params.position}`,
      method: 'post',
      data: null,
    }).then((res) => {
      res.data.forEach((item) => (item.isLeaf = item.leaf))
      return res
    })
  }
}
export default new AuditTreeService()
