Browse Source

修改整体统计中,合同统计合同总额变化

余思翰 3 months ago
parent
commit
f7e1c62f82
1 changed files with 33 additions and 4 deletions
  1. 33
    4
      oa-ui/src/views/statistics/components/contractStatistics.vue

+ 33
- 4
oa-ui/src/views/statistics/components/contractStatistics.vue View File

@@ -90,6 +90,16 @@ export default {
90 90
     },
91 91
     contractAmount() {
92 92
       this.initAmountBar();
93
+      let sum = Object.values(this.contractAmount).reduce(
94
+        (accumulator, currentValue) => accumulator + currentValue,
95
+        0
96
+      );
97
+      let subsum = Object.values(this.subAmount).reduce(
98
+        (accumulator, currentValue) => accumulator + currentValue,
99
+        0
100
+      );
101
+      this.sumAomunt = this.getTitleAmount(sum);
102
+      this.sumSubAomunt = this.getTitleAmount(subsum);
93 103
     },
94 104
     subYearNum() {
95 105
       this.initChartSubYear();
@@ -100,7 +110,6 @@ export default {
100 110
   },
101 111
   mounted() {
102 112
     this.initDatas();
103
-    // this.initAmountBar();
104 113
     this.initChartCwAomunt("");
105 114
     this.initChartCwSource("");
106 115
   },
@@ -119,7 +128,7 @@ export default {
119 128
           (accumulator, currentValue) => accumulator + currentValue,
120 129
           0
121 130
         );
122
-        this.sumAomunt = (sum / 100000000).toFixed(4) + "亿元";
131
+        this.sumAomunt = (sum / 100000000).toFixed(2) + "亿元";
123 132
       }
124 133
       this.subLoading = true;
125 134
       let subDatas = await getSubContractStatistic();
@@ -134,7 +143,7 @@ export default {
134 143
         (accumulator, currentValue) => accumulator + currentValue,
135 144
         0
136 145
       );
137
-      this.sumSubAomunt = (sum / 100000000).toFixed(4) + "亿元";
146
+      this.sumSubAomunt = (sum / 100000000).toFixed(2) + "亿元";
138 147
       this.initAmountBar();
139 148
       this.initChartSubYear();
140 149
       this.initChartSubCwAomunt("");
@@ -145,6 +154,10 @@ export default {
145 154
     async queryList() {
146 155
       let res1 = await getContractStatistic(this.addDateRange({}, this.dateRange));
147 156
       let res2 = await getSubContractStatistic(this.addDateRange({}, this.dateRange));
157
+      this.contractCwAmount = res1.data.sourceAmount[0];
158
+      this.contractSource = res1.data.sourceCount[0];
159
+      this.subCwAmount = res2.data.sourceAmount[0];
160
+      this.subSource = res2.data.sourceCount[0];
148 161
       if (this.dateRange) {
149 162
         this.contractYear = res1.data.monthCount[0];
150 163
         this.contractAmount = res1.data.monthAmount[0];
@@ -168,6 +181,22 @@ export default {
168 181
         this.subPaidYear = res2.data.paidYearCount[0];
169 182
       }
170 183
     },
184
+    getTitleAmount(sum) {
185
+      const units = [
186
+        { value: 1e8, unit: '亿' },
187
+        { value: 1e7, unit: '千万' },
188
+        { value: 1e6, unit: '百万' },
189
+        { value: 1e4, unit: '万' }
190
+      ];
191
+      let amount;
192
+      for (const unit of units) {
193
+        if (sum >= unit.value) {
194
+          amount = (sum / unit.value).toFixed(2) + unit.unit;
195
+          return amount
196
+        }
197
+      }
198
+      return amount = (sum / 1e4).toFixed(2) + '万';
199
+    },
171 200
     clickYear() {
172 201
       let that = this;
173 202
       this.mainChart.on("click", async function (event) {
@@ -518,7 +547,7 @@ export default {
518 547
                   return params.name + "\n" + v + "元";
519 548
                 } else {
520 549
                   // 千万元
521
-                  let v = (value / 10000000).toFixed(4) + "千万";
550
+                  let v = (value / 10000000).toFixed(4) + "千万";
522 551
                   return params.name + "\n" + v + "元";
523 552
                 }
524 553
               },

Loading…
Cancel
Save