1、调整产品和设备结构树权限配置分配用户时,admin只有在分配后或者有权限时才会被禁用
| | |
| | | <a-tabs v-model="activeTabKey"> |
| | | <a-tab-pane :key="1" tab="分配用户"> |
| | | <UserPermissionTransfer ref="userPermissionTransferRef" :currentTreeNodeInfo="currentTreeNodeInfo" |
| | | :dataSource="allUsersList" :isAssignSonNode="isAssignSonNode"/> |
| | | :dataSource="allUsersList" :isAssignSonNode="isAssignSonNode" |
| | | @setAdminDisabled="setAdminDisabled"/> |
| | | </a-tab-pane> |
| | | </a-tabs> |
| | | </a-modal> |
| | |
| | | dncApi.getAllUsersListApi() |
| | | .then(res => { |
| | | if (res.success) { |
| | | this.allUsersList = res.result.records.map(item => { |
| | | return { |
| | | ...item, |
| | | disabled: item.username === 'admin' |
| | | } |
| | | }) |
| | | this.allUsersList = res.result.records |
| | | this.$nextTick(() => this.$refs.userPermissionTransferRef.getHasPermissionUserByApi()) |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | setAdminDisabled() { |
| | | this.allUsersList = this.allUsersList.map(item => { |
| | | return { |
| | | ...item, |
| | | disabled: item.username === 'admin' |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | // 控制弹窗关闭 |
| | | handleModalClose() { |
| | | this.visible = false |
| | |
| | | that.targetKeys = [] |
| | | dncApi.getDeviceTreeHasPermissionUserApi(this.currentTreeNodeInfo) |
| | | .then(res => { |
| | | if (res.success) this.targetKeys = res.list.map(item => item.id) |
| | | if (res.success) { |
| | | that.targetKeys = res.list.map(item => item.id) |
| | | if (that.targetKeys.includes(that.dataSource.find(item => item.username === 'admin').id)) that.$emit('setAdminDisabled') |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | that.spinning = false |
| | |
| | | isAssignSonNode: isAssignSonNode ? 1 : 2, |
| | | userIdArray: moveKeys |
| | | } |
| | | console.log('params--------------------------', params) |
| | | console.log(targetKeys, direction, moveKeys) |
| | | if (direction === 'right') { |
| | | method = dncApi.assignDeviceDeviceTreePermissionToUser |
| | | } else { |
| | |
| | | message: '消息', |
| | | description: res.message |
| | | }) |
| | | this.targetKeys = targetKeys |
| | | that.targetKeys = targetKeys |
| | | if (targetKeys.includes(that.dataSource.find(item => item.username === 'admin').id)) that.$emit('setAdminDisabled') |
| | | } else { |
| | | $notification.error({ |
| | | message: '消息', |
| | |
| | | |
| | | <a-tab-pane :key="2" tab="分配用户"> |
| | | <UserPermissionTransfer ref="userPermissionTransferRef" :currentTreeNodeInfo="currentTreeNodeInfo" |
| | | :dataSource="allUsersList" :isAssignSonNode="isAssignSonNode"/> |
| | | :dataSource="allUsersList" :isAssignSonNode="isAssignSonNode" |
| | | @setAdminDisabled="setAdminDisabled"/> |
| | | </a-tab-pane> |
| | | </a-tabs> |
| | | </a-modal> |
| | |
| | | this.allTreeKeys = [] |
| | | queryProductionTreeList() |
| | | .then(res => { |
| | | console.log('res-------------------', res) |
| | | if (res.success) { |
| | | this.allDepartmentsList = res.result |
| | | this.generateList(this.allDepartmentsList) |
| | |
| | | dncApi.getAllUsersListApi() |
| | | .then(res => { |
| | | if (res.success) { |
| | | this.allUsersList = res.result.records.map(item => { |
| | | return { |
| | | ...item, |
| | | disabled: item.username === 'admin' |
| | | } |
| | | }) |
| | | this.allUsersList = res.result.records |
| | | this.$nextTick(() => this.$refs.userPermissionTransferRef.getHasPermissionUserByApi()) |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | setAdminDisabled() { |
| | | this.allUsersList = this.allUsersList.map(item => { |
| | | return { |
| | | ...item, |
| | | disabled: item.username === 'admin' |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | handleModalClose() { |
| | | this.visible = false |
| | | this.hasLoadedDataTabKeyArray = [] |
| | |
| | | that.targetKeys = [] |
| | | dncApi.getHasPermissionUserApi(this.currentTreeNodeInfo) |
| | | .then(res => { |
| | | if (res.success) this.targetKeys = res.list.map(item => item.id) |
| | | if (res.success) { |
| | | that.targetKeys = res.list.map(item => item.id) |
| | | if (that.targetKeys.includes(that.dataSource.find(item => item.username === 'admin').id)) that.$emit('setAdminDisabled') |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | that.spinning = false |
| | |
| | | isAssignSonNode: isAssignSonNode ? 1 : 2, |
| | | userIdArray: moveKeys |
| | | } |
| | | console.log('params--------------------------', params) |
| | | console.log(targetKeys, direction, moveKeys) |
| | | if (direction === 'right') { |
| | | method = dncApi.assignPermissionToUser |
| | | } else { |
| | |
| | | message: '消息', |
| | | description: res.message |
| | | }) |
| | | this.targetKeys = targetKeys |
| | | that.targetKeys = targetKeys |
| | | if (targetKeys.includes(that.dataSource.find(item => item.username === 'admin').id)) that.$emit('setAdminDisabled') |
| | | } else { |
| | | $notification.error({ |
| | | message: '消息', |