vue2-client 1.4.11 → 1.4.13
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 +366 -362
- package/index.js +30 -30
- package/package.json +78 -78
- package/src/App.vue +4 -2
- package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +225 -225
- package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +777 -777
- package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +553 -553
- package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
- package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
- package/src/base-client/components/common/XAddForm/XAddForm.vue +354 -354
- package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +327 -327
- package/src/base-client/components/common/XCard/XCard.vue +64 -64
- package/src/base-client/components/common/XForm/XForm.vue +274 -274
- package/src/base-client/components/common/XForm/XFormItem.vue +389 -389
- package/src/base-client/components/common/XFormTable/index.md +96 -96
- package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
- package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
- package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
- package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
- package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
- package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
- package/src/base-client/plugins/AppData.js +69 -69
- package/src/base-client/plugins/GetLoginInfoService.js +179 -179
- package/src/base-client/plugins/PagedList.js +177 -177
- package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
- package/src/base-client/plugins/i18n-extend.js +32 -32
- package/src/components/Ellipsis/index.md +38 -38
- package/src/components/NumberInfo/index.md +43 -43
- package/src/components/STable/README.md +341 -341
- package/src/components/STable/index.js +318 -318
- package/src/components/Trend/index.md +45 -45
- package/src/components/checkbox/ColorCheckbox.vue +157 -157
- package/src/components/checkbox/ImgCheckbox.vue +163 -163
- package/src/components/exception/ExceptionPage.vue +2 -2
- package/src/components/form/FormRow.vue +52 -52
- package/src/components/index.js +36 -36
- package/src/components/menu/SideMenu.vue +62 -62
- package/src/components/menu/menu.js +273 -273
- package/src/components/setting/Setting.vue +235 -235
- package/src/components/table/StandardTable.vue +141 -141
- package/src/components/table/advance/ActionColumns.vue +158 -158
- package/src/components/table/advance/SearchArea.vue +355 -355
- package/src/components/tool/AStepItem.vue +60 -60
- package/src/components/tool/AvatarList.vue +68 -68
- package/src/components/tool/Drawer.vue +142 -142
- package/src/components/tool/TagSelect.vue +83 -83
- package/src/components/transition/PageToggleTransition.vue +97 -97
- package/src/config/default/setting.config.js +1 -1
- package/src/config/replacer/resolve.config.js +67 -67
- package/src/layouts/AdminLayout.vue +174 -174
- package/src/layouts/header/AdminHeader.vue +104 -104
- package/src/layouts/header/HeaderNotice.vue +167 -167
- package/src/layouts/header/HeaderSearch.vue +67 -67
- package/src/layouts/header/InstitutionDetail.vue +181 -181
- package/src/layouts/tabs/TabsHead.vue +190 -190
- package/src/layouts/tabs/TabsView.vue +379 -379
- package/src/mock/goods/index.js +108 -108
- package/src/pages/CreateQueryPage.vue +65 -65
- package/src/pages/dashboard/workplace/WorkPlace.vue +141 -0
- package/src/pages/dashboard/workplace/i18n.js +40 -0
- package/src/pages/dashboard/workplace/index.js +2 -0
- package/src/pages/dashboard/workplace/index.less +59 -0
- package/src/pages/login/Login.vue +27 -41
- package/src/pages/report/ReportTable.js +124 -124
- package/src/pages/report/ReportTableHome.vue +28 -28
- package/src/pages/resourceManage/orgListManage.vue +98 -98
- package/src/pages/system/dictionary/index.vue +43 -43
- package/src/pages/system/file/index.vue +317 -317
- package/src/pages/system/queryParams/index.vue +43 -43
- package/src/router/async/config.async.js +27 -27
- package/src/router/async/router.map.js +5 -0
- package/src/router/index.js +27 -27
- package/src/services/api/DictionaryDetailsViewApi.js +6 -6
- package/src/services/api/LogDetailsViewApi.js +10 -10
- package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
- package/src/services/api/TicketDetailsViewApi.js +34 -34
- package/src/services/api/commonTempTable.js +10 -10
- package/src/services/api/index.js +17 -17
- package/src/services/api/manage.js +8 -8
- package/src/services/apiService.js +1 -0
- package/src/services/user.js +13 -5
- package/src/store/modules/index.js +4 -4
- package/src/store/mutation-types.js +1 -0
- package/src/theme/default/nprogress.less +76 -76
- package/src/theme/default/style.less +47 -47
- package/src/utils/colors.js +103 -103
- package/src/utils/excel/Blob.js +180 -180
- package/src/utils/excel/Export2Excel.js +141 -141
- package/src/utils/formatter.js +68 -68
- package/src/utils/i18n.js +80 -80
- package/src/utils/request.js +109 -33
- package/src/utils/routerUtil.js +364 -364
- package/src/utils/theme-color-replacer-extend.js +91 -91
- package/src/utils/themeUtil.js +100 -100
- package/src/utils/util.js +230 -230
- package/vue.config.js +7 -0
package/src/utils/request.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import axios from 'axios'
|
|
2
2
|
import Cookie from 'js-cookie'
|
|
3
|
-
import
|
|
4
|
-
import { ACCESS_TOKEN, V4_ACCESS_TOKEN } from '@vue2-client/store/mutation-types'
|
|
3
|
+
import { ACCESS_TOKEN, SYSTEM_VERSION, V4_ACCESS_TOKEN } from '@vue2-client/store/mutation-types'
|
|
5
4
|
import notification from 'ant-design-vue/es/notification'
|
|
5
|
+
import errorCode from '@vue2-client/utils/errorCode'
|
|
6
|
+
import qs from 'qs'
|
|
7
|
+
import { logout } from '@vue2-client/services/user'
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// 跨域认证信息 header 名
|
|
10
|
-
const xsrfHeaderName = 'Authorization'
|
|
9
|
+
// 是否显示重新登录
|
|
10
|
+
let isReloginShow
|
|
11
11
|
|
|
12
12
|
axios.defaults.timeout = 5000
|
|
13
13
|
axios.defaults.withCredentials = true
|
|
14
|
-
axios.defaults.xsrfHeaderName = xsrfHeaderName
|
|
15
|
-
axios.defaults.xsrfCookieName = xsrfHeaderName
|
|
16
14
|
|
|
17
15
|
// 认证类型
|
|
18
16
|
const AUTH_TYPE = {
|
|
@@ -25,7 +23,9 @@ const AUTH_TYPE = {
|
|
|
25
23
|
// http method
|
|
26
24
|
const METHOD = {
|
|
27
25
|
GET: 'get',
|
|
28
|
-
POST: 'post'
|
|
26
|
+
POST: 'post',
|
|
27
|
+
PUT: 'put',
|
|
28
|
+
DELETE: 'delete'
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/**
|
|
@@ -42,6 +42,10 @@ async function request (url, method, params, config) {
|
|
|
42
42
|
return axios.get(url, { params, ...config })
|
|
43
43
|
case METHOD.POST:
|
|
44
44
|
return axios.post(url, params, config)
|
|
45
|
+
case METHOD.PUT:
|
|
46
|
+
return axios.put(url, params, config)
|
|
47
|
+
case METHOD.DELETE:
|
|
48
|
+
return axios.delete(url, config)
|
|
45
49
|
default:
|
|
46
50
|
return axios.get(url, { params, ...config })
|
|
47
51
|
}
|
|
@@ -55,9 +59,7 @@ async function request (url, method, params, config) {
|
|
|
55
59
|
function setAuthorization (auth, authType = AUTH_TYPE.BEARER) {
|
|
56
60
|
switch (authType) {
|
|
57
61
|
case AUTH_TYPE.BEARER:
|
|
58
|
-
|
|
59
|
-
Cookie.set(xsrfHeaderName, 'Bearer ' + auth.token, { expires: auth.expireAt })
|
|
60
|
-
}
|
|
62
|
+
Cookie.set(V4_ACCESS_TOKEN, 'Bearer ' + auth.token, { expires: auth.expireAt })
|
|
61
63
|
break
|
|
62
64
|
case AUTH_TYPE.BASIC:
|
|
63
65
|
case AUTH_TYPE.AUTH1:
|
|
@@ -67,6 +69,21 @@ function setAuthorization (auth, authType = AUTH_TYPE.BEARER) {
|
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
|
|
72
|
+
/**
|
|
73
|
+
* 设置系统版本
|
|
74
|
+
* @param value 系统版本
|
|
75
|
+
*/
|
|
76
|
+
export function setSystemVersion (value) {
|
|
77
|
+
Cookie.set(SYSTEM_VERSION, value)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* 获取系统版本
|
|
82
|
+
*/
|
|
83
|
+
export function getSystemVersion () {
|
|
84
|
+
return Cookie.get(SYSTEM_VERSION)
|
|
85
|
+
}
|
|
86
|
+
|
|
70
87
|
/**
|
|
71
88
|
* 移出认证信息
|
|
72
89
|
* @param authType {AUTH_TYPE} 认证类型
|
|
@@ -74,7 +91,7 @@ function setAuthorization (auth, authType = AUTH_TYPE.BEARER) {
|
|
|
74
91
|
function removeAuthorization (authType = AUTH_TYPE.BEARER) {
|
|
75
92
|
switch (authType) {
|
|
76
93
|
case AUTH_TYPE.BEARER:
|
|
77
|
-
Cookie.remove(
|
|
94
|
+
Cookie.remove(V4_ACCESS_TOKEN)
|
|
78
95
|
break
|
|
79
96
|
case AUTH_TYPE.BASIC:
|
|
80
97
|
case AUTH_TYPE.AUTH1:
|
|
@@ -92,7 +109,7 @@ function removeAuthorization (authType = AUTH_TYPE.BEARER) {
|
|
|
92
109
|
function checkAuthorization (authType = AUTH_TYPE.BEARER) {
|
|
93
110
|
switch (authType) {
|
|
94
111
|
case AUTH_TYPE.BEARER:
|
|
95
|
-
if (Cookie.get(
|
|
112
|
+
if (Cookie.get(V4_ACCESS_TOKEN)) {
|
|
96
113
|
return true
|
|
97
114
|
}
|
|
98
115
|
break
|
|
@@ -117,38 +134,97 @@ function loadInterceptors () {
|
|
|
117
134
|
// 如果 token 存在
|
|
118
135
|
// 让每个请求携带自定义 token 请根据实际情况自行修改
|
|
119
136
|
if (token) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
compatible =
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
config.headers[ACCESS_TOKEN] = token
|
|
137
|
+
if (config.url !== '/auth/login') {
|
|
138
|
+
// 判断是否为V4环境
|
|
139
|
+
const compatible = getSystemVersion()
|
|
140
|
+
if (compatible === 'V4') {
|
|
141
|
+
// V4 环境则添加 V4请求头
|
|
142
|
+
config.headers[V4_ACCESS_TOKEN] = token
|
|
143
|
+
} else {
|
|
144
|
+
config.headers[ACCESS_TOKEN] = token
|
|
145
|
+
}
|
|
130
146
|
}
|
|
131
147
|
}
|
|
132
148
|
if (!config.headers['Content-Type']) {
|
|
133
149
|
config.headers['Content-Type'] = 'application/json;charset=UTF-8'
|
|
134
150
|
}
|
|
151
|
+
// 处理params参数
|
|
152
|
+
if (config.params) {
|
|
153
|
+
const url = config.url + '?' + qs.stringify(config.params, { indices: false })
|
|
154
|
+
config.params = {}
|
|
155
|
+
config.url = url
|
|
156
|
+
}
|
|
135
157
|
return config
|
|
136
158
|
}, errorHandler)
|
|
137
159
|
// 加载响应拦截器
|
|
138
|
-
axios.interceptors.response.use((
|
|
160
|
+
axios.interceptors.response.use((res) => {
|
|
139
161
|
// 判断是否为V4环境,不为compatible赋初始值
|
|
140
162
|
// 其有可能是undefined未定义,或第一次使用本系统LocalStorage在初始化,获得的值为null
|
|
141
|
-
|
|
142
|
-
compatible = localStorage.getItem('compatible')
|
|
143
|
-
}
|
|
163
|
+
const compatible = getSystemVersion()
|
|
144
164
|
if (compatible === 'V4') {
|
|
145
|
-
|
|
146
|
-
|
|
165
|
+
// 请求rul
|
|
166
|
+
const requestUrl = res.config.url
|
|
167
|
+
if (res.data.data) {
|
|
168
|
+
res.data = res.data.data
|
|
169
|
+
}
|
|
170
|
+
// 未设置状态码则默认成功状态
|
|
171
|
+
const code = res.data.code || 200
|
|
172
|
+
// 获取错误信息
|
|
173
|
+
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
|
174
|
+
// 二进制数据则直接返回
|
|
175
|
+
if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') {
|
|
176
|
+
return res.data
|
|
177
|
+
}
|
|
178
|
+
if (code === 401) {
|
|
179
|
+
if (!isReloginShow) {
|
|
180
|
+
isReloginShow = true
|
|
181
|
+
notification.open({
|
|
182
|
+
message: '系统提示',
|
|
183
|
+
description: '登录状态已过期,请重新登录',
|
|
184
|
+
btn: h => {
|
|
185
|
+
return h(
|
|
186
|
+
'a-button',
|
|
187
|
+
{
|
|
188
|
+
props: {
|
|
189
|
+
type: 'primary',
|
|
190
|
+
size: 'small'
|
|
191
|
+
},
|
|
192
|
+
on: {
|
|
193
|
+
click: () => {
|
|
194
|
+
logout().then(() => {
|
|
195
|
+
isReloginShow = false
|
|
196
|
+
location.href = '/login'
|
|
197
|
+
})
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
'确认'
|
|
202
|
+
)
|
|
203
|
+
},
|
|
204
|
+
duration: 0,
|
|
205
|
+
onClose: () => {
|
|
206
|
+
isReloginShow = false
|
|
207
|
+
}
|
|
208
|
+
})
|
|
209
|
+
}
|
|
210
|
+
} else if (code === 500) {
|
|
211
|
+
if (requestUrl !== '/login') {
|
|
212
|
+
notification.error({
|
|
213
|
+
message: '失败',
|
|
214
|
+
description: msg
|
|
215
|
+
})
|
|
216
|
+
}
|
|
217
|
+
} else if (code !== 200) {
|
|
218
|
+
notification.error({
|
|
219
|
+
message: '失败',
|
|
220
|
+
description: msg
|
|
221
|
+
})
|
|
147
222
|
} else {
|
|
148
|
-
return
|
|
223
|
+
return res.data
|
|
149
224
|
}
|
|
225
|
+
return Promise.reject(msg)
|
|
150
226
|
} else {
|
|
151
|
-
return
|
|
227
|
+
return res.data
|
|
152
228
|
}
|
|
153
229
|
}, errorHandler)
|
|
154
230
|
}
|
|
@@ -170,7 +246,7 @@ const errorHandler = (error) => {
|
|
|
170
246
|
description: data
|
|
171
247
|
})
|
|
172
248
|
if (token) {
|
|
173
|
-
|
|
249
|
+
logout().then(() => {
|
|
174
250
|
setTimeout(() => {
|
|
175
251
|
window.location.reload()
|
|
176
252
|
}, 1500)
|