Explorar el Código

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

余思翰 hace 3 meses
padre
commit
f7e1c62f82
Se han modificado 1 ficheros con 33 adiciones y 4 borrados
  1. 33
    4
      oa-ui/src/views/statistics/components/contractStatistics.vue

+ 33
- 4
oa-ui/src/views/statistics/components/contractStatistics.vue Ver fichero

90
     },
90
     },
91
     contractAmount() {
91
     contractAmount() {
92
       this.initAmountBar();
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
     subYearNum() {
104
     subYearNum() {
95
       this.initChartSubYear();
105
       this.initChartSubYear();
100
   },
110
   },
101
   mounted() {
111
   mounted() {
102
     this.initDatas();
112
     this.initDatas();
103
-    // this.initAmountBar();
104
     this.initChartCwAomunt("");
113
     this.initChartCwAomunt("");
105
     this.initChartCwSource("");
114
     this.initChartCwSource("");
106
   },
115
   },
119
           (accumulator, currentValue) => accumulator + currentValue,
128
           (accumulator, currentValue) => accumulator + currentValue,
120
           0
129
           0
121
         );
130
         );
122
-        this.sumAomunt = (sum / 100000000).toFixed(4) + "亿元";
131
+        this.sumAomunt = (sum / 100000000).toFixed(2) + "亿元";
123
       }
132
       }
124
       this.subLoading = true;
133
       this.subLoading = true;
125
       let subDatas = await getSubContractStatistic();
134
       let subDatas = await getSubContractStatistic();
134
         (accumulator, currentValue) => accumulator + currentValue,
143
         (accumulator, currentValue) => accumulator + currentValue,
135
         0
144
         0
136
       );
145
       );
137
-      this.sumSubAomunt = (sum / 100000000).toFixed(4) + "亿元";
146
+      this.sumSubAomunt = (sum / 100000000).toFixed(2) + "亿元";
138
       this.initAmountBar();
147
       this.initAmountBar();
139
       this.initChartSubYear();
148
       this.initChartSubYear();
140
       this.initChartSubCwAomunt("");
149
       this.initChartSubCwAomunt("");
145
     async queryList() {
154
     async queryList() {
146
       let res1 = await getContractStatistic(this.addDateRange({}, this.dateRange));
155
       let res1 = await getContractStatistic(this.addDateRange({}, this.dateRange));
147
       let res2 = await getSubContractStatistic(this.addDateRange({}, this.dateRange));
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
       if (this.dateRange) {
161
       if (this.dateRange) {
149
         this.contractYear = res1.data.monthCount[0];
162
         this.contractYear = res1.data.monthCount[0];
150
         this.contractAmount = res1.data.monthAmount[0];
163
         this.contractAmount = res1.data.monthAmount[0];
168
         this.subPaidYear = res2.data.paidYearCount[0];
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
     clickYear() {
200
     clickYear() {
172
       let that = this;
201
       let that = this;
173
       this.mainChart.on("click", async function (event) {
202
       this.mainChart.on("click", async function (event) {
518
                   return params.name + "\n" + v + "元";
547
                   return params.name + "\n" + v + "元";
519
                 } else {
548
                 } else {
520
                   // 千万元
549
                   // 千万元
521
-                  let v = (value / 10000000).toFixed(4) + "千万";
550
+                  let v = (value / 10000000).toFixed(4) + "千万";
522
                   return params.name + "\n" + v + "元";
551
                   return params.name + "\n" + v + "元";
523
                 }
552
                 }
524
               },
553
               },

Loading…
Cancelar
Guardar