vue2-client 1.2.75 → 1.2.78

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.
package/CHANGELOG.md CHANGED
@@ -1,7 +1,11 @@
1
1
  # Change Log
2
2
  > 所有关于本项目的变化都在该文档里。
3
3
 
4
- **1.2.75 -2022-06-18 @江超**
4
+ **1.2.78 -2022-06-24 @江超**
5
+ - 功能修改:
6
+ - 更新物联网设备统计页面
7
+
8
+ **1.2.75 - 1.2.77 -2022-06-18 @江超**
5
9
  - 功能修改:
6
10
  - 依赖更新
7
11
  - 提交物联网设备统计(完成60%)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.2.75",
3
+ "version": "1.2.78",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -10,40 +10,42 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "@amap/amap-jsapi-loader": "^1.0.1",
13
- "@antv/data-set": "^0.11.4",
13
+ "@antv/data-set": "^0.11.8",
14
14
  "@antv/f2": "^3.8.11",
15
- "@antv/g2plot": "^2.4.19",
15
+ "@antv/g2plot": "^2.4.20",
16
+ "@babel/core": "^7.18.5",
16
17
  "@logicflow/core": "^1.1.20",
17
18
  "@logicflow/extension": "^1.1.20",
18
19
  "@vue/babel-helper-vue-jsx-merge-props": "^1.2.1",
19
20
  "@vue/babel-preset-jsx": "^1.2.4",
20
21
  "animate.css": "^4.1.1",
21
- "ant-design-vue": "1.7.8",
22
+ "ant-design-vue": "^1.7.8",
22
23
  "axios": "^0.27.2",
23
24
  "clipboard": "^2.0.11",
24
- "core-js": "^3.23.1",
25
+ "core-js": "^3.23.2",
26
+ "webpack": "^4.46.0",
25
27
  "date-fns": "^2.28.0",
26
28
  "default-passive-events": "^2.0.0",
27
29
  "enquire.js": "^2.1.6",
28
30
  "file-saver": "^2.0.5",
29
- "highlight.js": "^10.7.3",
30
- "js-cookie": "^2.2.1",
31
+ "highlight.js": "^11.5.1",
32
+ "js-cookie": "^3.0.1",
31
33
  "jsencrypt": "^3.2.1",
32
34
  "lodash.get": "^4.4.2",
33
35
  "mockjs": "^1.1.0",
34
36
  "nprogress": "^0.2.0",
35
37
  "viser-vue": "^2.4.8",
36
38
  "vue": "^2.6.14",
37
- "vue-i18n": "^8.27.1",
39
+ "vue-i18n": "^8.27.2",
38
40
  "vue-infinite-scroll": "^2.0.2",
39
41
  "vue-json-viewer": "^2.2.22",
40
42
  "vue-router": "^3.5.4",
41
43
  "vuedraggable": "^2.24.3",
42
44
  "vuex": "^3.6.2",
43
- "xlsx": "0.18.5"
45
+ "xlsx": "^0.18.5"
44
46
  },
45
47
  "devDependencies": {
46
- "@ant-design/colors": "^4.0.5",
48
+ "@ant-design/colors": "^6.0.0",
47
49
  "@vue/cli-plugin-babel": "^4.5.18",
48
50
  "@vue/cli-plugin-eslint": "^4.5.18",
49
51
  "@vue/cli-plugin-router": "^4.5.18",
@@ -52,13 +54,13 @@
52
54
  "@vue/cli-service": "^4.5.18",
53
55
  "@vue/eslint-config-standard": "^4.0.0",
54
56
  "@vue/test-utils": "^1.3.0",
55
- "@vue/vue2-jest": "^28.0.0",
57
+ "@vue/vue2-jest": "^27.0.0",
56
58
  "@vuepress/plugin-back-to-top": "^1.9.7",
57
59
  "babel-eslint": "^10.1.0",
58
- "babel-jest": "^28.1.1",
60
+ "babel-jest": "^27.1.0",
59
61
  "babel-plugin-transform-remove-console": "^6.9.4",
60
62
  "babel-polyfill": "^6.26.0",
61
- "compression-webpack-plugin": "^4.0.1",
63
+ "compression-webpack-plugin": "^5.0.2",
62
64
  "deepmerge": "^4.2.2",
63
65
  "echarts": "^5.3.3",
64
66
  "eslint": "^6.8.0",
@@ -68,19 +70,20 @@
68
70
  "eslint-plugin-vue": "^6.2.2",
69
71
  "fast-deep-equal": "^3.1.3",
70
72
  "gh-pages": "^3.2.3",
71
- "jest": "^28.1.1",
72
- "less-loader": "^6.2.0",
73
+ "jest": "^27.1.0",
74
+ "less": "^3.13.1",
75
+ "less-loader": "^7.3.0",
73
76
  "react-bmap": "^1.0.130",
74
77
  "script-loader": "^0.7.2",
75
78
  "style-resources-loader": "^1.5.0",
76
79
  "vue-amap": "^0.5.10",
77
80
  "vue-baidu-map": "^0.21.22",
78
- "vue-bmap-gl": "0.0.30",
81
+ "vue-bmap-gl": "^0.0.30",
79
82
  "vue-cli-plugin-style-resources-loader": "^0.1.5",
80
- "vue-mapvgl": "0.0.34",
83
+ "vue-mapvgl": "^0.0.34",
81
84
  "vue-template-compiler": "^2.6.14",
82
85
  "vuepress": "^1.9.7",
83
- "webpack-theme-color-replacer": "1.4.1",
86
+ "webpack-theme-color-replacer": "^1.4.1",
84
87
  "whatwg-fetch": "^3.6.2"
85
88
  },
86
89
  "browserslist": [
@@ -66,10 +66,10 @@
66
66
 
67
67
  <a-card :body-style="{padding: '0'}" :bordered="false" :loading="loading">
68
68
  <div class="salesCard">
69
- <a-tabs :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}" default-active-key="1" size="large">
69
+ <a-tabs :activeKey="tabActiveKey" :default-active-key="tabActiveKey" :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}" size="large" @change="handleTabChange">
70
70
  <div slot="tabBarExtraContent" class="extra-wrapper">
71
71
  <div class="extra-item">
72
- <a-radio-group v-model="uploadCountMode" button-style="solid" @change="getDeviceUploadCountData">
72
+ <a-radio-group v-model="countMode" button-style="solid" @change="toggleCountMode">
73
73
  <a-radio-button value="now">最近24小时</a-radio-button>
74
74
  <a-radio-button value="week">近一周</a-radio-button>
75
75
  <a-radio-button value="month">近一个月</a-radio-button>
@@ -88,10 +88,14 @@
88
88
  <a-tab-pane key="2" tab="失联情况分析">
89
89
  <a-row>
90
90
  <a-col :lg="12" :md="12" :sm="24" :xl="16" :xs="24">
91
- <bar :data="barData2" title="失联发生情况" />
91
+ <x-card :loadState="lostContactLoadState" :retry="getDeviceLostContactCountData">
92
+ <div id="lostContactContainer" style="padding: 0 0 0 20px;height: 370px" />
93
+ </x-card>
92
94
  </a-col>
93
95
  <a-col :lg="12" :md="12" :sm="24" :xl="8" :xs="24">
94
- <rank-list :list="rankList" title="失联天数排行"/>
96
+ <x-card :loadState="lostContactRankLoadState" :retry="getDeviceLostContactCountData">
97
+ <rank-list :list="lostContactRank" title="失联天数排行"/>
98
+ </x-card>
95
99
  </a-col>
96
100
  </a-row>
97
101
  </a-tab-pane>
@@ -102,26 +106,26 @@
102
106
  <div :class="!isMobile && 'desktop'" class="antd-pro-pages-dashboard-analysis-twoColLayout">
103
107
  <a-row :gutter="24" :style="{ marginTop: '24px' }" type="flex">
104
108
  <a-col :lg="24" :md="24" :sm="24" :xl="12" :xs="24">
105
- <a-card :bordered="false" :loading="loading" :style="{ height: '100%' }" title="用气情况排行">
109
+ <a-card :bordered="false" :loading="loading" :style="{ height: '100%' }" title="异常报警分析">
106
110
  <a-dropdown slot="extra" :trigger="['click']" placement="bottomLeft">
107
111
  <a class="ant-dropdown-link" href="#">
108
112
  <a-icon type="ellipsis" />
109
113
  </a>
110
114
  <a-menu slot="overlay">
111
115
  <a-menu-item>
112
- <a href="javascript:">操作一</a>
116
+ <a href="javascript:">异常处理</a>
113
117
  </a-menu-item>
114
118
  <a-menu-item>
115
- <a href="javascript;">操作二</a>
119
+ <a href="javascript;">转向异常</a>
116
120
  </a-menu-item>
117
121
  </a-menu>
118
122
  </a-dropdown>
119
123
  <a-row :gutter="68">
120
124
  <a-col :sm="12" :style="{ marginBottom: ' 24px'}" :xs="24">
121
- <number-info :sub-total="17.1" :total="21232.1">
125
+ <number-info :sub-total="0" :total="0">
122
126
  <span slot="subtitle">
123
- <span>当天总用气量</span>
124
- <a-tooltip slot="action" title="指标说明">
127
+ <span>异常发生次数</span>
128
+ <a-tooltip slot="action" title="近一年内发生异常的次数">
125
129
  <a-icon :style="{ marginLeft: '8px' }" type="info-circle-o" />
126
130
  </a-tooltip>
127
131
  </span>
@@ -132,10 +136,10 @@
132
136
  </div>
133
137
  </a-col>
134
138
  <a-col :sm="12" :style="{ marginBottom: ' 24px'}" :xs="24">
135
- <number-info :sub-total="0.2" :total="0.7" status="up">
139
+ <number-info :sub-total="0" :total="0" status="up">
136
140
  <span slot="subtitle">
137
- <span>人均用气量</span>
138
- <a-tooltip slot="action" title="指标说明">
141
+ <span>报警发生次数</span>
142
+ <a-tooltip slot="action" title="近一年内发生报警的次数">
139
143
  <a-icon :style="{ marginLeft: '8px' }" type="info-circle-o" />
140
144
  </a-tooltip>
141
145
  </span>
@@ -209,32 +213,11 @@ import {
209
213
  MiniSmoothArea
210
214
  } from '@vue2-client/components'
211
215
  import { formatDate } from '@vue2-client/utils/util'
212
- import { Line } from '@antv/g2plot'
216
+ import { Line, Column } from '@antv/g2plot'
213
217
  import { mapState } from 'vuex'
214
218
  import { post } from '@vue2-client/services/api'
215
219
  import { DeviceDetailsCountApi } from '@vue2-client/services/api/iot/DeviceDetailsView/DeviceDetailsCountApi'
216
220
 
217
- const barData = []
218
- const barData2 = []
219
- for (let i = 0; i < 12; i += 1) {
220
- barData.push({
221
- x: `${i + 1}月`,
222
- y: Math.floor(Math.random() * 1000) + 200
223
- })
224
- barData2.push({
225
- x: `${i + 1}月`,
226
- y: Math.floor(Math.random() * 1000) + 200
227
- })
228
- }
229
-
230
- const rankList = []
231
- for (let i = 0; i < 7; i++) {
232
- rankList.push({
233
- name: '白鹭岛 ' + (i + 1) + ' 号店',
234
- total: 1234.56 - i * 100
235
- })
236
- }
237
-
238
221
  const searchUserData = []
239
222
  for (let i = 0; i < 7; i++) {
240
223
  searchUserData.push({
@@ -249,7 +232,7 @@ const searchUserScale = [
249
232
  },
250
233
  {
251
234
  dataKey: 'y',
252
- alias: '用气量',
235
+ alias: '发生次数',
253
236
  min: 0,
254
237
  max: 10
255
238
  }]
@@ -257,46 +240,25 @@ const searchUserScale = [
257
240
  const searchTableColumns = [
258
241
  {
259
242
  dataIndex: 'index',
260
- title: '用户编号',
243
+ title: '异常类型',
261
244
  width: 90
262
245
  },
263
246
  {
264
247
  dataIndex: 'keyword',
265
- title: '用户姓名'
248
+ title: '异常说明'
266
249
  },
267
250
  {
268
251
  dataIndex: 'count',
269
- title: '用气量'
252
+ title: '发生时间'
270
253
  },
271
254
  {
272
255
  dataIndex: 'range',
273
- title: '周涨幅',
274
- align: 'right',
275
- sorter: (a, b) => a.range - b.range,
276
- scopedSlots: { customRender: 'range' }
256
+ title: '是否处理',
257
+ align: 'right'
277
258
  }
278
259
  ]
279
260
 
280
- const userInfoArray = [
281
- '德昌鸿公司2',
282
- '瑞鑫宇公司',
283
- '保康县熊绎中学',
284
- '文康置业有限公司',
285
- '湖北省旗星文化旅游实业有限公司'
286
- ]
287
-
288
261
  const searchData = []
289
- let j = 0
290
- for (let i = 0; i < 5; i += 1) {
291
- searchData.push({
292
- index: Math.floor(Math.random() * 10000000),
293
- keyword: userInfoArray[j],
294
- count: Math.floor(Math.random() * 1000),
295
- range: Math.floor(Math.random() * 10),
296
- status: Math.floor((Math.random() * 10) % 2)
297
- })
298
- j++
299
- }
300
262
 
301
263
  const DataSet = require('@antv/data-set')
302
264
 
@@ -381,16 +343,27 @@ export default {
381
343
  deviceInstructRateOfColor: 'rgb(19, 194, 194)',
382
344
  // 设备指令下发成功率加载状态
383
345
  deviceInstructRateOfSuccessLoadState: 'loading',
346
+
347
+ // 是否刷新加载中
348
+ loading: false,
349
+ // 统计模式
350
+ countMode: 'now',
351
+ // 统计类型
352
+ tabActiveKey: '1',
384
353
  // >> 设备上报情况统计
385
- // 上报统计模式
386
- uploadCountMode: 'now',
387
354
  // 上报统计图表
388
355
  uploadCountPlot: undefined,
389
356
  // 抄表情况分析Loading
390
357
  radarLoadState: 'loading',
391
- // 是否刷新加载中
392
- loading: false,
393
- rankList,
358
+ // >> 设备失联情况统计
359
+ // 失联统计图表
360
+ lostContactCountPlot: undefined,
361
+ // 失联情况分析Loading
362
+ lostContactLoadState: 'loading',
363
+ // 失联天数排行榜
364
+ lostContactRank: [],
365
+ // 失联天数排行榜Loading
366
+ lostContactRankLoadState: 'loading',
394
367
 
395
368
  // 搜索用户数
396
369
  searchUserData,
@@ -398,9 +371,6 @@ export default {
398
371
  searchTableColumns,
399
372
  searchData,
400
373
 
401
- barData,
402
- barData2,
403
-
404
374
  //
405
375
  pieScale,
406
376
  pieData,
@@ -513,6 +483,30 @@ export default {
513
483
  format (date, format) {
514
484
  return formatDate(date, format)
515
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
+ },
516
510
  /**
517
511
  * 获取设备上报情况
518
512
  */
@@ -522,46 +516,107 @@ export default {
522
516
  method: 'POST',
523
517
  body: JSON.stringify({
524
518
  deviceId: this.deviceId,
525
- type: this.uploadCountMode
519
+ type: this.countMode
526
520
  })
527
521
  }).then((res) => res.json())
528
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
+ }
529
553
  if (this.uploadCountPlot) {
530
- this.uploadCountPlot.changeData(data)
554
+ this.uploadCountPlot.update(plotOption)
531
555
  } else {
532
- this.uploadCountPlot = new Line('container', {
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', {
533
583
  data,
534
- xField: 'date',
535
- yField: 'value',
536
- seriesField: 'name',
537
- yAxis: {
584
+ xField: '失联日期',
585
+ yField: '失联天数',
586
+ xAxis: {
538
587
  label: {
539
- // 数值格式化为千分位
540
- formatter: (v) => `${v}`.replace(/\d{1,3}(?=(\d{3})+$)/g, (s) => `${s},`)
541
- }
588
+ autoRotate: false,
589
+ },
542
590
  },
543
- tooltip: {
544
- shared: true
545
- },
546
- interactions: [{ type: 'brush' }],
547
591
  slider: {
548
- start: 0.5,
592
+ start: 0,
549
593
  end: 1
550
- },
551
- legend: {
552
- position: 'top',
553
- radio: true
554
- },
555
- smooth: true
594
+ }
556
595
  })
557
- this.uploadCountPlot.render()
596
+ this.lostContactCountPlot.render()
558
597
  }
559
- this.radarLoadState = 'success'
598
+ this.lostContactLoadState = 'success'
560
599
  })
561
600
  .catch((ex) => {
562
601
  console.error(ex)
563
- this.radarLoadState = 'error'
602
+ this.lostContactLoadState = 'error'
564
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
+ })
565
620
  }
566
621
  }
567
622
  }
@@ -8,7 +8,11 @@ const DeviceDetailsCountApi = {
8
8
  // 获取设备指令下发成功率
9
9
  getInstructRateOfSuccess: '/webmeterapi/getInstructRateOfSuccess',
10
10
  // 获取设备上报情况
11
- getDeviceUploadCountData: 'webmeterapi/getDeviceUploadCountData'
11
+ getDeviceUploadCountData: '/webmeterapi/getDeviceUploadCountData',
12
+ // 获取设备失联情况
13
+ getDeviceLostContactCountData: '/webmeterapi/getDeviceLostContactCountData',
14
+ // 获取设备失联排行榜
15
+ getDeviceLostContactRankData: '/webmeterapi/getDeviceLostContactRankData'
12
16
  }
13
17
 
14
18
  export { DeviceDetailsCountApi }