|
|
@@ -6,10 +6,14 @@
|
|
6
|
6
|
<div class="data-left">
|
|
7
|
7
|
<div class="data-title">{{ thisYear }}年项目总数</div>
|
|
8
|
8
|
<div class="number">{{ projectNum.toLocaleString('en-US') }}</div>
|
|
9
|
|
- <div>
|
|
10
|
|
- <span class="text-1">较去年</span>
|
|
|
9
|
+ <div class="compare-row">
|
|
|
10
|
+ <span class="text-1">同比</span>
|
|
11
|
11
|
<span class="text-2" :class="{ upColor: isProjectUp, dowColor: !isProjectUp }">{{ subYear }}</span>
|
|
12
|
12
|
<img :src="isProjectUp ? upImg : downImg" alt="">
|
|
|
13
|
+ <span class="text-1 compare-gap">环比</span>
|
|
|
14
|
+ <span class="text-2" :class="{ upColor: isProjectMonthUp, dowColor: !isProjectMonthUp }">{{ subMonth
|
|
|
15
|
+ }}</span>
|
|
|
16
|
+ <img :src="isProjectMonthUp ? upImg : downImg" alt="">
|
|
13
|
17
|
</div>
|
|
14
|
18
|
</div>
|
|
15
|
19
|
<div class="chart-box">
|
|
|
@@ -20,11 +24,15 @@
|
|
20
|
24
|
<div class="data-left">
|
|
21
|
25
|
<div class="data-title">{{ thisYear }}年承接合同数</div>
|
|
22
|
26
|
<div class="number">{{ contractNum.toLocaleString('en-US') }}</div>
|
|
23
|
|
- <div>
|
|
24
|
|
- <span class="text-1">较去年</span>
|
|
|
27
|
+ <div class="compare-row">
|
|
|
28
|
+ <span class="text-1">同比</span>
|
|
25
|
29
|
<span class="text-2" :class="{ upColor: isContractUp, dowColor: !isContractUp }">{{ contractSubYear
|
|
26
|
30
|
}}</span>
|
|
27
|
31
|
<img :src="isContractUp ? upImg : downImg" alt="">
|
|
|
32
|
+ <span class="text-1 compare-gap">环比</span>
|
|
|
33
|
+ <span class="text-2" :class="{ upColor: isContractMonthUp, dowColor: !isContractMonthUp }">{{
|
|
|
34
|
+ contractSubMonth }}</span>
|
|
|
35
|
+ <img :src="isContractMonthUp ? upImg : downImg" alt="">
|
|
28
|
36
|
</div>
|
|
29
|
37
|
</div>
|
|
30
|
38
|
<div class="chart-box">
|
|
|
@@ -35,10 +43,13 @@
|
|
35
|
43
|
<div class="data-left">
|
|
36
|
44
|
<div class="data-title">{{ thisYear }}借款次数</div>
|
|
37
|
45
|
<div class="number">{{ borrowNum.toLocaleString('en-US') }}</div>
|
|
38
|
|
- <div>
|
|
39
|
|
- <span class="text-1">较去年</span>
|
|
|
46
|
+ <div class="compare-row">
|
|
|
47
|
+ <span class="text-1">同比</span>
|
|
40
|
48
|
<span class="text-2" :class="{ upColor: isBorrowUp, dowColor: !isBorrowUp }">{{ borrowSubYear }}</span>
|
|
41
|
49
|
<img :src="isBorrowUp ? upImg : downImg" alt="">
|
|
|
50
|
+ <span class="text-1 compare-gap">环比</span>
|
|
|
51
|
+ <span class="text-2" :class="{ upColor: isBorrowMonthUp, dowColor: !isBorrowMonthUp }">{{ borrowSubMonth }}</span>
|
|
|
52
|
+ <img :src="isBorrowMonthUp ? upImg : downImg" alt="">
|
|
42
|
53
|
</div>
|
|
43
|
54
|
</div>
|
|
44
|
55
|
<div class="chart-box">
|
|
|
@@ -46,7 +57,7 @@
|
|
46
|
57
|
</div>
|
|
47
|
58
|
</div>
|
|
48
|
59
|
|
|
49
|
|
- <div class="five item-box" @click="$emit('handleClick', 'settle')">
|
|
|
60
|
+ <!-- <div class="five item-box" @click="$emit('handleClick', 'settle')">
|
|
50
|
61
|
<div class="data-left">
|
|
51
|
62
|
<div class="data-title">{{ thisYear }}结算次数</div>
|
|
52
|
63
|
<div class="number">{{ settleNum.toLocaleString('en-US') }}</div>
|
|
|
@@ -59,15 +70,18 @@
|
|
59
|
70
|
<div class="chart-box">
|
|
60
|
71
|
<div id="thisSettle"></div>
|
|
61
|
72
|
</div>
|
|
62
|
|
- </div>
|
|
|
73
|
+ </div> -->
|
|
63
|
74
|
<div class="three item-box" @click="$emit('handleClick', 'device')">
|
|
64
|
75
|
<div class="data-left">
|
|
65
|
76
|
<div class="data-title">{{ thisYear }}年设备申领</div>
|
|
66
|
77
|
<div class="number">{{ deviceNum.toLocaleString('en-US') }}</div>
|
|
67
|
|
- <div>
|
|
68
|
|
- <span class="text-1">较去年</span>
|
|
|
78
|
+ <div class="compare-row">
|
|
|
79
|
+ <span class="text-1">同比</span>
|
|
69
|
80
|
<span class="text-2" :class="{ upColor: isDeviceUp, dowColor: !isDeviceUp }">{{ deviceSubYear }}</span>
|
|
70
|
81
|
<img :src="isDeviceUp ? upImg : downImg" alt="">
|
|
|
82
|
+ <span class="text-1 compare-gap">环比</span>
|
|
|
83
|
+ <span class="text-2" :class="{ upColor: isDeviceMonthUp, dowColor: !isDeviceMonthUp }">{{ deviceSubMonth }}</span>
|
|
|
84
|
+ <img :src="isDeviceMonthUp ? upImg : downImg" alt="">
|
|
71
|
85
|
</div>
|
|
72
|
86
|
</div>
|
|
73
|
87
|
<div class="chart-box">
|
|
|
@@ -83,6 +97,11 @@ import upSrc from '@/assets/icons/up.png'
|
|
83
|
97
|
import downSrc from '@/assets/icons/down.png'
|
|
84
|
98
|
import * as echarts from 'echarts'
|
|
85
|
99
|
import { echartsInit } from '@/utils/echarts'
|
|
|
100
|
+import { listProject } from '@/api/oa/project/project'
|
|
|
101
|
+import { listContract } from '@/api/oa/contract/contract'
|
|
|
102
|
+import { listBorrow } from '@/api/oa/borrow/borrow'
|
|
|
103
|
+import { listDeviceApproval } from '@/api/oa/device/deviceApproval'
|
|
|
104
|
+
|
|
86
|
105
|
let thisYearChart, contractYearChart, deviceYearChart, borrowYearChart, settleYearChart
|
|
87
|
106
|
export default {
|
|
88
|
107
|
props: {
|
|
|
@@ -117,9 +136,13 @@ export default {
|
|
117
|
136
|
upImg: upSrc,
|
|
118
|
137
|
downImg: downSrc,
|
|
119
|
138
|
isProjectUp: false,
|
|
|
139
|
+ isProjectMonthUp: false,
|
|
120
|
140
|
isContractUp: false,
|
|
|
141
|
+ isContractMonthUp: false,
|
|
121
|
142
|
isDeviceUp: false,
|
|
|
143
|
+ isDeviceMonthUp: false,
|
|
122
|
144
|
isBorrowUp: false,
|
|
|
145
|
+ isBorrowMonthUp: false,
|
|
123
|
146
|
isSettleUp: false,
|
|
124
|
147
|
thisYear: new Date().getFullYear(),
|
|
125
|
148
|
year: {},
|
|
|
@@ -142,27 +165,43 @@ export default {
|
|
142
|
165
|
settleTypeAmount: {},
|
|
143
|
166
|
settleYear: {},
|
|
144
|
167
|
subYear: 0,
|
|
|
168
|
+ subMonth: 0,
|
|
145
|
169
|
contractSubYear: 0,
|
|
|
170
|
+ contractSubMonth: 0,
|
|
146
|
171
|
deviceSubYear: 0,
|
|
|
172
|
+ deviceSubMonth: 0,
|
|
147
|
173
|
borrowSubYear: 0,
|
|
|
174
|
+ borrowSubMonth: 0,
|
|
148
|
175
|
settleSubYear: 0,
|
|
|
176
|
+ projectMonthLabels: [],
|
|
|
177
|
+ projectMonthThisYear: [],
|
|
|
178
|
+ projectMonthLastYear: [],
|
|
|
179
|
+ contractMonthLabels: [],
|
|
|
180
|
+ contractMonthThisYear: [],
|
|
|
181
|
+ contractMonthLastYear: [],
|
|
|
182
|
+ borrowMonthLabels: [],
|
|
|
183
|
+ borrowMonthThisYear: [],
|
|
|
184
|
+ borrowMonthLastYear: [],
|
|
|
185
|
+ deviceMonthLabels: [],
|
|
|
186
|
+ deviceMonthThisYear: [],
|
|
|
187
|
+ deviceMonthLastYear: [],
|
|
149
|
188
|
loading: true
|
|
150
|
189
|
}
|
|
151
|
190
|
},
|
|
152
|
191
|
watch: {
|
|
153
|
|
- year() {
|
|
|
192
|
+ projectMonthThisYear() {
|
|
154
|
193
|
this.initChartOne();
|
|
155
|
194
|
},
|
|
156
|
|
- contractYear() {
|
|
|
195
|
+ contractMonthThisYear() {
|
|
157
|
196
|
this.initChartTwo();
|
|
158
|
197
|
},
|
|
159
|
|
- deviceYear() {
|
|
160
|
|
- this.initChartThree();
|
|
161
|
|
- },
|
|
162
|
|
- borrowYear() {
|
|
|
198
|
+ borrowMonthThisYear() {
|
|
163
|
199
|
this.initChartFour();
|
|
164
|
200
|
},
|
|
165
|
|
- settleYear(){
|
|
|
201
|
+ deviceMonthThisYear() {
|
|
|
202
|
+ this.initChartThree();
|
|
|
203
|
+ },
|
|
|
204
|
+ settleYear() {
|
|
166
|
205
|
this.initChartFive();
|
|
167
|
206
|
},
|
|
168
|
207
|
pDatas: {
|
|
|
@@ -218,32 +257,34 @@ export default {
|
|
218
|
257
|
methods: {
|
|
219
|
258
|
async initDatas() {
|
|
220
|
259
|
this.loading = true
|
|
|
260
|
+ await Promise.all([
|
|
|
261
|
+ this.loadProjectStats(),
|
|
|
262
|
+ this.loadContractStats(),
|
|
|
263
|
+ this.loadBorrowStats(),
|
|
|
264
|
+ this.loadDeviceStats()
|
|
|
265
|
+ ])
|
|
221
|
266
|
if (Object.keys(this.pDatas).length !== 0) {
|
|
222
|
267
|
this.year = this.pDatas.year[0];
|
|
223
|
268
|
this.type = this.pDatas.type[0];
|
|
224
|
269
|
this.source = this.pDatas.source[0];
|
|
225
|
270
|
this.dept = this.pDatas.dept[0];
|
|
226
|
|
- this.getProjectYearSub(this.year);
|
|
227
|
271
|
}
|
|
228
|
272
|
if (Object.keys(this.cDatas).length !== 0) {
|
|
229
|
273
|
this.contractAmount = this.cDatas.yearAmount[0];
|
|
230
|
274
|
this.contractCwAmount = this.cDatas.sourceAmount[0];
|
|
231
|
275
|
this.contractSource = this.cDatas.sourceCount[0];
|
|
232
|
276
|
this.contractYear = this.cDatas.yearCount[0];
|
|
233
|
|
- this.getContractYearSub(this.contractYear);
|
|
234
|
277
|
}
|
|
235
|
278
|
if (Object.keys(this.dDatas).length !== 0) {
|
|
236
|
279
|
this.deviceApproval = this.dDatas.approval[0];
|
|
237
|
280
|
this.deviceStatus = this.dDatas.status[0];
|
|
238
|
281
|
this.deviceYear = this.dDatas.year[0];
|
|
239
|
|
- this.getDeviceYearSub(this.deviceYear);
|
|
240
|
282
|
}
|
|
241
|
283
|
if (Object.keys(this.bDatas).length !== 0) {
|
|
242
|
284
|
this.borrowAmount = this.bDatas.amount[0];
|
|
243
|
285
|
this.borrowUsage = this.bDatas.usage[0];
|
|
244
|
286
|
this.borrowUsageAmount = this.bDatas.usageAmount[0];
|
|
245
|
287
|
this.borrowYear = this.bDatas.year[0];
|
|
246
|
|
- this.getBorrowYearSub(this.borrowYear);
|
|
247
|
288
|
}
|
|
248
|
289
|
if (Object.keys(this.sDatas).length !== 0) {
|
|
249
|
290
|
this.settleAmount = this.sDatas.amount[0];
|
|
|
@@ -255,6 +296,227 @@ export default {
|
|
255
|
296
|
|
|
256
|
297
|
this.loading = false
|
|
257
|
298
|
},
|
|
|
299
|
+ getMonthRange(year, month, capToToday = false) {
|
|
|
300
|
+ const monthStr = String(month).padStart(2, '0')
|
|
|
301
|
+ const begin = `${year}-${monthStr}-01`
|
|
|
302
|
+ const lastDay = new Date(year, month, 0).getDate()
|
|
|
303
|
+ let end = `${year}-${monthStr}-${String(lastDay).padStart(2, '0')}`
|
|
|
304
|
+ if (capToToday) {
|
|
|
305
|
+ const now = new Date()
|
|
|
306
|
+ if (year === now.getFullYear() && month === now.getMonth() + 1) {
|
|
|
307
|
+ end = this.parseTime(now, '{y}-{m}-{d}')
|
|
|
308
|
+ }
|
|
|
309
|
+ }
|
|
|
310
|
+ return [begin, end]
|
|
|
311
|
+ },
|
|
|
312
|
+ async fetchProjectCount(begin, end) {
|
|
|
313
|
+ const res = await listProject(this.addDateRange({ pageNum: 1, pageSize: 1 }, [begin, end]))
|
|
|
314
|
+ return res.total || 0
|
|
|
315
|
+ },
|
|
|
316
|
+ async loadProjectStats() {
|
|
|
317
|
+ const now = new Date()
|
|
|
318
|
+ const year = now.getFullYear()
|
|
|
319
|
+ const today = this.parseTime(now, '{y}-{m}-{d}')
|
|
|
320
|
+ const thisYearBegin = `${year}-01-01`
|
|
|
321
|
+ const lastYearBegin = `${year - 1}-01-01`
|
|
|
322
|
+ const lastYearDate = new Date(now)
|
|
|
323
|
+ lastYearDate.setFullYear(year - 1)
|
|
|
324
|
+ const lastYearToday = this.parseTime(lastYearDate, '{y}-{m}-{d}')
|
|
|
325
|
+ const currentMonth = now.getMonth() + 1
|
|
|
326
|
+ const lastMonthDate = new Date(year, now.getMonth() - 1, 1)
|
|
|
327
|
+ const lastMonthYear = lastMonthDate.getFullYear()
|
|
|
328
|
+ const lastMonth = lastMonthDate.getMonth() + 1
|
|
|
329
|
+ const [thisMonthBegin, thisMonthEnd] = this.getMonthRange(year, currentMonth, true)
|
|
|
330
|
+ const [lastMonthBegin, lastMonthEnd] = this.getMonthRange(lastMonthYear, lastMonth)
|
|
|
331
|
+
|
|
|
332
|
+ const monthTasks = []
|
|
|
333
|
+ const monthLabels = []
|
|
|
334
|
+ for (let m = 1; m <= currentMonth; m++) {
|
|
|
335
|
+ monthLabels.push(`${m}月`)
|
|
|
336
|
+ const [begin, end] = this.getMonthRange(year, m, m === currentMonth)
|
|
|
337
|
+ const [lastBegin, lastEnd] = this.getMonthRange(year - 1, m, false)
|
|
|
338
|
+ monthTasks.push(this.fetchProjectCount(begin, end))
|
|
|
339
|
+ monthTasks.push(this.fetchProjectCount(lastBegin, lastEnd))
|
|
|
340
|
+ }
|
|
|
341
|
+
|
|
|
342
|
+ const [thisYearCount, lastYearCount, thisMonthCount, lastMonthCount, ...monthCounts] = await Promise.all([
|
|
|
343
|
+ this.fetchProjectCount(thisYearBegin, today),
|
|
|
344
|
+ this.fetchProjectCount(lastYearBegin, lastYearToday),
|
|
|
345
|
+ this.fetchProjectCount(thisMonthBegin, thisMonthEnd),
|
|
|
346
|
+ this.fetchProjectCount(lastMonthBegin, lastMonthEnd),
|
|
|
347
|
+ ...monthTasks
|
|
|
348
|
+ ])
|
|
|
349
|
+
|
|
|
350
|
+ this.projectNum = thisYearCount
|
|
|
351
|
+ this.subYear = Math.abs(thisYearCount - lastYearCount)
|
|
|
352
|
+ this.isProjectUp = thisYearCount >= lastYearCount
|
|
|
353
|
+ this.subMonth = Math.abs(thisMonthCount - lastMonthCount)
|
|
|
354
|
+ this.isProjectMonthUp = thisMonthCount >= lastMonthCount
|
|
|
355
|
+
|
|
|
356
|
+ this.projectMonthLabels = monthLabels
|
|
|
357
|
+ this.projectMonthThisYear = []
|
|
|
358
|
+ this.projectMonthLastYear = []
|
|
|
359
|
+ for (let i = 0; i < monthCounts.length; i += 2) {
|
|
|
360
|
+ this.projectMonthThisYear.push(monthCounts[i])
|
|
|
361
|
+ this.projectMonthLastYear.push(monthCounts[i + 1])
|
|
|
362
|
+ }
|
|
|
363
|
+ },
|
|
|
364
|
+ async fetchContractCount(begin, end) {
|
|
|
365
|
+ const res = await listContract(this.addDateRange({ pageNum: 1, pageSize: 1 }, [begin, end]))
|
|
|
366
|
+ return res.total || 0
|
|
|
367
|
+ },
|
|
|
368
|
+ async loadContractStats() {
|
|
|
369
|
+ const now = new Date()
|
|
|
370
|
+ const year = now.getFullYear()
|
|
|
371
|
+ const today = this.parseTime(now, '{y}-{m}-{d}')
|
|
|
372
|
+ const thisYearBegin = `${year}-01-01`
|
|
|
373
|
+ const lastYearBegin = `${year - 1}-01-01`
|
|
|
374
|
+ const lastYearDate = new Date(now)
|
|
|
375
|
+ lastYearDate.setFullYear(year - 1)
|
|
|
376
|
+ const lastYearToday = this.parseTime(lastYearDate, '{y}-{m}-{d}')
|
|
|
377
|
+ const currentMonth = now.getMonth() + 1
|
|
|
378
|
+ const lastMonthDate = new Date(year, now.getMonth() - 1, 1)
|
|
|
379
|
+ const lastMonthYear = lastMonthDate.getFullYear()
|
|
|
380
|
+ const lastMonth = lastMonthDate.getMonth() + 1
|
|
|
381
|
+ const [thisMonthBegin, thisMonthEnd] = this.getMonthRange(year, currentMonth, true)
|
|
|
382
|
+ const [lastMonthBegin, lastMonthEnd] = this.getMonthRange(lastMonthYear, lastMonth)
|
|
|
383
|
+
|
|
|
384
|
+ const monthTasks = []
|
|
|
385
|
+ const monthLabels = []
|
|
|
386
|
+ for (let m = 1; m <= currentMonth; m++) {
|
|
|
387
|
+ monthLabels.push(`${m}月`)
|
|
|
388
|
+ const [begin, end] = this.getMonthRange(year, m, m === currentMonth)
|
|
|
389
|
+ const [lastBegin, lastEnd] = this.getMonthRange(year - 1, m, false)
|
|
|
390
|
+ monthTasks.push(this.fetchContractCount(begin, end))
|
|
|
391
|
+ monthTasks.push(this.fetchContractCount(lastBegin, lastEnd))
|
|
|
392
|
+ }
|
|
|
393
|
+
|
|
|
394
|
+ const [thisYearCount, lastYearCount, thisMonthCount, lastMonthCount, ...monthCounts] = await Promise.all([
|
|
|
395
|
+ this.fetchContractCount(thisYearBegin, today),
|
|
|
396
|
+ this.fetchContractCount(lastYearBegin, lastYearToday),
|
|
|
397
|
+ this.fetchContractCount(thisMonthBegin, thisMonthEnd),
|
|
|
398
|
+ this.fetchContractCount(lastMonthBegin, lastMonthEnd),
|
|
|
399
|
+ ...monthTasks
|
|
|
400
|
+ ])
|
|
|
401
|
+
|
|
|
402
|
+ this.contractNum = thisYearCount
|
|
|
403
|
+ this.contractSubYear = Math.abs(thisYearCount - lastYearCount)
|
|
|
404
|
+ this.isContractUp = thisYearCount >= lastYearCount
|
|
|
405
|
+ this.contractSubMonth = Math.abs(thisMonthCount - lastMonthCount)
|
|
|
406
|
+ this.isContractMonthUp = thisMonthCount >= lastMonthCount
|
|
|
407
|
+
|
|
|
408
|
+ this.contractMonthLabels = monthLabels
|
|
|
409
|
+ this.contractMonthThisYear = []
|
|
|
410
|
+ this.contractMonthLastYear = []
|
|
|
411
|
+ for (let i = 0; i < monthCounts.length; i += 2) {
|
|
|
412
|
+ this.contractMonthThisYear.push(monthCounts[i])
|
|
|
413
|
+ this.contractMonthLastYear.push(monthCounts[i + 1])
|
|
|
414
|
+ }
|
|
|
415
|
+ },
|
|
|
416
|
+ async fetchBorrowCount(begin, end) {
|
|
|
417
|
+ const res = await listBorrow(this.addDateRange({ pageNum: 1, pageSize: 1 }, [begin, end]))
|
|
|
418
|
+ return res.total || 0
|
|
|
419
|
+ },
|
|
|
420
|
+ async loadBorrowStats() {
|
|
|
421
|
+ const now = new Date()
|
|
|
422
|
+ const year = now.getFullYear()
|
|
|
423
|
+ const today = this.parseTime(now, '{y}-{m}-{d}')
|
|
|
424
|
+ const thisYearBegin = `${year}-01-01`
|
|
|
425
|
+ const lastYearBegin = `${year - 1}-01-01`
|
|
|
426
|
+ const lastYearDate = new Date(now)
|
|
|
427
|
+ lastYearDate.setFullYear(year - 1)
|
|
|
428
|
+ const lastYearToday = this.parseTime(lastYearDate, '{y}-{m}-{d}')
|
|
|
429
|
+ const currentMonth = now.getMonth() + 1
|
|
|
430
|
+ const lastMonthDate = new Date(year, now.getMonth() - 1, 1)
|
|
|
431
|
+ const lastMonthYear = lastMonthDate.getFullYear()
|
|
|
432
|
+ const lastMonth = lastMonthDate.getMonth() + 1
|
|
|
433
|
+ const [thisMonthBegin, thisMonthEnd] = this.getMonthRange(year, currentMonth, true)
|
|
|
434
|
+ const [lastMonthBegin, lastMonthEnd] = this.getMonthRange(lastMonthYear, lastMonth)
|
|
|
435
|
+
|
|
|
436
|
+ const monthTasks = []
|
|
|
437
|
+ const monthLabels = []
|
|
|
438
|
+ for (let m = 1; m <= currentMonth; m++) {
|
|
|
439
|
+ monthLabels.push(`${m}月`)
|
|
|
440
|
+ const [begin, end] = this.getMonthRange(year, m, m === currentMonth)
|
|
|
441
|
+ const [lastBegin, lastEnd] = this.getMonthRange(year - 1, m, false)
|
|
|
442
|
+ monthTasks.push(this.fetchBorrowCount(begin, end))
|
|
|
443
|
+ monthTasks.push(this.fetchBorrowCount(lastBegin, lastEnd))
|
|
|
444
|
+ }
|
|
|
445
|
+
|
|
|
446
|
+ const [thisYearCount, lastYearCount, thisMonthCount, lastMonthCount, ...monthCounts] = await Promise.all([
|
|
|
447
|
+ this.fetchBorrowCount(thisYearBegin, today),
|
|
|
448
|
+ this.fetchBorrowCount(lastYearBegin, lastYearToday),
|
|
|
449
|
+ this.fetchBorrowCount(thisMonthBegin, thisMonthEnd),
|
|
|
450
|
+ this.fetchBorrowCount(lastMonthBegin, lastMonthEnd),
|
|
|
451
|
+ ...monthTasks
|
|
|
452
|
+ ])
|
|
|
453
|
+
|
|
|
454
|
+ this.borrowNum = thisYearCount
|
|
|
455
|
+ this.borrowSubYear = Math.abs(thisYearCount - lastYearCount)
|
|
|
456
|
+ this.isBorrowUp = thisYearCount >= lastYearCount
|
|
|
457
|
+ this.borrowSubMonth = Math.abs(thisMonthCount - lastMonthCount)
|
|
|
458
|
+ this.isBorrowMonthUp = thisMonthCount >= lastMonthCount
|
|
|
459
|
+
|
|
|
460
|
+ this.borrowMonthLabels = monthLabels
|
|
|
461
|
+ this.borrowMonthThisYear = []
|
|
|
462
|
+ this.borrowMonthLastYear = []
|
|
|
463
|
+ for (let i = 0; i < monthCounts.length; i += 2) {
|
|
|
464
|
+ this.borrowMonthThisYear.push(monthCounts[i])
|
|
|
465
|
+ this.borrowMonthLastYear.push(monthCounts[i + 1])
|
|
|
466
|
+ }
|
|
|
467
|
+ },
|
|
|
468
|
+ async fetchDeviceCount(begin, end) {
|
|
|
469
|
+ const res = await listDeviceApproval(this.addDateRange({ pageNum: 1, pageSize: 1 }, [begin, end]))
|
|
|
470
|
+ return res.total || 0
|
|
|
471
|
+ },
|
|
|
472
|
+ async loadDeviceStats() {
|
|
|
473
|
+ const now = new Date()
|
|
|
474
|
+ const year = now.getFullYear()
|
|
|
475
|
+ const today = this.parseTime(now, '{y}-{m}-{d}')
|
|
|
476
|
+ const thisYearBegin = `${year}-01-01`
|
|
|
477
|
+ const lastYearBegin = `${year - 1}-01-01`
|
|
|
478
|
+ const lastYearDate = new Date(now)
|
|
|
479
|
+ lastYearDate.setFullYear(year - 1)
|
|
|
480
|
+ const lastYearToday = this.parseTime(lastYearDate, '{y}-{m}-{d}')
|
|
|
481
|
+ const currentMonth = now.getMonth() + 1
|
|
|
482
|
+ const lastMonthDate = new Date(year, now.getMonth() - 1, 1)
|
|
|
483
|
+ const lastMonthYear = lastMonthDate.getFullYear()
|
|
|
484
|
+ const lastMonth = lastMonthDate.getMonth() + 1
|
|
|
485
|
+ const [thisMonthBegin, thisMonthEnd] = this.getMonthRange(year, currentMonth, true)
|
|
|
486
|
+ const [lastMonthBegin, lastMonthEnd] = this.getMonthRange(lastMonthYear, lastMonth)
|
|
|
487
|
+
|
|
|
488
|
+ const monthTasks = []
|
|
|
489
|
+ const monthLabels = []
|
|
|
490
|
+ for (let m = 1; m <= currentMonth; m++) {
|
|
|
491
|
+ monthLabels.push(`${m}月`)
|
|
|
492
|
+ const [begin, end] = this.getMonthRange(year, m, m === currentMonth)
|
|
|
493
|
+ const [lastBegin, lastEnd] = this.getMonthRange(year - 1, m, false)
|
|
|
494
|
+ monthTasks.push(this.fetchDeviceCount(begin, end))
|
|
|
495
|
+ monthTasks.push(this.fetchDeviceCount(lastBegin, lastEnd))
|
|
|
496
|
+ }
|
|
|
497
|
+
|
|
|
498
|
+ const [thisYearCount, lastYearCount, thisMonthCount, lastMonthCount, ...monthCounts] = await Promise.all([
|
|
|
499
|
+ this.fetchDeviceCount(thisYearBegin, today),
|
|
|
500
|
+ this.fetchDeviceCount(lastYearBegin, lastYearToday),
|
|
|
501
|
+ this.fetchDeviceCount(thisMonthBegin, thisMonthEnd),
|
|
|
502
|
+ this.fetchDeviceCount(lastMonthBegin, lastMonthEnd),
|
|
|
503
|
+ ...monthTasks
|
|
|
504
|
+ ])
|
|
|
505
|
+
|
|
|
506
|
+ this.deviceNum = thisYearCount
|
|
|
507
|
+ this.deviceSubYear = Math.abs(thisYearCount - lastYearCount)
|
|
|
508
|
+ this.isDeviceUp = thisYearCount >= lastYearCount
|
|
|
509
|
+ this.deviceSubMonth = Math.abs(thisMonthCount - lastMonthCount)
|
|
|
510
|
+ this.isDeviceMonthUp = thisMonthCount >= lastMonthCount
|
|
|
511
|
+
|
|
|
512
|
+ this.deviceMonthLabels = monthLabels
|
|
|
513
|
+ this.deviceMonthThisYear = []
|
|
|
514
|
+ this.deviceMonthLastYear = []
|
|
|
515
|
+ for (let i = 0; i < monthCounts.length; i += 2) {
|
|
|
516
|
+ this.deviceMonthThisYear.push(monthCounts[i])
|
|
|
517
|
+ this.deviceMonthLastYear.push(monthCounts[i + 1])
|
|
|
518
|
+ }
|
|
|
519
|
+ },
|
|
258
|
520
|
initChartOne() {
|
|
259
|
521
|
let option = {
|
|
260
|
522
|
grid: {
|
|
|
@@ -275,7 +537,7 @@ export default {
|
|
275
|
537
|
},
|
|
276
|
538
|
xAxis: {
|
|
277
|
539
|
type: 'category',
|
|
278
|
|
- data: Object.keys(this.year).slice(-6),
|
|
|
540
|
+ data: this.projectMonthLabels.slice(-6),
|
|
279
|
541
|
show: false
|
|
280
|
542
|
},
|
|
281
|
543
|
yAxis: {
|
|
|
@@ -285,10 +547,21 @@ export default {
|
|
285
|
547
|
},
|
|
286
|
548
|
series: [
|
|
287
|
549
|
{
|
|
|
550
|
+ name: '今年',
|
|
|
551
|
+ min: 0,
|
|
|
552
|
+ data: this.projectMonthThisYear.slice(-6),
|
|
|
553
|
+ type: 'line',
|
|
|
554
|
+ smooth: true,
|
|
|
555
|
+ itemStyle: { color: '#3498DB' }
|
|
|
556
|
+ },
|
|
|
557
|
+ {
|
|
|
558
|
+ name: '去年同期',
|
|
288
|
559
|
min: 0,
|
|
289
|
|
- data: Object.values(this.year).slice(-6),
|
|
|
560
|
+ data: this.projectMonthLastYear.slice(-6),
|
|
290
|
561
|
type: 'line',
|
|
291
|
562
|
smooth: true,
|
|
|
563
|
+ itemStyle: { color: '#A0CFFF' },
|
|
|
564
|
+ lineStyle: { type: 'dashed' }
|
|
292
|
565
|
}
|
|
293
|
566
|
]
|
|
294
|
567
|
};
|
|
|
@@ -314,7 +587,7 @@ export default {
|
|
314
|
587
|
},
|
|
315
|
588
|
xAxis: {
|
|
316
|
589
|
type: 'category',
|
|
317
|
|
- data: Object.keys(this.contractYear).slice(-6),
|
|
|
590
|
+ data: this.contractMonthLabels.slice(-6),
|
|
318
|
591
|
show: false
|
|
319
|
592
|
},
|
|
320
|
593
|
yAxis: {
|
|
|
@@ -324,13 +597,21 @@ export default {
|
|
324
|
597
|
},
|
|
325
|
598
|
series: [
|
|
326
|
599
|
{
|
|
|
600
|
+ name: '今年',
|
|
327
|
601
|
min: 0,
|
|
328
|
|
- data: Object.values(this.contractYear).slice(-6),
|
|
|
602
|
+ data: this.contractMonthThisYear.slice(-6),
|
|
329
|
603
|
type: 'line',
|
|
330
|
604
|
smooth: true,
|
|
331
|
|
- itemStyle: {
|
|
332
|
|
- color: '#00B42A'
|
|
333
|
|
- }
|
|
|
605
|
+ itemStyle: { color: '#00B42A' }
|
|
|
606
|
+ },
|
|
|
607
|
+ {
|
|
|
608
|
+ name: '去年同期',
|
|
|
609
|
+ min: 0,
|
|
|
610
|
+ data: this.contractMonthLastYear.slice(-6),
|
|
|
611
|
+ type: 'line',
|
|
|
612
|
+ smooth: true,
|
|
|
613
|
+ itemStyle: { color: '#95DE64' },
|
|
|
614
|
+ lineStyle: { type: 'dashed' }
|
|
334
|
615
|
}
|
|
335
|
616
|
]
|
|
336
|
617
|
};
|
|
|
@@ -356,7 +637,7 @@ export default {
|
|
356
|
637
|
},
|
|
357
|
638
|
xAxis: {
|
|
358
|
639
|
type: 'category',
|
|
359
|
|
- data: Object.keys(this.deviceYear).slice(-6),
|
|
|
640
|
+ data: this.deviceMonthLabels.slice(-6),
|
|
360
|
641
|
show: false
|
|
361
|
642
|
},
|
|
362
|
643
|
yAxis: {
|
|
|
@@ -366,13 +647,21 @@ export default {
|
|
366
|
647
|
},
|
|
367
|
648
|
series: [
|
|
368
|
649
|
{
|
|
|
650
|
+ name: '今年',
|
|
369
|
651
|
min: 0,
|
|
370
|
|
- data: Object.values(this.deviceYear).slice(-6),
|
|
|
652
|
+ data: this.deviceMonthThisYear.slice(-6),
|
|
371
|
653
|
type: 'line',
|
|
372
|
654
|
smooth: true,
|
|
373
|
|
- itemStyle: {
|
|
374
|
|
- color: '#3498DB'
|
|
375
|
|
- }
|
|
|
655
|
+ itemStyle: { color: '#3498DB' }
|
|
|
656
|
+ },
|
|
|
657
|
+ {
|
|
|
658
|
+ name: '去年同期',
|
|
|
659
|
+ min: 0,
|
|
|
660
|
+ data: this.deviceMonthLastYear.slice(-6),
|
|
|
661
|
+ type: 'line',
|
|
|
662
|
+ smooth: true,
|
|
|
663
|
+ itemStyle: { color: '#A0CFFF' },
|
|
|
664
|
+ lineStyle: { type: 'dashed' }
|
|
376
|
665
|
}
|
|
377
|
666
|
]
|
|
378
|
667
|
};
|
|
|
@@ -398,7 +687,7 @@ export default {
|
|
398
|
687
|
},
|
|
399
|
688
|
xAxis: {
|
|
400
|
689
|
type: 'category',
|
|
401
|
|
- data: Object.keys(this.borrowYear).slice(-6),
|
|
|
690
|
+ data: this.borrowMonthLabels.slice(-6),
|
|
402
|
691
|
show: false
|
|
403
|
692
|
},
|
|
404
|
693
|
yAxis: {
|
|
|
@@ -408,13 +697,21 @@ export default {
|
|
408
|
697
|
},
|
|
409
|
698
|
series: [
|
|
410
|
699
|
{
|
|
|
700
|
+ name: '今年',
|
|
411
|
701
|
min: 0,
|
|
412
|
|
- data: Object.values(this.borrowYear).slice(-6),
|
|
|
702
|
+ data: this.borrowMonthThisYear.slice(-6),
|
|
413
|
703
|
type: 'line',
|
|
414
|
704
|
smooth: true,
|
|
415
|
|
- itemStyle: {
|
|
416
|
|
- color: '#7B68EE'
|
|
417
|
|
- }
|
|
|
705
|
+ itemStyle: { color: '#7B68EE' }
|
|
|
706
|
+ },
|
|
|
707
|
+ {
|
|
|
708
|
+ name: '去年同期',
|
|
|
709
|
+ min: 0,
|
|
|
710
|
+ data: this.borrowMonthLastYear.slice(-6),
|
|
|
711
|
+ type: 'line',
|
|
|
712
|
+ smooth: true,
|
|
|
713
|
+ itemStyle: { color: '#C4B5FD' },
|
|
|
714
|
+ lineStyle: { type: 'dashed' }
|
|
418
|
715
|
}
|
|
419
|
716
|
]
|
|
420
|
717
|
};
|
|
|
@@ -462,50 +759,6 @@ export default {
|
|
462
|
759
|
};
|
|
463
|
760
|
echartsInit(settleYearChart, 'thisSettle', option);
|
|
464
|
761
|
},
|
|
465
|
|
- getProjectYearSub(year) {
|
|
466
|
|
- let arr = Object.values(year).slice(-2);
|
|
467
|
|
- this.subYear = Number(arr[1]) - Number(arr[0]);
|
|
468
|
|
- this.projectNum = Number(arr[1])
|
|
469
|
|
- if (this.subYear < 0) {
|
|
470
|
|
- this.subYear = - this.subYear;
|
|
471
|
|
- this.isProjectUp = false
|
|
472
|
|
- } else {
|
|
473
|
|
- this.isProjectUp = true
|
|
474
|
|
- }
|
|
475
|
|
- },
|
|
476
|
|
- getContractYearSub(year) {
|
|
477
|
|
- let arr = Object.values(year).slice(-2);
|
|
478
|
|
- this.contractSubYear = Number(arr[1]) - Number(arr[0]);
|
|
479
|
|
- this.contractNum = Number(arr[1])
|
|
480
|
|
- if (this.contractSubYear < 0) {
|
|
481
|
|
- this.contractSubYear = - this.contractSubYear;
|
|
482
|
|
- this.isContractUp = false
|
|
483
|
|
- } else {
|
|
484
|
|
- this.isContractUp = true
|
|
485
|
|
- }
|
|
486
|
|
- },
|
|
487
|
|
- getDeviceYearSub(year) {
|
|
488
|
|
- let arr = Object.values(year).slice(-2);
|
|
489
|
|
- this.deviceSubYear = Number(arr[1]) - Number(arr[0]);
|
|
490
|
|
- this.deviceNum = Number(arr[1])
|
|
491
|
|
- if (this.deviceSubYear < 0) {
|
|
492
|
|
- this.deviceSubYear = - this.deviceSubYear;
|
|
493
|
|
- this.isDeviceUp = false
|
|
494
|
|
- } else {
|
|
495
|
|
- this.isDeviceUp = true
|
|
496
|
|
- }
|
|
497
|
|
- },
|
|
498
|
|
- getBorrowYearSub(year) {
|
|
499
|
|
- let arr = Object.values(year).slice(-2);
|
|
500
|
|
- this.borrowSubYear = Number(arr[1]) - Number(arr[0]);
|
|
501
|
|
- this.borrowNum = Number(arr[1])
|
|
502
|
|
- if (this.borrowSubYear < 0) {
|
|
503
|
|
- this.borrowSubYear = - this.borrowSubYear;
|
|
504
|
|
- this.isBorrowUp = false
|
|
505
|
|
- } else {
|
|
506
|
|
- this.isBorrowUp = true
|
|
507
|
|
- }
|
|
508
|
|
- },
|
|
509
|
762
|
getSettleYearSub(year) {
|
|
510
|
763
|
let arr = Object.values(year).slice(-2);
|
|
511
|
764
|
this.settleSubYear = Number(arr[1]) - Number(arr[0]);
|
|
|
@@ -552,10 +805,20 @@ export default {
|
|
552
|
805
|
.data-title {
|
|
553
|
806
|
font-family: 'puhuiti45';
|
|
554
|
807
|
font-weight: 500;
|
|
555
|
|
- margin-bottom: 24px;
|
|
|
808
|
+ margin-bottom: 16px;
|
|
556
|
809
|
font-size: 16px;
|
|
557
|
810
|
}
|
|
558
|
811
|
|
|
|
812
|
+ .compare-row {
|
|
|
813
|
+ display: flex;
|
|
|
814
|
+ align-items: center;
|
|
|
815
|
+ flex-wrap: wrap;
|
|
|
816
|
+ }
|
|
|
817
|
+
|
|
|
818
|
+ .compare-gap {
|
|
|
819
|
+ margin-left: 8px;
|
|
|
820
|
+ }
|
|
|
821
|
+
|
|
559
|
822
|
.number {
|
|
560
|
823
|
font-size: 24px;
|
|
561
|
824
|
font-family: 'puhuiti45';
|