chenshilong 6 年之前
父節點
當前提交
fd646d2e20
共有 3 個文件被更改,包括 25 次插入15 次删除
  1. 6 0
      public/scHintBox.html
  2. 18 14
      web/building_saas/main/js/views/block_lib.js
  3. 1 1
      web/building_saas/main/js/views/project_view.js

+ 6 - 0
public/scHintBox.html

@@ -77,6 +77,12 @@
         font: function(str){
             return `<span style='color:red;font-weight:bold;font-size:15px'> ${str} </span>`;
         },
+        fontRed: function(str){
+            return `<span style='color:red;'> ${str} </span>`;
+        },
+        fontBlue: function(str){
+            return `<span style='color:blue;'> ${str} </span>`;
+        },
         error: function (err) {   // 注意:该方法只能用在valueBox()的doOK回调函数中。
             $('#hintBox_error').text(err);
             $('#hintBox_error').show(200);

+ 18 - 14
web/building_saas/main/js/views/block_lib.js

@@ -27,7 +27,7 @@ var blockLibObj = {
                 "font":["Arial"]
             },
             "data":{
-                "field":"name",
+                "field":"nodeName",
                 "vAlign":1,
                 "hAlign":0,
                 "font":"Arial"
@@ -70,14 +70,14 @@ var blockLibObj = {
         $.bootstrapLoading.start();
         let me = this;
         me.mainDatas = [
-            {ID: 1, ParentID: -1, NextSiblingID: 2, name: '分类1', type: 1},
-            {ID: 2, ParentID: -1, NextSiblingID: 3, name: '分类2', type: 1},
-            {ID: 3, ParentID: -1, NextSiblingID: 4, name: '分类3', type: 1},
+            {ID: 1, ParentID: -1, NextSiblingID: 2, nodeName: '分类1', type: 1},
+            {ID: 2, ParentID: -1, NextSiblingID: 3, nodeName: '分类2', type: 1},
+            {ID: 3, ParentID: -1, NextSiblingID: 4, nodeName: '分类3', type: 1},
             // {ID: 105, ParentID: 1, NextSiblingID: 106, name: '块1', type: 2},
             // {ID: 106, ParentID: 1, NextSiblingID: 107, name: '块2', type: 2},
-            {ID: 7, ParentID: -1, NextSiblingID: 8, name: '分类7', type: 1},
-            {ID: 9, ParentID: -1, NextSiblingID: -1, name: '分类9', type: 1}//,
-            // {ID: 201, ParentID: 52, NextSiblingID: -1, name: '块201', type: 2}
+            {ID: 7, ParentID: -1, NextSiblingID: 8, nodeName: '分类7', type: 1},
+            {ID: 9, ParentID: -1, NextSiblingID: -1, nodeName: '分类9', type: 1}//,
+            // {ID: 201, ParentID: 52, NextSiblingID: -1, nodeName: '块201', type: 2}
         ];
 
         if (me.mainSpread) {
@@ -366,7 +366,7 @@ var blockLibObj = {
 
         let newNode = tree.insert(pID, nID);
         newNode.data.type = nodeType;
-        newNode.data.fileName = nodeName;
+        newNode.data.nodeName = nodeName;
         if (nodeType == 2){
             let bill = source.datas[0];
             newNode.data.compilationID = source.compilationID;
@@ -401,7 +401,7 @@ var blockLibObj = {
         let idx = tree.items.indexOf(newNode);
         sheet.addRows(idx, 1);
         sheet.getRange(idx, 0, 1, 1).locked(true);
-        sheet.setValue(idx, 0, newNode.data.fileName);
+        sheet.setValue(idx, 0, newNode.data.nodeName);
         sheet.setSelection(idx, 0, 1, 1);
 
         sheet.resumeEvent();
@@ -409,7 +409,7 @@ var blockLibObj = {
     },
     reName: function (node, newName){
         if (newName == '') return;
-        node.data.fileName = newName;
+        node.data.nodeName = newName;
         let idx = blockLibObj.mainTree.items.indexOf(node);
         blockLibObj.mainSheet.setValue(idx, 0, newName);
     },
@@ -503,7 +503,10 @@ var blockLibObj = {
                         return true;
                     },
                     callback: function (key, opt) {
-                        me.delete();
+                        let name = hintBox.fontRed(me.mainTree.selected.data.nodeName);
+                        hintBox.infoBox('操作确认', `确定要删除"${name}"吗?`, 2, function () {
+                            me.delete();
+                        });
                     }
                 },
                 "moveBlock": {
@@ -513,7 +516,8 @@ var blockLibObj = {
                         return true;
                     },
                     visible: function(key, opt){
-                        return me.curIsBlock();
+                        // return me.curIsBlock();
+                        return false;
                     },
                     callback: function (key, opt) {
 
@@ -568,12 +572,12 @@ $(document).ready(function(){
 
     $('#btn_block_reName').on('click', function (){
         let select = blockLibObj.mainTree.selected;
-        $('#input_block_reName').val(select.data.fileName);
+        $('#input_block_reName').val(select.data.nodeName);
     });
 
     $('#btn_block_reName_OK').on('click', function (){
         let select = blockLibObj.mainTree.selected;
-        let oldName = select.data.fileName;
+        let oldName = select.data.nodeName;
         let newName = $('#input_block_reName').val();
         if (oldName != newName) blockLibObj.reName(select, newName);
     });

+ 1 - 1
web/building_saas/main/js/views/project_view.js

@@ -2939,7 +2939,7 @@ $(function () {
             if (Categories.length <= 0) return result;
 
             for (let c of Categories){
-                result += '<option value="'+ c.data.ID +'">'+ c.data.name +'</option>';
+                result += '<option value="'+ c.data.ID +'">'+ c.data.nodeName +'</option>';
             };
             return result;
         };