Explorar o código

进度 汇总和编辑汇总

laiguoran %!s(int64=4) %!d(string=hai) anos
pai
achega
64785e9870
Modificáronse 2 ficheiros con 52 adicións e 10 borrados
  1. 15 1
      app/public/js/schedule_plan.js
  2. 37 9
      app/public/js/schedule_stage_gcl.js

+ 15 - 1
app/public/js/schedule_plan.js

@@ -26,7 +26,7 @@ $(function () {
         // markFoldKey: 'bills-fold',
         // markFoldSubKey: window.location.pathname.split('/')[2],
     };
-    const ledgerTree = createNewPathTree('filter', treeSetting);
+
 
     const static_cols = [
         {title: '编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 145, formatter: '@', readOnly: true, cellType: 'tree'},
@@ -51,6 +51,7 @@ $(function () {
         }
     };
     const monthsCols = [];
+    const calcCols = [];
     if(scheduleMonth.length > 0) {
         for (const sm of scheduleMonth) {
             const readOnly = sm.stage_used !== 0;
@@ -59,8 +60,12 @@ $(function () {
             const cols2 = {title: '|计划金额(万元)', colSpan: '|1', rowSpan: '|1', field: sm.yearmonth+'_tp', hAlign: 2, width: 90, type: 'Number', readOnly: readOnly ? readOnly : 'readOnly.tp'};
             monthsCols.push(cols);
             monthsCols.push(cols2);
+            calcCols.push(sm.yearmonth+'_gcl');
+            calcCols.push(sm.yearmonth+'_tp');
         }
     }
+    treeSetting.calcFields = calcCols;
+    const ledgerTree = createNewPathTree('filter', treeSetting);
     const spreadHeaderCols = static_cols.concat(monthsCols);
     ledgerSpreadSetting.cols = spreadHeaderCols;
 
@@ -135,6 +140,7 @@ $(function () {
         }
         console.log(ledgerTree);
         ledgerTree.sortTreeNode(true);
+        treeCalc.calculateAll(ledgerTree);
         // console.log(ledgerTree);
         SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), SpreadJsObj.DataType.Tree, ledgerTree);
     }, null, true);
@@ -242,9 +248,13 @@ $(function () {
                     } else {
                         select[yearmonth + '_tp'] = plan_tp;
                     }
+                    const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
+                    SpreadJsObj.reLoadNodesData(info.sheet, nodes);
                     SpreadJsObj.reLoadRowData(info.sheet, info.row);
                 },function () {
                     select[col.field] = orgValue;
+                    const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
+                    SpreadJsObj.reLoadNodesData(info.sheet, nodes);
                     SpreadJsObj.reLoadRowData(info.sheet, info.row);
                 })
             }
@@ -314,9 +324,13 @@ $(function () {
                 } else {
                     select[yearmonth + '_tp'] = plan_tp;
                 }
+                const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
+                SpreadJsObj.reLoadNodesData(info.sheet, nodes);
                 SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
             },function () {
                 select[col.field] = orgValue;
+                const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
+                SpreadJsObj.reLoadNodesData(info.sheet, nodes);
                 SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
             })
         },

+ 37 - 9
app/public/js/schedule_stage_gcl.js

@@ -26,7 +26,7 @@ $(function () {
         // markFoldKey: 'bills-fold',
         // markFoldSubKey: window.location.pathname.split('/')[2],
     };
-    const ledgerTree = createNewPathTree('filter', treeSetting);
+
 
     const static_cols = [
         {title: '编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 145, formatter: '@', readOnly: true, cellType: 'tree'},
@@ -51,6 +51,7 @@ $(function () {
         }
     };
     const monthsCols = [];
+    const calcCols = [];
     if(scheduleMonth.length > 0) {
         for (const sm of scheduleMonth) {
             if (sm.stage_gcl_used === 1) {
@@ -63,9 +64,15 @@ $(function () {
                 monthsCols.push(cols2);
                 monthsCols.push(cols3);
                 monthsCols.push(cols4);
+                calcCols.push(sm.yearmonth + '_plan_gcl');
+                calcCols.push(sm.yearmonth + '_plan_tp');
+                calcCols.push(sm.yearmonth + '_sj_gcl');
+                calcCols.push(sm.yearmonth + '_sj_tp');
             }
         }
     }
+    treeSetting.calcFields = calcCols;
+    const ledgerTree = createNewPathTree('filter', treeSetting);
     const spreadHeaderCols = static_cols.concat(monthsCols);
     ledgerSpreadSetting.cols = spreadHeaderCols;
 
@@ -133,6 +140,7 @@ $(function () {
         }
         console.log(ledgerTree);
         ledgerTree.sortTreeNode(true);
+        treeCalc.calculateAll(ledgerTree);
         // console.log(ledgerTree);
         SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), SpreadJsObj.DataType.Tree, ledgerTree);
     }, null, true);
@@ -222,9 +230,13 @@ $(function () {
                 console.log(updateData);
                 postData(window.location.pathname + '/save', {type: 'ledger_edit', postData: updateData}, function (result) {
                     select[yearmonth + '_sj_tp'] = sj_tp;
+                    const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
+                    SpreadJsObj.reLoadNodesData(info.sheet, nodes);
                     SpreadJsObj.reLoadRowData(info.sheet, info.row);
                 },function () {
                     select[col.field] = orgValue;
+                    const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
+                    SpreadJsObj.reLoadNodesData(info.sheet, nodes);
                     SpreadJsObj.reLoadRowData(info.sheet, info.row);
                 })
             }
@@ -277,9 +289,13 @@ $(function () {
             console.log(updateData);
             postData(window.location.pathname + '/save', {type: 'ledger_edit', postData: updateData}, function (result) {
                 select[yearmonth + '_sj_tp'] = sj_tp;
+                const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
+                SpreadJsObj.reLoadNodesData(info.sheet, nodes);
                 SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
             },function () {
                 select[col.field] = orgValue;
+                const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
+                SpreadJsObj.reLoadNodesData(info.sheet, nodes);
                 SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
             })
         },
@@ -412,24 +428,36 @@ $(function () {
                     SpreadJsObj.loadSheetData(huizongSpread.getActiveSheet(), SpreadJsObj.DataType.Tree, huizongTree);
                 }, null, true);
             }, null, true);
+        },
+        dropDownHtml: function (order) {
+            let html = '';
+            for (const ss of scheduleStage) {
+                if (ss.order !== order) {
+                    html += '<a class="dropdown-item change-tp" data-order="'+ ss.order +'" href="javascript:void(0);">'+ ss.yearmonth.split('-')[0] + '年' + parseInt(ss.yearmonth.split('-')[1]) +'月(第'+ ss.order +'期)</a>';
+                } else {
+                    $('#dropdownMenuButton').text(ss.yearmonth.split('-')[0] + '年' + parseInt(ss.yearmonth.split('-')[1]) +'月(第'+ ss.order +'期)');
+                }
+            }
+            $('.dropdown-menu').html(html);
         }
     };
 
     if (curScheduleStage && curScheduleStage.order) {
-        huizongObj.setSjs(curScheduleStage.order);
+        let order = parseInt(localStorage.getItem('tender_' + getTenderId() + '_schedule_tp_sjs') ? localStorage.getItem('tender_' + getTenderId() + '_schedule_tp_sjs') : curScheduleStage.order);
+        const ssinfo = _.find(scheduleStage, { order });
+        if (!ssinfo) {
+            order = curScheduleStage.order;
+        }
+        huizongObj.dropDownHtml(order);
+        huizongObj.setSjs(order);
     }
 
     // 汇总切换
     $('body').on('click', '.change-tp', function () {
         const order = parseInt($(this).data('order'));
-        $('#dropdownMenuButton').text($(this).text());
-        let html = '';
-        for (const ss of scheduleStage) {
-            if (ss.order !== order)
-            html += '<a class="dropdown-item change-tp" data-order="'+ ss.order +'" href="javascript:void(0);">'+ ss.yearmonth.split('-')[0] + '年' + parseInt(ss.yearmonth.split('-')[1]) +'月(第'+ ss.order +'期)</a>';
-        }
-        $('.dropdown-menu').html(html);
+        huizongObj.dropDownHtml(order);
         huizongObj.setSjs(order);
+        localStorage.setItem('tender_' + getTenderId() + '_schedule_tp_sjs', order);
     });
 
     // 月份添加