vue2-client 1.2.84 → 1.2.88

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 (27) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/package.json +94 -94
  3. package/src/App.vue +2 -1
  4. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +225 -225
  5. package/src/base-client/components/common/AmapMarker/index.js +3 -3
  6. package/src/base-client/components/common/ScrollList/SrcollList.vue +113 -113
  7. package/src/base-client/components/common/ScrollList/index.js +3 -3
  8. package/src/base-client/components/common/XTable/XTable.vue +2 -2
  9. package/src/base-client/components/iot/DeviceDetailsView/DeviceDetailsView.vue +232 -232
  10. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsCount.vue +678 -678
  11. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsException.vue +57 -57
  12. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsRead.vue +131 -131
  13. package/src/base-client/components/iot/DeviceTypeDetailsView/DeviceTypeDetailsView.vue +300 -300
  14. package/src/base-client/components/iot/WebmeterAnalysisView/WebmeterAnalysisView.vue +770 -770
  15. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  16. package/src/base-client/plugins/AppData.js +0 -2
  17. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  18. package/src/pages/login/Login.vue +62 -51
  19. package/src/pages/resourceManage/orgListManage.vue +98 -98
  20. package/src/router/async/config.async.js +26 -26
  21. package/src/router/index.js +27 -27
  22. package/src/services/api/WebmeterAnalysisViewApi.js +20 -20
  23. package/src/services/api/index.js +39 -39
  24. package/src/services/api/iot/DeviceDetailsView/DeviceDetailsCountApi.js +18 -18
  25. package/src/theme/default/style.less +47 -47
  26. package/src/utils/map-utils.js +31 -31
  27. package/src/utils/request.js +24 -7
@@ -1,678 +1,678 @@
1
- <template>
2
- <div>
3
- <a-row :gutter="24">
4
- <a-col :md="12" :sm="24" :style="{ marginBottom: '24px' }" :xl="6">
5
- <x-card :loadState="loadDeviceUsedDaySumState" :retry="getDeviceUsedDaySum">
6
- <chart-card :total="usedDays" title="设备累计使用时长" unit="天">
7
- <a-tooltip slot="action" :style="{ marginRight: '10px' }" title="刷新" @click="getDeviceUsedDaySum">
8
- <a-icon type="redo" />
9
- </a-tooltip>
10
- <a-tooltip slot="action" title="从安装至今设备使用天数">
11
- <a-icon type="info-circle-o" />
12
- </a-tooltip>
13
- <template slot="footer"><span>{{ format(installDate, 'yyyy-MM-dd') }} 安装</span></template>
14
- </chart-card>
15
- </x-card>
16
- </a-col>
17
- <a-col :md="12" :sm="24" :style="{ marginBottom: '24px' }" :xl="6">
18
- <x-card :loadState="loadDeviceUploadTimesState" :retry="getDeviceUploadTimesCount">
19
- <chart-card :total="uploadTimes | NumberFormat" title="累计上报次数" unit="次">
20
- <a-tooltip slot="action" :style="{ marginRight: '10px' }" title="刷新" @click="getDeviceUploadTimesCount">
21
- <a-icon type="redo" />
22
- </a-tooltip>
23
- <a-tooltip slot="action" title="从安装至今累计上报次数">
24
- <a-icon type="info-circle-o" />
25
- </a-tooltip>
26
- <div>
27
- <mini-area :dataSource="deviceRecentlyUploadList" :scale="deviceRecentlyUploadScale" />
28
- </div>
29
- <template slot="footer">近七天共上报 <span>{{ deviceRecentlyUploadSum | NumberFormat }} 次</span></template>
30
- </chart-card>
31
- </x-card>
32
- </a-col>
33
- <a-col :md="12" :sm="24" :style="{ marginBottom: '24px' }" :xl="6">
34
- <x-card :loadState="loadDeviceLostContactState" :retry="getDeviceLostContactCount">
35
- <chart-card :total="lostContactTimes | NumberFormat" title="累计失联次数" unit="次">
36
- <a-tooltip slot="action" :style="{ marginRight: '10px' }" title="刷新" @click="getDeviceLostContactCount()">
37
- <a-icon type="redo" />
38
- </a-tooltip>
39
- <a-tooltip slot="action" title="从安装至今累计失联(即3天未上报)次数">
40
- <a-icon type="info-circle-o" />
41
- </a-tooltip>
42
- <div>
43
- <mini-bar :dataSource="deviceLostContactList" :scale="deviceLostContactScale" />
44
- </div>
45
- <template slot="footer">最近失联日期 <span> {{ format(lastLostContactDate, 'yyyy-MM-dd') }}</span></template>
46
- </chart-card>
47
- </x-card>
48
- </a-col>
49
- <a-col :md="12" :sm="24" :style="{ marginBottom: '24px' }" :xl="6">
50
- <x-card :loadState="deviceInstructRateOfSuccessLoadState" :retry="getInstructRateOfSuccess">
51
- <chart-card :total="deviceInstructRateOfSuccessValue" title="指令下发成功率" unit="%">
52
- <a-tooltip slot="action" :style="{ marginRight: '10px' }" title="刷新" @click="getInstructRateOfSuccess()">
53
- <a-icon type="redo" />
54
- </a-tooltip>
55
- <a-tooltip slot="action" title="执行成功和已发送状态的指令占所有指令的比例">
56
- <a-icon type="info-circle-o" />
57
- </a-tooltip>
58
- <div>
59
- <mini-progress :color="deviceInstructRateOfColor" :percentage="deviceInstructRateOfSuccessValue" :target="90" height="8px" />
60
- </div>
61
- <template slot="footer">共下发指令 <span> {{ deviceInstructCount | NumberFormat }} 次</span></template>
62
- </chart-card>
63
- </x-card>
64
- </a-col>
65
- </a-row>
66
-
67
- <a-card :body-style="{padding: '0'}" :bordered="false" :loading="loading">
68
- <div class="salesCard">
69
- <a-tabs :activeKey="tabActiveKey" :default-active-key="tabActiveKey" :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}" size="large" @change="handleTabChange">
70
- <div slot="tabBarExtraContent" class="extra-wrapper">
71
- <div class="extra-item">
72
- <a-radio-group v-model="countMode" button-style="solid" @change="toggleCountMode">
73
- <a-radio-button value="now">最近24小时</a-radio-button>
74
- <a-radio-button value="week">近一周</a-radio-button>
75
- <a-radio-button value="month">近一个月</a-radio-button>
76
- <a-radio-button value="year">近一年</a-radio-button>
77
- </a-radio-group>
78
- </div>
79
- <a-range-picker :style="{width: '256px'}" />
80
- </div>
81
- <a-tab-pane key="1" tab="上报情况分析">
82
- <a-row :lg="24" :md="24" :sm="24" :xl="24" :xs="24">
83
- <x-card :loadState="radarLoadState" :retry="getDeviceUploadCountData">
84
- <div id="container" style="padding: 0 0 0 20px;height: 370px" />
85
- </x-card>
86
- </a-row>
87
- </a-tab-pane>
88
- <a-tab-pane key="2" tab="失联情况分析">
89
- <a-row>
90
- <a-col :lg="12" :md="12" :sm="24" :xl="16" :xs="24">
91
- <x-card :loadState="lostContactLoadState" :retry="getDeviceLostContactCountData">
92
- <div id="lostContactContainer" style="padding: 0 0 0 20px;height: 370px" />
93
- </x-card>
94
- </a-col>
95
- <a-col :lg="12" :md="12" :sm="24" :xl="8" :xs="24">
96
- <x-card :loadState="lostContactRankLoadState" :retry="getDeviceLostContactCountData">
97
- <rank-list :list="lostContactRank" title="失联天数排行"/>
98
- </x-card>
99
- </a-col>
100
- </a-row>
101
- </a-tab-pane>
102
- </a-tabs>
103
- </div>
104
- </a-card>
105
-
106
- <div :class="!isMobile && 'desktop'" class="antd-pro-pages-dashboard-analysis-twoColLayout">
107
- <a-row :gutter="24" :style="{ marginTop: '24px' }" type="flex">
108
- <a-col :lg="24" :md="24" :sm="24" :xl="12" :xs="24">
109
- <a-card :bordered="false" :loading="loading" :style="{ height: '100%' }" title="异常报警分析">
110
- <a-dropdown slot="extra" :trigger="['click']" placement="bottomLeft">
111
- <a class="ant-dropdown-link" href="#">
112
- <a-icon type="ellipsis" />
113
- </a>
114
- <a-menu slot="overlay">
115
- <a-menu-item>
116
- <a href="javascript:">异常处理</a>
117
- </a-menu-item>
118
- <a-menu-item>
119
- <a href="javascript;">转向异常</a>
120
- </a-menu-item>
121
- </a-menu>
122
- </a-dropdown>
123
- <a-row :gutter="68">
124
- <a-col :sm="12" :style="{ marginBottom: ' 24px'}" :xs="24">
125
- <number-info :sub-total="0" :total="0">
126
- <span slot="subtitle">
127
- <span>异常发生次数</span>
128
- <a-tooltip slot="action" title="近一年内发生异常的次数">
129
- <a-icon :style="{ marginLeft: '8px' }" type="info-circle-o" />
130
- </a-tooltip>
131
- </span>
132
- </number-info>
133
- <!-- miniChart -->
134
- <div>
135
- <mini-smooth-area :dataSource="searchUserData" :scale="searchUserScale" :style="{ height: '45px' }" />
136
- </div>
137
- </a-col>
138
- <a-col :sm="12" :style="{ marginBottom: ' 24px'}" :xs="24">
139
- <number-info :sub-total="0" :total="0" status="up">
140
- <span slot="subtitle">
141
- <span>报警发生次数</span>
142
- <a-tooltip slot="action" title="近一年内发生报警的次数">
143
- <a-icon :style="{ marginLeft: '8px' }" type="info-circle-o" />
144
- </a-tooltip>
145
- </span>
146
- </number-info>
147
- <!-- miniChart -->
148
- <div>
149
- <mini-smooth-area :dataSource="searchUserData" :scale="searchUserScale" :style="{ height: '45px' }" />
150
- </div>
151
- </a-col>
152
- </a-row>
153
- <div class="ant-table-wrapper">
154
- <a-table
155
- :columns="searchTableColumns"
156
- :dataSource="searchData"
157
- :pagination="{ pageSize: 5 }"
158
- row-key="index"
159
- size="small"
160
- >
161
- <span slot="range" slot-scope="text, record">
162
- <trend :flag="record.status === 0 ? 'up' : 'down'">
163
- {{ text }}%
164
- </trend>
165
- </span>
166
- </a-table>
167
- </div>
168
- </a-card>
169
- </a-col>
170
- <a-col :lg="24" :md="24" :sm="24" :xl="12" :xs="24">
171
- <a-card :bordered="false" :loading="loading" :style="{ height: '100%' }" class="antd-pro-pages-dashboard-analysis-salesCard" title="指令类别占比">
172
- <div slot="extra" style="height: inherit;">
173
- <div class="analysis-salesTypeRadio">
174
- <a-radio-group defaultValue="a">
175
- <a-radio-button value="a">本日</a-radio-button>
176
- <a-radio-button value="b">本周</a-radio-button>
177
- <a-radio-button value="c">本月</a-radio-button>
178
- </a-radio-group>
179
- </div>
180
- </div>
181
- <h4></h4>
182
- <div>
183
- <!-- style="width: calc(100% - 240px);" -->
184
- <div>
185
- <v-chart :data="pieData" :force-fit="true" :height="405" :scale="pieScale">
186
- <v-tooltip :showTitle="false" dataKey="item*percent" />
187
- <v-axis />
188
- <!-- position="right" :offsetX="-140" -->
189
- <v-legend dataKey="item"/>
190
- <v-pie :vStyle="pieStyle" color="item" position="percent" />
191
- <v-coord :innerRadius="0.6" :radius="0.75" type="theta" />
192
- </v-chart>
193
- </div>
194
- </div>
195
- </a-card>
196
- </a-col>
197
- </a-row>
198
- </div>
199
- </div>
200
- </template>
201
-
202
- <script>
203
- import moment from 'moment'
204
- import {
205
- ChartCard,
206
- MiniArea,
207
- MiniBar,
208
- MiniProgress,
209
- RankList,
210
- Bar,
211
- Trend,
212
- NumberInfo,
213
- MiniSmoothArea
214
- } from '@vue2-client/components'
215
- import { formatDate } from '@vue2-client/utils/util'
216
- import { Line, Column } from '@antv/g2plot'
217
- import { mapState } from 'vuex'
218
- import { post } from '@vue2-client/services/api'
219
- import { DeviceDetailsCountApi } from '@vue2-client/services/api/iot/DeviceDetailsView/DeviceDetailsCountApi'
220
-
221
- const searchUserData = []
222
- for (let i = 0; i < 7; i++) {
223
- searchUserData.push({
224
- x: moment().add(i, 'days').format('YYYY-MM-DD'),
225
- y: Math.ceil(Math.random() * 10)
226
- })
227
- }
228
- const searchUserScale = [
229
- {
230
- dataKey: 'x',
231
- alias: '时间'
232
- },
233
- {
234
- dataKey: 'y',
235
- alias: '发生次数',
236
- min: 0,
237
- max: 10
238
- }]
239
-
240
- const searchTableColumns = [
241
- {
242
- dataIndex: 'index',
243
- title: '异常类型',
244
- width: 90
245
- },
246
- {
247
- dataIndex: 'keyword',
248
- title: '异常说明'
249
- },
250
- {
251
- dataIndex: 'count',
252
- title: '发生时间'
253
- },
254
- {
255
- dataIndex: 'range',
256
- title: '是否处理',
257
- align: 'right'
258
- }
259
- ]
260
-
261
- const searchData = []
262
-
263
- const DataSet = require('@antv/data-set')
264
-
265
- const sourceData = [
266
- { item: '远程开户', count: 32.2 },
267
- { item: '远程充值', count: 21 },
268
- { item: '阀门控制', count: 17 },
269
- { item: '远程调价', count: 13 },
270
- { item: '设置参数', count: 9 },
271
- { item: '远程注销', count: 7.8 }
272
- ]
273
-
274
- const pieScale = [{
275
- dataKey: 'percent',
276
- min: 0,
277
- formatter: '.0%'
278
- }]
279
-
280
- const dv = new DataSet.View().source(sourceData)
281
- dv.transform({
282
- type: 'percent',
283
- field: 'count',
284
- dimension: 'item',
285
- as: 'percent'
286
- })
287
- const pieData = dv.rows
288
-
289
- export default {
290
- name: 'DeviceDetailsCount',
291
- components: {
292
- ChartCard,
293
- MiniArea,
294
- MiniBar,
295
- MiniProgress,
296
- RankList,
297
- Bar,
298
- Trend,
299
- NumberInfo,
300
- MiniSmoothArea
301
- },
302
- data () {
303
- return {
304
- // 页面宽度
305
- screenWidth: document.documentElement.clientWidth,
306
- // 客户名称
307
- customerName: '',
308
- // >> 设备累计使用时长统计
309
- // 设备近七天上报情况
310
- deviceRecentlyUploadList: [],
311
- // 设备累计使用天数
312
- usedDays: 0,
313
- // 设备安装时间
314
- installDate: '',
315
- // 设备累计使用天数加载状态
316
- loadDeviceUsedDaySumState: 'loading',
317
- // >> 设备累计上报次数统计
318
- // 设备累计上报次数
319
- uploadTimes: 0,
320
- // 设备近七天上报总次数
321
- deviceRecentlyUploadSum: 0,
322
- // 设备近七天上报情况明细列
323
- deviceRecentlyUploadScale: [{ dataKey: 'x', alias: '时间' }, { dataKey: 'y', alias: '次数' }],
324
- // 设备累计上报次数加载状态
325
- loadDeviceUploadTimesState: 'loading',
326
- // >> 设备累计失联次数统计
327
- // 设备近三个月失联情况
328
- deviceLostContactList: [],
329
- // 设备累计失联次数
330
- lostContactTimes: 0,
331
- // 设备最近失联日期
332
- lastLostContactDate: undefined,
333
- // 设备近七天失联情况明细列
334
- deviceLostContactScale: [{ dataKey: 'x', alias: '时间' }, { dataKey: 'y', alias: '失联天数' }],
335
- // 设备累计失联次数加载状态
336
- loadDeviceLostContactState: 'loading',
337
- // >> 设备指令下发成功率统计
338
- // 设备指令成功率
339
- deviceInstructRateOfSuccessValue: 0,
340
- // 设备指令总数
341
- deviceInstructCount: 0,
342
- // 指令成功率进度色
343
- deviceInstructRateOfColor: 'rgb(19, 194, 194)',
344
- // 设备指令下发成功率加载状态
345
- deviceInstructRateOfSuccessLoadState: 'loading',
346
-
347
- // 是否刷新加载中
348
- loading: false,
349
- // 统计模式
350
- countMode: 'now',
351
- // 统计类型
352
- tabActiveKey: '1',
353
- // >> 设备上报情况统计
354
- // 上报统计图表
355
- uploadCountPlot: undefined,
356
- // 抄表情况分析Loading
357
- radarLoadState: 'loading',
358
- // >> 设备失联情况统计
359
- // 失联统计图表
360
- lostContactCountPlot: undefined,
361
- // 失联情况分析Loading
362
- lostContactLoadState: 'loading',
363
- // 失联天数排行榜
364
- lostContactRank: [],
365
- // 失联天数排行榜Loading
366
- lostContactRankLoadState: 'loading',
367
-
368
- // 搜索用户数
369
- searchUserData,
370
- searchUserScale,
371
- searchTableColumns,
372
- searchData,
373
-
374
- //
375
- pieScale,
376
- pieData,
377
- sourceData,
378
- pieStyle: {
379
- stroke: '#fff',
380
- lineWidth: 1
381
- }
382
- }
383
- },
384
- props: {
385
- deviceId: {
386
- type: Number,
387
- required: true
388
- }
389
- },
390
- mounted () {
391
- this.getDeviceUsedDaySum()
392
- this.getDeviceUploadTimesCount()
393
- this.getDeviceLostContactCount()
394
- this.getInstructRateOfSuccess()
395
- this.getDeviceUploadCountData()
396
- },
397
- computed: {
398
- ...mapState('setting', ['isMobile'])
399
- },
400
- methods: {
401
- /**
402
- * 获取设备使用天数
403
- */
404
- getDeviceUsedDaySum () {
405
- this.loadDeviceUsedDaySumState = 'loading'
406
- post(DeviceDetailsCountApi.getDeviceUsedDaySum, {
407
- deviceId: this.deviceId
408
- }).then(res => {
409
- this.usedDays = res.value
410
- this.installDate = res.installDate
411
- this.loadDeviceUsedDaySumState = 'success'
412
- }, err => {
413
- console.warn(err)
414
- this.loadDeviceUsedDaySumState = 'error'
415
- })
416
- },
417
- /**
418
- * 获取设备累计上报次数和近七天上报情况
419
- */
420
- getDeviceUploadTimesCount () {
421
- this.loadDeviceUploadTimesState = 'loading'
422
- this.deviceRecentlyUploadSum = 0
423
- post(DeviceDetailsCountApi.getDeviceUploadTimesCount, {
424
- deviceId: this.deviceId
425
- }).then(res => {
426
- this.uploadTimes = res.value
427
- this.deviceRecentlyUploadList = res.recentlyUpload
428
- for (const item of this.deviceRecentlyUploadList) {
429
- this.deviceRecentlyUploadSum += item.y
430
- }
431
- this.loadDeviceUploadTimesState = 'success'
432
- }, err => {
433
- console.warn(err)
434
- this.loadDeviceUploadTimesState = 'error'
435
- })
436
- },
437
- /**
438
- * 获取设备累计失联次数和近三个月失联情况
439
- */
440
- getDeviceLostContactCount () {
441
- this.loadDeviceLostContactState = 'loading'
442
- return post(DeviceDetailsCountApi.getDeviceLostContactCount, {
443
- deviceId: this.deviceId
444
- }).then(res => {
445
- this.lostContactTimes = res.value
446
- this.lastLostContactDate = res.lastLostContactDate
447
- this.deviceLostContactList = res.lostContactList
448
- this.loadDeviceLostContactState = 'success'
449
- }, err => {
450
- console.warn(err)
451
- this.loadDeviceLostContactState = 'error'
452
- })
453
- },
454
- /**
455
- * 获取设备指令下发成功率
456
- */
457
- getInstructRateOfSuccess () {
458
- this.deviceInstructRateOfSuccessLoadState = 'loading'
459
- post(DeviceDetailsCountApi.getInstructRateOfSuccess, {
460
- deviceId: this.deviceId
461
- }).then(res => {
462
- this.deviceInstructRateOfSuccessValue = res.deviceInstructRateOfSuccessValue * 1.0
463
- if (this.deviceInstructRateOfSuccessValue < 70.0) {
464
- this.deviceInstructRateOfColor = 'rgb(242, 99, 123)'
465
- } else if (this.deviceInstructRateOfSuccessValue < 90.0) {
466
- this.deviceInstructRateOfColor = 'rgb(251, 212, 55)'
467
- } else {
468
- this.deviceInstructRateOfColor = 'rgb(19, 194, 194)'
469
- }
470
- this.deviceInstructCount = res.value
471
- this.deviceInstructRateOfSuccessLoadState = 'success'
472
- }, err => {
473
- console.warn(err)
474
- this.deviceInstructRateOfSuccessLoadState = 'error'
475
- })
476
- },
477
- /**
478
- * 格式化日期
479
- * @param date 日期字符串
480
- * @param format 格式化方式
481
- * @returns {string|*} 格式化结果
482
- */
483
- format (date, format) {
484
- return formatDate(date, format)
485
- },
486
- /**
487
- * 切换周期
488
- */
489
- toggleCountMode () {
490
- this.updateDataByKey()
491
- },
492
- /**
493
- * Tab切换
494
- */
495
- handleTabChange (key) {
496
- this.tabActiveKey = key + ''
497
- this.updateDataByKey()
498
- },
499
- /**
500
- * 根据模式更新数据
501
- */
502
- updateDataByKey () {
503
- if (this.tabActiveKey === '1') {
504
- this.getDeviceUploadCountData()
505
- } else {
506
- this.getDeviceLostContactCountData()
507
- this.getDeviceLostContactRankData()
508
- }
509
- },
510
- /**
511
- * 获取设备上报情况
512
- */
513
- getDeviceUploadCountData () {
514
- this.radarLoadState = 'loading'
515
- fetch(DeviceDetailsCountApi.getDeviceUploadCountData, {
516
- method: 'POST',
517
- body: JSON.stringify({
518
- deviceId: this.deviceId,
519
- type: this.countMode
520
- })
521
- }).then((res) => res.json())
522
- .then((data) => {
523
- const count = data.count
524
- const plotOption = {
525
- data: count,
526
- xField: 'date',
527
- yField: 'value',
528
- seriesField: 'name',
529
- yAxis: {
530
- label: {
531
- // 数值格式化为千分位
532
- formatter: (v) => `${v}`.replace(/\d{1,3}(?=(\d{3})+$)/g, (s) => `${s},`)
533
- }
534
- },
535
- tooltip: {
536
- shared: true
537
- },
538
- interactions: [{ type: 'brush' }],
539
- slider: {
540
- start: 0,
541
- end: 1
542
- },
543
- legend: {
544
- position: 'top',
545
- radio: true,
546
- flipPage: false
547
- },
548
- smooth: true
549
- }
550
- if (data.legendStyle) {
551
- plotOption.legend.selected = data.legendStyle
552
- }
553
- if (this.uploadCountPlot) {
554
- this.uploadCountPlot.update(plotOption)
555
- } else {
556
- this.uploadCountPlot = new Line('container', plotOption)
557
- this.uploadCountPlot.render()
558
- }
559
- this.radarLoadState = 'success'
560
- })
561
- .catch((ex) => {
562
- console.error(ex)
563
- this.radarLoadState = 'error'
564
- })
565
- },
566
- /**
567
- * 获取设备失联情况
568
- */
569
- getDeviceLostContactCountData () {
570
- this.lostContactLoadState = 'loading'
571
- fetch(DeviceDetailsCountApi.getDeviceLostContactCountData, {
572
- method: 'POST',
573
- body: JSON.stringify({
574
- deviceId: this.deviceId,
575
- type: this.countMode
576
- })
577
- }).then((res) => res.json())
578
- .then((data) => {
579
- if (this.lostContactCountPlot) {
580
- this.lostContactCountPlot.changeData(data)
581
- } else {
582
- this.lostContactCountPlot = new Column('lostContactContainer', {
583
- data,
584
- xField: '失联日期',
585
- yField: '失联天数',
586
- xAxis: {
587
- label: {
588
- autoRotate: false,
589
- },
590
- },
591
- slider: {
592
- start: 0,
593
- end: 1
594
- }
595
- })
596
- this.lostContactCountPlot.render()
597
- }
598
- this.lostContactLoadState = 'success'
599
- })
600
- .catch((ex) => {
601
- console.error(ex)
602
- this.lostContactLoadState = 'error'
603
- })
604
- },
605
- /**
606
- * 获取设备失联排行榜
607
- */
608
- getDeviceLostContactRankData () {
609
- this.lostContactRankLoadState = 'loading'
610
- post(DeviceDetailsCountApi.getDeviceLostContactRankData, {
611
- deviceId: this.deviceId,
612
- type: this.countMode
613
- }).then(res => {
614
- this.lostContactRank = res
615
- this.lostContactRankLoadState = 'success'
616
- }, err => {
617
- console.warn(err)
618
- this.lostContactRankLoadState = 'error'
619
- })
620
- }
621
- }
622
- }
623
- </script>
624
-
625
- <style lang="less" scoped>
626
-
627
- .text {
628
- color: rgba(0, 0, 0, .45);
629
- }
630
-
631
- .heading {
632
- color: rgba(0, 0, 0, .85);
633
- font-size: 20px;
634
- }
635
-
636
- .extra-wrapper {
637
- line-height: 55px;
638
- padding-right: 24px;
639
-
640
- .extra-item {
641
- display: inline-block;
642
- margin-right: 24px;
643
-
644
- a {
645
- margin-left: 24px;
646
- }
647
- }
648
- }
649
-
650
- .antd-pro-pages-dashboard-analysis-twoColLayout {
651
- position: relative;
652
- display: flex;
653
- display: block;
654
- flex-flow: row wrap;
655
- }
656
-
657
- .antd-pro-pages-dashboard-analysis-salesCard {
658
- height: calc(100% - 24px);
659
- /deep/ .ant-card-head {
660
- position: relative;
661
- }
662
- }
663
-
664
- .dashboard-analysis-iconGroup {
665
- i {
666
- margin-left: 16px;
667
- color: rgba(0,0,0,.45);
668
- cursor: pointer;
669
- transition: color .32s;
670
- color: black;
671
- }
672
- }
673
- .analysis-salesTypeRadio {
674
- position: absolute;
675
- right: 54px;
676
- bottom: 12px;
677
- }
678
- </style>
1
+ <template>
2
+ <div>
3
+ <a-row :gutter="24">
4
+ <a-col :md="12" :sm="24" :style="{ marginBottom: '24px' }" :xl="6">
5
+ <x-card :loadState="loadDeviceUsedDaySumState" :retry="getDeviceUsedDaySum">
6
+ <chart-card :total="usedDays" title="设备累计使用时长" unit="天">
7
+ <a-tooltip slot="action" :style="{ marginRight: '10px' }" title="刷新" @click="getDeviceUsedDaySum">
8
+ <a-icon type="redo" />
9
+ </a-tooltip>
10
+ <a-tooltip slot="action" title="从安装至今设备使用天数">
11
+ <a-icon type="info-circle-o" />
12
+ </a-tooltip>
13
+ <template slot="footer"><span>{{ format(installDate, 'yyyy-MM-dd') }} 安装</span></template>
14
+ </chart-card>
15
+ </x-card>
16
+ </a-col>
17
+ <a-col :md="12" :sm="24" :style="{ marginBottom: '24px' }" :xl="6">
18
+ <x-card :loadState="loadDeviceUploadTimesState" :retry="getDeviceUploadTimesCount">
19
+ <chart-card :total="uploadTimes | NumberFormat" title="累计上报次数" unit="次">
20
+ <a-tooltip slot="action" :style="{ marginRight: '10px' }" title="刷新" @click="getDeviceUploadTimesCount">
21
+ <a-icon type="redo" />
22
+ </a-tooltip>
23
+ <a-tooltip slot="action" title="从安装至今累计上报次数">
24
+ <a-icon type="info-circle-o" />
25
+ </a-tooltip>
26
+ <div>
27
+ <mini-area :dataSource="deviceRecentlyUploadList" :scale="deviceRecentlyUploadScale" />
28
+ </div>
29
+ <template slot="footer">近七天共上报 <span>{{ deviceRecentlyUploadSum | NumberFormat }} 次</span></template>
30
+ </chart-card>
31
+ </x-card>
32
+ </a-col>
33
+ <a-col :md="12" :sm="24" :style="{ marginBottom: '24px' }" :xl="6">
34
+ <x-card :loadState="loadDeviceLostContactState" :retry="getDeviceLostContactCount">
35
+ <chart-card :total="lostContactTimes | NumberFormat" title="累计失联次数" unit="次">
36
+ <a-tooltip slot="action" :style="{ marginRight: '10px' }" title="刷新" @click="getDeviceLostContactCount()">
37
+ <a-icon type="redo" />
38
+ </a-tooltip>
39
+ <a-tooltip slot="action" title="从安装至今累计失联(即3天未上报)次数">
40
+ <a-icon type="info-circle-o" />
41
+ </a-tooltip>
42
+ <div>
43
+ <mini-bar :dataSource="deviceLostContactList" :scale="deviceLostContactScale" />
44
+ </div>
45
+ <template slot="footer">最近失联日期 <span> {{ format(lastLostContactDate, 'yyyy-MM-dd') }}</span></template>
46
+ </chart-card>
47
+ </x-card>
48
+ </a-col>
49
+ <a-col :md="12" :sm="24" :style="{ marginBottom: '24px' }" :xl="6">
50
+ <x-card :loadState="deviceInstructRateOfSuccessLoadState" :retry="getInstructRateOfSuccess">
51
+ <chart-card :total="deviceInstructRateOfSuccessValue" title="指令下发成功率" unit="%">
52
+ <a-tooltip slot="action" :style="{ marginRight: '10px' }" title="刷新" @click="getInstructRateOfSuccess()">
53
+ <a-icon type="redo" />
54
+ </a-tooltip>
55
+ <a-tooltip slot="action" title="执行成功和已发送状态的指令占所有指令的比例">
56
+ <a-icon type="info-circle-o" />
57
+ </a-tooltip>
58
+ <div>
59
+ <mini-progress :color="deviceInstructRateOfColor" :percentage="deviceInstructRateOfSuccessValue" :target="90" height="8px" />
60
+ </div>
61
+ <template slot="footer">共下发指令 <span> {{ deviceInstructCount | NumberFormat }} 次</span></template>
62
+ </chart-card>
63
+ </x-card>
64
+ </a-col>
65
+ </a-row>
66
+
67
+ <a-card :body-style="{padding: '0'}" :bordered="false" :loading="loading">
68
+ <div class="salesCard">
69
+ <a-tabs :activeKey="tabActiveKey" :default-active-key="tabActiveKey" :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}" size="large" @change="handleTabChange">
70
+ <div slot="tabBarExtraContent" class="extra-wrapper">
71
+ <div class="extra-item">
72
+ <a-radio-group v-model="countMode" button-style="solid" @change="toggleCountMode">
73
+ <a-radio-button value="now">最近24小时</a-radio-button>
74
+ <a-radio-button value="week">近一周</a-radio-button>
75
+ <a-radio-button value="month">近一个月</a-radio-button>
76
+ <a-radio-button value="year">近一年</a-radio-button>
77
+ </a-radio-group>
78
+ </div>
79
+ <a-range-picker :style="{width: '256px'}" />
80
+ </div>
81
+ <a-tab-pane key="1" tab="上报情况分析">
82
+ <a-row :lg="24" :md="24" :sm="24" :xl="24" :xs="24">
83
+ <x-card :loadState="radarLoadState" :retry="getDeviceUploadCountData">
84
+ <div id="container" style="padding: 0 0 0 20px;height: 370px" />
85
+ </x-card>
86
+ </a-row>
87
+ </a-tab-pane>
88
+ <a-tab-pane key="2" tab="失联情况分析">
89
+ <a-row>
90
+ <a-col :lg="12" :md="12" :sm="24" :xl="16" :xs="24">
91
+ <x-card :loadState="lostContactLoadState" :retry="getDeviceLostContactCountData">
92
+ <div id="lostContactContainer" style="padding: 0 0 0 20px;height: 370px" />
93
+ </x-card>
94
+ </a-col>
95
+ <a-col :lg="12" :md="12" :sm="24" :xl="8" :xs="24">
96
+ <x-card :loadState="lostContactRankLoadState" :retry="getDeviceLostContactCountData">
97
+ <rank-list :list="lostContactRank" title="失联天数排行"/>
98
+ </x-card>
99
+ </a-col>
100
+ </a-row>
101
+ </a-tab-pane>
102
+ </a-tabs>
103
+ </div>
104
+ </a-card>
105
+
106
+ <div :class="!isMobile && 'desktop'" class="antd-pro-pages-dashboard-analysis-twoColLayout">
107
+ <a-row :gutter="24" :style="{ marginTop: '24px' }" type="flex">
108
+ <a-col :lg="24" :md="24" :sm="24" :xl="12" :xs="24">
109
+ <a-card :bordered="false" :loading="loading" :style="{ height: '100%' }" title="异常报警分析">
110
+ <a-dropdown slot="extra" :trigger="['click']" placement="bottomLeft">
111
+ <a class="ant-dropdown-link" href="#">
112
+ <a-icon type="ellipsis" />
113
+ </a>
114
+ <a-menu slot="overlay">
115
+ <a-menu-item>
116
+ <a href="javascript:">异常处理</a>
117
+ </a-menu-item>
118
+ <a-menu-item>
119
+ <a href="javascript;">转向异常</a>
120
+ </a-menu-item>
121
+ </a-menu>
122
+ </a-dropdown>
123
+ <a-row :gutter="68">
124
+ <a-col :sm="12" :style="{ marginBottom: ' 24px'}" :xs="24">
125
+ <number-info :sub-total="0" :total="0">
126
+ <span slot="subtitle">
127
+ <span>异常发生次数</span>
128
+ <a-tooltip slot="action" title="近一年内发生异常的次数">
129
+ <a-icon :style="{ marginLeft: '8px' }" type="info-circle-o" />
130
+ </a-tooltip>
131
+ </span>
132
+ </number-info>
133
+ <!-- miniChart -->
134
+ <div>
135
+ <mini-smooth-area :dataSource="searchUserData" :scale="searchUserScale" :style="{ height: '45px' }" />
136
+ </div>
137
+ </a-col>
138
+ <a-col :sm="12" :style="{ marginBottom: ' 24px'}" :xs="24">
139
+ <number-info :sub-total="0" :total="0" status="up">
140
+ <span slot="subtitle">
141
+ <span>报警发生次数</span>
142
+ <a-tooltip slot="action" title="近一年内发生报警的次数">
143
+ <a-icon :style="{ marginLeft: '8px' }" type="info-circle-o" />
144
+ </a-tooltip>
145
+ </span>
146
+ </number-info>
147
+ <!-- miniChart -->
148
+ <div>
149
+ <mini-smooth-area :dataSource="searchUserData" :scale="searchUserScale" :style="{ height: '45px' }" />
150
+ </div>
151
+ </a-col>
152
+ </a-row>
153
+ <div class="ant-table-wrapper">
154
+ <a-table
155
+ :columns="searchTableColumns"
156
+ :dataSource="searchData"
157
+ :pagination="{ pageSize: 5 }"
158
+ row-key="index"
159
+ size="small"
160
+ >
161
+ <span slot="range" slot-scope="text, record">
162
+ <trend :flag="record.status === 0 ? 'up' : 'down'">
163
+ {{ text }}%
164
+ </trend>
165
+ </span>
166
+ </a-table>
167
+ </div>
168
+ </a-card>
169
+ </a-col>
170
+ <a-col :lg="24" :md="24" :sm="24" :xl="12" :xs="24">
171
+ <a-card :bordered="false" :loading="loading" :style="{ height: '100%' }" class="antd-pro-pages-dashboard-analysis-salesCard" title="指令类别占比">
172
+ <div slot="extra" style="height: inherit;">
173
+ <div class="analysis-salesTypeRadio">
174
+ <a-radio-group defaultValue="a">
175
+ <a-radio-button value="a">本日</a-radio-button>
176
+ <a-radio-button value="b">本周</a-radio-button>
177
+ <a-radio-button value="c">本月</a-radio-button>
178
+ </a-radio-group>
179
+ </div>
180
+ </div>
181
+ <h4></h4>
182
+ <div>
183
+ <!-- style="width: calc(100% - 240px);" -->
184
+ <div>
185
+ <v-chart :data="pieData" :force-fit="true" :height="405" :scale="pieScale">
186
+ <v-tooltip :showTitle="false" dataKey="item*percent" />
187
+ <v-axis />
188
+ <!-- position="right" :offsetX="-140" -->
189
+ <v-legend dataKey="item"/>
190
+ <v-pie :vStyle="pieStyle" color="item" position="percent" />
191
+ <v-coord :innerRadius="0.6" :radius="0.75" type="theta" />
192
+ </v-chart>
193
+ </div>
194
+ </div>
195
+ </a-card>
196
+ </a-col>
197
+ </a-row>
198
+ </div>
199
+ </div>
200
+ </template>
201
+
202
+ <script>
203
+ import moment from 'moment'
204
+ import {
205
+ ChartCard,
206
+ MiniArea,
207
+ MiniBar,
208
+ MiniProgress,
209
+ RankList,
210
+ Bar,
211
+ Trend,
212
+ NumberInfo,
213
+ MiniSmoothArea
214
+ } from '@vue2-client/components'
215
+ import { formatDate } from '@vue2-client/utils/util'
216
+ import { Line, Column } from '@antv/g2plot'
217
+ import { mapState } from 'vuex'
218
+ import { post } from '@vue2-client/services/api'
219
+ import { DeviceDetailsCountApi } from '@vue2-client/services/api/iot/DeviceDetailsView/DeviceDetailsCountApi'
220
+
221
+ const searchUserData = []
222
+ for (let i = 0; i < 7; i++) {
223
+ searchUserData.push({
224
+ x: moment().add(i, 'days').format('YYYY-MM-DD'),
225
+ y: Math.ceil(Math.random() * 10)
226
+ })
227
+ }
228
+ const searchUserScale = [
229
+ {
230
+ dataKey: 'x',
231
+ alias: '时间'
232
+ },
233
+ {
234
+ dataKey: 'y',
235
+ alias: '发生次数',
236
+ min: 0,
237
+ max: 10
238
+ }]
239
+
240
+ const searchTableColumns = [
241
+ {
242
+ dataIndex: 'index',
243
+ title: '异常类型',
244
+ width: 90
245
+ },
246
+ {
247
+ dataIndex: 'keyword',
248
+ title: '异常说明'
249
+ },
250
+ {
251
+ dataIndex: 'count',
252
+ title: '发生时间'
253
+ },
254
+ {
255
+ dataIndex: 'range',
256
+ title: '是否处理',
257
+ align: 'right'
258
+ }
259
+ ]
260
+
261
+ const searchData = []
262
+
263
+ const DataSet = require('@antv/data-set')
264
+
265
+ const sourceData = [
266
+ { item: '远程开户', count: 32.2 },
267
+ { item: '远程充值', count: 21 },
268
+ { item: '阀门控制', count: 17 },
269
+ { item: '远程调价', count: 13 },
270
+ { item: '设置参数', count: 9 },
271
+ { item: '远程注销', count: 7.8 }
272
+ ]
273
+
274
+ const pieScale = [{
275
+ dataKey: 'percent',
276
+ min: 0,
277
+ formatter: '.0%'
278
+ }]
279
+
280
+ const dv = new DataSet.View().source(sourceData)
281
+ dv.transform({
282
+ type: 'percent',
283
+ field: 'count',
284
+ dimension: 'item',
285
+ as: 'percent'
286
+ })
287
+ const pieData = dv.rows
288
+
289
+ export default {
290
+ name: 'DeviceDetailsCount',
291
+ components: {
292
+ ChartCard,
293
+ MiniArea,
294
+ MiniBar,
295
+ MiniProgress,
296
+ RankList,
297
+ Bar,
298
+ Trend,
299
+ NumberInfo,
300
+ MiniSmoothArea
301
+ },
302
+ data () {
303
+ return {
304
+ // 页面宽度
305
+ screenWidth: document.documentElement.clientWidth,
306
+ // 客户名称
307
+ customerName: '',
308
+ // >> 设备累计使用时长统计
309
+ // 设备近七天上报情况
310
+ deviceRecentlyUploadList: [],
311
+ // 设备累计使用天数
312
+ usedDays: 0,
313
+ // 设备安装时间
314
+ installDate: '',
315
+ // 设备累计使用天数加载状态
316
+ loadDeviceUsedDaySumState: 'loading',
317
+ // >> 设备累计上报次数统计
318
+ // 设备累计上报次数
319
+ uploadTimes: 0,
320
+ // 设备近七天上报总次数
321
+ deviceRecentlyUploadSum: 0,
322
+ // 设备近七天上报情况明细列
323
+ deviceRecentlyUploadScale: [{ dataKey: 'x', alias: '时间' }, { dataKey: 'y', alias: '次数' }],
324
+ // 设备累计上报次数加载状态
325
+ loadDeviceUploadTimesState: 'loading',
326
+ // >> 设备累计失联次数统计
327
+ // 设备近三个月失联情况
328
+ deviceLostContactList: [],
329
+ // 设备累计失联次数
330
+ lostContactTimes: 0,
331
+ // 设备最近失联日期
332
+ lastLostContactDate: undefined,
333
+ // 设备近七天失联情况明细列
334
+ deviceLostContactScale: [{ dataKey: 'x', alias: '时间' }, { dataKey: 'y', alias: '失联天数' }],
335
+ // 设备累计失联次数加载状态
336
+ loadDeviceLostContactState: 'loading',
337
+ // >> 设备指令下发成功率统计
338
+ // 设备指令成功率
339
+ deviceInstructRateOfSuccessValue: 0,
340
+ // 设备指令总数
341
+ deviceInstructCount: 0,
342
+ // 指令成功率进度色
343
+ deviceInstructRateOfColor: 'rgb(19, 194, 194)',
344
+ // 设备指令下发成功率加载状态
345
+ deviceInstructRateOfSuccessLoadState: 'loading',
346
+
347
+ // 是否刷新加载中
348
+ loading: false,
349
+ // 统计模式
350
+ countMode: 'now',
351
+ // 统计类型
352
+ tabActiveKey: '1',
353
+ // >> 设备上报情况统计
354
+ // 上报统计图表
355
+ uploadCountPlot: undefined,
356
+ // 抄表情况分析Loading
357
+ radarLoadState: 'loading',
358
+ // >> 设备失联情况统计
359
+ // 失联统计图表
360
+ lostContactCountPlot: undefined,
361
+ // 失联情况分析Loading
362
+ lostContactLoadState: 'loading',
363
+ // 失联天数排行榜
364
+ lostContactRank: [],
365
+ // 失联天数排行榜Loading
366
+ lostContactRankLoadState: 'loading',
367
+
368
+ // 搜索用户数
369
+ searchUserData,
370
+ searchUserScale,
371
+ searchTableColumns,
372
+ searchData,
373
+
374
+ //
375
+ pieScale,
376
+ pieData,
377
+ sourceData,
378
+ pieStyle: {
379
+ stroke: '#fff',
380
+ lineWidth: 1
381
+ }
382
+ }
383
+ },
384
+ props: {
385
+ deviceId: {
386
+ type: Number,
387
+ required: true
388
+ }
389
+ },
390
+ mounted () {
391
+ this.getDeviceUsedDaySum()
392
+ this.getDeviceUploadTimesCount()
393
+ this.getDeviceLostContactCount()
394
+ this.getInstructRateOfSuccess()
395
+ this.getDeviceUploadCountData()
396
+ },
397
+ computed: {
398
+ ...mapState('setting', ['isMobile'])
399
+ },
400
+ methods: {
401
+ /**
402
+ * 获取设备使用天数
403
+ */
404
+ getDeviceUsedDaySum () {
405
+ this.loadDeviceUsedDaySumState = 'loading'
406
+ post(DeviceDetailsCountApi.getDeviceUsedDaySum, {
407
+ deviceId: this.deviceId
408
+ }).then(res => {
409
+ this.usedDays = res.value
410
+ this.installDate = res.installDate
411
+ this.loadDeviceUsedDaySumState = 'success'
412
+ }, err => {
413
+ console.warn(err)
414
+ this.loadDeviceUsedDaySumState = 'error'
415
+ })
416
+ },
417
+ /**
418
+ * 获取设备累计上报次数和近七天上报情况
419
+ */
420
+ getDeviceUploadTimesCount () {
421
+ this.loadDeviceUploadTimesState = 'loading'
422
+ this.deviceRecentlyUploadSum = 0
423
+ post(DeviceDetailsCountApi.getDeviceUploadTimesCount, {
424
+ deviceId: this.deviceId
425
+ }).then(res => {
426
+ this.uploadTimes = res.value
427
+ this.deviceRecentlyUploadList = res.recentlyUpload
428
+ for (const item of this.deviceRecentlyUploadList) {
429
+ this.deviceRecentlyUploadSum += item.y
430
+ }
431
+ this.loadDeviceUploadTimesState = 'success'
432
+ }, err => {
433
+ console.warn(err)
434
+ this.loadDeviceUploadTimesState = 'error'
435
+ })
436
+ },
437
+ /**
438
+ * 获取设备累计失联次数和近三个月失联情况
439
+ */
440
+ getDeviceLostContactCount () {
441
+ this.loadDeviceLostContactState = 'loading'
442
+ return post(DeviceDetailsCountApi.getDeviceLostContactCount, {
443
+ deviceId: this.deviceId
444
+ }).then(res => {
445
+ this.lostContactTimes = res.value
446
+ this.lastLostContactDate = res.lastLostContactDate
447
+ this.deviceLostContactList = res.lostContactList
448
+ this.loadDeviceLostContactState = 'success'
449
+ }, err => {
450
+ console.warn(err)
451
+ this.loadDeviceLostContactState = 'error'
452
+ })
453
+ },
454
+ /**
455
+ * 获取设备指令下发成功率
456
+ */
457
+ getInstructRateOfSuccess () {
458
+ this.deviceInstructRateOfSuccessLoadState = 'loading'
459
+ post(DeviceDetailsCountApi.getInstructRateOfSuccess, {
460
+ deviceId: this.deviceId
461
+ }).then(res => {
462
+ this.deviceInstructRateOfSuccessValue = res.deviceInstructRateOfSuccessValue * 1.0
463
+ if (this.deviceInstructRateOfSuccessValue < 70.0) {
464
+ this.deviceInstructRateOfColor = 'rgb(242, 99, 123)'
465
+ } else if (this.deviceInstructRateOfSuccessValue < 90.0) {
466
+ this.deviceInstructRateOfColor = 'rgb(251, 212, 55)'
467
+ } else {
468
+ this.deviceInstructRateOfColor = 'rgb(19, 194, 194)'
469
+ }
470
+ this.deviceInstructCount = res.value
471
+ this.deviceInstructRateOfSuccessLoadState = 'success'
472
+ }, err => {
473
+ console.warn(err)
474
+ this.deviceInstructRateOfSuccessLoadState = 'error'
475
+ })
476
+ },
477
+ /**
478
+ * 格式化日期
479
+ * @param date 日期字符串
480
+ * @param format 格式化方式
481
+ * @returns {string|*} 格式化结果
482
+ */
483
+ format (date, format) {
484
+ return formatDate(date, format)
485
+ },
486
+ /**
487
+ * 切换周期
488
+ */
489
+ toggleCountMode () {
490
+ this.updateDataByKey()
491
+ },
492
+ /**
493
+ * Tab切换
494
+ */
495
+ handleTabChange (key) {
496
+ this.tabActiveKey = key + ''
497
+ this.updateDataByKey()
498
+ },
499
+ /**
500
+ * 根据模式更新数据
501
+ */
502
+ updateDataByKey () {
503
+ if (this.tabActiveKey === '1') {
504
+ this.getDeviceUploadCountData()
505
+ } else {
506
+ this.getDeviceLostContactCountData()
507
+ this.getDeviceLostContactRankData()
508
+ }
509
+ },
510
+ /**
511
+ * 获取设备上报情况
512
+ */
513
+ getDeviceUploadCountData () {
514
+ this.radarLoadState = 'loading'
515
+ fetch(DeviceDetailsCountApi.getDeviceUploadCountData, {
516
+ method: 'POST',
517
+ body: JSON.stringify({
518
+ deviceId: this.deviceId,
519
+ type: this.countMode
520
+ })
521
+ }).then((res) => res.json())
522
+ .then((data) => {
523
+ const count = data.count
524
+ const plotOption = {
525
+ data: count,
526
+ xField: 'date',
527
+ yField: 'value',
528
+ seriesField: 'name',
529
+ yAxis: {
530
+ label: {
531
+ // 数值格式化为千分位
532
+ formatter: (v) => `${v}`.replace(/\d{1,3}(?=(\d{3})+$)/g, (s) => `${s},`)
533
+ }
534
+ },
535
+ tooltip: {
536
+ shared: true
537
+ },
538
+ interactions: [{ type: 'brush' }],
539
+ slider: {
540
+ start: 0,
541
+ end: 1
542
+ },
543
+ legend: {
544
+ position: 'top',
545
+ radio: true,
546
+ flipPage: false
547
+ },
548
+ smooth: true
549
+ }
550
+ if (data.legendStyle) {
551
+ plotOption.legend.selected = data.legendStyle
552
+ }
553
+ if (this.uploadCountPlot) {
554
+ this.uploadCountPlot.update(plotOption)
555
+ } else {
556
+ this.uploadCountPlot = new Line('container', plotOption)
557
+ this.uploadCountPlot.render()
558
+ }
559
+ this.radarLoadState = 'success'
560
+ })
561
+ .catch((ex) => {
562
+ console.error(ex)
563
+ this.radarLoadState = 'error'
564
+ })
565
+ },
566
+ /**
567
+ * 获取设备失联情况
568
+ */
569
+ getDeviceLostContactCountData () {
570
+ this.lostContactLoadState = 'loading'
571
+ fetch(DeviceDetailsCountApi.getDeviceLostContactCountData, {
572
+ method: 'POST',
573
+ body: JSON.stringify({
574
+ deviceId: this.deviceId,
575
+ type: this.countMode
576
+ })
577
+ }).then((res) => res.json())
578
+ .then((data) => {
579
+ if (this.lostContactCountPlot) {
580
+ this.lostContactCountPlot.changeData(data)
581
+ } else {
582
+ this.lostContactCountPlot = new Column('lostContactContainer', {
583
+ data,
584
+ xField: '失联日期',
585
+ yField: '失联天数',
586
+ xAxis: {
587
+ label: {
588
+ autoRotate: false,
589
+ },
590
+ },
591
+ slider: {
592
+ start: 0,
593
+ end: 1
594
+ }
595
+ })
596
+ this.lostContactCountPlot.render()
597
+ }
598
+ this.lostContactLoadState = 'success'
599
+ })
600
+ .catch((ex) => {
601
+ console.error(ex)
602
+ this.lostContactLoadState = 'error'
603
+ })
604
+ },
605
+ /**
606
+ * 获取设备失联排行榜
607
+ */
608
+ getDeviceLostContactRankData () {
609
+ this.lostContactRankLoadState = 'loading'
610
+ post(DeviceDetailsCountApi.getDeviceLostContactRankData, {
611
+ deviceId: this.deviceId,
612
+ type: this.countMode
613
+ }).then(res => {
614
+ this.lostContactRank = res
615
+ this.lostContactRankLoadState = 'success'
616
+ }, err => {
617
+ console.warn(err)
618
+ this.lostContactRankLoadState = 'error'
619
+ })
620
+ }
621
+ }
622
+ }
623
+ </script>
624
+
625
+ <style lang="less" scoped>
626
+
627
+ .text {
628
+ color: rgba(0, 0, 0, .45);
629
+ }
630
+
631
+ .heading {
632
+ color: rgba(0, 0, 0, .85);
633
+ font-size: 20px;
634
+ }
635
+
636
+ .extra-wrapper {
637
+ line-height: 55px;
638
+ padding-right: 24px;
639
+
640
+ .extra-item {
641
+ display: inline-block;
642
+ margin-right: 24px;
643
+
644
+ a {
645
+ margin-left: 24px;
646
+ }
647
+ }
648
+ }
649
+
650
+ .antd-pro-pages-dashboard-analysis-twoColLayout {
651
+ position: relative;
652
+ display: flex;
653
+ display: block;
654
+ flex-flow: row wrap;
655
+ }
656
+
657
+ .antd-pro-pages-dashboard-analysis-salesCard {
658
+ height: calc(100% - 24px);
659
+ /deep/ .ant-card-head {
660
+ position: relative;
661
+ }
662
+ }
663
+
664
+ .dashboard-analysis-iconGroup {
665
+ i {
666
+ margin-left: 16px;
667
+ color: rgba(0,0,0,.45);
668
+ cursor: pointer;
669
+ transition: color .32s;
670
+ color: black;
671
+ }
672
+ }
673
+ .analysis-salesTypeRadio {
674
+ position: absolute;
675
+ right: 54px;
676
+ bottom: 12px;
677
+ }
678
+ </style>