vue2-client 1.2.81 → 1.2.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/CHANGELOG.md +223 -219
  2. package/package.json +1 -1
  3. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +3 -3
  4. package/src/base-client/components/common/AmapMarker/index.js +3 -3
  5. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +1 -1
  6. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +1 -1
  7. package/src/base-client/components/common/ScrollList/SrcollList.vue +113 -113
  8. package/src/base-client/components/common/ScrollList/index.js +3 -3
  9. package/src/base-client/components/common/XForm/XFormItem.vue +1 -1
  10. package/src/base-client/components/common/XTable/XTable.vue +269 -269
  11. package/src/base-client/components/iot/DeviceDetailsView/DeviceDetailsView.vue +232 -232
  12. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsCount.vue +678 -678
  13. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsException.vue +57 -57
  14. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsRead.vue +131 -131
  15. package/src/base-client/components/iot/DeviceTypeDetailsView/DeviceTypeDetailsView.vue +300 -300
  16. package/src/base-client/components/iot/WebmeterAnalysisView/WebmeterAnalysisView.vue +770 -770
  17. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  18. package/src/base-client/plugins/AppData.js +81 -70
  19. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  20. package/src/pages/login/Login.vue +39 -1
  21. package/src/pages/resourceManage/orgListManage.vue +98 -98
  22. package/src/router/async/config.async.js +26 -26
  23. package/src/router/index.js +27 -27
  24. package/src/services/api/WebmeterAnalysisViewApi.js +20 -20
  25. package/src/services/api/index.js +39 -39
  26. package/src/services/api/iot/DeviceDetailsView/DeviceDetailsCountApi.js +18 -18
  27. package/src/services/apiService.js +1 -0
  28. package/src/services/user.js +8 -1
  29. package/src/theme/default/style.less +47 -47
  30. package/src/utils/map-utils.js +5 -2
  31. package/src/utils/request.js +53 -2
@@ -1,770 +1,770 @@
1
- <template>
2
- <a-page-header title="物联网运行维护">
3
- <div>
4
- <a-row :gutter="24">
5
- <a-col :md="12" :sm="24" :style="{ marginBottom: '24px' }" :xl="6">
6
- <x-card :loadState="instructSumLoadState" :retry="loadInstructSumCount">
7
- <chart-card :total="instructSum | NumberFormat" title="总指令数">
8
- <a-tooltip slot="action" :style="{ marginRight: '10px' }" title="刷新" @click="loadInstructSumCount()">
9
- <a-icon type="redo" />
10
- </a-tooltip>
11
- <a-tooltip slot="action" title="生成的所有指令总数">
12
- <a-icon type="info-circle-o" />
13
- </a-tooltip>
14
- <div>
15
- <trend :flag="instructYoW >= 0 ? 'up' : 'down'" style="margin-right: 16px;">
16
- <span slot="term">同周比</span>
17
- {{ instructYoW + '%' }}
18
- </trend>
19
- <trend :flag="instructYoD >= 0 ? 'up' : 'down'">
20
- <span slot="term">日同比</span>
21
- {{ instructYoD + '%' }}
22
- </trend>
23
- </div>
24
- <template slot="footer">昨日新增 <span>{{ instructYesAdd | NumberFormat }}</span></template>
25
- </chart-card>
26
- </x-card>
27
- </a-col>
28
- <a-col :md="12" :sm="24" :style="{ marginBottom: '24px' }" :xl="6">
29
- <x-card :loadState="metereadSumLoadState" :retry="loadMetereadSumCount">
30
- <chart-card :total="metereadSum | NumberFormat" title="总抄表量">
31
- <a-tooltip slot="action" :style="{ marginRight: '10px' }" title="刷新" @click="loadMetereadSumCount()">
32
- <a-icon type="redo" />
33
- </a-tooltip>
34
- <a-tooltip slot="action" title="生成的所有抄表(meteread)总数">
35
- <a-icon type="info-circle-o" />
36
- </a-tooltip>
37
- <div>
38
- <mini-area :dataSource="metereadSumDataByWeek" :scale="metereadSumByWeekScale" />
39
- </div>
40
- <template slot="footer">昨日新增 <span> {{ metereadYesAdd | NumberFormat }}</span></template>
41
- </chart-card>
42
- </x-card>
43
- </a-col>
44
- <a-col :md="12" :sm="24" :style="{ marginBottom: '24px' }" :xl="6">
45
- <x-card :loadState="usingMeterSumLoadState" :retry="loadUsingMeterSumCount">
46
- <chart-card :total="usingMeterSum | NumberFormat" title="在用表具数">
47
- <a-tooltip slot="action" :style="{ marginRight: '10px' }" title="刷新" @click="loadUsingMeterSumCount()">
48
- <a-icon type="redo" />
49
- </a-tooltip>
50
- <a-tooltip slot="action" title="开户成功的物联网表总数">
51
- <a-icon type="info-circle-o" />
52
- </a-tooltip>
53
- <div>
54
- <mini-bar :dataSource="usingMeterSumDataByWeek" :scale="usingMeterSumByWeekScale" />
55
- </div>
56
- <template slot="footer">昨日新增 <span>{{ usingMeterYesAdd | NumberFormat }}</span></template>
57
- </chart-card>
58
- </x-card>
59
- </a-col>
60
- <a-col :md="12" :sm="24" :style="{ marginBottom: '24px' }" :xl="6">
61
- <x-card :loadState="instructRateOfSuccessLoadState" :retry="loadInstructRateOfSuccess">
62
- <chart-card :total="instructRateOfSuccessValue + '%'" title="指令下发成功率">
63
- <a-tooltip slot="action" :style="{ marginRight: '10px' }" title="刷新" @click="loadInstructRateOfSuccess()">
64
- <a-icon type="redo" />
65
- </a-tooltip>
66
- <a-tooltip slot="action" title="执行成功和已发送状态的指令占所有指令的比例">
67
- <a-icon type="info-circle-o" />
68
- </a-tooltip>
69
- <div>
70
- <mini-progress :color="instructRateOfColor" :percentage="instructRateOfSuccessValue" :target="90" height="8px" />
71
- </div>
72
- <template slot="footer">
73
- <trend :flag="instructRateOfSuccessYoW >= 0 ? 'up' : 'down'" style="margin-right: 16px;">
74
- <span slot="term">同周比</span>
75
- {{ instructRateOfSuccessYoW + '%' }}
76
- </trend>
77
- <trend :flag="instructRateOfSuccessYoD >= 0 ? 'up' : 'down'" style="margin-right: 16px;">
78
- <span slot="term">日同比</span>
79
- {{ instructRateOfSuccessYoD + '%' }}
80
- </trend>
81
- <span slot="term">昨日成功率</span>
82
- {{ yesterdayInstructRateOf + '%' }}
83
- </template>
84
- </chart-card>
85
- </x-card>
86
- </a-col>
87
- </a-row>
88
-
89
- <a-card :body-style="{padding: '0'}" :bordered="false">
90
- <div class="salesCard">
91
- <a-tabs :activeKey="tabActiveKey" :default-active-key="tabActiveKey" :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}" size="large" @change="handleTabChange">
92
- <div slot="tabBarExtraContent" class="extra-wrapper">
93
- <div class="extra-item">
94
- <a-radio-group v-model="countMode" button-style="solid" @change="toggleCountMode">
95
- <a-radio-button value="now">最近24小时</a-radio-button>
96
- <a-radio-button value="week">近一周</a-radio-button>
97
- <a-radio-button value="month">近一个月</a-radio-button>
98
- <a-radio-button value="year">近一年</a-radio-button>
99
- </a-radio-group>
100
- </div>
101
- <a-range-picker :style="{width: '256px'}" />
102
- </div>
103
- <a-tab-pane key="1" tab="抄表情况分析">
104
- <a-row :lg="24" :md="24" :sm="24" :xl="24" :xs="24">
105
- <x-card :loadState="radarLoadState" :retry="getHandPlanCountByMeterBrand">
106
- <div id="container" style="padding: 0 0 0 20px;height: 370px" />
107
- </x-card>
108
- </a-row>
109
- </a-tab-pane>
110
- <a-tab-pane key="2" tab="访问量">
111
- <a-row>
112
- <a-col :lg="12" :md="12" :sm="24" :xl="16" :xs="24">
113
- <bar :data="barData2" title="销售额趋势" />
114
- </a-col>
115
- <a-col :lg="12" :md="12" :sm="24" :xl="8" :xs="24">
116
- <rank-list :list="rankList" title="门店销售排行榜"/>
117
- </a-col>
118
- </a-row>
119
- </a-tab-pane>
120
- </a-tabs>
121
- </div>
122
- </a-card>
123
-
124
- <div :class="!isMobile && 'desktop'" class="antd-pro-pages-dashboard-analysis-twoColLayout">
125
- <a-row :gutter="24" :style="{ marginTop: '24px' }" type="flex">
126
- <a-col :lg="24" :md="24" :sm="24" :xl="12" :xs="24">
127
- <x-card :bordered="false" :loadState="useGasLoadState" :retry="loadUseGasData" title="用气情况排行">
128
- <a-dropdown slot="extra" :trigger="['click']" placement="bottomLeft">
129
- <a class="ant-dropdown-link" href="#">
130
- <a-icon type="ellipsis" />
131
- </a>
132
- <a-menu slot="overlay">
133
- <a-menu-item>
134
- <a href="javascript:">操作一</a>
135
- </a-menu-item>
136
- <a-menu-item>
137
- <a href="javascript;">操作二</a>
138
- </a-menu-item>
139
- </a-menu>
140
- </a-dropdown>
141
- <a-row :gutter="68">
142
- <a-col :sm="12" :style="{ marginBottom: ' 24px'}" :xs="24">
143
- <number-info :status="useGasSubValue.status" :sub-total="useGasSubValue.subValue" :total="todayUseGasTotalValue">
144
- <span slot="subtitle">
145
- <span>当天总用气量</span>
146
- <a-tooltip slot="action" title="本日所有物联网表用户总用气量">
147
- <a-icon :style="{ marginLeft: '8px' }" type="info-circle-o" />
148
- </a-tooltip>
149
- </span>
150
- </number-info>
151
- <!-- miniChart -->
152
- <div>
153
- <mini-smooth-area :dataSource="useGasWeekData" :scale="useGasWeekDataScale" :style="{ height: '45px' }" />
154
- </div>
155
- </a-col>
156
- <a-col :sm="12" :style="{ marginBottom: ' 24px'}" :xs="24">
157
- <number-info :status="handPlanUserSubValue.status" :sub-total="handPlanUserSubValue.subValue" :total="todayHandPlanUserCount">
158
- <span slot="subtitle">
159
- <span>当天总抄表用户数</span>
160
- <a-tooltip slot="action" title="当天总抄表用户数">
161
- <a-icon :style="{ marginLeft: '8px' }" type="info-circle-o" />
162
- </a-tooltip>
163
- </span>
164
- </number-info>
165
- <!-- miniChart -->
166
- <div>
167
- <mini-smooth-area :dataSource="handPlanUserData" :scale="handPlanUserDataScale" :style="{ height: '45px' }" />
168
- </div>
169
- </a-col>
170
- </a-row>
171
- <div class="ant-table-wrapper">
172
- <a-table
173
- :columns="searchTableColumns"
174
- :dataSource="gasConsumptionRanking"
175
- :pagination="{ pageSize: 5 }"
176
- row-key="index"
177
- size="small"
178
- >
179
- <span slot="range" slot-scope="text, record">
180
- <trend :flag="record.status === 0 ? 'up' : 'down'">
181
- {{ text }}%
182
- </trend>
183
- </span>
184
- </a-table>
185
- </div>
186
- </x-card>
187
- </a-col>
188
- <a-col :lg="24" :md="24" :sm="24" :xl="12" :xs="24">
189
- <a-card :bordered="false" :loading="false" :style="{ height: '100%' }" class="antd-pro-pages-dashboard-analysis-salesCard" title="指令类别占比">
190
- <div slot="extra" style="height: inherit;">
191
- <div class="analysis-salesTypeRadio">
192
- <a-radio-group defaultValue="a">
193
- <a-radio-button value="a">本日</a-radio-button>
194
- <a-radio-button value="b">本周</a-radio-button>
195
- <a-radio-button value="c">本月</a-radio-button>
196
- </a-radio-group>
197
- </div>
198
- </div>
199
- <h4></h4>
200
- <div>
201
- <!-- style="width: calc(100% - 240px);" -->
202
- <div>
203
- <v-chart :data="pieData" :force-fit="true" :height="405" :scale="pieScale">
204
- <v-tooltip :showTitle="false" dataKey="item*percent" />
205
- <v-axis />
206
- <!-- position="right" :offsetX="-140" -->
207
- <v-legend dataKey="item"/>
208
- <v-pie :vStyle="pieStyle" color="item" position="percent" />
209
- <v-coord :innerRadius="0.6" :radius="0.75" type="theta" />
210
- </v-chart>
211
- </div>
212
- </div>
213
- </a-card>
214
- </a-col>
215
- </a-row>
216
- </div>
217
- </div>
218
- </a-page-header>
219
- </template>
220
-
221
- <script>
222
- import moment from 'moment'
223
- import {
224
- ChartCard,
225
- MiniArea,
226
- MiniBar,
227
- MiniProgress,
228
- RankList,
229
- Bar,
230
- Trend,
231
- NumberInfo,
232
- MiniSmoothArea
233
- } from '@vue2-client/components'
234
- import { formatDate } from '@vue2-client/utils/util'
235
- import { Line } from '@antv/g2plot'
236
- import { mapState } from 'vuex'
237
- import { WebmeterAnalysisViewApi, post } from '@vue2-client/services/api'
238
-
239
- const barData = []
240
- const barData2 = []
241
- for (let i = 0; i < 12; i += 1) {
242
- barData.push({
243
- x: `${i + 1}月`,
244
- y: Math.floor(Math.random() * 1000) + 200
245
- })
246
- barData2.push({
247
- x: `${i + 1}月`,
248
- y: Math.floor(Math.random() * 1000) + 200
249
- })
250
- }
251
-
252
- const rankList = []
253
- for (let i = 0; i < 7; i++) {
254
- rankList.push({
255
- name: '白鹭岛 ' + (i + 1) + ' 号店',
256
- total: 1234.56 - i * 100
257
- })
258
- }
259
-
260
- const searchUserData = []
261
- for (let i = 0; i < 7; i++) {
262
- searchUserData.push({
263
- x: moment().add(i, 'days').format('YYYY-MM-DD'),
264
- y: Math.ceil(Math.random() * 10)
265
- })
266
- }
267
-
268
- const searchTableColumns = [
269
- {
270
- dataIndex: 'f_userinfo_id',
271
- title: '用户编号',
272
- width: 90
273
- },
274
- {
275
- dataIndex: 'f_user_name',
276
- title: '用户姓名'
277
- },
278
- {
279
- dataIndex: 'count',
280
- title: '用气量'
281
- },
282
- {
283
- dataIndex: 'range',
284
- title: '周涨幅',
285
- align: 'right',
286
- sorter: (a, b) => a.range - b.range,
287
- scopedSlots: { customRender: 'range' }
288
- }
289
- ]
290
-
291
- const userInfoArray = [
292
- '德昌鸿公司2',
293
- '瑞鑫宇公司',
294
- '保康县熊绎中学',
295
- '文康置业有限公司',
296
- '湖北省旗星文化旅游实业有限公司'
297
- ]
298
-
299
- const searchData = []
300
- let j = 0
301
- for (let i = 0; i < 5; i += 1) {
302
- searchData.push({
303
- index: Math.floor(Math.random() * 10000000),
304
- keyword: userInfoArray[j],
305
- count: Math.floor(Math.random() * 1000),
306
- range: Math.floor(Math.random() * 10),
307
- status: Math.floor((Math.random() * 10) % 2)
308
- })
309
- j++
310
- }
311
-
312
- const DataSet = require('@antv/data-set')
313
-
314
- const sourceData = [
315
- { item: '远程开户', count: 32.2 },
316
- { item: '远程充值', count: 21 },
317
- { item: '阀门控制', count: 17 },
318
- { item: '远程调价', count: 13 },
319
- { item: '设置参数', count: 9 },
320
- { item: '远程注销', count: 7.8 }
321
- ]
322
-
323
- const pieScale = [{
324
- dataKey: 'percent',
325
- min: 0,
326
- formatter: '.0%'
327
- }]
328
-
329
- const dv = new DataSet.View().source(sourceData)
330
- dv.transform({
331
- type: 'percent',
332
- field: 'count',
333
- dimension: 'item',
334
- as: 'percent'
335
- })
336
- const pieData = dv.rows
337
-
338
- export default {
339
- name: 'WebmeterAnalysisView',
340
- components: {
341
- ChartCard,
342
- MiniArea,
343
- MiniBar,
344
- MiniProgress,
345
- RankList,
346
- Bar,
347
- Trend,
348
- NumberInfo,
349
- MiniSmoothArea
350
- },
351
- data () {
352
- return {
353
- // 页面宽度
354
- screenWidth: document.documentElement.clientWidth,
355
- // 客户名称
356
- customerName: '',
357
- // >> 指令总数统计
358
- // 指令数统计Loading
359
- instructSumLoadState: 'loading',
360
- // 总指令数
361
- instructSum: 0,
362
- // 同周比
363
- instructYoW: 0,
364
- // 日同比
365
- instructYoD: 0,
366
- // 昨日新增指令数
367
- instructYesAdd: 0,
368
- // >> 抄表量统计
369
- // 抄表量统计Loading
370
- metereadSumLoadState: 'loading',
371
- // 总抄表量
372
- metereadSum: 0,
373
- // 昨日新增抄表量
374
- metereadYesAdd: 0,
375
- // 近一周抄表量明细
376
- metereadSumDataByWeek: [],
377
- // 近一周抄表量明细列
378
- metereadSumByWeekScale: [
379
- {
380
- dataKey: 'x',
381
- alias: '时间'
382
- },
383
- {
384
- dataKey: 'y',
385
- alias: '抄表量'
386
- }
387
- ],
388
- // >> 在用表具数统计
389
- // 在用表具统计Loading
390
- usingMeterSumLoadState: 'loading',
391
- // 在用表具总量
392
- usingMeterSum: 0,
393
- // 昨日新增在用表具量
394
- usingMeterYesAdd: 0,
395
- // 近一周新增在用表具明细
396
- usingMeterSumDataByWeek: [],
397
- // 近一周新增在用表具明细列
398
- usingMeterSumByWeekScale: [
399
- {
400
- dataKey: 'x',
401
- alias: '时间'
402
- },
403
- {
404
- dataKey: 'y',
405
- alias: '开户数'
406
- }
407
- ],
408
- // >> 表具指令下发成功率统计
409
- // 表具指令成功率
410
- instructRateOfSuccessValue: 0,
411
- // 昨日指令成功率
412
- yesterdayInstructRateOf: 0,
413
- // 同周比
414
- instructRateOfSuccessYoW: 0,
415
- // 日同比
416
- instructRateOfSuccessYoD: 0,
417
- // 指令成功率进度色
418
- instructRateOfColor: 'rgb(19, 194, 194)',
419
- // 表具指令下发成功率加载状态
420
- instructRateOfSuccessLoadState: 'loading',
421
-
422
- // 统计模式
423
- countMode: 'now',
424
- // 统计类型
425
- tabActiveKey: '1',
426
- // >> 表具上报情况统计
427
- // 上报统计图表
428
- uploadCountPlot: undefined,
429
- // 抄表情况分析Loading
430
- radarLoadState: 'loading',
431
- // >> 用气情况排行统计
432
- // 用气情况排行统计Loading
433
- useGasLoadState: 'loading',
434
- // 当天总用气量
435
- todayUseGasTotalValue: 0,
436
- // 昨天总用气量
437
- yesterdayUseGasTotalValue: 0,
438
- // 近一周的每天用气情况
439
- useGasWeekData: [],
440
- useGasWeekDataScale: [
441
- {
442
- dataKey: 'x',
443
- alias: '时间'
444
- },
445
- {
446
- dataKey: 'y',
447
- alias: '用气量'
448
- }
449
- ],
450
- // 当天抄表用户数
451
- todayHandPlanUserCount: 0,
452
- // 昨天抄表用户数
453
- yesterdayHandPlanUserCount: 0,
454
- // 近一周的每天抄表情况
455
- handPlanUserData: [],
456
- handPlanUserDataScale: [
457
- {
458
- dataKey: 'x',
459
- alias: '时间'
460
- },
461
- {
462
- dataKey: 'y',
463
- alias: '用户数'
464
- }
465
- ],
466
- // 用气排行榜
467
- gasConsumptionRanking: [],
468
- rankList,
469
-
470
- // 搜索用户数
471
- searchUserData,
472
- searchTableColumns,
473
- searchData,
474
-
475
- barData,
476
- barData2,
477
-
478
- //
479
- pieScale,
480
- pieData,
481
- sourceData,
482
- pieStyle: {
483
- stroke: '#fff',
484
- lineWidth: 1
485
- }
486
- }
487
- },
488
- mounted () {
489
- // 加载指令数统计
490
- this.loadInstructSumCount()
491
- // 加载抄表量统计
492
- this.loadMetereadSumCount()
493
- // 加载在用表具量统计
494
- this.loadUsingMeterSumCount()
495
- // 加载指令成功率统计
496
- this.loadInstructRateOfSuccess()
497
- // 加载各表厂表具上报情况统计
498
- this.getHandPlanCountByMeterBrand()
499
- // 加载用气量统计
500
- this.loadUseGasData()
501
- },
502
- computed: {
503
- ...mapState('setting', ['isMobile']),
504
- useGasSubValue: function () {
505
- const subValue = this.todayUseGasTotalValue - this.yesterdayUseGasTotalValue
506
- const status = subValue >= 0 ? 'up' : 'down'
507
- return {
508
- subValue: subValue,
509
- status: status
510
- }
511
- },
512
- handPlanUserSubValue: function () {
513
- const subValue = this.todayHandPlanUserCount - this.yesterdayHandPlanUserCount
514
- const status = subValue >= 0 ? 'up' : 'down'
515
- return {
516
- subValue: subValue,
517
- status: status
518
- }
519
- },
520
- },
521
- methods: {
522
- /**
523
- * 加载指令总数统计
524
- */
525
- loadInstructSumCount () {
526
- this.instructSumLoadState = 'loading'
527
- post(WebmeterAnalysisViewApi.instructSumCount, {}).then(res => {
528
- this.instructSum = res.instructSum
529
- this.instructYoW = res.instructYoW
530
- this.instructYoD = res.instructYoD
531
- this.instructYesAdd = res.instructYesAdd
532
- this.instructSumLoadState = 'success'
533
- }, err => {
534
- console.warn(err)
535
- this.instructSumLoadState = 'error'
536
- })
537
- },
538
- /**
539
- * 加载抄表总数统计
540
- */
541
- loadMetereadSumCount () {
542
- this.metereadSumDataByWeek = []
543
- this.metereadSumLoadState = 'loading'
544
- post(WebmeterAnalysisViewApi.meteReadSumCount, {}).then(res => {
545
- // 加载近一周抄表数图表
546
- post(WebmeterAnalysisViewApi.meteReadDataByWeek, {}).then(res => {
547
- for (let i = 0, len = res.length; i < len; i++) {
548
- this.metereadSumDataByWeek.push({
549
- x: res[i].date,
550
- y: res[i].num
551
- })
552
- }
553
- })
554
- this.metereadSum = res.metereadSum
555
- this.metereadYesAdd = res.metereadYesAdd
556
- this.metereadSumLoadState = 'success'
557
- }, err => {
558
- console.warn(err)
559
- this.metereadSumLoadState = 'error'
560
- })
561
- },
562
- /**
563
- * 加载在用表具总数情况
564
- */
565
- loadUsingMeterSumCount () {
566
- this.usingMeterSumDataByWeek = []
567
- this.usingMeterSumLoadState = 'loading'
568
- return post(WebmeterAnalysisViewApi.usingMeterSumCount, {}).then(res => {
569
- // 加载近一周开户数图表
570
- post(WebmeterAnalysisViewApi.usingMeterDataByWeek, {}).then(res => {
571
- for (let i = 0, len = res.length; i < len; i++) {
572
- this.usingMeterSumDataByWeek.push({
573
- x: res[i].date,
574
- y: res[i].num
575
- })
576
- }
577
- })
578
- this.usingMeterSum = res.usingMeterSum
579
- this.usingMeterYesAdd = res.usingMeterYesAdd
580
- this.usingMeterSumLoadState = 'success'
581
- }, err => {
582
- console.warn(err)
583
- this.usingMeterSumLoadState = 'error'
584
- })
585
- },
586
- /**
587
- * 加载表具指令下发成功率
588
- */
589
- loadInstructRateOfSuccess () {
590
- this.instructRateOfSuccessLoadState = 'loading'
591
- post(WebmeterAnalysisViewApi.instructRateOfSuccess, {}).then(res => {
592
- this.instructRateOfSuccessValue = res.instructRateOfSuccessValue * 1.0
593
- if (this.instructRateOfSuccessValue < 70.0) {
594
- this.instructRateOfColor = 'rgb(242, 99, 123)'
595
- } else if (this.instructRateOfSuccessValue < 90.0) {
596
- this.instructRateOfColor = 'rgb(251, 212, 55)'
597
- } else {
598
- this.instructRateOfColor = 'rgb(19, 194, 194)'
599
- }
600
- this.instructRateOfSuccessYoW = res.instructRateOfSuccessYoW
601
- this.instructRateOfSuccessYoD = res.instructRateOfSuccessYoD
602
- this.yesterdayInstructRateOf = res.yesterdayInstructRateOf
603
- this.instructRateOfSuccessLoadState = 'success'
604
- }, err => {
605
- console.warn(err)
606
- this.instructRateOfSuccessLoadState = 'error'
607
- })
608
- },
609
- /**
610
- * 格式化日期
611
- * @param date 日期字符串
612
- * @param format 格式化方式
613
- * @returns {string|*} 格式化结果
614
- */
615
- format (date, format) {
616
- return formatDate(date, format)
617
- },
618
- /**
619
- * 切换周期
620
- */
621
- toggleCountMode () {
622
- this.updateDataByKey()
623
- },
624
- /**
625
- * Tab切换
626
- */
627
- handleTabChange (key) {
628
- this.tabActiveKey = key + ''
629
- this.updateDataByKey()
630
- },
631
- /**
632
- * 根据模式更新数据
633
- */
634
- updateDataByKey () {
635
- if (this.tabActiveKey === '1') {
636
- this.getHandPlanCountByMeterBrand()
637
- } else {
638
- // this.getDeviceLostContactCountData()
639
- // this.getDeviceLostContactRankData()
640
- }
641
- },
642
- /**
643
- * 获取各表厂表具上报情况
644
- */
645
- getHandPlanCountByMeterBrand () {
646
- this.radarLoadState = 'loading'
647
- fetch(WebmeterAnalysisViewApi.handMeterSumCountData, {
648
- method: 'POST',
649
- body: JSON.stringify({
650
- type: this.countMode
651
- })
652
- }).then((res) => res.json())
653
- .then((data) => {
654
- const plotOption = {
655
- data,
656
- xField: 'date',
657
- yField: 'value',
658
- seriesField: 'name',
659
- yAxis: {
660
- label: {
661
- // 数值格式化为千分位
662
- formatter: (v) => `${v}`.replace(/\d{1,3}(?=(\d{3})+$)/g, (s) => `${s},`)
663
- }
664
- },
665
- tooltip: {
666
- shared: true
667
- },
668
- interactions: [{ type: 'brush' }],
669
- slider: {
670
- start: 0,
671
- end: 1
672
- },
673
- legend: {
674
- position: 'top',
675
- radio: true,
676
- flipPage: false
677
- },
678
- smooth: true
679
- }
680
- if (this.uploadCountPlot) {
681
- this.uploadCountPlot.update(plotOption)
682
- } else {
683
- this.uploadCountPlot = new Line('container', plotOption)
684
- this.uploadCountPlot.render()
685
- }
686
- this.radarLoadState = 'success'
687
- })
688
- .catch((ex) => {
689
- console.error(ex)
690
- this.radarLoadState = 'error'
691
- })
692
- },
693
- /**
694
- * 获取用气请求排行
695
- */
696
- loadUseGasData () {
697
- this.gasConsumptionRanking = []
698
- this.useGasLoadState = 'loading'
699
- return post(WebmeterAnalysisViewApi.useGasSumCount, {}).then(res => {
700
- this.gasConsumptionRanking = res.gasConsumptionRanking
701
- this.todayUseGasTotalValue = res.todayUseGasTotalValue
702
- this.todayHandPlanUserCount = res.todayHandPlanUserCount
703
- this.yesterdayUseGasTotalValue = res.yesterdayUseGasTotalValue
704
- this.yesterdayHandPlanUserCount = res.yesterdayHandPlanUserCount
705
- this.useGasWeekData = res.useGasWeekData
706
- this.handPlanUserData = res.handPlanUserData
707
- this.useGasLoadState = 'success'
708
- }, err => {
709
- console.warn(err)
710
- this.useGasLoadState = 'error'
711
- })
712
- }
713
- }
714
- }
715
- </script>
716
-
717
- <style lang="less" scoped>
718
-
719
- .text {
720
- color: rgba(0, 0, 0, .45);
721
- }
722
-
723
- .heading {
724
- color: rgba(0, 0, 0, .85);
725
- font-size: 20px;
726
- }
727
-
728
- .extra-wrapper {
729
- line-height: 55px;
730
- padding-right: 24px;
731
-
732
- .extra-item {
733
- display: inline-block;
734
- margin-right: 24px;
735
-
736
- a {
737
- margin-left: 24px;
738
- }
739
- }
740
- }
741
-
742
- .antd-pro-pages-dashboard-analysis-twoColLayout {
743
- position: relative;
744
- display: flex;
745
- display: block;
746
- flex-flow: row wrap;
747
- }
748
-
749
- .antd-pro-pages-dashboard-analysis-salesCard {
750
- height: calc(100% - 24px);
751
- /deep/ .ant-card-head {
752
- position: relative;
753
- }
754
- }
755
-
756
- .dashboard-analysis-iconGroup {
757
- i {
758
- margin-left: 16px;
759
- color: rgba(0,0,0,.45);
760
- cursor: pointer;
761
- transition: color .32s;
762
- color: black;
763
- }
764
- }
765
- .analysis-salesTypeRadio {
766
- position: absolute;
767
- right: 54px;
768
- bottom: 12px;
769
- }
770
- </style>
1
+ <template>
2
+ <a-page-header title="物联网运行维护">
3
+ <div>
4
+ <a-row :gutter="24">
5
+ <a-col :md="12" :sm="24" :style="{ marginBottom: '24px' }" :xl="6">
6
+ <x-card :loadState="instructSumLoadState" :retry="loadInstructSumCount">
7
+ <chart-card :total="instructSum | NumberFormat" title="总指令数">
8
+ <a-tooltip slot="action" :style="{ marginRight: '10px' }" title="刷新" @click="loadInstructSumCount()">
9
+ <a-icon type="redo" />
10
+ </a-tooltip>
11
+ <a-tooltip slot="action" title="生成的所有指令总数">
12
+ <a-icon type="info-circle-o" />
13
+ </a-tooltip>
14
+ <div>
15
+ <trend :flag="instructYoW >= 0 ? 'up' : 'down'" style="margin-right: 16px;">
16
+ <span slot="term">同周比</span>
17
+ {{ instructYoW + '%' }}
18
+ </trend>
19
+ <trend :flag="instructYoD >= 0 ? 'up' : 'down'">
20
+ <span slot="term">日同比</span>
21
+ {{ instructYoD + '%' }}
22
+ </trend>
23
+ </div>
24
+ <template slot="footer">昨日新增 <span>{{ instructYesAdd | NumberFormat }}</span></template>
25
+ </chart-card>
26
+ </x-card>
27
+ </a-col>
28
+ <a-col :md="12" :sm="24" :style="{ marginBottom: '24px' }" :xl="6">
29
+ <x-card :loadState="metereadSumLoadState" :retry="loadMetereadSumCount">
30
+ <chart-card :total="metereadSum | NumberFormat" title="总抄表量">
31
+ <a-tooltip slot="action" :style="{ marginRight: '10px' }" title="刷新" @click="loadMetereadSumCount()">
32
+ <a-icon type="redo" />
33
+ </a-tooltip>
34
+ <a-tooltip slot="action" title="生成的所有抄表(meteread)总数">
35
+ <a-icon type="info-circle-o" />
36
+ </a-tooltip>
37
+ <div>
38
+ <mini-area :dataSource="metereadSumDataByWeek" :scale="metereadSumByWeekScale" />
39
+ </div>
40
+ <template slot="footer">昨日新增 <span> {{ metereadYesAdd | NumberFormat }}</span></template>
41
+ </chart-card>
42
+ </x-card>
43
+ </a-col>
44
+ <a-col :md="12" :sm="24" :style="{ marginBottom: '24px' }" :xl="6">
45
+ <x-card :loadState="usingMeterSumLoadState" :retry="loadUsingMeterSumCount">
46
+ <chart-card :total="usingMeterSum | NumberFormat" title="在用表具数">
47
+ <a-tooltip slot="action" :style="{ marginRight: '10px' }" title="刷新" @click="loadUsingMeterSumCount()">
48
+ <a-icon type="redo" />
49
+ </a-tooltip>
50
+ <a-tooltip slot="action" title="开户成功的物联网表总数">
51
+ <a-icon type="info-circle-o" />
52
+ </a-tooltip>
53
+ <div>
54
+ <mini-bar :dataSource="usingMeterSumDataByWeek" :scale="usingMeterSumByWeekScale" />
55
+ </div>
56
+ <template slot="footer">昨日新增 <span>{{ usingMeterYesAdd | NumberFormat }}</span></template>
57
+ </chart-card>
58
+ </x-card>
59
+ </a-col>
60
+ <a-col :md="12" :sm="24" :style="{ marginBottom: '24px' }" :xl="6">
61
+ <x-card :loadState="instructRateOfSuccessLoadState" :retry="loadInstructRateOfSuccess">
62
+ <chart-card :total="instructRateOfSuccessValue + '%'" title="指令下发成功率">
63
+ <a-tooltip slot="action" :style="{ marginRight: '10px' }" title="刷新" @click="loadInstructRateOfSuccess()">
64
+ <a-icon type="redo" />
65
+ </a-tooltip>
66
+ <a-tooltip slot="action" title="执行成功和已发送状态的指令占所有指令的比例">
67
+ <a-icon type="info-circle-o" />
68
+ </a-tooltip>
69
+ <div>
70
+ <mini-progress :color="instructRateOfColor" :percentage="instructRateOfSuccessValue" :target="90" height="8px" />
71
+ </div>
72
+ <template slot="footer">
73
+ <trend :flag="instructRateOfSuccessYoW >= 0 ? 'up' : 'down'" style="margin-right: 16px;">
74
+ <span slot="term">同周比</span>
75
+ {{ instructRateOfSuccessYoW + '%' }}
76
+ </trend>
77
+ <trend :flag="instructRateOfSuccessYoD >= 0 ? 'up' : 'down'" style="margin-right: 16px;">
78
+ <span slot="term">日同比</span>
79
+ {{ instructRateOfSuccessYoD + '%' }}
80
+ </trend>
81
+ <span slot="term">昨日成功率</span>
82
+ {{ yesterdayInstructRateOf + '%' }}
83
+ </template>
84
+ </chart-card>
85
+ </x-card>
86
+ </a-col>
87
+ </a-row>
88
+
89
+ <a-card :body-style="{padding: '0'}" :bordered="false">
90
+ <div class="salesCard">
91
+ <a-tabs :activeKey="tabActiveKey" :default-active-key="tabActiveKey" :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}" size="large" @change="handleTabChange">
92
+ <div slot="tabBarExtraContent" class="extra-wrapper">
93
+ <div class="extra-item">
94
+ <a-radio-group v-model="countMode" button-style="solid" @change="toggleCountMode">
95
+ <a-radio-button value="now">最近24小时</a-radio-button>
96
+ <a-radio-button value="week">近一周</a-radio-button>
97
+ <a-radio-button value="month">近一个月</a-radio-button>
98
+ <a-radio-button value="year">近一年</a-radio-button>
99
+ </a-radio-group>
100
+ </div>
101
+ <a-range-picker :style="{width: '256px'}" />
102
+ </div>
103
+ <a-tab-pane key="1" tab="抄表情况分析">
104
+ <a-row :lg="24" :md="24" :sm="24" :xl="24" :xs="24">
105
+ <x-card :loadState="radarLoadState" :retry="getHandPlanCountByMeterBrand">
106
+ <div id="container" style="padding: 0 0 0 20px;height: 370px" />
107
+ </x-card>
108
+ </a-row>
109
+ </a-tab-pane>
110
+ <a-tab-pane key="2" tab="访问量">
111
+ <a-row>
112
+ <a-col :lg="12" :md="12" :sm="24" :xl="16" :xs="24">
113
+ <bar :data="barData2" title="销售额趋势" />
114
+ </a-col>
115
+ <a-col :lg="12" :md="12" :sm="24" :xl="8" :xs="24">
116
+ <rank-list :list="rankList" title="门店销售排行榜"/>
117
+ </a-col>
118
+ </a-row>
119
+ </a-tab-pane>
120
+ </a-tabs>
121
+ </div>
122
+ </a-card>
123
+
124
+ <div :class="!isMobile && 'desktop'" class="antd-pro-pages-dashboard-analysis-twoColLayout">
125
+ <a-row :gutter="24" :style="{ marginTop: '24px' }" type="flex">
126
+ <a-col :lg="24" :md="24" :sm="24" :xl="12" :xs="24">
127
+ <x-card :bordered="false" :loadState="useGasLoadState" :retry="loadUseGasData" title="用气情况排行">
128
+ <a-dropdown slot="extra" :trigger="['click']" placement="bottomLeft">
129
+ <a class="ant-dropdown-link" href="#">
130
+ <a-icon type="ellipsis" />
131
+ </a>
132
+ <a-menu slot="overlay">
133
+ <a-menu-item>
134
+ <a href="javascript:">操作一</a>
135
+ </a-menu-item>
136
+ <a-menu-item>
137
+ <a href="javascript;">操作二</a>
138
+ </a-menu-item>
139
+ </a-menu>
140
+ </a-dropdown>
141
+ <a-row :gutter="68">
142
+ <a-col :sm="12" :style="{ marginBottom: ' 24px'}" :xs="24">
143
+ <number-info :status="useGasSubValue.status" :sub-total="useGasSubValue.subValue" :total="todayUseGasTotalValue">
144
+ <span slot="subtitle">
145
+ <span>当天总用气量</span>
146
+ <a-tooltip slot="action" title="本日所有物联网表用户总用气量">
147
+ <a-icon :style="{ marginLeft: '8px' }" type="info-circle-o" />
148
+ </a-tooltip>
149
+ </span>
150
+ </number-info>
151
+ <!-- miniChart -->
152
+ <div>
153
+ <mini-smooth-area :dataSource="useGasWeekData" :scale="useGasWeekDataScale" :style="{ height: '45px' }" />
154
+ </div>
155
+ </a-col>
156
+ <a-col :sm="12" :style="{ marginBottom: ' 24px'}" :xs="24">
157
+ <number-info :status="handPlanUserSubValue.status" :sub-total="handPlanUserSubValue.subValue" :total="todayHandPlanUserCount">
158
+ <span slot="subtitle">
159
+ <span>当天总抄表用户数</span>
160
+ <a-tooltip slot="action" title="当天总抄表用户数">
161
+ <a-icon :style="{ marginLeft: '8px' }" type="info-circle-o" />
162
+ </a-tooltip>
163
+ </span>
164
+ </number-info>
165
+ <!-- miniChart -->
166
+ <div>
167
+ <mini-smooth-area :dataSource="handPlanUserData" :scale="handPlanUserDataScale" :style="{ height: '45px' }" />
168
+ </div>
169
+ </a-col>
170
+ </a-row>
171
+ <div class="ant-table-wrapper">
172
+ <a-table
173
+ :columns="searchTableColumns"
174
+ :dataSource="gasConsumptionRanking"
175
+ :pagination="{ pageSize: 5 }"
176
+ row-key="index"
177
+ size="small"
178
+ >
179
+ <span slot="range" slot-scope="text, record">
180
+ <trend :flag="record.status === 0 ? 'up' : 'down'">
181
+ {{ text }}%
182
+ </trend>
183
+ </span>
184
+ </a-table>
185
+ </div>
186
+ </x-card>
187
+ </a-col>
188
+ <a-col :lg="24" :md="24" :sm="24" :xl="12" :xs="24">
189
+ <a-card :bordered="false" :loading="false" :style="{ height: '100%' }" class="antd-pro-pages-dashboard-analysis-salesCard" title="指令类别占比">
190
+ <div slot="extra" style="height: inherit;">
191
+ <div class="analysis-salesTypeRadio">
192
+ <a-radio-group defaultValue="a">
193
+ <a-radio-button value="a">本日</a-radio-button>
194
+ <a-radio-button value="b">本周</a-radio-button>
195
+ <a-radio-button value="c">本月</a-radio-button>
196
+ </a-radio-group>
197
+ </div>
198
+ </div>
199
+ <h4></h4>
200
+ <div>
201
+ <!-- style="width: calc(100% - 240px);" -->
202
+ <div>
203
+ <v-chart :data="pieData" :force-fit="true" :height="405" :scale="pieScale">
204
+ <v-tooltip :showTitle="false" dataKey="item*percent" />
205
+ <v-axis />
206
+ <!-- position="right" :offsetX="-140" -->
207
+ <v-legend dataKey="item"/>
208
+ <v-pie :vStyle="pieStyle" color="item" position="percent" />
209
+ <v-coord :innerRadius="0.6" :radius="0.75" type="theta" />
210
+ </v-chart>
211
+ </div>
212
+ </div>
213
+ </a-card>
214
+ </a-col>
215
+ </a-row>
216
+ </div>
217
+ </div>
218
+ </a-page-header>
219
+ </template>
220
+
221
+ <script>
222
+ import moment from 'moment'
223
+ import {
224
+ ChartCard,
225
+ MiniArea,
226
+ MiniBar,
227
+ MiniProgress,
228
+ RankList,
229
+ Bar,
230
+ Trend,
231
+ NumberInfo,
232
+ MiniSmoothArea
233
+ } from '@vue2-client/components'
234
+ import { formatDate } from '@vue2-client/utils/util'
235
+ import { Line } from '@antv/g2plot'
236
+ import { mapState } from 'vuex'
237
+ import { WebmeterAnalysisViewApi, post } from '@vue2-client/services/api'
238
+
239
+ const barData = []
240
+ const barData2 = []
241
+ for (let i = 0; i < 12; i += 1) {
242
+ barData.push({
243
+ x: `${i + 1}月`,
244
+ y: Math.floor(Math.random() * 1000) + 200
245
+ })
246
+ barData2.push({
247
+ x: `${i + 1}月`,
248
+ y: Math.floor(Math.random() * 1000) + 200
249
+ })
250
+ }
251
+
252
+ const rankList = []
253
+ for (let i = 0; i < 7; i++) {
254
+ rankList.push({
255
+ name: '白鹭岛 ' + (i + 1) + ' 号店',
256
+ total: 1234.56 - i * 100
257
+ })
258
+ }
259
+
260
+ const searchUserData = []
261
+ for (let i = 0; i < 7; i++) {
262
+ searchUserData.push({
263
+ x: moment().add(i, 'days').format('YYYY-MM-DD'),
264
+ y: Math.ceil(Math.random() * 10)
265
+ })
266
+ }
267
+
268
+ const searchTableColumns = [
269
+ {
270
+ dataIndex: 'f_userinfo_id',
271
+ title: '用户编号',
272
+ width: 90
273
+ },
274
+ {
275
+ dataIndex: 'f_user_name',
276
+ title: '用户姓名'
277
+ },
278
+ {
279
+ dataIndex: 'count',
280
+ title: '用气量'
281
+ },
282
+ {
283
+ dataIndex: 'range',
284
+ title: '周涨幅',
285
+ align: 'right',
286
+ sorter: (a, b) => a.range - b.range,
287
+ scopedSlots: { customRender: 'range' }
288
+ }
289
+ ]
290
+
291
+ const userInfoArray = [
292
+ '德昌鸿公司2',
293
+ '瑞鑫宇公司',
294
+ '保康县熊绎中学',
295
+ '文康置业有限公司',
296
+ '湖北省旗星文化旅游实业有限公司'
297
+ ]
298
+
299
+ const searchData = []
300
+ let j = 0
301
+ for (let i = 0; i < 5; i += 1) {
302
+ searchData.push({
303
+ index: Math.floor(Math.random() * 10000000),
304
+ keyword: userInfoArray[j],
305
+ count: Math.floor(Math.random() * 1000),
306
+ range: Math.floor(Math.random() * 10),
307
+ status: Math.floor((Math.random() * 10) % 2)
308
+ })
309
+ j++
310
+ }
311
+
312
+ const DataSet = require('@antv/data-set')
313
+
314
+ const sourceData = [
315
+ { item: '远程开户', count: 32.2 },
316
+ { item: '远程充值', count: 21 },
317
+ { item: '阀门控制', count: 17 },
318
+ { item: '远程调价', count: 13 },
319
+ { item: '设置参数', count: 9 },
320
+ { item: '远程注销', count: 7.8 }
321
+ ]
322
+
323
+ const pieScale = [{
324
+ dataKey: 'percent',
325
+ min: 0,
326
+ formatter: '.0%'
327
+ }]
328
+
329
+ const dv = new DataSet.View().source(sourceData)
330
+ dv.transform({
331
+ type: 'percent',
332
+ field: 'count',
333
+ dimension: 'item',
334
+ as: 'percent'
335
+ })
336
+ const pieData = dv.rows
337
+
338
+ export default {
339
+ name: 'WebmeterAnalysisView',
340
+ components: {
341
+ ChartCard,
342
+ MiniArea,
343
+ MiniBar,
344
+ MiniProgress,
345
+ RankList,
346
+ Bar,
347
+ Trend,
348
+ NumberInfo,
349
+ MiniSmoothArea
350
+ },
351
+ data () {
352
+ return {
353
+ // 页面宽度
354
+ screenWidth: document.documentElement.clientWidth,
355
+ // 客户名称
356
+ customerName: '',
357
+ // >> 指令总数统计
358
+ // 指令数统计Loading
359
+ instructSumLoadState: 'loading',
360
+ // 总指令数
361
+ instructSum: 0,
362
+ // 同周比
363
+ instructYoW: 0,
364
+ // 日同比
365
+ instructYoD: 0,
366
+ // 昨日新增指令数
367
+ instructYesAdd: 0,
368
+ // >> 抄表量统计
369
+ // 抄表量统计Loading
370
+ metereadSumLoadState: 'loading',
371
+ // 总抄表量
372
+ metereadSum: 0,
373
+ // 昨日新增抄表量
374
+ metereadYesAdd: 0,
375
+ // 近一周抄表量明细
376
+ metereadSumDataByWeek: [],
377
+ // 近一周抄表量明细列
378
+ metereadSumByWeekScale: [
379
+ {
380
+ dataKey: 'x',
381
+ alias: '时间'
382
+ },
383
+ {
384
+ dataKey: 'y',
385
+ alias: '抄表量'
386
+ }
387
+ ],
388
+ // >> 在用表具数统计
389
+ // 在用表具统计Loading
390
+ usingMeterSumLoadState: 'loading',
391
+ // 在用表具总量
392
+ usingMeterSum: 0,
393
+ // 昨日新增在用表具量
394
+ usingMeterYesAdd: 0,
395
+ // 近一周新增在用表具明细
396
+ usingMeterSumDataByWeek: [],
397
+ // 近一周新增在用表具明细列
398
+ usingMeterSumByWeekScale: [
399
+ {
400
+ dataKey: 'x',
401
+ alias: '时间'
402
+ },
403
+ {
404
+ dataKey: 'y',
405
+ alias: '开户数'
406
+ }
407
+ ],
408
+ // >> 表具指令下发成功率统计
409
+ // 表具指令成功率
410
+ instructRateOfSuccessValue: 0,
411
+ // 昨日指令成功率
412
+ yesterdayInstructRateOf: 0,
413
+ // 同周比
414
+ instructRateOfSuccessYoW: 0,
415
+ // 日同比
416
+ instructRateOfSuccessYoD: 0,
417
+ // 指令成功率进度色
418
+ instructRateOfColor: 'rgb(19, 194, 194)',
419
+ // 表具指令下发成功率加载状态
420
+ instructRateOfSuccessLoadState: 'loading',
421
+
422
+ // 统计模式
423
+ countMode: 'now',
424
+ // 统计类型
425
+ tabActiveKey: '1',
426
+ // >> 表具上报情况统计
427
+ // 上报统计图表
428
+ uploadCountPlot: undefined,
429
+ // 抄表情况分析Loading
430
+ radarLoadState: 'loading',
431
+ // >> 用气情况排行统计
432
+ // 用气情况排行统计Loading
433
+ useGasLoadState: 'loading',
434
+ // 当天总用气量
435
+ todayUseGasTotalValue: 0,
436
+ // 昨天总用气量
437
+ yesterdayUseGasTotalValue: 0,
438
+ // 近一周的每天用气情况
439
+ useGasWeekData: [],
440
+ useGasWeekDataScale: [
441
+ {
442
+ dataKey: 'x',
443
+ alias: '时间'
444
+ },
445
+ {
446
+ dataKey: 'y',
447
+ alias: '用气量'
448
+ }
449
+ ],
450
+ // 当天抄表用户数
451
+ todayHandPlanUserCount: 0,
452
+ // 昨天抄表用户数
453
+ yesterdayHandPlanUserCount: 0,
454
+ // 近一周的每天抄表情况
455
+ handPlanUserData: [],
456
+ handPlanUserDataScale: [
457
+ {
458
+ dataKey: 'x',
459
+ alias: '时间'
460
+ },
461
+ {
462
+ dataKey: 'y',
463
+ alias: '用户数'
464
+ }
465
+ ],
466
+ // 用气排行榜
467
+ gasConsumptionRanking: [],
468
+ rankList,
469
+
470
+ // 搜索用户数
471
+ searchUserData,
472
+ searchTableColumns,
473
+ searchData,
474
+
475
+ barData,
476
+ barData2,
477
+
478
+ //
479
+ pieScale,
480
+ pieData,
481
+ sourceData,
482
+ pieStyle: {
483
+ stroke: '#fff',
484
+ lineWidth: 1
485
+ }
486
+ }
487
+ },
488
+ mounted () {
489
+ // 加载指令数统计
490
+ this.loadInstructSumCount()
491
+ // 加载抄表量统计
492
+ this.loadMetereadSumCount()
493
+ // 加载在用表具量统计
494
+ this.loadUsingMeterSumCount()
495
+ // 加载指令成功率统计
496
+ this.loadInstructRateOfSuccess()
497
+ // 加载各表厂表具上报情况统计
498
+ this.getHandPlanCountByMeterBrand()
499
+ // 加载用气量统计
500
+ this.loadUseGasData()
501
+ },
502
+ computed: {
503
+ ...mapState('setting', ['isMobile']),
504
+ useGasSubValue: function () {
505
+ const subValue = this.todayUseGasTotalValue - this.yesterdayUseGasTotalValue
506
+ const status = subValue >= 0 ? 'up' : 'down'
507
+ return {
508
+ subValue: subValue,
509
+ status: status
510
+ }
511
+ },
512
+ handPlanUserSubValue: function () {
513
+ const subValue = this.todayHandPlanUserCount - this.yesterdayHandPlanUserCount
514
+ const status = subValue >= 0 ? 'up' : 'down'
515
+ return {
516
+ subValue: subValue,
517
+ status: status
518
+ }
519
+ },
520
+ },
521
+ methods: {
522
+ /**
523
+ * 加载指令总数统计
524
+ */
525
+ loadInstructSumCount () {
526
+ this.instructSumLoadState = 'loading'
527
+ post(WebmeterAnalysisViewApi.instructSumCount, {}).then(res => {
528
+ this.instructSum = res.instructSum
529
+ this.instructYoW = res.instructYoW
530
+ this.instructYoD = res.instructYoD
531
+ this.instructYesAdd = res.instructYesAdd
532
+ this.instructSumLoadState = 'success'
533
+ }, err => {
534
+ console.warn(err)
535
+ this.instructSumLoadState = 'error'
536
+ })
537
+ },
538
+ /**
539
+ * 加载抄表总数统计
540
+ */
541
+ loadMetereadSumCount () {
542
+ this.metereadSumDataByWeek = []
543
+ this.metereadSumLoadState = 'loading'
544
+ post(WebmeterAnalysisViewApi.meteReadSumCount, {}).then(res => {
545
+ // 加载近一周抄表数图表
546
+ post(WebmeterAnalysisViewApi.meteReadDataByWeek, {}).then(res => {
547
+ for (let i = 0, len = res.length; i < len; i++) {
548
+ this.metereadSumDataByWeek.push({
549
+ x: res[i].date,
550
+ y: res[i].num
551
+ })
552
+ }
553
+ })
554
+ this.metereadSum = res.metereadSum
555
+ this.metereadYesAdd = res.metereadYesAdd
556
+ this.metereadSumLoadState = 'success'
557
+ }, err => {
558
+ console.warn(err)
559
+ this.metereadSumLoadState = 'error'
560
+ })
561
+ },
562
+ /**
563
+ * 加载在用表具总数情况
564
+ */
565
+ loadUsingMeterSumCount () {
566
+ this.usingMeterSumDataByWeek = []
567
+ this.usingMeterSumLoadState = 'loading'
568
+ return post(WebmeterAnalysisViewApi.usingMeterSumCount, {}).then(res => {
569
+ // 加载近一周开户数图表
570
+ post(WebmeterAnalysisViewApi.usingMeterDataByWeek, {}).then(res => {
571
+ for (let i = 0, len = res.length; i < len; i++) {
572
+ this.usingMeterSumDataByWeek.push({
573
+ x: res[i].date,
574
+ y: res[i].num
575
+ })
576
+ }
577
+ })
578
+ this.usingMeterSum = res.usingMeterSum
579
+ this.usingMeterYesAdd = res.usingMeterYesAdd
580
+ this.usingMeterSumLoadState = 'success'
581
+ }, err => {
582
+ console.warn(err)
583
+ this.usingMeterSumLoadState = 'error'
584
+ })
585
+ },
586
+ /**
587
+ * 加载表具指令下发成功率
588
+ */
589
+ loadInstructRateOfSuccess () {
590
+ this.instructRateOfSuccessLoadState = 'loading'
591
+ post(WebmeterAnalysisViewApi.instructRateOfSuccess, {}).then(res => {
592
+ this.instructRateOfSuccessValue = res.instructRateOfSuccessValue * 1.0
593
+ if (this.instructRateOfSuccessValue < 70.0) {
594
+ this.instructRateOfColor = 'rgb(242, 99, 123)'
595
+ } else if (this.instructRateOfSuccessValue < 90.0) {
596
+ this.instructRateOfColor = 'rgb(251, 212, 55)'
597
+ } else {
598
+ this.instructRateOfColor = 'rgb(19, 194, 194)'
599
+ }
600
+ this.instructRateOfSuccessYoW = res.instructRateOfSuccessYoW
601
+ this.instructRateOfSuccessYoD = res.instructRateOfSuccessYoD
602
+ this.yesterdayInstructRateOf = res.yesterdayInstructRateOf
603
+ this.instructRateOfSuccessLoadState = 'success'
604
+ }, err => {
605
+ console.warn(err)
606
+ this.instructRateOfSuccessLoadState = 'error'
607
+ })
608
+ },
609
+ /**
610
+ * 格式化日期
611
+ * @param date 日期字符串
612
+ * @param format 格式化方式
613
+ * @returns {string|*} 格式化结果
614
+ */
615
+ format (date, format) {
616
+ return formatDate(date, format)
617
+ },
618
+ /**
619
+ * 切换周期
620
+ */
621
+ toggleCountMode () {
622
+ this.updateDataByKey()
623
+ },
624
+ /**
625
+ * Tab切换
626
+ */
627
+ handleTabChange (key) {
628
+ this.tabActiveKey = key + ''
629
+ this.updateDataByKey()
630
+ },
631
+ /**
632
+ * 根据模式更新数据
633
+ */
634
+ updateDataByKey () {
635
+ if (this.tabActiveKey === '1') {
636
+ this.getHandPlanCountByMeterBrand()
637
+ } else {
638
+ // this.getDeviceLostContactCountData()
639
+ // this.getDeviceLostContactRankData()
640
+ }
641
+ },
642
+ /**
643
+ * 获取各表厂表具上报情况
644
+ */
645
+ getHandPlanCountByMeterBrand () {
646
+ this.radarLoadState = 'loading'
647
+ fetch(WebmeterAnalysisViewApi.handMeterSumCountData, {
648
+ method: 'POST',
649
+ body: JSON.stringify({
650
+ type: this.countMode
651
+ })
652
+ }).then((res) => res.json())
653
+ .then((data) => {
654
+ const plotOption = {
655
+ data,
656
+ xField: 'date',
657
+ yField: 'value',
658
+ seriesField: 'name',
659
+ yAxis: {
660
+ label: {
661
+ // 数值格式化为千分位
662
+ formatter: (v) => `${v}`.replace(/\d{1,3}(?=(\d{3})+$)/g, (s) => `${s},`)
663
+ }
664
+ },
665
+ tooltip: {
666
+ shared: true
667
+ },
668
+ interactions: [{ type: 'brush' }],
669
+ slider: {
670
+ start: 0,
671
+ end: 1
672
+ },
673
+ legend: {
674
+ position: 'top',
675
+ radio: true,
676
+ flipPage: false
677
+ },
678
+ smooth: true
679
+ }
680
+ if (this.uploadCountPlot) {
681
+ this.uploadCountPlot.update(plotOption)
682
+ } else {
683
+ this.uploadCountPlot = new Line('container', plotOption)
684
+ this.uploadCountPlot.render()
685
+ }
686
+ this.radarLoadState = 'success'
687
+ })
688
+ .catch((ex) => {
689
+ console.error(ex)
690
+ this.radarLoadState = 'error'
691
+ })
692
+ },
693
+ /**
694
+ * 获取用气请求排行
695
+ */
696
+ loadUseGasData () {
697
+ this.gasConsumptionRanking = []
698
+ this.useGasLoadState = 'loading'
699
+ return post(WebmeterAnalysisViewApi.useGasSumCount, {}).then(res => {
700
+ this.gasConsumptionRanking = res.gasConsumptionRanking
701
+ this.todayUseGasTotalValue = res.todayUseGasTotalValue
702
+ this.todayHandPlanUserCount = res.todayHandPlanUserCount
703
+ this.yesterdayUseGasTotalValue = res.yesterdayUseGasTotalValue
704
+ this.yesterdayHandPlanUserCount = res.yesterdayHandPlanUserCount
705
+ this.useGasWeekData = res.useGasWeekData
706
+ this.handPlanUserData = res.handPlanUserData
707
+ this.useGasLoadState = 'success'
708
+ }, err => {
709
+ console.warn(err)
710
+ this.useGasLoadState = 'error'
711
+ })
712
+ }
713
+ }
714
+ }
715
+ </script>
716
+
717
+ <style lang="less" scoped>
718
+
719
+ .text {
720
+ color: rgba(0, 0, 0, .45);
721
+ }
722
+
723
+ .heading {
724
+ color: rgba(0, 0, 0, .85);
725
+ font-size: 20px;
726
+ }
727
+
728
+ .extra-wrapper {
729
+ line-height: 55px;
730
+ padding-right: 24px;
731
+
732
+ .extra-item {
733
+ display: inline-block;
734
+ margin-right: 24px;
735
+
736
+ a {
737
+ margin-left: 24px;
738
+ }
739
+ }
740
+ }
741
+
742
+ .antd-pro-pages-dashboard-analysis-twoColLayout {
743
+ position: relative;
744
+ display: flex;
745
+ display: block;
746
+ flex-flow: row wrap;
747
+ }
748
+
749
+ .antd-pro-pages-dashboard-analysis-salesCard {
750
+ height: calc(100% - 24px);
751
+ /deep/ .ant-card-head {
752
+ position: relative;
753
+ }
754
+ }
755
+
756
+ .dashboard-analysis-iconGroup {
757
+ i {
758
+ margin-left: 16px;
759
+ color: rgba(0,0,0,.45);
760
+ cursor: pointer;
761
+ transition: color .32s;
762
+ color: black;
763
+ }
764
+ }
765
+ .analysis-salesTypeRadio {
766
+ position: absolute;
767
+ right: 54px;
768
+ bottom: 12px;
769
+ }
770
+ </style>