Browse Source

决策大屏调整

ellisran 11 months ago
parent
commit
6aa0016aa5

+ 4 - 4
app/controller/datacollect_controller.js

@@ -167,15 +167,15 @@ module.exports = app => {
                         const monthOneStage = ctx.app._.find(month_stage, { yearmonth: s.s_time });
                         if (monthOneStage) {
                             monthOneStage.tp = ctx.helper.add(monthOneStage.tp, s.tp);
-                            monthOneStage.end_yf_tp = ctx.helper.add(monthOneStage.end_yf_tp, s.end_yf_tp);
-                            monthOneStage.end_sf_tp = ctx.helper.add(monthOneStage.end_sf_tp, s.end_sf_tp);
+                            monthOneStage.end_yf_tp = ctx.helper.add(monthOneStage.end_yf_tp, s.yf_tp);
+                            monthOneStage.end_sf_tp = ctx.helper.add(monthOneStage.end_sf_tp, s.sf_tp);
                         } else {
                             const data = {
                                 yearmonth: s.s_time,
                                 tp: s.tp,
                                 end_tp: s.end_tp,
-                                end_yf_tp: s.end_yf_tp,
-                                end_sf_tp: s.end_sf_tp,
+                                end_yf_tp: s.yf_tp,
+                                end_sf_tp: s.sf_tp,
                             };
                             month_stage.push(data);
                         }

+ 2 - 2
app/service/stage.js

@@ -946,8 +946,8 @@ module.exports = app => {
                 s.tp = this.ctx.helper.sum([s.contract_tp, s.qc_tp, s.pc_tp]);
                 s.pre_tp = this.ctx.helper.add(s.pre_contract_tp, s.pre_qc_tp);
                 s.end_tp = this.ctx.helper.add(s.pre_tp, s.tp);
-                s.end_yf_tp = this.ctx.helper.add(s.pre_yf_tp, s.yf_tp);
-                s.end_sf_tp = this.ctx.helper.add(s.pre_sf_tp, s.sf_tp);
+                // s.yf_tp = this.ctx.helper.add(s.pre_yf_tp, s.yf_tp);
+                // s.sf_tp = this.ctx.helper.add(s.pre_sf_tp, s.sf_tp);
             }
             return stages;
         }

+ 60 - 6
app/view/datacollect/index4GY18Y.ejs

@@ -1018,11 +1018,11 @@
 
             // 中间表格数值
             gcsr_price = sr_chart_option_data.end_yf_tp;
-            $('.gcsr_price').text(gcsr_price);
+            $('.gcsr_price').text(formatNum(gcsr_price, '#,##0.######'));
             gccb_price = cb_chart_option_data.end_yf_tp;
-            $('.gccb_price').text(gccb_price);
+            $('.gccb_price').text(formatNum(gccb_price, '#,##0.######'));
             gclr_price = ZhCalc.sub(gcsr_price, gccb_price);
-            $('.gclr_price').text(gclr_price);
+            $('.gclr_price').text(formatNum(gclr_price, '#,##0.######'));
             gclrl_num = ZhCalc.round(ZhCalc.div(gclr_price, gccb_price)*100, 2);
             $('.gclrl_num').text((gclrl_num ? gclrl_num : 0) + '%');
 
@@ -1102,7 +1102,6 @@
                     show_yisf_option_data.yf_tp.push(c4.yf_tp);
                 }
             }
-            console.log(yingsf_option_data, yisf_option_data);
             const yisf_option = yisfChart.getOption();
             yisf_option.dataZoom[0].start = 0;
             yisf_option.dataZoom[0].end = computedPosition(show_yisf_option_data.yearmonth.length);
@@ -1171,10 +1170,10 @@
                 allgccb.end_gather_tp = ZhCalc.add(allgccb.end_gather_tp, cb.end_gather_tp);
                 allgccb.end_sf_tp = ZhCalc.add(allgccb.end_sf_tp, cb.end_sf_tp);
                 allgccb.end_yf_tp = ZhCalc.add(allgccb.end_yf_tp, cb.end_yf_tp);
-                hzHtml += '<tr class="bg-dark" style="line-height: 2rem;text-align: center;"><td style="text-align: left">' + cb.name + '</td><td>' + cb.end_gather_tp + '</td><td>' + cb.end_sf_tp + '</td><td>' + cb.end_yf_tp + '</td><td>' + cb.end_df_tp + '</td></tr>';
+                hzHtml += '<tr class="bg-dark" style="line-height: 2rem;text-align: center;"><td style="text-align: left">' + cb.name + '</td><td>' + cb.end_gather_tp + '</td><td>' + cb.end_yf_tp + '</td><td>' + cb.end_sf_tp + '</td><td>' + cb.end_df_tp + '</td></tr>';
             }
             allgccb.end_df_tp = ZhCalc.sub(allgccb.end_yf_tp, allgccb.end_sf_tp);
-            hzHtml += '<tr class="bg-dark" style="line-height: 2rem;text-align: center;"><td style="text-align: left">' + allgccb.name + '</td><td>' + allgccb.end_gather_tp + '</td><td>' + allgccb.end_sf_tp + '</td><td>' + allgccb.end_yf_tp + '</td><td>' + allgccb.end_df_tp + '</td></tr>';
+            hzHtml += '<tr class="bg-dark" style="line-height: 2rem;text-align: center;"><td style="text-align: left">' + allgccb.name + '</td><td>' + allgccb.end_gather_tp + '</td><td>' + allgccb.end_yf_tp + '</td><td>' + allgccb.end_sf_tp + '</td><td>' + allgccb.end_df_tp + '</td></tr>';
             $('.stage-data').html(hzHtml);
             setTableboxHeight();
             // console.log(sr_tenders, cb_tenders);
@@ -1275,4 +1274,59 @@
             return 100;
         }
     }
+
+    function formatNum(num, pattern) {
+        const minus = num > 0 ? '' : '-'
+        const strarr = num ? Math.abs(num).toString().split('.') : ['0'];
+        const fmtarr = pattern ? pattern.split('.') : [''];
+        let retstr = '';
+
+        // 整数部分
+        let str = strarr[0];
+        let fmt = fmtarr[0];
+        let i = str.length - 1;
+        let comma = false;
+        for (var f = fmt.length - 1; f >= 0; f--) {
+            switch (fmt.substr(f, 1)) {
+                case '#':
+                    if (i >= 0) retstr = str.substr(i--, 1) + retstr;
+                    break;
+                case '0':
+                    if (i >= 0) retstr = str.substr(i--, 1) + retstr;
+                    else retstr = '0' + retstr;
+                    break;
+                case ',':
+                    comma = true;
+                    retstr = ',' + retstr;
+                    break;
+            }
+        }
+        if (i >= 0) {
+            if (comma) {
+                const l = str.length;
+                for (;i >= 0; i--) {
+                    retstr = str.substr(i, 1) + retstr;
+                    if (i > 0 && ((l - i) % 3) == 0) retstr = ',' + retstr;
+                }
+            } else retstr = str.substr(0, i + 1) + retstr;
+        }
+
+        retstr = retstr + '.';
+        // 处理小数部分
+        str = strarr.length > 1 ? strarr[1] : '';
+        fmt = fmtarr.length > 1 ? fmtarr[1] : '';
+        i = 0;
+        for (var f = 0; f < fmt.length; f++) {
+            switch (fmt.substr(f, 1)) {
+                case '#':
+                    if (i < str.length) retstr += str.substr(i++, 1);
+                    break;
+                case '0':
+                    if (i < str.length) retstr += str.substr(i++, 1);
+                    else retstr += '0';
+                    break;
+            }
+        }
+        return minus + retstr.replace(/^,+/, '').replace(/\.$/, '');
+    }
 </script>