vue2-client 1.2.28 → 1.2.29

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 (69) hide show
  1. package/CHANGELOG.md +56 -56
  2. package/package.json +2 -1
  3. package/src/base-client/all.js +57 -57
  4. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +272 -174
  5. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +2 -3
  6. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +1 -2
  7. package/src/base-client/components/common/ScrollList/SrcollList.vue +113 -0
  8. package/src/base-client/components/common/ScrollList/index.js +3 -0
  9. package/src/base-client/components/common/XAddForm/XAddForm.vue +1 -1
  10. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +315 -315
  11. package/src/base-client/components/common/XAddNativeForm/index.js +3 -3
  12. package/src/base-client/components/common/XAddNativeForm/index.md +56 -56
  13. package/src/base-client/components/common/XForm/XForm.vue +1 -1
  14. package/src/base-client/components/common/XForm/XFormItem.vue +1 -1
  15. package/src/base-client/components/common/XFormTable/XFormTable.vue +1 -2
  16. package/src/base-client/components/iot/CustomerDetailsView/CustomerDetailsView.vue +1 -2
  17. package/src/base-client/components/iot/DeviceBrandDetailsView/DeviceBrandDetailsView.vue +1 -2
  18. package/src/base-client/components/iot/DeviceDetailsView/DeviceDetailsView.vue +1 -2
  19. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsCount.vue +1 -1
  20. package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsInstructOperate.vue +1 -2
  21. package/src/base-client/components/iot/DeviceTypeDetailsView/DeviceTypeDetailsView.vue +1 -2
  22. package/src/base-client/components/iot/InstructDetailsView/InstructDetailsView.vue +1 -3
  23. package/src/base-client/components/iot/LogDetailsView/LogDetailsView.vue +1 -2
  24. package/src/base-client/components/iot/MeterDetailsView/MeterDetailsView.vue +1 -2
  25. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsCount.vue +1 -1
  26. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsException.vue +1 -2
  27. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsHandPlan.vue +1 -2
  28. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsInstruct.vue +1 -2
  29. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsMain.vue +1 -2
  30. package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsSellGas.vue +1 -2
  31. package/src/base-client/components/iot/WebmeterAnalysisView/WebmeterAnalysisView.vue +1 -2
  32. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +1 -2
  33. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +1 -2
  34. package/src/base-client/components/ticket/EmployeeDetailsView/EmployeeDetailsView.vue +1 -2
  35. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +844 -846
  36. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +1 -2
  37. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +528 -529
  38. package/src/base-client/plugins/AppData.js +1 -2
  39. package/src/base-client/plugins/GetLoginInfoService.js +45 -14
  40. package/src/components/exception/ExceptionPage.vue +1 -1
  41. package/src/config/CreateQueryConfig.js +40 -0
  42. package/src/layouts/ComponentLayoutOne.vue +0 -1
  43. package/src/layouts/SinglePageView.vue +1 -1
  44. package/src/layouts/header/HeaderNotice.vue +1 -1
  45. package/src/pages/report/ReportTableHome.vue +1 -1
  46. package/src/pages/resourceManage/depListManage.vue +23 -0
  47. package/src/pages/resourceManage/funListManage.vue +23 -0
  48. package/src/pages/resourceManage/index.js +15 -0
  49. package/src/pages/resourceManage/orgListManage.vue +98 -0
  50. package/src/pages/resourceManage/resourceManageMain.vue +37 -34
  51. package/src/pages/resourceManage/roleListManage.vue +23 -0
  52. package/src/pages/resourceManage/staffListManage.vue +23 -0
  53. package/src/pages/system/ticket/index.vue +437 -438
  54. package/src/pages/system/ticket/submitTicketSuccess.vue +1 -2
  55. package/src/services/api/EmployeeDetailsViewApi.js +16 -16
  56. package/src/services/api/common.js +10 -0
  57. package/src/services/api/index.js +39 -0
  58. package/src/services/{api.js → apiService.js} +0 -0
  59. package/src/services/user.js +1 -1
  60. package/src/store/modules/account.js +2 -2
  61. package/src/utils/indexedDB.js +1 -1
  62. package/src/utils/request.js +197 -197
  63. package/src/utils/routerUtil.js +1 -13
  64. package/src/utils/util.js +12 -0
  65. package/yarn.lock +13634 -0
  66. package/src/base-client/components/iot/DataAnalysisViewGD/DataAnalysisViewGD.vue +0 -549
  67. package/src/base-client/components/iot/DataAnalysisViewGD/WindowTemplate/WindowInfotemp.vue +0 -99
  68. package/src/base-client/components/iot/DataAnalysisViewGD/WindowTemplate/index.js +0 -3
  69. package/src/base-client/components/iot/DataAnalysisViewGD/index.js +0 -3
@@ -51,8 +51,7 @@
51
51
  import Result from '@vue2-client/components/result/Result'
52
52
  import DetailList from '@vue2-client/components/tool/DetailList'
53
53
  import AStepItem from '@vue2-client/components/tool/AStepItem'
54
- import { TicketDetailsViewApi } from '@vue2-client/services/api/TicketDetailsViewApi'
55
- import { post } from '@vue2-client/services/api/restTools'
54
+ import { TicketDetailsViewApi, post } from '@vue2-client/services/api'
56
55
  import { formatDate } from '@vue2-client/utils/util'
57
56
 
58
57
  const AStepItemGroup = AStepItem.Group
@@ -1,16 +1,16 @@
1
- const EmployeeDetailsViewApi = {
2
- // 查询:获取员工详细信息
3
- getEmployeeDetails: '/webmeterapi/getEmployeeDetails',
4
- // 查询:获取员工上一周应答工单数量
5
- getConfirmTicketsCountWeekly: '/webmeterapi/getConfirmTicketsCountWeekly',
6
- // 查询:获取员工上一周完成工单数量
7
- getFinishedTicketsCountWeekly: '/webmeterapi/getFinishedTicketsCountWeekly',
8
- // 查询:是否存在此员工
9
- findEmpName: '/webmeterapi/findEmpName',
10
- // 查询:获取所有员工名,供前端展示备选项
11
- getAllEmployeeName: '/webmeterapi/getAllEmployeeName',
12
- // 查询:根据员工名,获取员工id
13
- getEmployeeId: '/webmeterapi/getEmployeeId'
14
- }
15
-
16
- export { EmployeeDetailsViewApi }
1
+ const EmployeeDetailsViewApi = {
2
+ // 查询:获取员工详细信息
3
+ getEmployeeDetails: '/webmeterapi/getEmployeeDetails',
4
+ // 查询:获取员工上一周应答工单数量
5
+ getConfirmTicketsCountWeekly: '/webmeterapi/getConfirmTicketsCountWeekly',
6
+ // 查询:获取员工上一周完成工单数量
7
+ getFinishedTicketsCountWeekly: '/webmeterapi/getFinishedTicketsCountWeekly',
8
+ // 查询:是否存在此员工
9
+ findEmpName: '/webmeterapi/findEmpName',
10
+ // 查询:获取所有员工名,供前端展示备选项
11
+ getAllEmployeeName: '/webmeterapi/getAllEmployeeName',
12
+ // 查询:根据员工名,获取员工id
13
+ getEmployeeId: '/webmeterapi/getEmployeeId'
14
+ }
15
+
16
+ export { EmployeeDetailsViewApi }
@@ -1,4 +1,5 @@
1
1
  import { METHOD, request } from '@vue2-client/utils/request'
2
+ import { indexedDB } from '@vue2-client/utils/indexedDB'
2
3
 
3
4
  const commonApi = {
4
5
  // 获取表格列配置
@@ -13,6 +14,15 @@ const commonApi = {
13
14
  getDictionaryParam: '/webmeterapi/getDictionaryParam'
14
15
  }
15
16
 
17
+ /**
18
+ * 带缓存查询的表格配置文件查询
19
+ * @param queryParamsName 配置名称
20
+ * @param callback 回调函数
21
+ */
22
+ export function getColumnsJson (queryParamsName, callback) {
23
+ indexedDB.getByWeb(queryParamsName, commonApi.getColumnsJson, { str: queryParamsName }, callback)
24
+ }
25
+
16
26
  /**
17
27
  * 通用表单查询
18
28
  */
@@ -0,0 +1,39 @@
1
+ import { commonApi, getColumnsJson, query, addOrModify, remove } from '@vue2-client/services/api/common'
2
+ import { CustomerDetailsViewApi } from '@vue2-client/services/api/CustomerDetailsViewApi'
3
+ import { DeviceBrandDetailsViewApi } from '@vue2-client/services/api/DeviceBrandDetailsViewApi'
4
+ import { DeviceDetailsViewApi } from '@vue2-client/services/api/DeviceDetailsViewApi'
5
+ import { DeviceTypeDetailsViewApi } from '@vue2-client/services/api/DeviceTypeDetailsViewApi'
6
+ import { DictionaryDetailsViewApi } from '@vue2-client/services/api/DictionaryDetailsViewApi'
7
+ import { EmployeeDetailsViewApi } from '@vue2-client/services/api/EmployeeDetailsViewApi'
8
+ import { FormGroupEditApi } from '@vue2-client/services/api/FormGroupEditApi'
9
+ import { InstructDetailsViewApi } from '@vue2-client/services/api/InstructDetailsViewApi'
10
+ import { iotApi } from '@vue2-client/services/api/iot'
11
+ import { LogDetailsViewApi } from '@vue2-client/services/api/LogDetailsViewApi'
12
+ import { manageApi } from '@vue2-client/services/api/manage'
13
+ import { MeterDetailsViewApi } from '@vue2-client/services/api/MeterDetailsViewApi'
14
+ import { QueryParamsDetailsViewApi } from '@vue2-client/services/api/QueryParamsDetailsViewApi'
15
+ import { get, post } from '@vue2-client/services/api/restTools'
16
+ import { serviceApi } from '@vue2-client/services/api/service'
17
+ import { TicketDetailsViewApi } from '@vue2-client/services/api/TicketDetailsViewApi'
18
+ import { WebmeterAnalysisViewApi } from '@vue2-client/services/api/WebmeterAnalysisViewApi'
19
+
20
+ export {
21
+ commonApi, getColumnsJson, query, addOrModify, remove,
22
+ CustomerDetailsViewApi,
23
+ DeviceBrandDetailsViewApi,
24
+ DeviceDetailsViewApi,
25
+ DeviceTypeDetailsViewApi,
26
+ DictionaryDetailsViewApi,
27
+ EmployeeDetailsViewApi,
28
+ FormGroupEditApi,
29
+ InstructDetailsViewApi,
30
+ iotApi,
31
+ LogDetailsViewApi,
32
+ manageApi,
33
+ MeterDetailsViewApi,
34
+ QueryParamsDetailsViewApi,
35
+ get, post,
36
+ serviceApi,
37
+ TicketDetailsViewApi,
38
+ WebmeterAnalysisViewApi
39
+ }
File without changes
@@ -1,4 +1,4 @@
1
- import { LOGIN, ROUTES } from '@vue2-client/services/api'
1
+ import { LOGIN, ROUTES } from '@vue2-client/services/apiService'
2
2
  import { request, METHOD, removeAuthorization } from '@vue2-client/utils/request'
3
3
 
4
4
  /**
@@ -24,7 +24,7 @@ export default {
24
24
  login: state => {
25
25
  if (!state.login) {
26
26
  try {
27
- const user = sessionStorage.getItem(process.env.VUE_APP_LOGIN_KEY)
27
+ const user = localStorage.getItem(process.env.VUE_APP_LOGIN_KEY)
28
28
  state.login = JSON.parse(user)
29
29
  } catch (e) {
30
30
  console.error(e)
@@ -85,7 +85,7 @@ export default {
85
85
  },
86
86
  setLogin (state, login) {
87
87
  state.login = login
88
- sessionStorage.setItem(process.env.VUE_APP_LOGIN_KEY, JSON.stringify(login))
88
+ localStorage.setItem(process.env.VUE_APP_LOGIN_KEY, JSON.stringify(login))
89
89
  },
90
90
  setPermissions (state, permissions) {
91
91
  state.permissions = permissions
@@ -1,5 +1,5 @@
1
1
  // indexDB 存储
2
- import { post } from '@vue2-client/services/api/restTools'
2
+ import { post } from '@vue2-client/services/api'
3
3
 
4
4
  export const indexedDB = {
5
5
  db: undefined,
@@ -1,197 +1,197 @@
1
- import axios from 'axios'
2
- import Cookie from 'js-cookie'
3
- import Vue from 'vue'
4
- import { ACCESS_TOKEN } from '@vue2-client/store/mutation-types'
5
- import notification from 'ant-design-vue/es/notification'
6
-
7
- // 跨域认证信息 header 名
8
- const xsrfHeaderName = 'Authorization'
9
-
10
- axios.defaults.timeout = 5000
11
- axios.defaults.withCredentials = true
12
- axios.defaults.xsrfHeaderName = xsrfHeaderName
13
- axios.defaults.xsrfCookieName = xsrfHeaderName
14
-
15
- // 认证类型
16
- const AUTH_TYPE = {
17
- BEARER: 'Bearer',
18
- BASIC: 'basic',
19
- AUTH1: 'auth1',
20
- AUTH2: 'auth2'
21
- }
22
-
23
- // http method
24
- const METHOD = {
25
- GET: 'get',
26
- POST: 'post'
27
- }
28
-
29
- /**
30
- * axios请求
31
- * @param url 请求地址
32
- * @param method {METHOD} http method
33
- * @param params 请求参数
34
- * @returns {Promise<AxiosResponse<T>>}
35
- */
36
- async function request (url, method, params, config) {
37
- switch (method) {
38
- case METHOD.GET:
39
- return axios.get(url, { params, ...config })
40
- case METHOD.POST:
41
- return axios.post(url, params, config)
42
- default:
43
- return axios.get(url, { params, ...config })
44
- }
45
- }
46
-
47
- /**
48
- * 设置认证信息
49
- * @param auth {Object}
50
- * @param authType {AUTH_TYPE} 认证类型,默认:{AUTH_TYPE.BEARER}
51
- */
52
- function setAuthorization (auth, authType = AUTH_TYPE.BEARER) {
53
- switch (authType) {
54
- case AUTH_TYPE.BEARER:
55
- Cookie.set(xsrfHeaderName, 'Bearer ' + auth.token, { expires: auth.expireAt })
56
- break
57
- case AUTH_TYPE.BASIC:
58
- case AUTH_TYPE.AUTH1:
59
- case AUTH_TYPE.AUTH2:
60
- default:
61
- break
62
- }
63
- }
64
-
65
- /**
66
- * 移出认证信息
67
- * @param authType {AUTH_TYPE} 认证类型
68
- */
69
- function removeAuthorization (authType = AUTH_TYPE.BEARER) {
70
- switch (authType) {
71
- case AUTH_TYPE.BEARER:
72
- Cookie.remove(xsrfHeaderName)
73
- break
74
- case AUTH_TYPE.BASIC:
75
- case AUTH_TYPE.AUTH1:
76
- case AUTH_TYPE.AUTH2:
77
- default:
78
- break
79
- }
80
- }
81
-
82
- /**
83
- * 检查认证信息
84
- * @param authType
85
- * @returns {boolean}
86
- */
87
- function checkAuthorization (authType = AUTH_TYPE.BEARER) {
88
- switch (authType) {
89
- case AUTH_TYPE.BEARER:
90
- if (Cookie.get(xsrfHeaderName)) {
91
- return true
92
- }
93
- break
94
- case AUTH_TYPE.BASIC:
95
- case AUTH_TYPE.AUTH1:
96
- case AUTH_TYPE.AUTH2:
97
- default:
98
- break
99
- }
100
- return false
101
- }
102
-
103
- /**
104
- * 加载 axios 拦截器
105
- * @param interceptors
106
- * @param options
107
- */
108
- function loadInterceptors () {
109
- // 加载请求拦截器
110
- axios.interceptors.request.use(config => {
111
- const token = localStorage.getItem(ACCESS_TOKEN)
112
- // 如果 token 存在
113
- // 让每个请求携带自定义 token 请根据实际情况自行修改
114
- if (token) {
115
- config.headers['Access-Token'] = token
116
- }
117
- if (!config.headers['Content-Type']) {
118
- config.headers['Content-Type'] = 'application/json;charset=UTF-8'
119
- }
120
- return config
121
- }, errorHandler)
122
- // 加载响应拦截器
123
- axios.interceptors.response.use((response) => {
124
- return response.data
125
- }, errorHandler)
126
- }
127
-
128
- // 异常拦截处理器
129
- const errorHandler = (error) => {
130
- if (error.response) {
131
- const data = error.response.data
132
- // 从 localstorage 获取 token
133
- const token = localStorage.getItem(ACCESS_TOKEN)
134
- if (error.response.status === 403) {
135
- notification.error({
136
- message: '禁止访问',
137
- description: data
138
- })
139
- } else if (error.response.status === 401 && !(data.result && data.result.isLogin)) {
140
- notification.error({
141
- message: '鉴权失败',
142
- description: data
143
- })
144
- if (token) {
145
- Vue.$store.dispatch('Logout').then(() => {
146
- setTimeout(() => {
147
- window.location.reload()
148
- }, 1500)
149
- })
150
- }
151
- } else if (error.response.status === 500) {
152
- notification.error({
153
- message: '系统异常',
154
- description: data
155
- })
156
- } else {
157
- notification.error({
158
- message: '数据异常',
159
- description: data
160
- })
161
- }
162
- }
163
- return Promise.reject(error)
164
- }
165
-
166
- /**
167
- * 解析 url 中的参数
168
- * @param url
169
- * @returns {Object}
170
- */
171
- function parseUrlParams (url) {
172
- const params = {}
173
- if (!url || url === '' || typeof url !== 'string') {
174
- return params
175
- }
176
- const paramsStr = url.split('?')[1]
177
- if (!paramsStr) {
178
- return params
179
- }
180
- const paramsArr = paramsStr.replace(/&|=/g, ' ').split(' ')
181
- for (let i = 0; i < paramsArr.length / 2; i++) {
182
- const value = paramsArr[i * 2 + 1]
183
- params[paramsArr[i * 2]] = value === 'true' ? true : (value === 'false' ? false : value)
184
- }
185
- return params
186
- }
187
-
188
- export {
189
- METHOD,
190
- AUTH_TYPE,
191
- request,
192
- setAuthorization,
193
- removeAuthorization,
194
- checkAuthorization,
195
- loadInterceptors,
196
- parseUrlParams
197
- }
1
+ import axios from 'axios'
2
+ import Cookie from 'js-cookie'
3
+ import Vue from 'vue'
4
+ import { ACCESS_TOKEN } from '@vue2-client/store/mutation-types'
5
+ import notification from 'ant-design-vue/es/notification'
6
+
7
+ // 跨域认证信息 header 名
8
+ const xsrfHeaderName = 'Authorization'
9
+
10
+ axios.defaults.timeout = 5000
11
+ axios.defaults.withCredentials = true
12
+ axios.defaults.xsrfHeaderName = xsrfHeaderName
13
+ axios.defaults.xsrfCookieName = xsrfHeaderName
14
+
15
+ // 认证类型
16
+ const AUTH_TYPE = {
17
+ BEARER: 'Bearer',
18
+ BASIC: 'basic',
19
+ AUTH1: 'auth1',
20
+ AUTH2: 'auth2'
21
+ }
22
+
23
+ // http method
24
+ const METHOD = {
25
+ GET: 'get',
26
+ POST: 'post'
27
+ }
28
+
29
+ /**
30
+ * axios请求
31
+ * @param url 请求地址
32
+ * @param method {METHOD} http method
33
+ * @param params 请求参数
34
+ * @returns {Promise<AxiosResponse<T>>}
35
+ */
36
+ async function request (url, method, params, config) {
37
+ switch (method) {
38
+ case METHOD.GET:
39
+ return axios.get(url, { params, ...config })
40
+ case METHOD.POST:
41
+ return axios.post(url, params, config)
42
+ default:
43
+ return axios.get(url, { params, ...config })
44
+ }
45
+ }
46
+
47
+ /**
48
+ * 设置认证信息
49
+ * @param auth {Object}
50
+ * @param authType {AUTH_TYPE} 认证类型,默认:{AUTH_TYPE.BEARER}
51
+ */
52
+ function setAuthorization (auth, authType = AUTH_TYPE.BEARER) {
53
+ switch (authType) {
54
+ case AUTH_TYPE.BEARER:
55
+ Cookie.set(xsrfHeaderName, 'Bearer ' + auth.token, { expires: auth.expireAt })
56
+ break
57
+ case AUTH_TYPE.BASIC:
58
+ case AUTH_TYPE.AUTH1:
59
+ case AUTH_TYPE.AUTH2:
60
+ default:
61
+ break
62
+ }
63
+ }
64
+
65
+ /**
66
+ * 移出认证信息
67
+ * @param authType {AUTH_TYPE} 认证类型
68
+ */
69
+ function removeAuthorization (authType = AUTH_TYPE.BEARER) {
70
+ switch (authType) {
71
+ case AUTH_TYPE.BEARER:
72
+ Cookie.remove(xsrfHeaderName)
73
+ break
74
+ case AUTH_TYPE.BASIC:
75
+ case AUTH_TYPE.AUTH1:
76
+ case AUTH_TYPE.AUTH2:
77
+ default:
78
+ break
79
+ }
80
+ }
81
+
82
+ /**
83
+ * 检查认证信息
84
+ * @param authType
85
+ * @returns {boolean}
86
+ */
87
+ function checkAuthorization (authType = AUTH_TYPE.BEARER) {
88
+ switch (authType) {
89
+ case AUTH_TYPE.BEARER:
90
+ if (Cookie.get(xsrfHeaderName)) {
91
+ return true
92
+ }
93
+ break
94
+ case AUTH_TYPE.BASIC:
95
+ case AUTH_TYPE.AUTH1:
96
+ case AUTH_TYPE.AUTH2:
97
+ default:
98
+ break
99
+ }
100
+ return false
101
+ }
102
+
103
+ /**
104
+ * 加载 axios 拦截器
105
+ * @param interceptors
106
+ * @param options
107
+ */
108
+ function loadInterceptors () {
109
+ // 加载请求拦截器
110
+ axios.interceptors.request.use(config => {
111
+ const token = localStorage.getItem(ACCESS_TOKEN)
112
+ // 如果 token 存在
113
+ // 让每个请求携带自定义 token 请根据实际情况自行修改
114
+ if (token) {
115
+ config.headers['Access-Token'] = token
116
+ }
117
+ if (!config.headers['Content-Type']) {
118
+ config.headers['Content-Type'] = 'application/json;charset=UTF-8'
119
+ }
120
+ return config
121
+ }, errorHandler)
122
+ // 加载响应拦截器
123
+ axios.interceptors.response.use((response) => {
124
+ return response.data
125
+ }, errorHandler)
126
+ }
127
+
128
+ // 异常拦截处理器
129
+ const errorHandler = (error) => {
130
+ if (error.response) {
131
+ const data = error.response.data
132
+ // 从 localstorage 获取 token
133
+ const token = localStorage.getItem(ACCESS_TOKEN)
134
+ if (error.response.status === 403) {
135
+ notification.error({
136
+ message: '禁止访问',
137
+ description: data
138
+ })
139
+ } else if (error.response.status === 401 && !(data.result && data.result.isLogin)) {
140
+ notification.error({
141
+ message: '鉴权失败',
142
+ description: data
143
+ })
144
+ if (token) {
145
+ Vue.$store.dispatch('Logout').then(() => {
146
+ setTimeout(() => {
147
+ window.location.reload()
148
+ }, 1500)
149
+ })
150
+ }
151
+ } else if (error.response.status === 500) {
152
+ notification.error({
153
+ message: '系统异常',
154
+ description: data
155
+ })
156
+ } else {
157
+ notification.error({
158
+ message: '数据异常',
159
+ description: data
160
+ })
161
+ }
162
+ }
163
+ return Promise.reject(error)
164
+ }
165
+
166
+ /**
167
+ * 解析 url 中的参数
168
+ * @param url
169
+ * @returns {Object}
170
+ */
171
+ function parseUrlParams (url) {
172
+ const params = {}
173
+ if (!url || url === '' || typeof url !== 'string') {
174
+ return params
175
+ }
176
+ const paramsStr = url.split('?')[1]
177
+ if (!paramsStr) {
178
+ return params
179
+ }
180
+ const paramsArr = paramsStr.replace(/&|=/g, ' ').split(' ')
181
+ for (let i = 0; i < paramsArr.length / 2; i++) {
182
+ const value = paramsArr[i * 2 + 1]
183
+ params[paramsArr[i * 2]] = value === 'true' ? true : (value === 'false' ? false : value)
184
+ }
185
+ return params
186
+ }
187
+
188
+ export {
189
+ METHOD,
190
+ AUTH_TYPE,
191
+ request,
192
+ setAuthorization,
193
+ removeAuthorization,
194
+ checkAuthorization,
195
+ loadInterceptors,
196
+ parseUrlParams
197
+ }
@@ -1,6 +1,7 @@
1
1
  import Vue from 'vue'
2
2
  import routerMap from '@vue2-client/router/async/router.map'
3
3
  import { mergeI18nFromRoutes } from '@vue2-client/utils/i18n'
4
+ import { arrRemoveEmpty } from '@vue2-client/utils/util'
4
5
  import Router from 'vue-router'
5
6
  import deepMerge from 'deepmerge'
6
7
  import basicOptions from '@vue2-client/router/async/config.async'
@@ -356,17 +357,4 @@ function positionRouter (r) {
356
357
  return router
357
358
  }
358
359
 
359
- /**
360
- * 数组去空值
361
- */
362
- function arrRemoveEmpty (arr) {
363
- for (var i = 0; i < arr.length; i++) {
364
- if (arr[i] == '' || typeof (arr[i]) == 'undefined') {
365
- arr.splice(i, 1)
366
- i--
367
- }
368
- }
369
- return arr
370
- }
371
-
372
360
  export { parseRoutes, loadRoutes, formatAuthority, getI18nKey, loadGuards, deepMergeRoutes, formatRoutes, setAppOptions, funcToRouter, setAppRouterMap }
package/src/utils/util.js CHANGED
@@ -23,6 +23,18 @@ const timeList = [
23
23
  US: 'Good evening'
24
24
  }
25
25
  ]
26
+ /**
27
+ * 数组去空值
28
+ */
29
+ export function arrRemoveEmpty (arr) {
30
+ for (var i = 0; i < arr.length; i++) {
31
+ if (arr[i] == '' || typeof (arr[i]) == 'undefined') {
32
+ arr.splice(i, 1)
33
+ i--
34
+ }
35
+ }
36
+ return arr
37
+ }
26
38
 
27
39
  export function isDef (v) {
28
40
  return v !== undefined && v !== null