vue2-client 1.2.77 → 1.2.80

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,6 +1,19 @@
1
1
  # Change Log
2
2
  > 所有关于本项目的变化都在该文档里。
3
3
 
4
+ **1.2.80 -2022-07-18 @江超**
5
+ - 功能修改:
6
+ - 更新物联网表统计页面
7
+
8
+ **1.2.79 -2022-06-24 @苗艳强**
9
+ - 问题修复:
10
+ - x-form-table:
11
+ - 修复fixedQueryForm属性变化时查询表单异常清空问题
12
+
13
+ **1.2.78 -2022-06-24 @江超**
14
+ - 功能修改:
15
+ - 更新物联网设备统计页面
16
+
4
17
  **1.2.75 - 1.2.77 -2022-06-18 @江超**
5
18
  - 功能修改:
6
19
  - 依赖更新
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.2.77",
3
+ "version": "1.2.80",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -104,7 +104,7 @@ export default {
104
104
  formData.append('resUploadStock', this.model.resUploadStock)
105
105
  formData.append('filename', info.file.name)
106
106
  formData.append('filesize', (info.file.size / 1024 / 1024).toFixed(4))
107
- formData.append('f_operator', this.currUser.username)
107
+ formData.append('f_operator', this.currUser ? this.currUser.username : '')
108
108
 
109
109
  // const url = '/webmeteruploadapi/resource'
110
110
  // if (process.env.NODE_ENV === 'production') {
@@ -192,13 +192,11 @@ export default {
192
192
  },
193
193
  fixedQueryForm: {
194
194
  handler () {
195
- this.mainLoading = true
196
195
  this.form = {}
197
196
  indexedDB.getByWeb(this.queryParamsName, commonApi.getColumnsJson, { str: this.queryParamsName }, (ret) => {
198
197
  this.tableColumns = ret.columnJson
199
198
  this.formItems = ret.formJson
200
199
  this.buttonState = ret.buttonState
201
- this.mainLoading = false
202
200
  this.loaded = true
203
201
  })
204
202
  },
@@ -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
  }
@@ -86,21 +86,23 @@
86
86
  </a-col>
87
87
  </a-row>
88
88
 
89
- <a-card :body-style="{padding: '0'}" :bordered="false" :loading="loading">
89
+ <a-card :body-style="{padding: '0'}" :bordered="false">
90
90
  <div class="salesCard">
91
- <a-tabs :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}" default-active-key="1" size="large">
91
+ <a-tabs :activeKey="tabActiveKey" :default-active-key="tabActiveKey" :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}" size="large" @change="handleTabChange">
92
92
  <div slot="tabBarExtraContent" class="extra-wrapper">
93
93
  <div class="extra-item">
94
- <a>今日</a>
95
- <a>本周</a>
96
- <a>本月</a>
97
- <a>本年</a>
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>
98
100
  </div>
99
101
  <a-range-picker :style="{width: '256px'}" />
100
102
  </div>
101
103
  <a-tab-pane key="1" tab="抄表情况分析">
102
104
  <a-row :lg="24" :md="24" :sm="24" :xl="24" :xs="24">
103
- <x-card :loadState="radarLoadState" :retry="loadGasView">
105
+ <x-card :loadState="radarLoadState" :retry="getHandPlanCountByMeterBrand">
104
106
  <div id="container" style="padding: 0 0 0 20px;height: 370px" />
105
107
  </x-card>
106
108
  </a-row>
@@ -122,7 +124,7 @@
122
124
  <div :class="!isMobile && 'desktop'" class="antd-pro-pages-dashboard-analysis-twoColLayout">
123
125
  <a-row :gutter="24" :style="{ marginTop: '24px' }" type="flex">
124
126
  <a-col :lg="24" :md="24" :sm="24" :xl="12" :xs="24">
125
- <a-card :bordered="false" :loading="loading" :style="{ height: '100%' }" title="用气情况排行">
127
+ <x-card :bordered="false" :loadState="useGasLoadState" :retry="loadUseGasData" title="用气情况排行">
126
128
  <a-dropdown slot="extra" :trigger="['click']" placement="bottomLeft">
127
129
  <a class="ant-dropdown-link" href="#">
128
130
  <a-icon type="ellipsis" />
@@ -138,38 +140,38 @@
138
140
  </a-dropdown>
139
141
  <a-row :gutter="68">
140
142
  <a-col :sm="12" :style="{ marginBottom: ' 24px'}" :xs="24">
141
- <number-info :sub-total="17.1" :total="21232.1">
143
+ <number-info :status="useGasSubValue.status" :sub-total="useGasSubValue.subValue" :total="todayUseGasTotalValue">
142
144
  <span slot="subtitle">
143
145
  <span>当天总用气量</span>
144
- <a-tooltip slot="action" title="指标说明">
146
+ <a-tooltip slot="action" title="本日所有物联网表用户总用气量">
145
147
  <a-icon :style="{ marginLeft: '8px' }" type="info-circle-o" />
146
148
  </a-tooltip>
147
149
  </span>
148
150
  </number-info>
149
151
  <!-- miniChart -->
150
152
  <div>
151
- <mini-smooth-area :dataSource="searchUserData" :scale="searchUserScale" :style="{ height: '45px' }" />
153
+ <mini-smooth-area :dataSource="useGasWeekData" :scale="useGasWeekDataScale" :style="{ height: '45px' }" />
152
154
  </div>
153
155
  </a-col>
154
156
  <a-col :sm="12" :style="{ marginBottom: ' 24px'}" :xs="24">
155
- <number-info :sub-total="0.2" :total="0.7" status="up">
157
+ <number-info :status="handPlanUserSubValue.status" :sub-total="handPlanUserSubValue.subValue" :total="todayHandPlanUserCount">
156
158
  <span slot="subtitle">
157
- <span>人均用气量</span>
158
- <a-tooltip slot="action" title="指标说明">
159
+ <span>当天总抄表用户数</span>
160
+ <a-tooltip slot="action" title="当天总抄表用户数">
159
161
  <a-icon :style="{ marginLeft: '8px' }" type="info-circle-o" />
160
162
  </a-tooltip>
161
163
  </span>
162
164
  </number-info>
163
165
  <!-- miniChart -->
164
166
  <div>
165
- <mini-smooth-area :dataSource="searchUserData" :scale="searchUserScale" :style="{ height: '45px' }" />
167
+ <mini-smooth-area :dataSource="handPlanUserData" :scale="handPlanUserDataScale" :style="{ height: '45px' }" />
166
168
  </div>
167
169
  </a-col>
168
170
  </a-row>
169
171
  <div class="ant-table-wrapper">
170
172
  <a-table
171
173
  :columns="searchTableColumns"
172
- :dataSource="searchData"
174
+ :dataSource="gasConsumptionRanking"
173
175
  :pagination="{ pageSize: 5 }"
174
176
  row-key="index"
175
177
  size="small"
@@ -181,10 +183,10 @@
181
183
  </span>
182
184
  </a-table>
183
185
  </div>
184
- </a-card>
186
+ </x-card>
185
187
  </a-col>
186
188
  <a-col :lg="24" :md="24" :sm="24" :xl="12" :xs="24">
187
- <a-card :bordered="false" :loading="loading" :style="{ height: '100%' }" class="antd-pro-pages-dashboard-analysis-salesCard" title="指令类别占比">
189
+ <a-card :bordered="false" :loading="false" :style="{ height: '100%' }" class="antd-pro-pages-dashboard-analysis-salesCard" title="指令类别占比">
188
190
  <div slot="extra" style="height: inherit;">
189
191
  <div class="analysis-salesTypeRadio">
190
192
  <a-radio-group defaultValue="a">
@@ -262,17 +264,6 @@ for (let i = 0; i < 7; i++) {
262
264
  y: Math.ceil(Math.random() * 10)
263
265
  })
264
266
  }
265
- const searchUserScale = [
266
- {
267
- dataKey: 'x',
268
- alias: '时间'
269
- },
270
- {
271
- dataKey: 'y',
272
- alias: '用气量',
273
- min: 0,
274
- max: 10
275
- }]
276
267
 
277
268
  const searchTableColumns = [
278
269
  {
@@ -363,6 +354,7 @@ export default {
363
354
  screenWidth: document.documentElement.clientWidth,
364
355
  // 客户名称
365
356
  customerName: '',
357
+ // >> 指令总数统计
366
358
  // 指令数统计Loading
367
359
  instructSumLoadState: 'loading',
368
360
  // 总指令数
@@ -373,6 +365,7 @@ export default {
373
365
  instructYoD: 0,
374
366
  // 昨日新增指令数
375
367
  instructYesAdd: 0,
368
+ // >> 抄表量统计
376
369
  // 抄表量统计Loading
377
370
  metereadSumLoadState: 'loading',
378
371
  // 总抄表量
@@ -392,8 +385,7 @@ export default {
392
385
  alias: '抄表量'
393
386
  }
394
387
  ],
395
- // 抄表情况分析Loading
396
- radarLoadState: 'loading',
388
+ // >> 在用表具数统计
397
389
  // 在用表具统计Loading
398
390
  usingMeterSumLoadState: 'loading',
399
391
  // 在用表具总量
@@ -413,9 +405,8 @@ export default {
413
405
  alias: '开户数'
414
406
  }
415
407
  ],
416
- // 指令成功率统计Loading
417
- instructRateOfSuccessLoadState: 'loading',
418
- // 指令成功率
408
+ // >> 表具指令下发成功率统计
409
+ // 表具指令成功率
419
410
  instructRateOfSuccessValue: 0,
420
411
  // 昨日指令成功率
421
412
  yesterdayInstructRateOf: 0,
@@ -425,13 +416,59 @@ export default {
425
416
  instructRateOfSuccessYoD: 0,
426
417
  // 指令成功率进度色
427
418
  instructRateOfColor: 'rgb(19, 194, 194)',
428
- // 是否刷新加载中
429
- loading: false,
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: [],
430
468
  rankList,
431
469
 
432
470
  // 搜索用户数
433
471
  searchUserData,
434
- searchUserScale,
435
472
  searchTableColumns,
436
473
  searchData,
437
474
 
@@ -457,18 +494,37 @@ export default {
457
494
  this.loadUsingMeterSumCount()
458
495
  // 加载指令成功率统计
459
496
  this.loadInstructRateOfSuccess()
460
- // 加载g2图表
461
- this.loadGasView()
497
+ // 加载各表厂表具上报情况统计
498
+ this.getHandPlanCountByMeterBrand()
499
+ // 加载用气量统计
500
+ this.loadUseGasData()
462
501
  },
463
502
  computed: {
464
- ...mapState('setting', ['isMobile'])
465
- },
466
- props: {
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
+ },
467
520
  },
468
521
  methods: {
522
+ /**
523
+ * 加载指令总数统计
524
+ */
469
525
  loadInstructSumCount () {
470
526
  this.instructSumLoadState = 'loading'
471
- return post(WebmeterAnalysisViewApi.instructSumCount, {}).then(res => {
527
+ post(WebmeterAnalysisViewApi.instructSumCount, {}).then(res => {
472
528
  this.instructSum = res.instructSum
473
529
  this.instructYoW = res.instructYoW
474
530
  this.instructYoD = res.instructYoD
@@ -479,10 +535,13 @@ export default {
479
535
  this.instructSumLoadState = 'error'
480
536
  })
481
537
  },
538
+ /**
539
+ * 加载抄表总数统计
540
+ */
482
541
  loadMetereadSumCount () {
483
542
  this.metereadSumDataByWeek = []
484
543
  this.metereadSumLoadState = 'loading'
485
- return post(WebmeterAnalysisViewApi.meteReadSumCount, {}).then(res => {
544
+ post(WebmeterAnalysisViewApi.meteReadSumCount, {}).then(res => {
486
545
  // 加载近一周抄表数图表
487
546
  post(WebmeterAnalysisViewApi.meteReadDataByWeek, {}).then(res => {
488
547
  for (let i = 0, len = res.length; i < len; i++) {
@@ -500,6 +559,9 @@ export default {
500
559
  this.metereadSumLoadState = 'error'
501
560
  })
502
561
  },
562
+ /**
563
+ * 加载在用表具总数情况
564
+ */
503
565
  loadUsingMeterSumCount () {
504
566
  this.usingMeterSumDataByWeek = []
505
567
  this.usingMeterSumLoadState = 'loading'
@@ -521,9 +583,12 @@ export default {
521
583
  this.usingMeterSumLoadState = 'error'
522
584
  })
523
585
  },
586
+ /**
587
+ * 加载表具指令下发成功率
588
+ */
524
589
  loadInstructRateOfSuccess () {
525
590
  this.instructRateOfSuccessLoadState = 'loading'
526
- return post(WebmeterAnalysisViewApi.instructRateOfSuccess, {}).then(res => {
591
+ post(WebmeterAnalysisViewApi.instructRateOfSuccess, {}).then(res => {
527
592
  this.instructRateOfSuccessValue = res.instructRateOfSuccessValue * 1.0
528
593
  if (this.instructRateOfSuccessValue < 70.0) {
529
594
  this.instructRateOfColor = 'rgb(242, 99, 123)'
@@ -541,21 +606,52 @@ export default {
541
606
  this.instructRateOfSuccessLoadState = 'error'
542
607
  })
543
608
  },
609
+ /**
610
+ * 格式化日期
611
+ * @param date 日期字符串
612
+ * @param format 格式化方式
613
+ * @returns {string|*} 格式化结果
614
+ */
544
615
  format (date, format) {
545
616
  return formatDate(date, format)
546
617
  },
547
- loadGasView () {
548
- const _this = this
549
- _this.getHandPlanCountByMeterBrand()
618
+ /**
619
+ * 切换周期
620
+ */
621
+ toggleCountMode () {
622
+ this.updateDataByKey()
550
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
+ */
551
645
  getHandPlanCountByMeterBrand () {
552
646
  this.radarLoadState = 'loading'
553
- fetch('/webmeterapi/foreignaidHandMeterSumCountData', {
647
+ fetch(WebmeterAnalysisViewApi.handMeterSumCountData, {
554
648
  method: 'POST',
555
- body: JSON.stringify({})
649
+ body: JSON.stringify({
650
+ type: this.countMode
651
+ })
556
652
  }).then((res) => res.json())
557
653
  .then((data) => {
558
- const linePlot = new Line('container', {
654
+ const plotOption = {
559
655
  data,
560
656
  xField: 'date',
561
657
  yField: 'value',
@@ -571,20 +667,47 @@ export default {
571
667
  },
572
668
  interactions: [{ type: 'brush' }],
573
669
  slider: {
574
- start: 0.5,
670
+ start: 0,
575
671
  end: 1
576
672
  },
577
673
  legend: {
578
- position: 'top'
674
+ position: 'top',
675
+ radio: true,
676
+ flipPage: false
579
677
  },
580
678
  smooth: true
581
- })
582
- linePlot.render()
679
+ }
680
+ if (this.uploadCountPlot) {
681
+ this.uploadCountPlot.update(plotOption)
682
+ } else {
683
+ this.uploadCountPlot = new Line('container', plotOption)
684
+ this.uploadCountPlot.render()
685
+ }
583
686
  this.radarLoadState = 'success'
584
687
  })
585
- .catch((ex) => {
586
- console.error(ex)
587
- this.radarLoadState = 'error'
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'
588
711
  })
589
712
  }
590
713
  }
@@ -1,30 +1,20 @@
1
- const WebmeterAnalysisViewApi = {
2
- // 查询:指令数统计
3
- instructSumCount: '/webmeterapi/foreignaidInstructSumCountData',
4
- // 查询:抄表数统计
5
- meteReadSumCount: '/webmeterapi/foreignaidMetereadSumCountData',
6
- // 查询:近一周抄表量数据
7
- meteReadDataByWeek: '/webmeterapi/foreignaidMetereadDataByWeekData',
8
- // 查询:在用表具数
9
- usingMeterSumCount: '/webmeterapi/foreignaidUsingMeterSumCountData',
10
- // 查询:近一周在用表具数数据
11
- usingMeterDataByWeek: '/webmeterapi/foreignaidUsingMeterDataByWeekData',
12
- // 查询:指令成功率统计
13
- instructRateOfSuccess: '/webmeterapi/foreignaidInstructRateOfSuccessData',
14
- // 查询:用气量趋势统计
15
- VerticalChartOfGasConsumption: '/webmeterapi/VerticalChartOfGasConsumption',
16
- // 查询:用气排行榜趋势统计
17
- GasConsumptionRanking: '/webmeterapi/GasConsumptionRanking',
18
- // 查询:指令圆形统计图
19
- InstructionStateDiagram: '/webmeterapi/InstructionStateDiagram',
20
- // 查询:用户气量分析
21
- AnalysisOfUserGasConsumption: '/webmeterapi/AnalysisOfUserGasConsumption',
22
- // 查询:用户气量统计图分析
23
- LineChartOfTotalGasConsumption: '/webmeterapi/LineChartOfTotalGasConsumption',
24
- // 查询:用户用气量分析折线图平均值
25
- LineChartOfPerCapitaGasConsumption: '/webmeterapi/LineChartOfPerCapitaGasConsumption',
26
- // 查询:周用用气量排行榜
27
- RankingOfGasConsumptionAnalysis: '/webmeterapi/RankingOfGasConsumptionAnalysis'
28
- }
29
-
30
- export { WebmeterAnalysisViewApi }
1
+ const WebmeterAnalysisViewApi = {
2
+ // 查询:指令数统计
3
+ instructSumCount: '/webmeterapi/foreignaidInstructSumCountData',
4
+ // 查询:抄表数统计
5
+ meteReadSumCount: '/webmeterapi/foreignaidMetereadSumCountData',
6
+ // 查询:近一周抄表量数据
7
+ meteReadDataByWeek: '/webmeterapi/foreignaidMetereadDataByWeekData',
8
+ // 查询:在用表具数
9
+ usingMeterSumCount: '/webmeterapi/foreignaidUsingMeterSumCountData',
10
+ // 查询:近一周在用表具数数据
11
+ usingMeterDataByWeek: '/webmeterapi/foreignaidUsingMeterDataByWeekData',
12
+ // 查询:指令成功率统计
13
+ instructRateOfSuccess: '/webmeterapi/foreignaidInstructRateOfSuccessData',
14
+ // 查询:按表厂抄表量统计
15
+ handMeterSumCountData: '/webmeterapi/foreignaidHandMeterSumCountData',
16
+ // 查询:统计用气量数据
17
+ useGasSumCount: '/webmeterapi/foreignaidUseGasSumCountData'
18
+ }
19
+
20
+ export { WebmeterAnalysisViewApi }
@@ -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 }