diff --git a/src/resources/plugins/TsZtree/TsZtree.vue b/src/resources/plugins/TsZtree/TsZtree.vue
index 28bfeec8e41dd0c6221acc316bdd50737be6f637..0a0f800e1f0cfdd09551109ad5fbd1f50a5b9225 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/framework/extramenu/extramenu-manage.vue b/src/views/pages/framework/extramenu/extramenu-manage.vue
index cf6f860b8a727b30f561235f1c6b0780deecc910..8ec63bbeee2a89c844590641fd4313af483be591 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;
diff --git a/src/views/pages/process/catalog/catalog-manage.vue b/src/views/pages/process/catalog/catalog-manage.vue
index ad87f52576813fabcbd62d3611a58f0cb8dc921a..4e4c17ceae0ae74e7dda66853b96501a2aecceaa 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) {