From e90126d04a8289ba48ad21e9edbe9db7bbff5fb3 Mon Sep 17 00:00:00 2001 From: yaojn Date: Tue, 28 Nov 2023 10:47:43 +0800 Subject: [PATCH] =?UTF-8?q?-=20[=E4=BF=AE=E5=A4=8D]=E4=BB=8E=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E7=AE=A1=E7=90=86=E8=B7=B3=E8=BD=AC=E5=88=B0=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E7=9B=AE=E5=BD=95=E6=A0=87=E9=A2=98=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E4=B8=8D=E4=B8=8A=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/process/catalog/catalog-manage.vue | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/views/pages/process/catalog/catalog-manage.vue b/src/views/pages/process/catalog/catalog-manage.vue index c0ef2606e..ad87f5257 100644 --- a/src/views/pages/process/catalog/catalog-manage.vue +++ b/src/views/pages/process/catalog/catalog-manage.vue @@ -202,6 +202,7 @@ export default { if (this.processUuid) { this.addChannel(node.uuid);// 新加服务 } else if (this.uuid) { + this.catalogName = this.$t('dialog.title.edittarget', { target: this.$t('term.process.catalog')}); this.channelData.parentUuid = node.parentUuid; // 编辑服务 this.channelData.uuid = node.uuid; } @@ -211,16 +212,17 @@ export default { 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.currentUuid = uuid; this.treeUuid = uuid; if (type == 'catalog') { // 编辑目录 + this.catalogName = this.$t('dialog.title.edittarget', { target: this.$t('page.catalogue') }); this.$set(this.catalogData, 'uuid', uuid); this.$set(this.catalogData, 'parentUuid', parentUuid); } else if (type == 'channel') { // 编辑服务 + this.catalogName = this.$t('dialog.title.edittarget', { target: this.$t('term.process.catalog')}); this.$set(this.channelData, 'uuid', uuid); this.$set(this.channelData, 'parentUuid', parentUuid); } @@ -270,36 +272,37 @@ export default { }, onDrop(tree, treeNodes, targetNode, moveType, isCopy) { if (targetNode == null) { + // 服务不可以拖拽为根目录 return false; } let treeNode = treeNodes[0]; let parentId = null; let keyId = 'uuid'; - parentId = moveType == 'inner' ? targetNode[keyId] : targetNode.getParentNode() == null ? 0 : targetNode.getParentNode()[keyId]; + if (moveType === 'inner') { + parentId = targetNode?.[keyId] || 0; + } else { + parentId = targetNode && targetNode.getParentNode() === null ? 0 : (targetNode?.getParentNode()?.[keyId] || 0); + } let data = { uuid: treeNode.uuid, moveType: moveType, parentUuid: parentId, - targetUuid: targetNode.uuid + targetUuid: targetNode?.uuid || 0 }; if (moveType != null) { 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')); - } + if (res && res.Status == 'OK') { + this.$Message.success(this.$t('message.executesuccess')); } }).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')); - } + if (res && res.Status == 'OK') { + this.$Message.success(this.$t('message.executesuccess')); } }).finally(() => { this.getTreeList(); -- Gitee