From 2ae1ec76f0c292cf5a49209d2923757e1a58e2c9 Mon Sep 17 00:00:00 2001 From: dengbf Date: Fri, 22 Dec 2023 15:30:38 +0800 Subject: [PATCH 1/2] =?UTF-8?q?-=20[=E4=BF=AE=E5=A4=8D]=20=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E7=AE=A1=E7=90=86-=E6=89=93=E5=BC=80=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E7=AE=A1=E7=90=86=EF=BC=8C=E7=82=B9=E5=87=BB=E6=A0=B9?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=8F=B3=E4=BE=A7=E7=9A=84=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=EF=BC=8C=E5=86=8D=E6=AC=A1=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=90=8D=E7=A7=B0=EF=BC=8C=E6=9C=AA=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E6=88=90=E7=BC=96=E8=BE=91=E7=9B=AE=E5=BD=95=20=20=20?= =?UTF-8?q?=20-=20[=E5=85=B3=E8=81=94]=20#[1051993034948608]=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E7=AE=A1=E7=90=86-=E6=89=93=E5=BC=80=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E7=AE=A1=E7=90=86=EF=BC=8C=E7=82=B9=E5=87=BB=E6=A0=B9?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=8F=B3=E4=BE=A7=E7=9A=84=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=EF=BC=8C=E5=86=8D=E6=AC=A1=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=90=8D=E7=A7=B0=EF=BC=8C=E6=9C=AA=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E6=88=90=E7=BC=96=E8=BE=91=E7=9B=AE=E5=BD=95=20http:/?= =?UTF-8?q?/192.168.0.96:8090/demo/rdm.html#/bug-detail/939050947543040/93?= =?UTF-8?q?9050947543057/1051993034948608?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/pages/framework/extramenu/extramenu-manage.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/views/pages/framework/extramenu/extramenu-manage.vue b/src/views/pages/framework/extramenu/extramenu-manage.vue index cf6f860b..8ec63bbe 100644 --- a/src/views/pages/framework/extramenu/extramenu-manage.vue +++ b/src/views/pages/framework/extramenu/extramenu-manage.vue @@ -17,6 +17,7 @@ :nodes="nodeList" :hoverDomList="hoverDomList" urlKey="xUrl" + :beforeClick="beforeClick" :onClick="clickNode" :beforeDrop="beforeDrop" :onDrop="onDrop" @@ -170,6 +171,14 @@ export default { }); }); }, + beforeClick(zTreeObj, node) { + if (!this.selectSaveId || this.selectSaveId != node.id) { + zTreeObj.cancelSelectedNode(); + return true; + } else { + return false; + } + }, clickNode(tree, node) { this.isMenu = node.type; this.selectedTreeId = node.id; -- Gitee From 90b4226c323677279c98e2814a34f97a08ac633a Mon Sep 17 00:00:00 2001 From: dengbf Date: Fri, 22 Dec 2023 15:31:36 +0800 Subject: [PATCH 2/2] =?UTF-8?q?-=20[=E4=BF=AE=E5=A4=8D]=20=E8=A1=A5?= =?UTF-8?q?=E5=85=85TsZtree=E7=9A=84beforeClick?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/resources/plugins/TsZtree/TsZtree.vue | 21 ++++++++++++------- .../pages/process/catalog/catalog-manage.vue | 9 ++++++++ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/resources/plugins/TsZtree/TsZtree.vue b/src/resources/plugins/TsZtree/TsZtree.vue index 28bfeec8..0a0f800e 100644 --- a/src/resources/plugins/TsZtree/TsZtree.vue +++ b/src/resources/plugins/TsZtree/TsZtree.vue @@ -23,7 +23,8 @@ export default { enableToggleClick: { type: Boolean, default: false }, //是否激活反选功能(点击已选中节点取消点击) beforeDrop: { type: Function }, // 拖放之前事件 urlKey: { type: String, default: 'url' }, //节点链接的目标URL的属性名称, 特殊用途:当后台数据只能生成 url 属性,又不想实现点击节点跳转的功能时,可以直接修改此属性为其他不存在的属性名称, - nodeClasses: { type: Function } // 使用 className 设置文字样式,只针对 zTree 在节点上显示的对象。便于 css 与 js 解耦 默认值:{add: [], remove: []} add表示新增类名,remove表示移除类名 + nodeClasses: { type: Function }, // 使用 className 设置文字样式,只针对 zTree 在节点上显示的对象。便于 css 与 js 解耦 默认值:{add: [], remove: []} add表示新增类名,remove表示移除类名 + beforeClick: {type: Function} //返回true或者false,判断是否可以点击 }, data() { return { @@ -79,13 +80,17 @@ export default { } }, beforeClick: (treeId, treeNode, clickFlag) => { - const selectedList = this.zTreeObj.getSelectedNodes(); - if (!selectedList.includes(treeNode)) { - return true; - } else if (this.enableToggleClick) { - this.zTreeObj.cancelSelectedNode(treeNode); - if (this.onClick) { - this.onClick(this.zTreeObj, null); + if(this.beforeClick) { + return this.beforeClick(this.zTreeObj, treeNode); + }else { + const selectedList = this.zTreeObj.getSelectedNodes(); + if (!selectedList.includes(treeNode)) { + return true; + } else if (this.enableToggleClick) { + this.zTreeObj.cancelSelectedNode(treeNode); + if (this.onClick) { + this.onClick(this.zTreeObj, null); + } } } return false; diff --git a/src/views/pages/process/catalog/catalog-manage.vue b/src/views/pages/process/catalog/catalog-manage.vue index ad87f525..4e4c17ce 100644 --- a/src/views/pages/process/catalog/catalog-manage.vue +++ b/src/views/pages/process/catalog/catalog-manage.vue @@ -30,6 +30,7 @@ idKey="uuid" :nodes="nodeList" :hoverDomList="hoverDomList" + :beforeClick="beforeClick" :onClick="clickNode" :onDrop="onDrop" :value="treeUuid" @@ -192,6 +193,14 @@ export default { } }); }, + beforeClick(zTreeObj, node) { + if (!this.currentUuid || this.currentUuid != node.uuid) { + zTreeObj.cancelSelectedNode(); + return true; + } else { + return false; + } + }, clickNode(tree, node) { // 节点选中 if (node?.uuid && this.firstTreeUuid == node.uuid) { -- Gitee