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.
Files changed (96) hide show
  1. package/CHANGELOG.md +366 -362
  2. package/index.js +30 -30
  3. package/package.json +78 -78
  4. package/src/App.vue +4 -2
  5. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +225 -225
  6. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +777 -777
  7. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +553 -553
  8. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
  9. package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
  10. package/src/base-client/components/common/XAddForm/XAddForm.vue +354 -354
  11. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +327 -327
  12. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  13. package/src/base-client/components/common/XForm/XForm.vue +274 -274
  14. package/src/base-client/components/common/XForm/XFormItem.vue +389 -389
  15. package/src/base-client/components/common/XFormTable/index.md +96 -96
  16. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  17. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
  18. package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
  19. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
  20. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  21. package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
  22. package/src/base-client/plugins/AppData.js +69 -69
  23. package/src/base-client/plugins/GetLoginInfoService.js +179 -179
  24. package/src/base-client/plugins/PagedList.js +177 -177
  25. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  26. package/src/base-client/plugins/i18n-extend.js +32 -32
  27. package/src/components/Ellipsis/index.md +38 -38
  28. package/src/components/NumberInfo/index.md +43 -43
  29. package/src/components/STable/README.md +341 -341
  30. package/src/components/STable/index.js +318 -318
  31. package/src/components/Trend/index.md +45 -45
  32. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  33. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  34. package/src/components/exception/ExceptionPage.vue +2 -2
  35. package/src/components/form/FormRow.vue +52 -52
  36. package/src/components/index.js +36 -36
  37. package/src/components/menu/SideMenu.vue +62 -62
  38. package/src/components/menu/menu.js +273 -273
  39. package/src/components/setting/Setting.vue +235 -235
  40. package/src/components/table/StandardTable.vue +141 -141
  41. package/src/components/table/advance/ActionColumns.vue +158 -158
  42. package/src/components/table/advance/SearchArea.vue +355 -355
  43. package/src/components/tool/AStepItem.vue +60 -60
  44. package/src/components/tool/AvatarList.vue +68 -68
  45. package/src/components/tool/Drawer.vue +142 -142
  46. package/src/components/tool/TagSelect.vue +83 -83
  47. package/src/components/transition/PageToggleTransition.vue +97 -97
  48. package/src/config/default/setting.config.js +1 -1
  49. package/src/config/replacer/resolve.config.js +67 -67
  50. package/src/layouts/AdminLayout.vue +174 -174
  51. package/src/layouts/header/AdminHeader.vue +104 -104
  52. package/src/layouts/header/HeaderNotice.vue +167 -167
  53. package/src/layouts/header/HeaderSearch.vue +67 -67
  54. package/src/layouts/header/InstitutionDetail.vue +181 -181
  55. package/src/layouts/tabs/TabsHead.vue +190 -190
  56. package/src/layouts/tabs/TabsView.vue +379 -379
  57. package/src/mock/goods/index.js +108 -108
  58. package/src/pages/CreateQueryPage.vue +65 -65
  59. package/src/pages/dashboard/workplace/WorkPlace.vue +141 -0
  60. package/src/pages/dashboard/workplace/i18n.js +40 -0
  61. package/src/pages/dashboard/workplace/index.js +2 -0
  62. package/src/pages/dashboard/workplace/index.less +59 -0
  63. package/src/pages/login/Login.vue +27 -41
  64. package/src/pages/report/ReportTable.js +124 -124
  65. package/src/pages/report/ReportTableHome.vue +28 -28
  66. package/src/pages/resourceManage/orgListManage.vue +98 -98
  67. package/src/pages/system/dictionary/index.vue +43 -43
  68. package/src/pages/system/file/index.vue +317 -317
  69. package/src/pages/system/queryParams/index.vue +43 -43
  70. package/src/router/async/config.async.js +27 -27
  71. package/src/router/async/router.map.js +5 -0
  72. package/src/router/index.js +27 -27
  73. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  74. package/src/services/api/LogDetailsViewApi.js +10 -10
  75. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  76. package/src/services/api/TicketDetailsViewApi.js +34 -34
  77. package/src/services/api/commonTempTable.js +10 -10
  78. package/src/services/api/index.js +17 -17
  79. package/src/services/api/manage.js +8 -8
  80. package/src/services/apiService.js +1 -0
  81. package/src/services/user.js +13 -5
  82. package/src/store/modules/index.js +4 -4
  83. package/src/store/mutation-types.js +1 -0
  84. package/src/theme/default/nprogress.less +76 -76
  85. package/src/theme/default/style.less +47 -47
  86. package/src/utils/colors.js +103 -103
  87. package/src/utils/excel/Blob.js +180 -180
  88. package/src/utils/excel/Export2Excel.js +141 -141
  89. package/src/utils/formatter.js +68 -68
  90. package/src/utils/i18n.js +80 -80
  91. package/src/utils/request.js +109 -33
  92. package/src/utils/routerUtil.js +364 -364
  93. package/src/utils/theme-color-replacer-extend.js +91 -91
  94. package/src/utils/themeUtil.js +100 -100
  95. package/src/utils/util.js +230 -230
  96. package/vue.config.js +7 -0
@@ -1,18 +1,16 @@
1
1
  import axios from 'axios'
2
2
  import Cookie from 'js-cookie'
3
- import Vue from 'vue'
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
- let compatible
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
- if (auth.token) {
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(xsrfHeaderName)
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(xsrfHeaderName)) {
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
- // 如果是首次使用系统LocalStorage需要初始化,在登陆之后重新获取一次compatible
121
- if (compatible === null) {
122
- compatible = localStorage.getItem('compatible')
123
- }
124
- // 判断是否为V4环境
125
- if (compatible === 'V4') {
126
- // V4 环境则添加 V4请求头
127
- config.headers[V4_ACCESS_TOKEN] = token
128
- } else {
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((response) => {
160
+ axios.interceptors.response.use((res) => {
139
161
  // 判断是否为V4环境,不为compatible赋初始值
140
162
  // 其有可能是undefined未定义,或第一次使用本系统LocalStorage在初始化,获得的值为null
141
- if (compatible === null || compatible === undefined) {
142
- compatible = localStorage.getItem('compatible')
143
- }
163
+ const compatible = getSystemVersion()
144
164
  if (compatible === 'V4') {
145
- if (response.data.data) {
146
- return response.data.data
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 response.data
223
+ return res.data
149
224
  }
225
+ return Promise.reject(msg)
150
226
  } else {
151
- return response.data
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
- Vue.$store.dispatch('Logout').then(() => {
249
+ logout().then(() => {
174
250
  setTimeout(() => {
175
251
  window.location.reload()
176
252
  }, 1500)