Преглед изворни кода

造价对比列显示调整

MaiXinRong пре 1 месец
родитељ
комит
813239d29a
2 измењених фајлова са 15 додато и 12 уклоњено
  1. 2 0
      app/lib/rpt_data_analysis.js
  2. 13 12
      app/public/js/budget_compare.js

+ 2 - 0
app/lib/rpt_data_analysis.js

@@ -1066,6 +1066,7 @@ const auditSelect = {
             const tPrefix = 'as' + i + '_';
             fields.push({ source: sPrefix + 'contract_qty', target: tPrefix + 'contract_qty' });
             fields.push({ source: sPrefix + 'contract_tp', target: tPrefix + 'contract_tp' });
+            fields.push({ source: sPrefix + 'contract_expr', target: tPrefix + 'contract_expr' });
             fields.push({ source: sPrefix + 'qc_qty', target: tPrefix + 'qc_qty' });
             fields.push({ source: sPrefix + 'qc_tp', target: tPrefix + 'qc_tp' });
             fields.push({ source: sPrefix + 'gather_qty', target: tPrefix + 'gather_qty' });
@@ -1083,6 +1084,7 @@ const auditSelect = {
             const sPrefix = 'r' + o + '_';
             const tPrefix = 'as' + i + '_';
             fields.push({ source: sPrefix + 'contract_qty', target: tPrefix + 'contract_qty' });
+            fields.push({ source: sPrefix + 'contract_expr', target: tPrefix + 'contract_expr' });
             fields.push({ source: sPrefix + 'qc_qty', target: tPrefix + 'qc_qty' });
             fields.push({ source: sPrefix + 'gather_qty', target: tPrefix + 'gather_qty' });
         }

+ 13 - 12
app/public/js/budget_compare.js

@@ -32,7 +32,7 @@ function customizeTreeSetting(setting, customDisplay) {
     for (const cd of customDisplay) {
         for (const c of setting.cols) {
             if (cd.fields.indexOf(c.field) !== -1) {
-                c.visible = c.defaultVisible === undefined ? cd.visible : c.defaultVisible && cd.visible;
+                c.defaultVisible = cd.visible;
             }
         }
     }
@@ -80,7 +80,7 @@ $(document).ready(() => {
             {title: '预估决算|数量1/数量2', colSpan: '3|1', rowSpan: '1|1', field: 'final_dgn_qty', hAlign: 2, width: 80, bc_type: 'number', visible: false},
             {title: '|经济指标', colSpan: '|1', rowSpan: '|1', field: 'final_dgn_price', hAlign: 2, width: 80, type: 'Number', bc_type: 'number', visible: false},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'final_tp', hAlign: 2, width: 80, type: 'Number', bc_type: 'number', visible: false},
-            {title: '数据对比', colSpan: '1', rowSpan: '2', field: 'stackedBar', hAlign: 0, width: 300, cellType: 'stackedBar', stackedBarCover: false, bc_type: 'grid', visible: false, getTip: getStackedBarTip},
+            {title: '数据对比', colSpan: '1', rowSpan: '2', field: 'stackedBar', hAlign: 0, width: 300, cellType: 'stackedBar', stackedBarCover: false, bc_type: 'grid', defaultVisible: true, visible: false, getTip: getStackedBarTip},
             {title: '增幅%|数量1/数量2', colSpan: '2|1', rowSpan: '1|1', field: 'compare_dgn_qty', hAlign: 2, width: 80},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'compare_tp', hAlign: 2, width: 80, type: 'Number'},
         ],
@@ -133,11 +133,7 @@ $(document).ready(() => {
             }
         },
         initShowType() {
-            const type = this.compareType;
-            spreadSetting.cols.forEach(x => {
-                if (!x.bc_type) return;
-                x.visible = x.bc_type === type;
-            });
+            this.reCalcColVisible();
             const colIndex = spreadSetting.cols.findIndex(x => { return x.field === 'stackedBar'});
             spreadSetting.cols[colIndex].stackedBarCover = parseInt(this.stackedBarCover);
         },
@@ -318,6 +314,13 @@ $(document).ready(() => {
             const colIndex = spreadSetting.cols.findIndex(x => { return x.field === 'stackedBar'});
             SpreadJsObj.reloadColData(compareSheet, colIndex);
         },
+        reCalcColVisible() {
+            const type = this.compareType;
+            spreadSetting.cols.forEach(x => {
+                if (!x.bc_type) return;
+                x.visible = x.bc_type === type && x.defaultVisible;
+            });
+        },
         setCompareType(type) {
             this.compareType = type || 'number';
             $('[name=showType]').removeClass('active');
@@ -329,10 +332,7 @@ $(document).ready(() => {
                 $('.ml-grid').hide();
                 $('.ml-number').show();
             }
-            spreadSetting.cols.forEach(x => {
-                if (!x.bc_type) return;
-                x.visible = x.bc_type === type;
-            });
+            this.reCalcColVisible();
             setLocalCache(compareTypeKey, this.compareType);
         },
         setStackedBarCover(cover){
@@ -343,9 +343,9 @@ $(document).ready(() => {
             setLocalCache(stackedBarCoverKey, this.stackedBarCover);
         }
     };
+    customizeTreeSetting(spreadSetting, customColDisplay());
     compareObj.loadCacheData();
     compareObj.initCompare();
-    customizeTreeSetting(spreadSetting, customColDisplay());
     SpreadJsObj.initSheet(compareSheet, spreadSetting);
 
     function compareCode(str1, str2, symbol = '-') {
@@ -564,6 +564,7 @@ $(document).ready(() => {
             cd.visible = check;
         }
         customizeTreeSetting(spreadSetting, customDisplay);
+        compareObj.loadCacheData();
         SpreadJsObj.refreshColumnVisible(compareSheet);
         Cookies.set(ckColSetting, JSON.stringify(customDisplay), 30*24*60*60*1000);
         $('#row-view').modal('hide');