Browse Source

模板子目关联复制整块恢复默认,应用成功后加提示。

zhangweicheng 6 years ago
parent
commit
fa09ccf172

+ 1 - 0
modules/all_models/ration_template.js

@@ -14,6 +14,7 @@ let ration_template =  new Schema({
         code:String,
         name:String,
         type:String,
+        defaultLocation:String,//记录默认给定的清单编号,恢复原始数据时用(目前复制整块)
         billsLocation:String,//这个是清单编号
         fxID:String,//这个是分项对应的ID
         unit:String,

+ 2 - 1
modules/main/facade/ration_facade.js

@@ -215,7 +215,7 @@ async function addRationSubList(stdRation,newRation,needInstall,compilation) {
     console.log("添加定额install时间-----"+(addRationInstallFeeTime - addRationCoeTime));
     //添加定额模板子目
     let ration_template = await addRationTemplate(stdRation,newRation);
-    return {ration:newRation,ration_gljs:ration_gljs,ration_coes:ration_coes,ration_installations:ration_installations,ration_templates:[ration_template]};
+    return {ration:newRation,ration_gljs:ration_gljs,ration_coes:ration_coes,ration_installations:ration_installations,ration_templates:ration_template?[ration_template]:[]};
 }
 
 async function addRationInstallFee(std,newRation) {
@@ -274,6 +274,7 @@ async function addRationTemplate(std,newRation) {
                 template.type = tem.type;
                 template.unit = re_ration.unit;
                 template.billsLocation = tem.billsLocation;
+                template.defaultLocation = tem.billsLocation;
                 templateList.push(template)
             }
         }

+ 5 - 0
web/building_saas/css/custom.css

@@ -305,4 +305,9 @@ input.text-right{
 /*修改tooltip默认最大宽度 */
 .tooltip-inner{
     max-width: 400px !important;
+}
+.applySuccess{
+    display: none;
+    color: #43CD80;
+    margin-left: 8px
 }

+ 1 - 0
web/building_saas/main/html/main.html

@@ -304,6 +304,7 @@
                                                       </div>
                                                       <div class="">
                                                           <button class=" btn btn-primary btn-sm cus-width" type="button" id="apply_mbzm">应用</button>
+                                                          <label class="applySuccess" ><i class="fa fa-check" aria-hidden="true"></i>成功</label>
                                                           <button class=" btn btn-primary btn-sm cus-width" type="button" id="next_mbzm">下一条</button>
                                                       </div>
 

+ 9 - 1
web/building_saas/main/js/controllers/block_controller.js

@@ -340,7 +340,7 @@ let BlockController = {
                 i==0?firstNode = temNode:'';
             }
         }
-        ProjectController.syncDisplayNewNodes(projectObj.mainController, newNodes);
+        ProjectController.syncDisplayNewNodes(projectObj.mainController, newNodes,true);
         let sels = projectObj.mainController.sheet.getSelections();
         //设置选中并更新下方显示
         projectObj.mainController.setTreeSelected(firstNode);
@@ -475,6 +475,14 @@ let BlockController = {
             template.ID = uuid.v1();
             template.projectID = projectObj.project.ID();
             template.rationID = rationData.ID;
+            //其它值恢复成默认
+            for(let t of template.templateList){
+                t.billID = "";
+                t.fxID="";
+                t.quantity="0";
+                t.coe = "";
+                if(t.defaultLocation) t.billsLocation = t.defaultLocation;
+            }
             return template;
         }
         

+ 2 - 2
web/building_saas/main/js/controllers/project_controller.js

@@ -16,7 +16,7 @@ ProjectController = {
             cbTools.refreshFormulaNodes();
         });
     },
-    syncDisplayNewNodes: function (sc, newNodes) {
+    syncDisplayNewNodes: function (sc, newNodes,withOutSelect=false) {//withOutSelect 不需要自动选中,外面自已处理
         TREE_SHEET_HELPER.massOperationSheet(sc.sheet, function () {
             var sels = sc.sheet.getSelections();
             newNodes.sort(function (a, b) {
@@ -36,7 +36,7 @@ ProjectController = {
                 lastNode = newNode
                // sc.sheet.showRow(newNode.serialNo(), GC.Spread.Sheets.VerticalPosition.center);
             }
-            if(lastNode){
+            if(withOutSelect==false&& lastNode){
                 sc.setTreeSelected(lastNode);
                 sc.sheet.setSelection(lastNode.serialNo(), sels[0].col, 1, 1);
             }

+ 2 - 0
web/building_saas/main/js/main.js

@@ -22,6 +22,8 @@ $(function () {
         billsLibObj.refreshBillsSpread();
         billsLibObj.refreshBillsRelaSpread();
         rationLibObj.refreshSpread();
+        subObj.initGljSubTab();
+        refreshSubSpread();
     });
 
     $('#tab_report').on('shown.bs.tab', function(e){

+ 7 - 3
web/building_saas/main/js/views/mbzm_view.js

@@ -181,11 +181,15 @@ let mbzm_obj={
                 projectObj.project.calcProgram.calcNodesAndSave(calRations,function () {
                     installationFeeObj.calcInstallationFee();
                 });
-
+                mbzm_obj.showApplySuccess();
             });
-            console.log(result);
         })
-
+    },
+    showApplySuccess:function () {
+        $(".applySuccess").show();
+        setTimeout(function () {
+            $(".applySuccess").hide();
+        },1500)
     },
     positionChecking(type,data){//这个要之后再测试一下
         let validate = true;