vue2-client 1.2.74 → 1.2.75

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 (46) hide show
  1. package/.env +15 -15
  2. package/.eslintrc.js +82 -82
  3. package/CHANGELOG.md +5 -0
  4. package/package.json +46 -46
  5. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +225 -225
  6. package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +113 -113
  7. package/src/base-client/components/common/CitySelect/CitySelect.vue +244 -244
  8. package/src/base-client/components/common/CitySelect/index.js +3 -3
  9. package/src/base-client/components/common/CitySelect/index.md +109 -109
  10. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +539 -539
  11. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +773 -773
  12. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +310 -310
  13. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +553 -553
  14. package/src/base-client/components/common/Upload/Upload.vue +151 -151
  15. package/src/base-client/components/common/Upload/index.js +3 -3
  16. package/src/base-client/components/common/XAddForm/XAddForm.vue +345 -345
  17. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +322 -322
  18. package/src/base-client/components/common/XForm/XForm.vue +268 -268
  19. package/src/base-client/components/common/XForm/XFormItem.vue +358 -358
  20. package/src/base-client/components/common/XFormTable/XFormTable.vue +491 -491
  21. package/src/base-client/components/common/XTable/XTable.vue +269 -269
  22. package/src/base-client/components/iot/DeviceDetailsView/DeviceDetailsView.vue +232 -230
  23. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsCount.vue +623 -330
  24. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsException.vue +57 -57
  25. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsRead.vue +131 -131
  26. package/src/base-client/components/iot/DeviceTypeDetailsView/DeviceTypeDetailsView.vue +300 -300
  27. package/src/base-client/components/iot/WebmeterAnalysisView/WebmeterAnalysisView.vue +647 -647
  28. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  29. package/src/base-client/plugins/AppData.js +70 -70
  30. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  31. package/src/components/Charts/ChartCard.vue +14 -0
  32. package/src/config/CreateQueryConfig.js +301 -301
  33. package/src/pages/resourceManage/orgListManage.vue +98 -98
  34. package/src/router/async/config.async.js +26 -26
  35. package/src/router/async/router.map.js +60 -60
  36. package/src/router/index.js +27 -27
  37. package/src/services/api/common.js +56 -56
  38. package/src/services/api/index.js +39 -39
  39. package/src/services/api/iot/DeviceDetailsView/DeviceDetailsCountApi.js +14 -0
  40. package/src/services/api/manage.js +16 -16
  41. package/src/services/api/restTools.js +24 -24
  42. package/src/theme/default/style.less +47 -47
  43. package/src/utils/map-utils.js +28 -28
  44. package/src/utils/request.js +198 -198
  45. package/src/utils/util.js +222 -222
  46. package/vue.config.js +153 -153
@@ -1,330 +1,623 @@
1
- <template>
2
- <div>
3
- <a-row :gutter="24">
4
- <!-- <a-col :md="12" :sm="24">
5
- <a-card
6
- hoverable
7
- title="累计用气量"
8
- style="margin-bottom: 24px"
9
- :bordered="true">
10
- <div>
11
- <a-skeleton v-show="radarLoading3" active />
12
- <div style="height: 200px" id="container2" v-show="!radarLoading3"/>
13
- </div>
14
- </a-card>
15
- </a-col>
16
- <a-col :md="6" :sm="24">
17
- <a-card
18
- hoverable
19
- title="日用气量"
20
- style="margin-bottom: 24px"
21
- :bordered="true">
22
- <div>
23
- <a-skeleton v-show="radarLoading" active />
24
- <div style="height: 200px" id="container" v-show="!radarLoading"/>
25
- </div>
26
- </a-card>
27
- </a-col>
28
- <a-col :md="6" :sm="24">
29
- <a-card
30
- hoverable
31
- title="日用气金额"
32
- style="margin-bottom: 24px"
33
- :bordered="true">
34
- <div>
35
- <a-skeleton v-show="radarLoading2" active />
36
- <div style="height: 200px" id="containerUseMoney" v-show="!radarLoading2"/>
37
- </div>
38
- </a-card>
39
- </a-col>
40
- <a-col :md="12" :sm="24">
41
- <a-card
42
- hoverable
43
- title="剩余余额"
44
- style="margin-bottom: 24px"
45
- :bordered="true">
46
- <div>
47
- <a-skeleton v-show="radarLoading4" active />
48
- <div style="height: 200px" id="container3" v-show="!radarLoading4"/>
49
- </div>
50
- </a-card>
51
- </a-col>
52
- <a-col :md="6" :sm="24">
53
- <a-card
54
- hoverable
55
- title="电压情况"
56
- style="margin-bottom: 24px"
57
- :bordered="true">
58
- <div>
59
- <a-skeleton v-show="radarLoading5" active />
60
- <div style="height: 200px" id="container4" v-show="!radarLoading5"/>
61
- </div>
62
- </a-card>
63
- </a-col>
64
- <a-col :md="6" :sm="24">
65
- <a-card
66
- hoverable
67
- title="信号强度情况"
68
- style="margin-bottom: 24px"
69
- :bordered="true">
70
- <div>
71
- <a-skeleton v-show="radarLoading6" active />
72
- <div style="height: 200px" id="container5" v-show="!radarLoading6"/>
73
- </div>
74
- </a-card>
75
- </a-col>-->
76
- </a-row>
77
- </div>
78
- </template>
79
- <script>
80
- import { Area, Line } from '@antv/g2plot/lib/index'
81
- import ARow from 'ant-design-vue/es/grid/Row'
82
- import ACol from 'ant-design-vue/es/grid/Col'
83
- import { MeterDetailsViewApi } from '@vue2-client/services/api'
84
-
85
- export default {
86
- name: 'DeviceDetailsCount',
87
- components: {
88
- ACol,
89
- ARow
90
- },
91
- props: {
92
- deviceNo: {
93
- type: String,
94
- required: true
95
- }
96
- },
97
- data () {
98
- return {
99
- radarLoading: true,
100
- radarLoading2: true,
101
- radarLoading3: true,
102
- radarLoading4: true,
103
- radarLoading5: true,
104
- radarLoading6: true
105
- }
106
- },
107
- mounted () {
108
- this.loadGasView()
109
- },
110
- methods: {
111
- loadGasView () {
112
- const _this = this
113
- fetch(MeterDetailsViewApi.getGasConsumptionData, {
114
- method: 'POST',
115
- body: JSON.stringify({
116
- userId: this.userid
117
- })
118
- })
119
- .then((res) => res.json())
120
- .then((data) => {
121
- const line = new Line('container', {
122
- data,
123
- padding: 'auto',
124
- xField: 'date',
125
- yField: 'scales',
126
- smooth: true,
127
- color: 'l(0) 0:#3ED474 1:#399EFC',
128
- lineStyle: {
129
- lineWidth: 5
130
- },
131
- tooltip: {
132
- fields: ['date', 'scales'],
133
- formatter: (datum) => {
134
- return { name: '用气量', value: datum.scales + '方' }
135
- }
136
- }
137
- })
138
- line.render()
139
- _this.radarLoading = false
140
- const areaUseMoney = new Line('containerUseMoney', {
141
- data,
142
- padding: 'auto',
143
- xField: 'date',
144
- yField: 'oughtfee',
145
- smooth: true,
146
- color: 'l(0) 0:#9EFCFF 1:#9E87FF',
147
- lineStyle: {
148
- lineWidth: 5
149
- },
150
- tooltip: {
151
- fields: ['date', 'oughtfee'],
152
- formatter: (datum) => {
153
- return { name: '用气金额', value: datum.oughtfee + '元' }
154
- }
155
- }
156
- })
157
- areaUseMoney.render()
158
- _this.radarLoading2 = false
159
- const column = new Area('container2', {
160
- data,
161
- padding: 'auto',
162
- xField: 'date',
163
- yField: 'used',
164
- point: {
165
- size: 5,
166
- shape: 'diamond',
167
- style: {
168
- fill: 'white',
169
- stroke: 'l(0) 0:#3ED474 1:#399EFC',
170
- lineWidth: 2
171
- }
172
- },
173
- color: 'l(270) 0:#3ED474 1:#399EFC',
174
- areaStyle: () => {
175
- return {
176
- fill: 'l(270) 0:#3ED474 1:#399EFC'
177
- }
178
- },
179
- smooth: true,
180
- tooltip: {
181
- fields: ['date', 'used'],
182
- formatter: (datum) => {
183
- return { name: '累计用气量', value: datum.used + '方' }
184
- }
185
- }
186
- })
187
- column.render()
188
- _this.radarLoading3 = false
189
- const area2 = new Area('container3', {
190
- data,
191
- padding: 'auto',
192
- xField: 'date',
193
- yField: 'balance',
194
- point: {
195
- size: 5,
196
- shape: 'diamond',
197
- style: {
198
- fill: 'white',
199
- stroke: 'l(270) 0:#3ED474 1:#399EFC',
200
- lineWidth: 2
201
- }
202
- },
203
- color: 'l(270) 0:#3ED474 1:#399EFC',
204
- lineStyle: {
205
- lineWidth: 5
206
- },
207
- smooth: true,
208
- tooltip: {
209
- fields: ['date', 'balance'],
210
- formatter: (datum) => {
211
- return { name: '剩余金额', value: datum.balance + '' }
212
- }
213
- },
214
- annotations: [
215
- // 低于中位数颜色变化
216
- {
217
- type: 'regionFilter',
218
- start: ['max', '0'],
219
- end: ['min', '-999999']
220
- },
221
- {
222
- type: 'text',
223
- position: ['min', '0'],
224
- content: '欠费线',
225
- offsetY: -4,
226
- style: {
227
- textBaseline: 'bottom'
228
- }
229
- },
230
- {
231
- type: 'line',
232
- start: ['min', '0'],
233
- end: ['max', '0'],
234
- style: {
235
- stroke: 'l(0) 0:#FEB692 1:#EA5455',
236
- lineDash: [2, 2]
237
- }
238
- }
239
- ]
240
- })
241
- area2.render()
242
- _this.radarLoading4 = false
243
- const line2 = new Line('container4', {
244
- data,
245
- padding: 'auto',
246
- xField: 'date',
247
- yField: 'batterylevel',
248
- color: 'l(0) 0:#3ED474 1:#399EFC',
249
- lineStyle: {
250
- lineWidth: 5
251
- },
252
- smooth: true,
253
- tooltip: {
254
- fields: ['date', 'batterylevel'],
255
- formatter: (datum) => {
256
- return { name: '电压', value: datum.batterylevel + 'V' }
257
- }
258
- }
259
- })
260
- line2.render()
261
- _this.radarLoading5 = false
262
- const line3 = new Line('container5', {
263
- data,
264
- padding: 'auto',
265
- xField: 'date',
266
- yField: 'signal',
267
- color: 'l(0) 0:#9EFCFF 1:#9E87FF',
268
- lineStyle: {
269
- lineWidth: 5
270
- },
271
- smooth: true,
272
- tooltip: {
273
- fields: ['date', 'signal'],
274
- formatter: (datum) => {
275
- return { name: '信号强度', value: datum.signal + 'dBm' }
276
- }
277
- }
278
- })
279
- line3.render()
280
- _this.radarLoading6 = false
281
- })
282
- }
283
- },
284
- watch: {
285
- 'userid' () {
286
- this.loadGasView()
287
- }
288
- }
289
- }
290
- </script>
291
-
292
- <style lang='less' scoped>
293
- .detail-layout {
294
- margin-left: 44px
295
- }
296
- .text {
297
- color: rgba(0, 0, 0, .45)
298
- }
299
-
300
- .heading {
301
- color: rgba(0, 0, 0, .85);
302
- font-size: 20px
303
- }
304
-
305
- .no-data {
306
- color: rgba(0, 0, 0, .25);
307
- text-align: center;
308
- line-height: 64px;
309
- font-size: 16px
310
-
311
- /*i {*/
312
- /* font-size: 24px*/
313
- /* margin-right: 16px*/
314
- /* position: relative*/
315
- /* top: 3px*/
316
- /*}*/
317
- }
318
-
319
- .mobile {
320
- .detail-layout {
321
- margin-left: unset
322
- }
323
- .text {
324
-
325
- }
326
- .status-list {
327
- text-align: left
328
- }
329
- }
330
- </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 :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}" default-active-key="1" size="large">
70
+ <div slot="tabBarExtraContent" class="extra-wrapper">
71
+ <div class="extra-item">
72
+ <a-radio-group v-model="uploadCountMode" button-style="solid" @change="getDeviceUploadCountData">
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
+ <bar :data="barData2" title="失联发生情况" />
92
+ </a-col>
93
+ <a-col :lg="12" :md="12" :sm="24" :xl="8" :xs="24">
94
+ <rank-list :list="rankList" title="失联天数排行"/>
95
+ </a-col>
96
+ </a-row>
97
+ </a-tab-pane>
98
+ </a-tabs>
99
+ </div>
100
+ </a-card>
101
+
102
+ <div :class="!isMobile && 'desktop'" class="antd-pro-pages-dashboard-analysis-twoColLayout">
103
+ <a-row :gutter="24" :style="{ marginTop: '24px' }" type="flex">
104
+ <a-col :lg="24" :md="24" :sm="24" :xl="12" :xs="24">
105
+ <a-card :bordered="false" :loading="loading" :style="{ height: '100%' }" title="用气情况排行">
106
+ <a-dropdown slot="extra" :trigger="['click']" placement="bottomLeft">
107
+ <a class="ant-dropdown-link" href="#">
108
+ <a-icon type="ellipsis" />
109
+ </a>
110
+ <a-menu slot="overlay">
111
+ <a-menu-item>
112
+ <a href="javascript:">操作一</a>
113
+ </a-menu-item>
114
+ <a-menu-item>
115
+ <a href="javascript;">操作二</a>
116
+ </a-menu-item>
117
+ </a-menu>
118
+ </a-dropdown>
119
+ <a-row :gutter="68">
120
+ <a-col :sm="12" :style="{ marginBottom: ' 24px'}" :xs="24">
121
+ <number-info :sub-total="17.1" :total="21232.1">
122
+ <span slot="subtitle">
123
+ <span>当天总用气量</span>
124
+ <a-tooltip slot="action" title="指标说明">
125
+ <a-icon :style="{ marginLeft: '8px' }" type="info-circle-o" />
126
+ </a-tooltip>
127
+ </span>
128
+ </number-info>
129
+ <!-- miniChart -->
130
+ <div>
131
+ <mini-smooth-area :dataSource="searchUserData" :scale="searchUserScale" :style="{ height: '45px' }" />
132
+ </div>
133
+ </a-col>
134
+ <a-col :sm="12" :style="{ marginBottom: ' 24px'}" :xs="24">
135
+ <number-info :sub-total="0.2" :total="0.7" status="up">
136
+ <span slot="subtitle">
137
+ <span>人均用气量</span>
138
+ <a-tooltip slot="action" title="指标说明">
139
+ <a-icon :style="{ marginLeft: '8px' }" type="info-circle-o" />
140
+ </a-tooltip>
141
+ </span>
142
+ </number-info>
143
+ <!-- miniChart -->
144
+ <div>
145
+ <mini-smooth-area :dataSource="searchUserData" :scale="searchUserScale" :style="{ height: '45px' }" />
146
+ </div>
147
+ </a-col>
148
+ </a-row>
149
+ <div class="ant-table-wrapper">
150
+ <a-table
151
+ :columns="searchTableColumns"
152
+ :dataSource="searchData"
153
+ :pagination="{ pageSize: 5 }"
154
+ row-key="index"
155
+ size="small"
156
+ >
157
+ <span slot="range" slot-scope="text, record">
158
+ <trend :flag="record.status === 0 ? 'up' : 'down'">
159
+ {{ text }}%
160
+ </trend>
161
+ </span>
162
+ </a-table>
163
+ </div>
164
+ </a-card>
165
+ </a-col>
166
+ <a-col :lg="24" :md="24" :sm="24" :xl="12" :xs="24">
167
+ <a-card :bordered="false" :loading="loading" :style="{ height: '100%' }" class="antd-pro-pages-dashboard-analysis-salesCard" title="指令类别占比">
168
+ <div slot="extra" style="height: inherit;">
169
+ <div class="analysis-salesTypeRadio">
170
+ <a-radio-group defaultValue="a">
171
+ <a-radio-button value="a">本日</a-radio-button>
172
+ <a-radio-button value="b">本周</a-radio-button>
173
+ <a-radio-button value="c">本月</a-radio-button>
174
+ </a-radio-group>
175
+ </div>
176
+ </div>
177
+ <h4></h4>
178
+ <div>
179
+ <!-- style="width: calc(100% - 240px);" -->
180
+ <div>
181
+ <v-chart :data="pieData" :force-fit="true" :height="405" :scale="pieScale">
182
+ <v-tooltip :showTitle="false" dataKey="item*percent" />
183
+ <v-axis />
184
+ <!-- position="right" :offsetX="-140" -->
185
+ <v-legend dataKey="item"/>
186
+ <v-pie :vStyle="pieStyle" color="item" position="percent" />
187
+ <v-coord :innerRadius="0.6" :radius="0.75" type="theta" />
188
+ </v-chart>
189
+ </div>
190
+ </div>
191
+ </a-card>
192
+ </a-col>
193
+ </a-row>
194
+ </div>
195
+ </div>
196
+ </template>
197
+
198
+ <script>
199
+ import moment from 'moment'
200
+ import {
201
+ ChartCard,
202
+ MiniArea,
203
+ MiniBar,
204
+ MiniProgress,
205
+ RankList,
206
+ Bar,
207
+ Trend,
208
+ NumberInfo,
209
+ MiniSmoothArea
210
+ } from '@vue2-client/components'
211
+ import { formatDate } from '@vue2-client/utils/util'
212
+ import { Line } from '@antv/g2plot'
213
+ import { mapState } from 'vuex'
214
+ import { post } from '@vue2-client/services/api'
215
+ import { DeviceDetailsCountApi } from '@vue2-client/services/api/iot/DeviceDetailsView/DeviceDetailsCountApi'
216
+
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
+ const searchUserData = []
239
+ for (let i = 0; i < 7; i++) {
240
+ searchUserData.push({
241
+ x: moment().add(i, 'days').format('YYYY-MM-DD'),
242
+ y: Math.ceil(Math.random() * 10)
243
+ })
244
+ }
245
+ const searchUserScale = [
246
+ {
247
+ dataKey: 'x',
248
+ alias: '时间'
249
+ },
250
+ {
251
+ dataKey: 'y',
252
+ alias: '用气量',
253
+ min: 0,
254
+ max: 10
255
+ }]
256
+
257
+ const searchTableColumns = [
258
+ {
259
+ dataIndex: 'index',
260
+ title: '用户编号',
261
+ width: 90
262
+ },
263
+ {
264
+ dataIndex: 'keyword',
265
+ title: '用户姓名'
266
+ },
267
+ {
268
+ dataIndex: 'count',
269
+ title: '用气量'
270
+ },
271
+ {
272
+ dataIndex: 'range',
273
+ title: '周涨幅',
274
+ align: 'right',
275
+ sorter: (a, b) => a.range - b.range,
276
+ scopedSlots: { customRender: 'range' }
277
+ }
278
+ ]
279
+
280
+ const userInfoArray = [
281
+ '德昌鸿公司2',
282
+ '瑞鑫宇公司',
283
+ '保康县熊绎中学',
284
+ '文康置业有限公司',
285
+ '湖北省旗星文化旅游实业有限公司'
286
+ ]
287
+
288
+ 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
+
301
+ const DataSet = require('@antv/data-set')
302
+
303
+ const sourceData = [
304
+ { item: '远程开户', count: 32.2 },
305
+ { item: '远程充值', count: 21 },
306
+ { item: '阀门控制', count: 17 },
307
+ { item: '远程调价', count: 13 },
308
+ { item: '设置参数', count: 9 },
309
+ { item: '远程注销', count: 7.8 }
310
+ ]
311
+
312
+ const pieScale = [{
313
+ dataKey: 'percent',
314
+ min: 0,
315
+ formatter: '.0%'
316
+ }]
317
+
318
+ const dv = new DataSet.View().source(sourceData)
319
+ dv.transform({
320
+ type: 'percent',
321
+ field: 'count',
322
+ dimension: 'item',
323
+ as: 'percent'
324
+ })
325
+ const pieData = dv.rows
326
+
327
+ export default {
328
+ name: 'DeviceDetailsCount',
329
+ components: {
330
+ ChartCard,
331
+ MiniArea,
332
+ MiniBar,
333
+ MiniProgress,
334
+ RankList,
335
+ Bar,
336
+ Trend,
337
+ NumberInfo,
338
+ MiniSmoothArea
339
+ },
340
+ data () {
341
+ return {
342
+ // 页面宽度
343
+ screenWidth: document.documentElement.clientWidth,
344
+ // 客户名称
345
+ customerName: '',
346
+ // >> 设备累计使用时长统计
347
+ // 设备近七天上报情况
348
+ deviceRecentlyUploadList: [],
349
+ // 设备累计使用天数
350
+ usedDays: 0,
351
+ // 设备安装时间
352
+ installDate: '',
353
+ // 设备累计使用天数加载状态
354
+ loadDeviceUsedDaySumState: 'loading',
355
+ // >> 设备累计上报次数统计
356
+ // 设备累计上报次数
357
+ uploadTimes: 0,
358
+ // 设备近七天上报总次数
359
+ deviceRecentlyUploadSum: 0,
360
+ // 设备近七天上报情况明细列
361
+ deviceRecentlyUploadScale: [{ dataKey: 'x', alias: '时间' }, { dataKey: 'y', alias: '次数' }],
362
+ // 设备累计上报次数加载状态
363
+ loadDeviceUploadTimesState: 'loading',
364
+ // >> 设备累计失联次数统计
365
+ // 设备近三个月失联情况
366
+ deviceLostContactList: [],
367
+ // 设备累计失联次数
368
+ lostContactTimes: 0,
369
+ // 设备最近失联日期
370
+ lastLostContactDate: undefined,
371
+ // 设备近七天失联情况明细列
372
+ deviceLostContactScale: [{ dataKey: 'x', alias: '时间' }, { dataKey: 'y', alias: '失联天数' }],
373
+ // 设备累计失联次数加载状态
374
+ loadDeviceLostContactState: 'loading',
375
+ // >> 设备指令下发成功率统计
376
+ // 设备指令成功率
377
+ deviceInstructRateOfSuccessValue: 0,
378
+ // 设备指令总数
379
+ deviceInstructCount: 0,
380
+ // 指令成功率进度色
381
+ deviceInstructRateOfColor: 'rgb(19, 194, 194)',
382
+ // 设备指令下发成功率加载状态
383
+ deviceInstructRateOfSuccessLoadState: 'loading',
384
+ // >> 设备上报情况统计
385
+ // 上报统计模式
386
+ uploadCountMode: 'now',
387
+ // 上报统计图表
388
+ uploadCountPlot: undefined,
389
+ // 抄表情况分析Loading
390
+ radarLoadState: 'loading',
391
+ // 是否刷新加载中
392
+ loading: false,
393
+ rankList,
394
+
395
+ // 搜索用户数
396
+ searchUserData,
397
+ searchUserScale,
398
+ searchTableColumns,
399
+ searchData,
400
+
401
+ barData,
402
+ barData2,
403
+
404
+ //
405
+ pieScale,
406
+ pieData,
407
+ sourceData,
408
+ pieStyle: {
409
+ stroke: '#fff',
410
+ lineWidth: 1
411
+ }
412
+ }
413
+ },
414
+ props: {
415
+ deviceId: {
416
+ type: Number,
417
+ required: true
418
+ }
419
+ },
420
+ mounted () {
421
+ this.getDeviceUsedDaySum()
422
+ this.getDeviceUploadTimesCount()
423
+ this.getDeviceLostContactCount()
424
+ this.getInstructRateOfSuccess()
425
+ this.getDeviceUploadCountData()
426
+ },
427
+ computed: {
428
+ ...mapState('setting', ['isMobile'])
429
+ },
430
+ methods: {
431
+ /**
432
+ * 获取设备使用天数
433
+ */
434
+ getDeviceUsedDaySum () {
435
+ this.loadDeviceUsedDaySumState = 'loading'
436
+ post(DeviceDetailsCountApi.getDeviceUsedDaySum, {
437
+ deviceId: this.deviceId
438
+ }).then(res => {
439
+ this.usedDays = res.value
440
+ this.installDate = res.installDate
441
+ this.loadDeviceUsedDaySumState = 'success'
442
+ }, err => {
443
+ console.warn(err)
444
+ this.loadDeviceUsedDaySumState = 'error'
445
+ })
446
+ },
447
+ /**
448
+ * 获取设备累计上报次数和近七天上报情况
449
+ */
450
+ getDeviceUploadTimesCount () {
451
+ this.loadDeviceUploadTimesState = 'loading'
452
+ this.deviceRecentlyUploadSum = 0
453
+ post(DeviceDetailsCountApi.getDeviceUploadTimesCount, {
454
+ deviceId: this.deviceId
455
+ }).then(res => {
456
+ this.uploadTimes = res.value
457
+ this.deviceRecentlyUploadList = res.recentlyUpload
458
+ for (const item of this.deviceRecentlyUploadList) {
459
+ this.deviceRecentlyUploadSum += item.y
460
+ }
461
+ this.loadDeviceUploadTimesState = 'success'
462
+ }, err => {
463
+ console.warn(err)
464
+ this.loadDeviceUploadTimesState = 'error'
465
+ })
466
+ },
467
+ /**
468
+ * 获取设备累计失联次数和近三个月失联情况
469
+ */
470
+ getDeviceLostContactCount () {
471
+ this.loadDeviceLostContactState = 'loading'
472
+ return post(DeviceDetailsCountApi.getDeviceLostContactCount, {
473
+ deviceId: this.deviceId
474
+ }).then(res => {
475
+ this.lostContactTimes = res.value
476
+ this.lastLostContactDate = res.lastLostContactDate
477
+ this.deviceLostContactList = res.lostContactList
478
+ this.loadDeviceLostContactState = 'success'
479
+ }, err => {
480
+ console.warn(err)
481
+ this.loadDeviceLostContactState = 'error'
482
+ })
483
+ },
484
+ /**
485
+ * 获取设备指令下发成功率
486
+ */
487
+ getInstructRateOfSuccess () {
488
+ this.deviceInstructRateOfSuccessLoadState = 'loading'
489
+ post(DeviceDetailsCountApi.getInstructRateOfSuccess, {
490
+ deviceId: this.deviceId
491
+ }).then(res => {
492
+ this.deviceInstructRateOfSuccessValue = res.deviceInstructRateOfSuccessValue * 1.0
493
+ if (this.deviceInstructRateOfSuccessValue < 70.0) {
494
+ this.deviceInstructRateOfColor = 'rgb(242, 99, 123)'
495
+ } else if (this.deviceInstructRateOfSuccessValue < 90.0) {
496
+ this.deviceInstructRateOfColor = 'rgb(251, 212, 55)'
497
+ } else {
498
+ this.deviceInstructRateOfColor = 'rgb(19, 194, 194)'
499
+ }
500
+ this.deviceInstructCount = res.value
501
+ this.deviceInstructRateOfSuccessLoadState = 'success'
502
+ }, err => {
503
+ console.warn(err)
504
+ this.deviceInstructRateOfSuccessLoadState = 'error'
505
+ })
506
+ },
507
+ /**
508
+ * 格式化日期
509
+ * @param date 日期字符串
510
+ * @param format 格式化方式
511
+ * @returns {string|*} 格式化结果
512
+ */
513
+ format (date, format) {
514
+ return formatDate(date, format)
515
+ },
516
+ /**
517
+ * 获取设备上报情况
518
+ */
519
+ getDeviceUploadCountData () {
520
+ this.radarLoadState = 'loading'
521
+ fetch(DeviceDetailsCountApi.getDeviceUploadCountData, {
522
+ method: 'POST',
523
+ body: JSON.stringify({
524
+ deviceId: this.deviceId,
525
+ type: this.uploadCountMode
526
+ })
527
+ }).then((res) => res.json())
528
+ .then((data) => {
529
+ if (this.uploadCountPlot) {
530
+ this.uploadCountPlot.changeData(data)
531
+ } else {
532
+ this.uploadCountPlot = new Line('container', {
533
+ data,
534
+ xField: 'date',
535
+ yField: 'value',
536
+ seriesField: 'name',
537
+ yAxis: {
538
+ label: {
539
+ // 数值格式化为千分位
540
+ formatter: (v) => `${v}`.replace(/\d{1,3}(?=(\d{3})+$)/g, (s) => `${s},`)
541
+ }
542
+ },
543
+ tooltip: {
544
+ shared: true
545
+ },
546
+ interactions: [{ type: 'brush' }],
547
+ slider: {
548
+ start: 0.5,
549
+ end: 1
550
+ },
551
+ legend: {
552
+ position: 'top',
553
+ radio: true
554
+ },
555
+ smooth: true
556
+ })
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
+ </script>
569
+
570
+ <style lang="less" scoped>
571
+
572
+ .text {
573
+ color: rgba(0, 0, 0, .45);
574
+ }
575
+
576
+ .heading {
577
+ color: rgba(0, 0, 0, .85);
578
+ font-size: 20px;
579
+ }
580
+
581
+ .extra-wrapper {
582
+ line-height: 55px;
583
+ padding-right: 24px;
584
+
585
+ .extra-item {
586
+ display: inline-block;
587
+ margin-right: 24px;
588
+
589
+ a {
590
+ margin-left: 24px;
591
+ }
592
+ }
593
+ }
594
+
595
+ .antd-pro-pages-dashboard-analysis-twoColLayout {
596
+ position: relative;
597
+ display: flex;
598
+ display: block;
599
+ flex-flow: row wrap;
600
+ }
601
+
602
+ .antd-pro-pages-dashboard-analysis-salesCard {
603
+ height: calc(100% - 24px);
604
+ /deep/ .ant-card-head {
605
+ position: relative;
606
+ }
607
+ }
608
+
609
+ .dashboard-analysis-iconGroup {
610
+ i {
611
+ margin-left: 16px;
612
+ color: rgba(0,0,0,.45);
613
+ cursor: pointer;
614
+ transition: color .32s;
615
+ color: black;
616
+ }
617
+ }
618
+ .analysis-salesTypeRadio {
619
+ position: absolute;
620
+ right: 54px;
621
+ bottom: 12px;
622
+ }
623
+ </style>