123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- import axios from '@/common/services/axios-instance'
- class AuditPermissionTreeService {
- getParentOrgInfo(params) {
- return axios({
- url: 'api/xcoa-mobile/v1/iamorg/getManagedHierarchyOrg',
- method: 'post',
- params,
- }).then((res) => {
- res.data.forEach((item) => {
- item.isLeaf = item.leaf
- if (item.props.orgId === null) {
- item.props = { ORG_ID: null, BELONGED_ORG_ID: -1 }
- } else {
- item.props = { ORG_ID: item.props.orgId, BELONGED_ORG_ID: -1 }
- }
- })
- return res
- })
- }
- getPcParentOrgInfo() {
- return axios({
- url: 'api/xcoa-mobile/v1/iamorg/getCurrentUserGroup',
- method: 'get',
- }).then((res) => {
- res.data.isLeaf = true
- res.data.props = { ORG_ID: res.data.id, BELONGED_ORG_ID: -1 }
- res.data.text = res.data.name
- const result = { data: [] }
- result.data.push(res.data)
- return result
- })
- }
- // 业务类型分类树
- getCategoryTree(parentId, params) {
- // url: `api/xcoa-mobile/v1/iam-tree/findTreeNodeById/${params.configId}/${parentId}`,
- return axios({
- url: `api/xcoa-mobile/v1/iamorg/getAuditOrgTreeNodeById/${parentId}`,
- method: 'post',
- params,
- }).then((res) => {
- res.data.forEach((item) => {
- item.isLeaf = item.leaf
- if (item.props.orgId === null) {
- item.props = {}
- } else {
- item.props = { ORG_ID: Number(item.props.orgId), BELONGED_ORG_ID: -1 }
- }
- })
- 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
- })
- }
- // 地址树搜索功能
- groupsQuery(data) {
- return axios({
- url: `api/xcoa-mobile/v1/iamorg/groups_query`,
- method: 'post',
- params: data,
- }).then((res) => {
- res.data.forEach((item) => {
- item.isLeaf = item.leaf
- item.name = item.text
- item.oldId = item.id
- item.props.ORG_ID = item.props.orgId
- if (item.props.ORG_ID !== null) {
- item.code = item.props.ORG_ID.toString()
- item.id = item.props.ORG_ID
- } else {
- item.code = item.id.toString()
- }
- item.type = 'Group'
- item.checkable = true
- })
- return res.data
- })
- }
- }
- export default new AuditPermissionTreeService()
|