From 5f1f2f97c9d934b3e4fb531a32a883d5abb95abc Mon Sep 17 00:00:00 2001 From: yaojn Date: Fri, 24 Nov 2023 18:52:36 +0800 Subject: [PATCH] =?UTF-8?q?-=20[=E4=BF=AE=E5=A4=8D]=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E7=AE=A1=E7=90=86-=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=BC=82=E5=B8=B8=20=20=20-=20[=E5=85=B3?= =?UTF-8?q?=E8=81=94]#[1031698165235712]=E6=9C=8D=E5=8A=A1=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E7=AE=A1=E7=90=86-=E7=BC=96=E8=BE=91=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E5=BC=82=E5=B8=B8=20http://192.168.0.96:8090/demo/rdm?= =?UTF-8?q?.html#/bug-detail/939050947543040/939050947543057/1031698165235?= =?UTF-8?q?712?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/resources/plugins/TsZtree/TsZtree.vue | 4 +- .../pages/process/catalog/catalog-manage.vue | 108 ++++++++++++------ .../process/catalog/catalog/edit/channel.vue | 9 +- .../process/catalog/catalog/edit/editmixin.js | 7 +- src/views/pages/process/flow/flow-edit.vue | 2 +- .../flow/flowedit/relation-service.vue | 2 +- 6 files changed, 93 insertions(+), 39 deletions(-) diff --git a/src/resources/plugins/TsZtree/TsZtree.vue b/src/resources/plugins/TsZtree/TsZtree.vue index 4f21351c..4cf6451c 100644 --- a/src/resources/plugins/TsZtree/TsZtree.vue +++ b/src/resources/plugins/TsZtree/TsZtree.vue @@ -25,7 +25,8 @@ export default { onClick: { type: Function }, //点击事件 onDrop: { type: Function }, //拖放事件 value: { type: [String, Number] }, //默认选择节点 - enableToggleClick: { type: Boolean, default: false } //是否激活反选功能(点击已选中节点取消点击) + enableToggleClick: { type: Boolean, default: false }, //是否激活反选功能(点击已选中节点取消点击) + beforeDrop: {type: Function} // 拖放之前事件 }, data() { return { @@ -70,6 +71,7 @@ export default { } }, callback: { + beforeDrop: this.beforeDrop, onDrop: (event, treeId, treeNodes, targetNode, moveType, isCopy) => { if (this.onDrop) { this.onDrop(this.zTreeObj, treeNodes, targetNode, moveType, isCopy); diff --git a/src/views/pages/process/catalog/catalog-manage.vue b/src/views/pages/process/catalog/catalog-manage.vue index c5ed1f3e..64f3dc48 100644 --- a/src/views/pages/process/catalog/catalog-manage.vue +++ b/src/views/pages/process/catalog/catalog-manage.vue @@ -32,7 +32,8 @@ :hoverDomList="hoverDomList" :onClick="clickNode" :onDrop="onDrop" - :value="currentCatalogId" + :value="treeUuid" + :beforeDrop="beforeDrop" > @@ -41,7 +42,8 @@ @@ -63,7 +65,9 @@ export default { props: [''], data() { return { - currentCatalogId: null, + firstTreeUuid: '', // 用于从流程编辑跳转到服务目录,新增服务,需要默认选中第一个目录,但是打开新增服务的页面 + currentUuid: null, + treeUuid: null, isSiderHide: false, catalogTypeName: 'catalog', // 类型,默认目录表单 catalogName: this.$t('dialog.title.edittarget', { target: this.$t('page.catalogue') }), //表单标题 @@ -127,7 +131,7 @@ export default { } }, clickFn: (treeNode) => { - this.addChannel(treeNode); + this.addChannel(treeNode?.uuid); } }, { @@ -149,8 +153,7 @@ export default { }; }, created() { - let {parentUuid = '', processUuid = '', uuid = ''} = this.$route.query || {}; - this.parentUuid = parentUuid; + let {processUuid = '', uuid = ''} = this.$route.query || {}; this.processUuid = processUuid; this.uuid = uuid; }, @@ -168,14 +171,20 @@ export default { if (res.Status == 'OK') { this.nodeList = res.Return || []; if (!isFirst) { - this.currentCatalogId = this.selectSaveUuid; - } else if (this.parentUuid != '') { - this.currentCatalogId = this.parentUuid; - this.addChannel(this.parentUuid); - } else if (this.uuid != '') { - this.currentCatalogId = this.uuid; + this.currentUuid = this.selectSaveUuid; + this.treeUuid = this.selectSaveUuid; + } else if (this.uuid) { + this.currentUuid = this.uuid; + this.treeUuid = this.uuid; + this.catalogTypeName = 'channel';//服务 + this.firstTreeUuid = this.uuid; + } else if (this.processUuid) { + this.treeUuid = !this.$utils.isEmpty(this.nodeList) ? this.nodeList[0]?.uuid : null; + this.firstTreeUuid = this.treeUuid; + this.catalogTypeName = 'channel';//服务 } else if (!this.$utils.isEmpty(this.nodeList)) { - this.currentCatalogId = this.nodeList[0]?.uuid || null; + this.currentUuid = this.nodeList[0]?.uuid || null; + this.treeUuid = this.nodeList[0]?.uuid || null; } else { this.addRoot(); } @@ -185,19 +194,35 @@ export default { }, clickNode(tree, node) { // 节点选中 + if (node?.uuid && this.firstTreeUuid == node.uuid) { + // 从流程管理跳转到服务目录,有目录列表就打开新增服务的页面,没有就新增跟目录 + if (this.$utils.isEmpty(this.nodeList)) { + this.addRoot(); + } else { + if (this.processUuid) { + this.addChannel(node.uuid);// 新加服务 + } else if (this.uuid) { + this.channelData.parentUuid = node.parentUuid; // 编辑服务 + this.channelData.uuid = node.uuid; + } + } + return false; + } this.catalogTypeName = node?.type; if (this.catalogTypeName) { let {uuid = '', parentUuid = null, childrenCount = null, type = ''} = node || {}; this.catalogName = this.$t('dialog.title.edittarget', { target: type == 'channel' ? this.$t('term.process.catalog') : this.$t('page.catalogue') }); this.childrenCount = childrenCount; - this.currentCatalogId = uuid; + this.currentUuid = uuid; + this.treeUuid = uuid; this.$set(this.channelData, 'uuid', uuid); this.$set(this.channelData, 'parentUuid', parentUuid); } }, treeSelected(uuid) { //树select选择中 - this.currentCatalogId = uuid; + this.currentUuid = uuid; + this.treeUuid = uuid; }, //添加根目录按钮 addRoot() { @@ -205,7 +230,7 @@ export default { this.catalogName = this.$t('dialog.title.addtarget', { target: this.$t('page.rootdirectory') }); this.catalogData.parentUuid = '0'; this.catalogData.uuid = ''; - this.currentCatalogId = null; + this.currentUuid = null; }, //搜索服务点击 selectChannel(uuid) { @@ -230,9 +255,15 @@ export default { this.disabledConfig.saving = false; }); }, + beforeDrop(tree, treeNodes, targetNode, moveType) { + // 不允许将服务拖拽为根目录 + if (targetNode == null) { + return false; + } + }, onDrop(tree, treeNodes, targetNode, moveType, isCopy) { if (targetNode == null) { - return; + return false; } let treeNode = treeNodes[0]; let parentId = null; @@ -244,20 +275,29 @@ export default { parentUuid: parentId, targetUuid: targetNode.uuid }; + if (moveType != null) { - let typeConfig = { - catalog: this.$api.process.service.moveCatalog(data), - channel: this.$api.process.service.moveChannel(data) - }; - typeConfig[typeConfig].then(res => { - if (res) { - if (res.Status == 'OK') { - this.$Message.success(this.$t('message.executesuccess')); + if (treeNode.type == 'catalog') { + this.$api.process.service.moveCatalog(data).then(res => { + if (res) { + if (res.Status == 'OK') { + this.$Message.success(this.$t('message.executesuccess')); + } } - } - }).finally(() => { - this.getTreeList(); - }); + }).finally(() => { + this.getTreeList(); + }); + } else if (treeNode.type == 'channel') { + this.$api.process.service.moveChannel(data).then(res => { + if (res) { + if (res.Status == 'OK') { + this.$Message.success(this.$t('message.executesuccess')); + } + } + }).finally(() => { + this.getTreeList(); + }); + } } }, handleDelete() { @@ -317,18 +357,18 @@ export default { this.catalogTypeName = 'catalog'; this.catalogData.parentUuid = treeNode.uuid; this.catalogData.uuid = ''; - this.currentCatalogId = null; + this.currentUuid = null; }, //添加服务 - addChannel(treeNode) { + addChannel(uuid) { this.catalogName = this.$t('dialog.title.addtarget', { target: this.$t('term.process.catalog') }); this.catalogTypeName = 'channel'; - this.channelData.parentUuid = treeNode.uuid; + this.channelData.parentUuid = uuid; this.channelData.uuid = ''; - if (this.processUuid != '') { + if (this.processUuid) { this.channelData.processUuid = this.processUuid; } - this.currentCatalogId = null; + this.currentUuid = null; }, saveEdit(data) { //底部保存按钮 diff --git a/src/views/pages/process/catalog/catalog/edit/channel.vue b/src/views/pages/process/catalog/catalog/edit/channel.vue index f00cbd33..4b70c2ff 100644 --- a/src/views/pages/process/catalog/catalog/edit/channel.vue +++ b/src/views/pages/process/catalog/catalog/edit/channel.vue @@ -360,7 +360,7 @@ export default { ], initValue: { name: '', - processUuid: '', //工作流uuid + processUuid: this.processUuid, //工作流uuid isActive: 1, authorityList: ['common#alluser'], worktimeUuid: '', //工作时间窗口uuid @@ -576,6 +576,13 @@ export default { }, selectPriority(val) { this.priority(val); + }, + processUuid: { + handler(newValue, oldValue) { + this.$set(this.initValue, 'processUuid', newValue); + this.getData(true); + }, + deep: true } } }; diff --git a/src/views/pages/process/catalog/catalog/edit/editmixin.js b/src/views/pages/process/catalog/catalog/edit/editmixin.js index 0b8f6b65..55b73a31 100644 --- a/src/views/pages/process/catalog/catalog/edit/editmixin.js +++ b/src/views/pages/process/catalog/catalog/edit/editmixin.js @@ -1,6 +1,11 @@ export default { props: { - uuid: [Number, String] + uuid: [Number, String], + processUuid: { + // 流程id + type: String, + default: '' + } }, data() { return { diff --git a/src/views/pages/process/flow/flow-edit.vue b/src/views/pages/process/flow/flow-edit.vue index ed2bf9e9..2202e360 100644 --- a/src/views/pages/process/flow/flow-edit.vue +++ b/src/views/pages/process/flow/flow-edit.vue @@ -1003,7 +1003,7 @@ export default { }); }, goCreatecatalog() { - window.open(HOME + '/process.html#/catalog-manage?parentUuid=1&processUuid=' + this.processConfig.uuid, '_blank'); + window.open(HOME + '/process.html#/catalog-manage?processUuid=' + this.processConfig.uuid, '_blank'); }, removeAuthconfig(node) { if (node && node.uuid) { diff --git a/src/views/pages/process/flow/flowedit/relation-service.vue b/src/views/pages/process/flow/flowedit/relation-service.vue index c0347776..6efac219 100644 --- a/src/views/pages/process/flow/flowedit/relation-service.vue +++ b/src/views/pages/process/flow/flowedit/relation-service.vue @@ -130,7 +130,7 @@ export default { // }); }, linkCatalog() { - window.open(HOME + '/process.html#/catalog-manage?parentUuid=1&processUuid=' + this.processUuid, '_blank'); + window.open(HOME + '/process.html#/catalog-manage?processUuid=' + this.processUuid, '_blank'); } }, filter: {}, -- Gitee