瀏覽代碼

修复本年累计完成bug

laiguoran 4 年之前
父節點
當前提交
5302490953
共有 2 個文件被更改,包括 10 次插入7 次删除
  1. 6 4
      app/controller/schedule_controller.js
  2. 4 3
      app/public/js/schedule_stage_tp.js

+ 6 - 4
app/controller/schedule_controller.js

@@ -302,10 +302,12 @@ module.exports = app => {
                 const stageList = _.filter(stageOrderList, function(item) {
                     return item.s_time.indexOf(curStage.s_time.split('-')[0]) !== -1;
                 });
-                const newSS = _.sortBy(scheduleStage, 'yearmonth');
-                const stageIdList = _.map(_.filter(stageList, function(item) {
-                    return _.find(newSS, { order: item.order });
-                }), 'id');
+                // const newSS = _.sortBy(scheduleStage, 'yearmonth');
+                // const stageIdList = _.map(_.filter(stageList, function(item) {
+                //     return _.find(newSS, { order: item.order });
+                // }), 'id');
+                const stageIdList = _.map(stageList, 'id');
+                console.log(stageIdList);
                 curYearStageData = await ctx.service.stageBills.getStagesData(tender.id, stageIdList.join(','));
             }
             return { slmList, nextSlmList, endSlmList, yearSlmList, curYearStageData, scheduleMonth, stageOrderList, scheduleStage, curScheduleStage };

+ 4 - 3
app/public/js/schedule_stage_tp.js

@@ -124,7 +124,6 @@ $(function () {
             const newLedgerList = setMonthToLedger(data.ledgerData, slmList, nextSlmList, endSlmList, yearSlmList, curYearStageData);
             baseLedgerTree.loadDatas(newLedgerList);
             treeCalc.calculateAll(baseLedgerTree);
-            console.log(baseLedgerTree);
             for (const d of baseLedgerTree.nodes) {
                 if (!d.b_code) {
                     const one = _.find(selectedLedgerList, function (item) {
@@ -269,8 +268,10 @@ function setMonthToLedger(ledgerList, slm, nextSlm, endSlm, yearSlm, yearLedgerD
     }
     if (yearLedgerData.length > 0) {
         for (const yl of yearLedgerData) {
-            const index = _.findIndex(ledgerList, {'id': yl.lid});
-            if (index && index !== -1) {
+            const index = _.findIndex(ledgerList, function (item) {
+                return item.id === yl.lid;
+            });
+            if (index !== undefined && index !== -1) {
                 ledgerList[index].year_contract_qty = ZhCalc.add(yl.contract_qty, yl.qc_qty);
                 ledgerList[index].year_gather_tp = ZhCalc.add(yl.contract_tp, yl.qc_tp);
             }