瀏覽代碼

Merge branch '1.0.0_online' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost into 1.0.0_online

zhongzewei 6 年之前
父節點
當前提交
74fd6735ee

+ 5 - 5
web/building_saas/main/html/main.html

@@ -39,8 +39,8 @@
         let userAccount = '<%- userAccount %>';
         let userID = '<%- userID %>';
         let projectReadOnly = JSON.parse('<%- projectReadOnly %>');
-//        const G_SHOW_BLOCK_LIB = true;
-        const G_SHOW_BLOCK_LIB = false;
+        const G_SHOW_BLOCK_LIB = true;
+//        const G_SHOW_BLOCK_LIB = false;
     </script>
 </head>
 
@@ -131,7 +131,7 @@
                           <script>
                               if (G_SHOW_BLOCK_LIB){
                                   $("#li_stdRationTab").after('<li class="nav-item"> <a class="nav-link px-3" href="javascript:void(0)" ' +
-                                      'id="blockLibTab" relaPanel="#kmbk">块模板库2</a></li>');
+                                      'id="blockLibTab" relaPanel="#kmbk">块模板库</a></li>');
                               }
                           </script>
                       </ul>
@@ -458,9 +458,9 @@
                               <div class="tab-pane" id="kmbk">
                                   <div class="tools-bar-height-d container-fluid">
                                       <div class="p-1 row">
-                                          <button id="btn_block_collapse" class="btn btn-primary btn-sm" type="button">展开/折叠</button>
+                                          <!--<button id="btn_block_collapse" class="btn btn-primary btn-sm" type="button">展开/折叠</button>-->
                                           <button id="btn_block_newFolder" class="btn btn-primary btn-sm" type="button">新建分类</button>
-                                          <button id="btn_block_newSubFolder" class="btn btn-warning btn-sm" type="button">新建块</button>
+                                          <!--<button id="btn_block_newSubFolder" class="btn btn-warning btn-sm" type="button">新建块</button>-->
                                       </div>
                                   </div>
                                   <div class="top-content" style="overflow: hidden">

+ 2 - 2
web/building_saas/main/js/views/block_lib.js

@@ -284,7 +284,7 @@ var blockLibObj = {
         };
         return new TreeCell();
     },
-    newNode: function (nodeType){     // 1 分类  2 块文件
+    newNode: function (nodeType, nodeName){     // 1 分类  2 块文件
         let tree = blockLibObj.mainTree;
         let pID = -1, nID = -1;
         let select = tree.selected;
@@ -316,7 +316,7 @@ var blockLibObj = {
             };
             newNode = tree.insert(pID, nID);
             newNode.data.type = 2;
-            newNode.data.name = '块文件';
+            newNode.data.name = nodeName;
         }
 
         tree.selected = newNode;

+ 19 - 0
web/building_saas/main/js/views/project_view.js

@@ -1498,6 +1498,25 @@ var projectObj = {
                     visible: function(key, opt){//2018-11-15 暂时隐藏
                         return false
                     }
+                },
+                "createBlocks":{
+                    name:'生成组价模板',
+                    icon: 'fa-edit',
+                    disabled:function (key,opt) {
+                        let selected = project.mainTree.selected;
+                        return selected.sourceType != ModuleNames.bills;
+                    },
+                    callback:function(){
+                        if (!$("#kmbk").is(":visible")){
+                            $('#blockLibTab').click()
+                        };
+                        let selected = project.mainTree.selected;
+                        let name = selected.data.code + ' ' + selected.data.name + ' ' + selected.data.unit;
+                        blockLibObj.newNode(2, name);
+                    },
+                    visible: function(key, opt){
+                        return G_SHOW_BLOCK_LIB;
+                    }
                 }
             }
         });