| | |
| | | // æå®å½åææ¡£çæ¬ |
| | | appointCurrentDocumentVersionApi: fileId => putAction(`/nc/file/assign/version/${fileId}`), |
| | | // ææ¡£æ¯å¯¹ |
| | | fileCompareApi: fileIdArray => getAction(`/nc/file/comparison/${fileIdArray[0]}/${fileIdArray[1]}`) |
| | | fileCompareApi: fileIdArray => getAction(`/nc/file/comparison/${fileIdArray[0]}/${fileIdArray[1]}`), |
| | | // è·åææé¨é¨å表 |
| | | getAllDepartmentsListApi: () => getAction('/ucenter/depart/list/all'), |
| | | // è·åææç¨æ·å表 |
| | | getAllUsersListApi: () => getAction('/sys/user/list'), |
| | | // è·åææéçé¨é¨å表 |
| | | getHasPermissionDepartApi: ({ type, id }) => getAction(`/nc/product/get/perm/depart/${type}/${id}`), |
| | | // è·åææéçç¨æ·å表 |
| | | getHasPermissionUserApi: ({ type, id }) => getAction(`/nc/product/get/perm/user/${type}/${id}`), |
| | | // åé
é¨é¨æé |
| | | assignPermissionToDepart: ({ treeNodeType, treeNodeId, isAssignSonNode, departIdArray }) => { |
| | | return postAction(`/nc/product/assign/add/department/${treeNodeType}/${treeNodeId}/${isAssignSonNode}`, departIdArray) |
| | | }, |
| | | // ç§»é¤é¨é¨æé |
| | | removePermissionFromDepart: ({ treeNodeType, treeNodeId, isAssignSonNode, departIdArray }) => { |
| | | return postAction(`/nc/product/assign/remove/department/${treeNodeType}/${treeNodeId}/${isAssignSonNode}`, departIdArray) |
| | | }, |
| | | // åé
ç¨æ¶æé |
| | | assignPermissionToUser: ({ treeNodeType, treeNodeId, isAssignSonNode, userIdArray }) => { |
| | | return postAction(`/nc/product/assign/add/user/${treeNodeType}/${treeNodeId}/${isAssignSonNode}`, userIdArray) |
| | | }, |
| | | // ç§»é¤é¨é¨æé |
| | | removePermissionFromUser: ({ treeNodeType, treeNodeId, isAssignSonNode, userIdArray }) => { |
| | | return postAction(`/nc/product/assign/remove/user/${treeNodeType}/${treeNodeId}/${isAssignSonNode}`, userIdArray) |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-modal :visible="visible" :title="title" width="50%" :maskClosable="false" @cancel="handleModalClose" |
| | | :footer="null"> |
| | | <a-form-model layout="inline"> |
| | | <a-form-item label="åç§°"> |
| | | <a-input readOnly :value="currentTreeNodeInfo.label"></a-input> |
| | | </a-form-item> |
| | | <a-form-item label="æ¯å¦åé
åèç¹"> |
| | | <a-switch v-model="isAssignSonNode"></a-switch> |
| | | </a-form-item> |
| | | </a-form-model> |
| | | |
| | | <a-tabs v-model="activeTabKey"> |
| | | <a-tab-pane :key="1" tab="åé
é¨é¨"> |
| | | <DepartPermissionTransfer ref="departPermissionTransferRef" :currentTreeNodeInfo="currentTreeNodeInfo" |
| | | :dataSource="allDepartmentsList" :isAssignSonNode="isAssignSonNode"/> |
| | | </a-tab-pane> |
| | | |
| | | <a-tab-pane :key="2" tab="åé
ç¨æ·"> |
| | | <UserPermissionTransfer ref="userPermissionTransferRef" :currentTreeNodeInfo="currentTreeNodeInfo" |
| | | :dataSource="allUsersList" :isAssignSonNode="isAssignSonNode"/> |
| | | </a-tab-pane> |
| | | </a-tabs> |
| | | </a-modal> |
| | | </template> |
| | | |
| | | <script> |
| | | import dncApi from '@/api/dnc' |
| | | import DepartPermissionTransfer from './DepartPermissionTransfer' |
| | | import UserPermissionTransfer from './UserPermissionTransfer' |
| | | |
| | | export default { |
| | | name: 'AssignPermissionModal', |
| | | components: { UserPermissionTransfer, DepartPermissionTransfer }, |
| | | props: { |
| | | currentTreeNodeInfo: { |
| | | type: Object |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | visible: false, |
| | | title: '', |
| | | isAssignSonNode: true, |
| | | activeTabKey: 1, |
| | | allDepartmentsList: [], |
| | | allUsersList: [], |
| | | hasLoadedDataTabKeyArray: [] |
| | | } |
| | | }, |
| | | watch: { |
| | | visible: { |
| | | handler(value) { |
| | | if (value) { |
| | | this.activeTabKey = 1 |
| | | this.isAssignSonNode = true |
| | | this.getAllDepartmentsListByApi() |
| | | } |
| | | } |
| | | }, |
| | | activeTabKey: { |
| | | handler(value) { |
| | | if (this.hasLoadedDataTabKeyArray.includes(value)) return |
| | | if (value === 2) this.getAllUsersListByApi() |
| | | this.hasLoadedDataTabKeyArray.push(value) |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | this.$bus.$on('treeMenuItemMethodTrigger', this.triggerCorrespondingMethod) |
| | | }, |
| | | methods: { |
| | | // ç¹å»æ èç¹å³é®èåæéé
ç½®æé®å触å |
| | | handleAssignPermission() { |
| | | this.visible = true |
| | | }, |
| | | |
| | | // è°ç¨æ¥å£è·åææé¨é¨å表 |
| | | getAllDepartmentsListByApi() { |
| | | dncApi.getAllDepartmentsListApi() |
| | | .then(res => { |
| | | if (res.success) { |
| | | this.allDepartmentsList = res.list |
| | | this.$nextTick(() => this.$refs.departPermissionTransferRef.getHasPermissionDepartByApi()) |
| | | // åªæä¸æ¬¡éåºæ¶å¨é¨é¨åé
tabç颿ä¼è¿å
¥æ¤å¤æ |
| | | // è¥ä¸æ¬¡éåºæ¶å¨ç¨æ·åé
tabçé¢å忬¡è¿å
¥æ¶keyç±2å为1æ¶ä¼è§¦åwatchçæµactiveTabKeyåååä¼å°key:1å å
¥hasLoadedDataTabKeyArrayï¼å æ¤æ é忬¡å å
¥key:1 |
| | | if (!this.hasLoadedDataTabKeyArray.includes(this.activeTabKey)) this.hasLoadedDataTabKeyArray.push(this.activeTabKey) |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | // è°ç¨æ¥å£è·åææç¨æ·å表 |
| | | getAllUsersListByApi() { |
| | | dncApi.getAllUsersListApi() |
| | | .then(res => { |
| | | if (res.success) { |
| | | this.allUsersList = res.result.records |
| | | this.$nextTick(() => this.$refs.userPermissionTransferRef.getHasPermissionUserByApi()) |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | handleModalClose() { |
| | | this.visible = false |
| | | this.hasLoadedDataTabKeyArray = [] |
| | | }, |
| | | |
| | | triggerCorrespondingMethod({ methodName, modalTitle }) { |
| | | if (this[methodName]) { |
| | | this[methodName]() |
| | | this.title = modalTitle |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-spin :spinning="spinning"> |
| | | <a-transfer |
| | | class="transfer-container" |
| | | :data-source="dataSource" |
| | | show-search |
| | | :list-style="{flex:1,height: '500px'}" |
| | | :titles="['æªåé
é¨é¨', 'å·²åé
é¨é¨']" |
| | | :operations="['åé
é¨é¨', 'ç§»é¤é¨é¨']" |
| | | :target-keys="targetKeys" |
| | | :render="item => `${item.departName}`" |
| | | @change="handleChange" |
| | | :rowKey="record => record.departId" |
| | | > |
| | | |
| | | <span slot="notFoundContent">ææ æ°æ®</span> |
| | | </a-transfer> |
| | | </a-spin> |
| | | </template> |
| | | |
| | | <script> |
| | | import dncApi from '@/api/dnc' |
| | | |
| | | export default { |
| | | name: 'DepartPermissionTransfer', |
| | | components: {}, |
| | | props: { |
| | | currentTreeNodeInfo: { |
| | | type: Object |
| | | }, |
| | | dataSource: { |
| | | type: Array |
| | | }, |
| | | isAssignSonNode: { |
| | | type: Boolean |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | targetKeys: [], |
| | | spinning: false |
| | | } |
| | | }, |
| | | methods: { |
| | | getHasPermissionDepartByApi() { |
| | | dncApi.getHasPermissionDepartApi(this.currentTreeNodeInfo) |
| | | .then(res => { |
| | | if (res.success) this.targetKeys = res.list.map(item => item.departId) |
| | | }) |
| | | }, |
| | | |
| | | handleChange(targetKeys, direction, moveKeys) { |
| | | const { currentTreeNodeInfo: { type, id }, isAssignSonNode, $notification } = this |
| | | const that = this |
| | | let method |
| | | const params = { |
| | | treeNodeType: type, |
| | | treeNodeId: id, |
| | | isAssignSonNode: isAssignSonNode ? 1 : 2, |
| | | departIdArray: moveKeys |
| | | } |
| | | console.log('params--------------------------', params) |
| | | console.log(targetKeys, direction, moveKeys) |
| | | if (direction === 'right') { |
| | | method = dncApi.assignPermissionToDepart |
| | | } else { |
| | | method = dncApi.removePermissionFromDepart |
| | | } |
| | | that.spinning = true |
| | | method(params) |
| | | .then(res => { |
| | | if (res.success) { |
| | | $notification.success({ |
| | | message: 'æ¶æ¯', |
| | | description: res.message |
| | | }) |
| | | this.targetKeys = targetKeys |
| | | } else { |
| | | $notification.error({ |
| | | message: 'æ¶æ¯', |
| | | description: res.message |
| | | }) |
| | | } |
| | | }) |
| | | .catch(err => { |
| | | $notification.error({ |
| | | message: 'æ¶æ¯', |
| | | description: err.message |
| | | }) |
| | | }) |
| | | .finally(() => { |
| | | that.spinning = false |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped lang="less"> |
| | | .transfer-container { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-spin :spinning="spinning"> |
| | | <a-transfer |
| | | class="transfer-container" |
| | | :data-source="dataSource" |
| | | show-search |
| | | :list-style="{flex:1,height: '500px'}" |
| | | :titles="['æªåé
ç¨æ·', 'å·²åé
ç¨æ·']" |
| | | :operations="['åé
ç¨æ·', 'ç§»é¤ç¨æ·']" |
| | | :target-keys="targetKeys" |
| | | :render="item => `${item.realname}`" |
| | | @change="handleChange" |
| | | :rowKey="record => record.id" |
| | | > |
| | | <span slot="notFoundContent">ææ æ°æ®</span> |
| | | </a-transfer> |
| | | </a-spin> |
| | | </template> |
| | | |
| | | <script> |
| | | import dncApi from '@/api/dnc' |
| | | |
| | | export default { |
| | | name: 'UserPermissionTransfer', |
| | | components: {}, |
| | | props: { |
| | | currentTreeNodeInfo: { |
| | | type: Object |
| | | }, |
| | | dataSource: { |
| | | type: Array |
| | | }, |
| | | isAssignSonNode: { |
| | | type: Boolean |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | targetKeys: [], |
| | | spinning: false |
| | | } |
| | | }, |
| | | methods: { |
| | | getHasPermissionUserByApi() { |
| | | dncApi.getHasPermissionUserApi(this.currentTreeNodeInfo) |
| | | .then(res => { |
| | | if (res.success) this.targetKeys = res.list.map(item => item.id) |
| | | }) |
| | | }, |
| | | |
| | | handleChange(targetKeys, direction, moveKeys) { |
| | | const { currentTreeNodeInfo: { type, id }, isAssignSonNode, $notification, dataSource } = this |
| | | const that = this |
| | | let method |
| | | const params = { |
| | | treeNodeType: type, |
| | | treeNodeId: id, |
| | | isAssignSonNode: isAssignSonNode ? 1 : 2, |
| | | userIdArray: moveKeys |
| | | } |
| | | console.log('params--------------------------', params) |
| | | console.log(targetKeys, direction, moveKeys) |
| | | if (direction === 'right') { |
| | | method = dncApi.assignPermissionToUser |
| | | } else { |
| | | method = dncApi.removePermissionFromUser |
| | | const adminId = dataSource.find(item => item.username === 'admin').id |
| | | if (moveKeys.includes(adminId)) { |
| | | $notification.warning({ |
| | | message: 'æ¶æ¯', |
| | | description: 'ä¸è½ç§»é¤ç®¡çåæé' |
| | | }) |
| | | return |
| | | } |
| | | } |
| | | that.spinning = true |
| | | method(params) |
| | | .then(res => { |
| | | if (res.success) { |
| | | $notification.success({ |
| | | message: 'æ¶æ¯', |
| | | description: res.message |
| | | }) |
| | | this.targetKeys = targetKeys |
| | | } else { |
| | | $notification.error({ |
| | | message: 'æ¶æ¯', |
| | | description: res.message |
| | | }) |
| | | } |
| | | }) |
| | | .catch(err => { |
| | | $notification.error({ |
| | | message: 'æ¶æ¯', |
| | | description: err.message |
| | | }) |
| | | }) |
| | | .finally(() => { |
| | | that.spinning = false |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped lang="less"> |
| | | .transfer-container { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | </style> |
| | |
| | | <a-menu slot="overlay"> |
| | | <a-menu-item key="1" @click="expandedKeys = allTreeKeys">å±å¼ææ</a-menu-item> |
| | | <a-menu-item key="2" @click="expandedKeys = ['-1']">åå¹¶ææ</a-menu-item> |
| | | <a-menu-item key="3" @click="queryTreeData">å·æ°</a-menu-item> |
| | | <a-menu-item key="3" @click="getTreeDataByApi">å·æ°</a-menu-item> |
| | | </a-menu> |
| | | <a-button> |
| | | <a-icon type="bars"/> |
| | |
| | | |
| | | <!--产åå¼¹çª--> |
| | | <ProductModal ref="productModalFormRef" :currentTreeNodeInfo="rightClickSelected" |
| | | @submitSuccess="queryTreeData"/> |
| | | @submitSuccess="getTreeDataByApi"/> |
| | | <!--é¨ä»¶å¼¹çª--> |
| | | <ComponentModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> |
| | | <!--é¶ä»¶å¼¹çª--> |
| | |
| | | <ProcessModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> |
| | | <!--å·¥æ¥å¼¹çª--> |
| | | <ProcessStepModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> |
| | | <!--æéé
置弹çª--> |
| | | <AssignPermissionModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> |
| | | </a-card> |
| | | </template> |
| | | |
| | |
| | | import PartModal from './Part/PartModal' |
| | | import ProcessModal from './Process/ProcessModal' |
| | | import ProcessStepModal from './ProcessStep/ProcessStepModal' |
| | | import AssignPermissionModal from './Permission/AssignPermissionModal' |
| | | |
| | | export default { |
| | | name: 'ProductStructureTree', |
| | | components: { |
| | | AssignPermissionModal, |
| | | ProcessStepModal, |
| | | ProcessModal, |
| | | PartModal, |
| | |
| | | } |
| | | }, |
| | | created() { |
| | | this.queryTreeData() |
| | | this.getTreeDataByApi() |
| | | this.$bus.$on('treeMenuItemMethodTrigger', this.triggerCorrespondingMethod) |
| | | }, |
| | | methods: { |
| | | queryTreeData() { |
| | | getTreeDataByApi() { |
| | | this.loading = true |
| | | this.cardLoading = true |
| | | dncApi.getProductStructureTreeApi().then(res => { |
| | |
| | | this.rightClickSelected = Object.assign({}, record) |
| | | }, |
| | | |
| | | /** |
| | | * æ èç¹å³é®åå»èåä¸å 餿鮿¶è§¦å |
| | | */ |
| | | // æ èç¹å³é®åå»èåä¸å 餿鮿¶è§¦å |
| | | handleDelete() { |
| | | this.$confirm({ |
| | | title: 'æç¤º', |
| | |
| | | deleteAction(that.url.delete, { id: this.rightClickSelected.id }) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | that.queryTreeData() |
| | | that.getTreeDataByApi() |
| | | that.$notification.success({ |
| | | message: 'æ¶æ¯', |
| | | description: res.message |
| | |
| | | modalFormSubmitSuccess(isAddNextLevel) { |
| | | // 夿æ¯å¦ä¸ºæ·»å ä¸çº§å¹¶ä¸å¤æç¶èç¹æ¯å¦å±å¼ |
| | | if (isAddNextLevel && !this.expandedKeys.includes(this.rightClickSelected.id)) this.expandedKeys.push(this.rightClickSelected.id) |
| | | this.queryTreeData() |
| | | this.getTreeDataByApi() |
| | | }, |
| | | |
| | | /** |
| | |
| | | } |
| | | }, |
| | | |
| | | triggerCorrespondingMethod({ methodName, modalTitle }) { |
| | | if (this[methodName]) this[methodName](modalTitle) |
| | | triggerCorrespondingMethod({ methodName }) { |
| | | if (this[methodName]) this[methodName]() |
| | | }, |
| | | |
| | | /** |
| | |
| | | { label: 'ç¼è¾å·¥åºä¿¡æ¯', code: 'process_edit', icon: 'edit', isCommonMethod: false }, |
| | | { label: 'å é¤', code: 'process_delete', icon: 'delete', isCommonMethod: true }, |
| | | // { label: '导åºNCç¨åº', code: 'process_export', icon: 'import', isCommonMethod: true }, |
| | | { label: '导å
¥NCç¨åº', code: 'process_import', icon: 'export', isCommonMethod: true } |
| | | { label: '导å
¥NCç¨åº', code: 'process_import', icon: 'export', isCommonMethod: true }, |
| | | { label: 'æéé
ç½®', code: 'public_assign_permission', icon: 'idcard', isCommonMethod: true } |
| | | ], |
| | | //å·¥æ¥ |
| | | processStep: [ |
| | |
| | | { label: 'ç¼è¾å·¥æ¥ä¿¡æ¯', code: 'processStep_edit', icon: 'edit', isCommonMethod: false }, |
| | | { label: 'å é¤', code: 'processStep_delete', icon: 'delete', isCommonMethod: true }, |
| | | // { label: '导åºNCç¨åº', code: 'processStep_export', icon: 'import', isCommonMethod: true }, |
| | | { label: '导å
¥NCç¨åº', code: 'processStep_import', icon: 'export', isCommonMethod: true } |
| | | { label: '导å
¥NCç¨åº', code: 'processStep_import', icon: 'export', isCommonMethod: true }, |
| | | { label: 'æéé
ç½®', code: 'public_assign_permission', icon: 'idcard', isCommonMethod: true } |
| | | ] |
| | | } |
| | | } |
| | |
| | | ], |
| | | //æä»¶ |
| | | file: [ |
| | | { label: 'æå®å½åçæ¬', code: 'file_assign', subMenu: [], icon: 'export', isCommonMethod: false },//æä»¶-æå®å½åçæ¬ |
| | | { label: 'æ¯å¯¹', code: 'file_add_relative', subMenu: [], icon: 'export', isCommonMethod: false }//æ¯å¯¹ |
| | | { label: 'æå®å½åçæ¬', code: 'file_assign', subMenu: [], icon: 'highlight', isCommonMethod: false },//æä»¶-æå®å½åçæ¬ |
| | | { label: 'æ¯å¯¹', code: 'file_add_relative', subMenu: [], icon: 'interaction', isCommonMethod: false }//æ¯å¯¹ |
| | | ] |
| | | } |
| | | } |