chenshilong 7 years ago
parent
commit
934f397c68

+ 17 - 2
web/building_saas/main/js/models/ration.js

@@ -627,14 +627,28 @@ var Ration = {
             }
             else return null;
         };
-        ration.prototype.addNewRationForPaste = function (rationType) {
+        ration.prototype.addNewRationFast = function (rationType) {
             let me = this;
             let project = projectObj.project, sheetController = projectObj.mainController;
             let engineering = projectInfoObj.projectInfo.property.engineering;
             let selected = project.mainTree.selected, newSource = null, newNode = null,pre=null,br=null;
             let billItemID = null,serialNo=1,nextID=null;
             if (selected === null) { return null; }
-            if (selected.sourceType === project.Ration.getSourceType()) {
+            if (selected.sourceType === project.Bills.getSourceType() && selected.depth() > 0) {
+                if(selected.data.type === billType.FB){
+                    return null;
+                }
+                else if (selected.source.children.length > 0) {
+                    alert('当前清单已有清单子项,不能套用定额。');
+                } else if (selected.data.calcBase&&selected.data.calcBase!="") {
+                    alert('当前有基数计算不能插入定额/量价/工料机。');
+                } else {
+                    billItemID = selected.source.getID();
+                    nextID = selected.tree.rootID();
+                    br = this.getBillsSortRation(billItemID);
+                    serialNo = br.length > 0 ? br[br.length - 1].serialNo + 1 : 1
+                }
+            } else if (selected.sourceType === project.Ration.getSourceType()) {
                 billItemID = selected.getParentID();
                 br = this.getBillsSortRation(billItemID);
                 serialNo = selected.data.serialNo+1;
@@ -669,6 +683,7 @@ var Ration = {
                     newNode.data = newSource;
                 })
                 ProjectController.syncDisplayNewNode(sheetController, newNode);
+                $.bootstrapLoading.end();
                 return newNode;
             }
             else return null;

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

@@ -54,8 +54,8 @@ let MainTreeCol = {
             else
                 rst = isDef(node.data.code) ? node.data.code : '';
 
-            if (node.data.adjustState && rst != '')
-                rst = rst + rationPrefix.replace;
+/*            if (node.data.adjustState && rst != '')
+                rst = rst + rationPrefix.replace;*/
             return rst;
         },
         marketPrice:function (node) {

+ 6 - 4
web/building_saas/main/js/views/project_view.js

@@ -531,7 +531,7 @@ var projectObj = {
             if (isDef(node.data.prefix) && node.data.prefix !== rationPrefix.none){
                  value = value.replace(new RegExp(node.data.prefix), '');
             };
-            value = value.replace(new RegExp(rationPrefix.replace), '');
+            // value = value.replace(new RegExp(rationPrefix.replace), '');
             info.sheet.setValue(info.row, info.col, value);
         }
         if(node&&fieldName =='quantity'&&(node.data.quantityEXP !==null||node.data.quantityEXP !==undefined)){
@@ -644,7 +644,7 @@ var projectObj = {
                     for (let i = 0; i < add; i++) {
                         switch (nodeType) {
                             case 1:
-                                curNode = projectObj.project.Ration.addNewRationForPaste(rationType.ration);
+                                curNode = projectObj.project.Ration.addNewRationFast(rationType.ration);
                                 break;
                             case 2:
                                 curNode = ProjectController.addFB(projectObj.project, projectObj.mainController);
@@ -680,7 +680,7 @@ var projectObj = {
                         // 编号去掉“换、借、补”等多余的字
                         code = code.replace(new RegExp(rationPrefix.complementary), '');
                         code = code.replace(new RegExp(rationPrefix.borrow), '');
-                        code = code.replace(new RegExp(rationPrefix.replace), '');
+                        // code = code.replace(new RegExp(rationPrefix.replace), '');
                         updateRationCodes.push({'node':ptNode, value:code});
                     }
                     projectObj.project.Ration.updateRationCodes(updateRationCodes);
@@ -1920,7 +1920,9 @@ $('#downLevel').click(function () {
     }
 });
 $('#insertRation').click(function () {
-    projectObj.project.Ration.addNewRation(null,rationType.ration);
+    // projectObj.project.Ration.addNewRation(null,rationType.ration);
+    // 连续点工具栏的插入定额按钮,显示树结构画线有问题。
+    projectObj.project.Ration.addNewRationFast(rationType.ration);
 });
 $('#upMove').click(function () {
     var controller = projectObj.mainController, project = projectObj.project;