vue2-client 1.2.79 → 1.2.82
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 +8 -0
- package/package.json +94 -94
- package/src/base-client/components/iot/WebmeterAnalysisView/WebmeterAnalysisView.vue +183 -60
- package/src/base-client/plugins/AppData.js +77 -70
- package/src/pages/login/Login.vue +37 -1
- package/src/services/api/WebmeterAnalysisViewApi.js +20 -30
- package/src/services/apiService.js +1 -0
- package/src/services/user.js +8 -1
- package/src/utils/request.js +53 -2
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "vue2-client",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"private": false,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"serve": "vue-cli-service serve",
|
|
7
|
-
"build": "vue-cli-service build",
|
|
8
|
-
"test:unit": "vue-cli-service test:unit",
|
|
9
|
-
"lint": "vue-cli-service lint"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"@amap/amap-jsapi-loader": "^1.0.1",
|
|
13
|
-
"@antv/data-set": "^0.11.8",
|
|
14
|
-
"@antv/f2": "^3.8.11",
|
|
15
|
-
"@antv/g2plot": "^2.4.20",
|
|
16
|
-
"@babel/core": "^7.18.5",
|
|
17
|
-
"@logicflow/core": "^1.1.20",
|
|
18
|
-
"@logicflow/extension": "^1.1.20",
|
|
19
|
-
"@vue/babel-helper-vue-jsx-merge-props": "^1.2.1",
|
|
20
|
-
"@vue/babel-preset-jsx": "^1.2.4",
|
|
21
|
-
"animate.css": "^4.1.1",
|
|
22
|
-
"ant-design-vue": "^1.7.8",
|
|
23
|
-
"axios": "^0.27.2",
|
|
24
|
-
"clipboard": "^2.0.11",
|
|
25
|
-
"core-js": "^3.23.2",
|
|
26
|
-
"webpack": "^4.46.0",
|
|
27
|
-
"date-fns": "^2.28.0",
|
|
28
|
-
"default-passive-events": "^2.0.0",
|
|
29
|
-
"enquire.js": "^2.1.6",
|
|
30
|
-
"file-saver": "^2.0.5",
|
|
31
|
-
"highlight.js": "^11.5.1",
|
|
32
|
-
"js-cookie": "^3.0.1",
|
|
33
|
-
"jsencrypt": "^3.2.1",
|
|
34
|
-
"lodash.get": "^4.4.2",
|
|
35
|
-
"mockjs": "^1.1.0",
|
|
36
|
-
"nprogress": "^0.2.0",
|
|
37
|
-
"viser-vue": "^2.4.8",
|
|
38
|
-
"vue": "^2.6.14",
|
|
39
|
-
"vue-i18n": "^8.27.2",
|
|
40
|
-
"vue-infinite-scroll": "^2.0.2",
|
|
41
|
-
"vue-json-viewer": "^2.2.22",
|
|
42
|
-
"vue-router": "^3.5.4",
|
|
43
|
-
"vuedraggable": "^2.24.3",
|
|
44
|
-
"vuex": "^3.6.2",
|
|
45
|
-
"xlsx": "^0.18.5"
|
|
46
|
-
},
|
|
47
|
-
"devDependencies": {
|
|
48
|
-
"@ant-design/colors": "^6.0.0",
|
|
49
|
-
"@vue/cli-plugin-babel": "^4.5.18",
|
|
50
|
-
"@vue/cli-plugin-eslint": "^4.5.18",
|
|
51
|
-
"@vue/cli-plugin-router": "^4.5.18",
|
|
52
|
-
"@vue/cli-plugin-unit-jest": "~5.0.6",
|
|
53
|
-
"@vue/cli-plugin-vuex": "^4.5.18",
|
|
54
|
-
"@vue/cli-service": "^4.5.18",
|
|
55
|
-
"@vue/eslint-config-standard": "^4.0.0",
|
|
56
|
-
"@vue/test-utils": "^1.3.0",
|
|
57
|
-
"@vue/vue2-jest": "^27.0.0",
|
|
58
|
-
"@vuepress/plugin-back-to-top": "^1.9.7",
|
|
59
|
-
"babel-eslint": "^10.1.0",
|
|
60
|
-
"babel-jest": "^27.1.0",
|
|
61
|
-
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
62
|
-
"babel-polyfill": "^6.26.0",
|
|
63
|
-
"compression-webpack-plugin": "^5.0.2",
|
|
64
|
-
"deepmerge": "^4.2.2",
|
|
65
|
-
"echarts": "^5.3.3",
|
|
66
|
-
"eslint": "^6.8.0",
|
|
67
|
-
"eslint-plugin-import": "^2.26.0",
|
|
68
|
-
"eslint-plugin-node": "^11.1.0",
|
|
69
|
-
"eslint-plugin-standard": "^5.0.0",
|
|
70
|
-
"eslint-plugin-vue": "^6.2.2",
|
|
71
|
-
"fast-deep-equal": "^3.1.3",
|
|
72
|
-
"gh-pages": "^3.2.3",
|
|
73
|
-
"jest": "^27.1.0",
|
|
74
|
-
"less": "^3.13.1",
|
|
75
|
-
"less-loader": "^7.3.0",
|
|
76
|
-
"react-bmap": "^1.0.130",
|
|
77
|
-
"script-loader": "^0.7.2",
|
|
78
|
-
"style-resources-loader": "^1.5.0",
|
|
79
|
-
"vue-amap": "^0.5.10",
|
|
80
|
-
"vue-baidu-map": "^0.21.22",
|
|
81
|
-
"vue-bmap-gl": "^0.0.30",
|
|
82
|
-
"vue-cli-plugin-style-resources-loader": "^0.1.5",
|
|
83
|
-
"vue-mapvgl": "^0.0.34",
|
|
84
|
-
"vue-template-compiler": "^2.6.14",
|
|
85
|
-
"vuepress": "^1.9.7",
|
|
86
|
-
"webpack-theme-color-replacer": "^1.4.1",
|
|
87
|
-
"whatwg-fetch": "^3.6.2"
|
|
88
|
-
},
|
|
89
|
-
"browserslist": [
|
|
90
|
-
"> 1%",
|
|
91
|
-
"last 2 versions",
|
|
92
|
-
"not ie <= 10"
|
|
93
|
-
]
|
|
94
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "vue2-client",
|
|
3
|
+
"version": "1.2.82",
|
|
4
|
+
"private": false,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"serve": "vue-cli-service serve",
|
|
7
|
+
"build": "vue-cli-service build",
|
|
8
|
+
"test:unit": "vue-cli-service test:unit",
|
|
9
|
+
"lint": "vue-cli-service lint"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@amap/amap-jsapi-loader": "^1.0.1",
|
|
13
|
+
"@antv/data-set": "^0.11.8",
|
|
14
|
+
"@antv/f2": "^3.8.11",
|
|
15
|
+
"@antv/g2plot": "^2.4.20",
|
|
16
|
+
"@babel/core": "^7.18.5",
|
|
17
|
+
"@logicflow/core": "^1.1.20",
|
|
18
|
+
"@logicflow/extension": "^1.1.20",
|
|
19
|
+
"@vue/babel-helper-vue-jsx-merge-props": "^1.2.1",
|
|
20
|
+
"@vue/babel-preset-jsx": "^1.2.4",
|
|
21
|
+
"animate.css": "^4.1.1",
|
|
22
|
+
"ant-design-vue": "^1.7.8",
|
|
23
|
+
"axios": "^0.27.2",
|
|
24
|
+
"clipboard": "^2.0.11",
|
|
25
|
+
"core-js": "^3.23.2",
|
|
26
|
+
"webpack": "^4.46.0",
|
|
27
|
+
"date-fns": "^2.28.0",
|
|
28
|
+
"default-passive-events": "^2.0.0",
|
|
29
|
+
"enquire.js": "^2.1.6",
|
|
30
|
+
"file-saver": "^2.0.5",
|
|
31
|
+
"highlight.js": "^11.5.1",
|
|
32
|
+
"js-cookie": "^3.0.1",
|
|
33
|
+
"jsencrypt": "^3.2.1",
|
|
34
|
+
"lodash.get": "^4.4.2",
|
|
35
|
+
"mockjs": "^1.1.0",
|
|
36
|
+
"nprogress": "^0.2.0",
|
|
37
|
+
"viser-vue": "^2.4.8",
|
|
38
|
+
"vue": "^2.6.14",
|
|
39
|
+
"vue-i18n": "^8.27.2",
|
|
40
|
+
"vue-infinite-scroll": "^2.0.2",
|
|
41
|
+
"vue-json-viewer": "^2.2.22",
|
|
42
|
+
"vue-router": "^3.5.4",
|
|
43
|
+
"vuedraggable": "^2.24.3",
|
|
44
|
+
"vuex": "^3.6.2",
|
|
45
|
+
"xlsx": "^0.18.5"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@ant-design/colors": "^6.0.0",
|
|
49
|
+
"@vue/cli-plugin-babel": "^4.5.18",
|
|
50
|
+
"@vue/cli-plugin-eslint": "^4.5.18",
|
|
51
|
+
"@vue/cli-plugin-router": "^4.5.18",
|
|
52
|
+
"@vue/cli-plugin-unit-jest": "~5.0.6",
|
|
53
|
+
"@vue/cli-plugin-vuex": "^4.5.18",
|
|
54
|
+
"@vue/cli-service": "^4.5.18",
|
|
55
|
+
"@vue/eslint-config-standard": "^4.0.0",
|
|
56
|
+
"@vue/test-utils": "^1.3.0",
|
|
57
|
+
"@vue/vue2-jest": "^27.0.0",
|
|
58
|
+
"@vuepress/plugin-back-to-top": "^1.9.7",
|
|
59
|
+
"babel-eslint": "^10.1.0",
|
|
60
|
+
"babel-jest": "^27.1.0",
|
|
61
|
+
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
62
|
+
"babel-polyfill": "^6.26.0",
|
|
63
|
+
"compression-webpack-plugin": "^5.0.2",
|
|
64
|
+
"deepmerge": "^4.2.2",
|
|
65
|
+
"echarts": "^5.3.3",
|
|
66
|
+
"eslint": "^6.8.0",
|
|
67
|
+
"eslint-plugin-import": "^2.26.0",
|
|
68
|
+
"eslint-plugin-node": "^11.1.0",
|
|
69
|
+
"eslint-plugin-standard": "^5.0.0",
|
|
70
|
+
"eslint-plugin-vue": "^6.2.2",
|
|
71
|
+
"fast-deep-equal": "^3.1.3",
|
|
72
|
+
"gh-pages": "^3.2.3",
|
|
73
|
+
"jest": "^27.1.0",
|
|
74
|
+
"less": "^3.13.1",
|
|
75
|
+
"less-loader": "^7.3.0",
|
|
76
|
+
"react-bmap": "^1.0.130",
|
|
77
|
+
"script-loader": "^0.7.2",
|
|
78
|
+
"style-resources-loader": "^1.5.0",
|
|
79
|
+
"vue-amap": "^0.5.10",
|
|
80
|
+
"vue-baidu-map": "^0.21.22",
|
|
81
|
+
"vue-bmap-gl": "^0.0.30",
|
|
82
|
+
"vue-cli-plugin-style-resources-loader": "^0.1.5",
|
|
83
|
+
"vue-mapvgl": "^0.0.34",
|
|
84
|
+
"vue-template-compiler": "^2.6.14",
|
|
85
|
+
"vuepress": "^1.9.7",
|
|
86
|
+
"webpack-theme-color-replacer": "^1.4.1",
|
|
87
|
+
"whatwg-fetch": "^3.6.2"
|
|
88
|
+
},
|
|
89
|
+
"browserslist": [
|
|
90
|
+
"> 1%",
|
|
91
|
+
"last 2 versions",
|
|
92
|
+
"not ie <= 10"
|
|
93
|
+
]
|
|
94
|
+
}
|
|
@@ -86,21 +86,23 @@
|
|
|
86
86
|
</a-col>
|
|
87
87
|
</a-row>
|
|
88
88
|
|
|
89
|
-
<a-card :body-style="{padding: '0'}" :bordered="false"
|
|
89
|
+
<a-card :body-style="{padding: '0'}" :bordered="false">
|
|
90
90
|
<div class="salesCard">
|
|
91
|
-
<a-tabs :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}"
|
|
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
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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="
|
|
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
|
-
<
|
|
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="
|
|
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="
|
|
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 :
|
|
157
|
+
<number-info :status="handPlanUserSubValue.status" :sub-total="handPlanUserSubValue.subValue" :total="todayHandPlanUserCount">
|
|
156
158
|
<span slot="subtitle">
|
|
157
|
-
<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="
|
|
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="
|
|
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
|
-
</
|
|
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="
|
|
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,26 +264,15 @@ 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
|
{
|
|
279
|
-
dataIndex: '
|
|
270
|
+
dataIndex: 'f_userinfo_id',
|
|
280
271
|
title: '用户编号',
|
|
281
272
|
width: 90
|
|
282
273
|
},
|
|
283
274
|
{
|
|
284
|
-
dataIndex: '
|
|
275
|
+
dataIndex: 'f_user_name',
|
|
285
276
|
title: '用户姓名'
|
|
286
277
|
},
|
|
287
278
|
{
|
|
@@ -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
|
-
//
|
|
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
|
-
//
|
|
417
|
-
|
|
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
|
-
|
|
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
|
-
//
|
|
461
|
-
this.
|
|
497
|
+
// 加载各表厂表具上报情况统计
|
|
498
|
+
this.getHandPlanCountByMeterBrand()
|
|
499
|
+
// 加载用气量统计
|
|
500
|
+
this.loadUseGasData()
|
|
462
501
|
},
|
|
463
502
|
computed: {
|
|
464
|
-
...mapState('setting', ['isMobile'])
|
|
465
|
-
|
|
466
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
548
|
-
|
|
549
|
-
|
|
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(
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
586
|
-
|
|
587
|
-
|
|
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,70 +1,77 @@
|
|
|
1
|
-
import { manageApi, post } from '@vue2-client/services/api'
|
|
2
|
-
import { handleTree } from '@vue2-client/utils/util'
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
1
|
+
import { manageApi, post } from '@vue2-client/services/api'
|
|
2
|
+
import { handleTree } from '@vue2-client/utils/util'
|
|
3
|
+
const setting = require('../../config/default/setting.config')
|
|
4
|
+
const GetAppDataService = {
|
|
5
|
+
install (Vue) {
|
|
6
|
+
// 给vue增添对话框显示方法
|
|
7
|
+
Vue.$appdata = Vue.prototype.$appdata = GetAppDataService
|
|
8
|
+
},
|
|
9
|
+
async load () {
|
|
10
|
+
const params = {}
|
|
11
|
+
await post(manageApi.getDictionaryValue, {}).then((res) => {
|
|
12
|
+
// 判断是否是V4环境
|
|
13
|
+
if (setting.compatible === 'V4') {
|
|
14
|
+
// 如果是V4,从返回值中,data取值
|
|
15
|
+
Object.assign(params, res.data)
|
|
16
|
+
} else {
|
|
17
|
+
Object.assign(params, res)
|
|
18
|
+
}
|
|
19
|
+
const badgeItemArray = {}
|
|
20
|
+
for (const key of Object.keys(params)) {
|
|
21
|
+
badgeItemArray[key] = {}
|
|
22
|
+
for (const item of params[key]) {
|
|
23
|
+
if (item.status) {
|
|
24
|
+
badgeItemArray[key][item.value] = {
|
|
25
|
+
status: item.status,
|
|
26
|
+
text: item.text
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// 追加参数
|
|
32
|
+
localStorage.setItem(process.env.VUE_APP_DICTIONARY_KEY, JSON.stringify(params))
|
|
33
|
+
localStorage.setItem(process.env.VUE_APP_BADGE_KEY, JSON.stringify(badgeItemArray))
|
|
34
|
+
})
|
|
35
|
+
// 获取省市区数据
|
|
36
|
+
await post(manageApi.getDivisionsOhChina, {}).then((res) => {
|
|
37
|
+
// 追加参数
|
|
38
|
+
localStorage.setItem(process.env.VUE_APP_DIVISIONSOHCHINA, JSON.stringify(res))
|
|
39
|
+
})
|
|
40
|
+
},
|
|
41
|
+
// 返回树形省市区
|
|
42
|
+
getDivisionsOhChinaForTree () {
|
|
43
|
+
const str = localStorage.getItem(process.env.VUE_APP_DIVISIONSOHCHINA)
|
|
44
|
+
return handleTree(JSON.parse(str), 'code', 'parentcode')
|
|
45
|
+
},
|
|
46
|
+
// 返回列表省市区
|
|
47
|
+
getDivisionsOhChinaForList () {
|
|
48
|
+
const str = localStorage.getItem(process.env.VUE_APP_DIVISIONSOHCHINA)
|
|
49
|
+
return JSON.parse(str)
|
|
50
|
+
},
|
|
51
|
+
getDictionaryList (key) {
|
|
52
|
+
const str = localStorage.getItem(process.env.VUE_APP_DICTIONARY_KEY)
|
|
53
|
+
const object = JSON.parse(str)
|
|
54
|
+
return object[key]
|
|
55
|
+
},
|
|
56
|
+
getParam (key, value) {
|
|
57
|
+
const str = localStorage.getItem(process.env.VUE_APP_BADGE_KEY)
|
|
58
|
+
const object = JSON.parse(str)
|
|
59
|
+
const result = object[key]
|
|
60
|
+
if (result && result.hasOwnProperty(value)) {
|
|
61
|
+
return result[value]
|
|
62
|
+
} else {
|
|
63
|
+
return null
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
getParams () {
|
|
67
|
+
const str = localStorage.getItem(process.env.VUE_APP_DICTIONARY_KEY)
|
|
68
|
+
const object = JSON.parse(str)
|
|
69
|
+
return object
|
|
70
|
+
},
|
|
71
|
+
getSingleValues () {
|
|
72
|
+
const str = localStorage.getItem(process.env.VUE_APP_BADGE_KEY)
|
|
73
|
+
const object = JSON.parse(str)
|
|
74
|
+
return object
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export default GetAppDataService
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
|
|
55
55
|
<script>
|
|
56
56
|
import CommonLayout from '@vue2-client/layouts/CommonLayout'
|
|
57
|
-
import { getRoutesConfig, login } from '@vue2-client/services/user'
|
|
57
|
+
import { getRoutesConfig, login, V4Login } from '@vue2-client/services/user'
|
|
58
58
|
import { setAuthorization } from '@vue2-client/utils/request'
|
|
59
59
|
import { loadRoutes, funcToRouter } from '@vue2-client/utils/routerUtil'
|
|
60
60
|
import { mapMutations, mapState } from 'vuex'
|
|
@@ -95,6 +95,10 @@ export default {
|
|
|
95
95
|
loginStart(name, password).then(this.afterLoginOA).finally(() => { this.logging = false })
|
|
96
96
|
break
|
|
97
97
|
}
|
|
98
|
+
case 'V4' : {
|
|
99
|
+
V4Login(name, password).then(this.afterLoginV4)
|
|
100
|
+
break
|
|
101
|
+
}
|
|
98
102
|
}
|
|
99
103
|
}
|
|
100
104
|
})
|
|
@@ -107,6 +111,33 @@ export default {
|
|
|
107
111
|
this.setACCESSTOKEN(result.password)
|
|
108
112
|
this.$router.push(this.homePage).catch(() => {})
|
|
109
113
|
},
|
|
114
|
+
afterLoginV4 (res) {
|
|
115
|
+
const name = this.form.getFieldValue('name')
|
|
116
|
+
const password = this.form.getFieldValue('password')
|
|
117
|
+
this.logging = false
|
|
118
|
+
const loginRes = res
|
|
119
|
+
const V4Token = { token: res.data.access_token, expire: res.data.expires_in }
|
|
120
|
+
this.setV4AccessToken(V4Token)
|
|
121
|
+
if (loginRes.code === 200) {
|
|
122
|
+
const encrypt = new JSEncrypt()
|
|
123
|
+
encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB')
|
|
124
|
+
const data = encrypt.encrypt(JSON.stringify({ username: name, password: password }))
|
|
125
|
+
// 获取路由配置
|
|
126
|
+
console.log('开始请求智慧燃气')
|
|
127
|
+
getRoutesConfig(data).then(result => {
|
|
128
|
+
this.$login.login(result).then(() => {
|
|
129
|
+
this.afterGeneral(result)
|
|
130
|
+
if (result.deps === '用户工单登记') {
|
|
131
|
+
this.$router.push(this.ticketPage).catch(() => {})
|
|
132
|
+
} else {
|
|
133
|
+
this.$router.push(this.homePage).catch(() => {})
|
|
134
|
+
}
|
|
135
|
+
})
|
|
136
|
+
})
|
|
137
|
+
} else {
|
|
138
|
+
this.error = loginRes.msg
|
|
139
|
+
}
|
|
140
|
+
},
|
|
110
141
|
afterLogin (res) {
|
|
111
142
|
const name = this.form.getFieldValue('name')
|
|
112
143
|
const password = this.form.getFieldValue('password')
|
|
@@ -161,6 +192,11 @@ export default {
|
|
|
161
192
|
// 格式化时间获取年月日, 登陆过期时间
|
|
162
193
|
const dateAfter = new Date(timestamp)
|
|
163
194
|
setAuthorization({ token: data, expireAt: dateAfter })
|
|
195
|
+
},
|
|
196
|
+
setV4AccessToken (data) {
|
|
197
|
+
localStorage.setItem('ACCESS_TOKEN', data.token)
|
|
198
|
+
localStorage.setItem('ACCESS_TOKEN_EXPIRES', data.expire)
|
|
199
|
+
setAuthorization({ token: data.token, expire: data.expire })
|
|
164
200
|
}
|
|
165
201
|
}
|
|
166
202
|
}
|
|
@@ -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
|
-
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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 }
|
package/src/services/user.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LOGIN, ROUTES } from '@vue2-client/services/apiService'
|
|
1
|
+
import { LOGIN, ROUTES, V4_LOGIN } from '@vue2-client/services/apiService'
|
|
2
2
|
import { request, METHOD, removeAuthorization } from '@vue2-client/utils/request'
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -18,6 +18,13 @@ export async function getRoutesConfig (value) {
|
|
|
18
18
|
return request(ROUTES, METHOD.POST, value)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
export async function V4Login (name, password) {
|
|
22
|
+
return request(V4_LOGIN, METHOD.POST, {
|
|
23
|
+
username: name,
|
|
24
|
+
password: password
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
|
|
21
28
|
/**
|
|
22
29
|
* 退出登录
|
|
23
30
|
*/
|
package/src/utils/request.js
CHANGED
|
@@ -4,8 +4,13 @@ import Vue from 'vue'
|
|
|
4
4
|
import { ACCESS_TOKEN } from '@vue2-client/store/mutation-types'
|
|
5
5
|
import notification from 'ant-design-vue/es/notification'
|
|
6
6
|
|
|
7
|
+
const setting = require('../config/default/setting.config')
|
|
8
|
+
|
|
7
9
|
// 跨域认证信息 header 名
|
|
8
10
|
const xsrfHeaderName = 'Authorization'
|
|
11
|
+
// V4系统请求头名
|
|
12
|
+
const v4TokenName = 'ACCESS_TOKEN'
|
|
13
|
+
const v4TokenExpire = 'ACCESS_TOKEN_EXPIRES'
|
|
9
14
|
|
|
10
15
|
axios.defaults.timeout = 5000
|
|
11
16
|
axios.defaults.withCredentials = true
|
|
@@ -45,6 +50,43 @@ async function request (url, method, params, config) {
|
|
|
45
50
|
}
|
|
46
51
|
}
|
|
47
52
|
|
|
53
|
+
/**
|
|
54
|
+
* 设置V4认证信息
|
|
55
|
+
* @param auth {Object}
|
|
56
|
+
* @param authType {AUTH_TYPE} 认证类型,默认:{AUTH_TYPE.BEARER}
|
|
57
|
+
*/
|
|
58
|
+
function setAuthorizationV4 (auth, authType = AUTH_TYPE.BEARER) {
|
|
59
|
+
switch (authType) {
|
|
60
|
+
case AUTH_TYPE.BEARER:
|
|
61
|
+
Cookie.set(v4TokenName, 'Bearer ' + auth.token)
|
|
62
|
+
Cookie.set(v4TokenExpire, 'Bearer ' + auth.expire)
|
|
63
|
+
break
|
|
64
|
+
case AUTH_TYPE.BASIC:
|
|
65
|
+
case AUTH_TYPE.AUTH1:
|
|
66
|
+
case AUTH_TYPE.AUTH2:
|
|
67
|
+
default:
|
|
68
|
+
break
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* 移出V4认证信息
|
|
74
|
+
* @param authType {AUTH_TYPE} 认证类型
|
|
75
|
+
*/
|
|
76
|
+
function removeAuthorizationV4 (authType = AUTH_TYPE.BEARER) {
|
|
77
|
+
switch (authType) {
|
|
78
|
+
case AUTH_TYPE.BEARER:
|
|
79
|
+
Cookie.remove(v4TokenName)
|
|
80
|
+
Cookie.remove(v4TokenExpire)
|
|
81
|
+
break
|
|
82
|
+
case AUTH_TYPE.BASIC:
|
|
83
|
+
case AUTH_TYPE.AUTH1:
|
|
84
|
+
case AUTH_TYPE.AUTH2:
|
|
85
|
+
default:
|
|
86
|
+
break
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
48
90
|
/**
|
|
49
91
|
* 设置认证信息
|
|
50
92
|
* @param auth {Object}
|
|
@@ -113,7 +155,14 @@ function loadInterceptors () {
|
|
|
113
155
|
// 如果 token 存在
|
|
114
156
|
// 让每个请求携带自定义 token 请根据实际情况自行修改
|
|
115
157
|
if (token) {
|
|
116
|
-
|
|
158
|
+
// 判断是否为V4环境
|
|
159
|
+
if (setting.compatible === 'V4') {
|
|
160
|
+
// V4 环境则添加 V4请求头
|
|
161
|
+
config.headers['ACCESS_TOKEN'] = localStorage.getItem('ACCESS_TOKEN')
|
|
162
|
+
config.headers['ACCESS_TOKEN_EXPIRES'] = localStorage.getItem('ACCESS_TOKEN_EXPIRES')
|
|
163
|
+
} else {
|
|
164
|
+
config.headers['Access-Token'] = token
|
|
165
|
+
}
|
|
117
166
|
}
|
|
118
167
|
if (!config.headers['Content-Type']) {
|
|
119
168
|
config.headers['Content-Type'] = 'application/json;charset=UTF-8'
|
|
@@ -194,5 +243,7 @@ export {
|
|
|
194
243
|
removeAuthorization,
|
|
195
244
|
checkAuthorization,
|
|
196
245
|
loadInterceptors,
|
|
197
|
-
parseUrlParams
|
|
246
|
+
parseUrlParams,
|
|
247
|
+
setAuthorizationV4,
|
|
248
|
+
removeAuthorizationV4
|
|
198
249
|
}
|