chenshilong 6 年之前
父节点
当前提交
573e9d177d
共有 1 个文件被更改,包括 15 次插入9 次删除
  1. 15 9
      web/building_saas/main/js/views/block_lib.js

+ 15 - 9
web/building_saas/main/js/views/block_lib.js

@@ -413,6 +413,12 @@ var blockLibObj = {
         };
         return nodes;
     },
+    curIsBlock: function () {
+        return this.mainTree.selected.data.type == 2;
+    },
+    curIsCategory: function () {
+        return this.mainTree.selected.data.type == 1;
+    },
     refreshSpread: function (){
         if (this.mainSpread)
             this.mainSpread.refresh();
@@ -456,10 +462,10 @@ var blockLibObj = {
                     name: '一对一克隆',
                     icon: "fa-battery-empty",
                     disabled: function () {
-                       return me.mainTree.selected.data.type == 1;
+
                     },
                     visible: function(key, opt){
-                        return true;
+                        return me.curIsBlock();
                     },
                     callback: function (key, opt) {
 
@@ -469,10 +475,10 @@ var blockLibObj = {
                     name: '一对多克隆',
                     icon: "fa-battery-half",
                     disabled: function () {
-                        return me.mainTree.selected.data.type == 1;
+
                     },
                     visible: function(key, opt){
-                        return true;
+                        return me.curIsBlock();
                     },
                     callback: function (key, opt) {
 
@@ -482,10 +488,10 @@ var blockLibObj = {
                     name: '多对多克隆',
                     icon: "fa-battery-full",
                     disabled: function () {
-                        return me.mainTree.selected.data.type == 2;
+
                     },
                     visible: function(key, opt){
-                        return true;
+                        return me.curIsCategory();
                     },
                     callback: function (key, opt) {
 
@@ -495,7 +501,7 @@ var blockLibObj = {
                     name: '删除',
                     icon: "delete",
                     disabled: function () {
-                        return false;
+
                     },
                     visible: function(key, opt){
                         return true;
@@ -508,10 +514,10 @@ var blockLibObj = {
                     name: '移动模板',
                     icon: "cut",
                     disabled: function () {
-                        return me.mainTree.selected.data.type == 1;
+
                     },
                     visible: function(key, opt){
-                        return true;
+                        return me.curIsBlock();
                     },
                     callback: function (key, opt) {