瀏覽代碼

多期比较相关

MaiXinRong 5 月之前
父節點
當前提交
273ebbefa2
共有 2 個文件被更改,包括 9 次插入7 次删除
  1. 1 1
      app/controller/measure_controller.js
  2. 8 6
      app/public/js/measure_compare.js

+ 1 - 1
app/controller/measure_controller.js

@@ -270,7 +270,7 @@ module.exports = app => {
                 }
                 const zlj = JSON.parse(JSON.stringify(stdConst.zlj));
                 zlj.deal_bills_tp = ctx.tender.info.deal_param.zanLiePrice;
-                result.spec = {zlj: zlj, jrg: stdConst.jrg};
+                result.spec = { zlj: zlj, jrg: stdConst.jrg };
                 ctx.body = { err: 0, msg: '', data: result };
             } catch (err) {
                 this.log(err);

+ 8 - 6
app/public/js/measure_compare.js

@@ -267,6 +267,7 @@ function calculateStagePosData(datas) {
 }
 
 $(document).ready(() => {
+    let spec;
     autoFlashHeight();
     initSpreadSettingWithRoles([]);
     const billsSpread = SpreadJsObj.createNewSpread($('#bills-spread')[0]);
@@ -375,7 +376,8 @@ $(document).ready(() => {
         gclGatherData = gclGatherModel.gatherGclData();
         SpreadJsObj.loadSheetData(gclSheet, SpreadJsObj.DataType.Data, gclGatherData);
         loadLeafXmjData(0);
-        const chapterData = gclGatherModel.gatherChapterData(chapter, result.spec, ['deal_tp', 'total_price', 'sum_contract_tp', 'sum_qc_tp', 'sum_gather_tp']);
+        spec = result.spec;
+        const chapterData = gclGatherModel.gatherChapterData(chapter, spec, ['deal_tp', 'total_price', 'sum_contract_tp', 'sum_qc_tp', 'sum_gather_tp']);
         SpreadJsObj.loadSheetData(chapterSheet, SpreadJsObj.DataType.Data, chapterData);
     }, null, true);
     function loadPosData(iRow) {
@@ -394,7 +396,6 @@ $(document).ready(() => {
         SpreadJsObj.resetTopAndSelect(leafXmjSheet);
     }
     billsSheet.bind(spreadNS.Events.SelectionChanged, function (e, info) {
-        console.log(SpreadJsObj.getSelectObject(info.sheet));
         if (info.newSelections) {
             const iNewRow = info.newSelections[0].row;
             if (info.oldSelections) {
@@ -426,14 +427,14 @@ $(document).ready(() => {
     });
     const compareStages = [];
     $('#select-qi-ok').click(function () {
-        function refreshView (data) {
+        function refreshView () {
             const gatherField = ['deal_tp', 'total_price', 'sum_contract_tp', 'sum_qc_tp', 'sum_gather_tp'];
             compareStages.length = 0;
             for (let order = 0, iLength = trs.length; order < iLength; order++) {
                 const tr = trs[order];
                 if ($('input', tr)[0].checked) {
                     compareStages.push(order + 1);
-                    gatherField.push(`contract_tp${order}`, `qc_tp${order}`, `gather_tp${order}`);
+                    gatherField.push(`contract_tp${order + 1}`, `qc_tp${order + 1}`, `gather_tp${order + 1}`);
                 }
             }
             // setLocalCache(cCacheKey, compareStages.join(','));
@@ -453,7 +454,7 @@ $(document).ready(() => {
             SpreadJsObj.loadSheetData(gclSheet, SpreadJsObj.DataType.Data, gclGatherData);
             loadLeafXmjData(0);
 
-            const chapterData = gclGatherModel.gatherChapterData(chapter, data.spec, gatherField);
+            const chapterData = gclGatherModel.gatherChapterData(chapter, spec, gatherField);
             SpreadJsObj.reLoadSheetHeader(chapterSheet);
             SpreadJsObj.loadSheetData(chapterSheet, SpreadJsObj.DataType.Data, chapterData);
         }
@@ -469,6 +470,7 @@ $(document).ready(() => {
         }
         if (loadData.length > 0) {
             postData(window.location.pathname + '/load', {stages: loadData}, function (result) {
+                spec = result.spec;
                 for (const aData of result.stages) {
                     calculateStageLedgerData(aData.bills);
                     cTree.loadMinorData(aData.bills, aData.order + '', ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'gather_qty', 'gather_tp'], ['contract_tp', 'qc_tp', 'gather_tp']);
@@ -478,7 +480,7 @@ $(document).ready(() => {
                 cTree.reCalcSumData(['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'gather_qty', 'gather_tp'], showData);
                 treeCalc.calculateAll(cTree);
                 cPos.reCalcSumData(['contract_qty', 'qc_qty', 'gather_qty'], showData);
-                refreshView(result);
+                refreshView();
                 $('#select-qi').modal('hide');
             }, null, true);
         } else {