@utogether/udp-core 1.0.1-beta.22 → 1.0.1-beta.23

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 (67) hide show
  1. package/dist/{403-B87JSuhn.js → 403-CVk0Zv7-.js} +1 -1
  2. package/dist/{404-BhiUKT1b.js → 404-ndDOUJxF.js} +1 -1
  3. package/dist/{500-2G6eyDeT.js → 500-CBFigQjv.js} +1 -1
  4. package/dist/{AuthorityInfo-Bl4_zDot.js → AuthorityInfo-BDf4I8In.js} +1 -1
  5. package/dist/{AuthorityInfo.vue_vue_type_style_index_0_lang-92i5Oriz.js → AuthorityInfo.vue_vue_type_style_index_0_lang-cEIXuHBK.js} +1 -1
  6. package/dist/{Company-CbTh7_bX.js → Company-DYDDIDa5.js} +3 -3
  7. package/dist/{CompanyPanel-BVEYMQKM.js → CompanyPanel-DggYD4kC.js} +1 -1
  8. package/dist/{Department-Cu83Buy8.js → Department-DqrAvwmT.js} +3 -3
  9. package/dist/{DepartmentPanel-CO76buwO.js → DepartmentPanel-BjhhDlhw.js} +1 -1
  10. package/dist/{DesignPanel-DDgVNzYW.js → DesignPanel-DAR2pcpF.js} +1 -1
  11. package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-Bwernx0s.js → DesignPanel.vue_vue_type_style_index_0_lang-B8GPGq0h.js} +2 -2
  12. package/dist/{DictView-DJDg_Oem.js → DictView-BcLgE6q2.js} +1 -1
  13. package/dist/{InvOrganization-D9BMWweK.js → InvOrganization-B61NWug9.js} +1 -1
  14. package/dist/{Org-CcfRkpBY.js → Org-9tL7q4mS.js} +1 -1
  15. package/dist/{Preview-DGP1uIZU.js → Preview-Bn4QDJ6s.js} +1 -1
  16. package/dist/{ReportDefine-u7r-IVPD.js → ReportDefine-BMGU8p3z.js} +1 -1
  17. package/dist/{ReportDesign-CLQRMIy3.js → ReportDesign-DkwxPGCT.js} +2 -2
  18. package/dist/{ReportQuery-BNTCTpqI.js → ReportQuery-DOFFL8Nn.js} +1 -1
  19. package/dist/{ReportQueryFrom-G7X1Fyf5.js → ReportQueryFrom-BDDlluNb.js} +1 -1
  20. package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-D5lDZFPM.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-Yqw26YrX.js} +1 -1
  21. package/dist/{ReportTemplate-QWAuFjaB.js → ReportTemplate-DmFqn7ji.js} +1 -1
  22. package/dist/{Role-Ba1OVGG0.js → Role-DGw_eao_.js} +3 -3
  23. package/dist/{RoleAssign-DFiMYll8.js → RoleAssign-BJ32jpGq.js} +3 -3
  24. package/dist/{RolePanel-c-xitljX.js → RolePanel-B2O0mFtr.js} +1 -1
  25. package/dist/{RolePanel-D6xKrLlM.js → RolePanel-DHS9C-hf.js} +1 -1
  26. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-BeZ1xNXU.js → RolePanel.vue_vue_type_script_setup_true_lang-CEYM_zn7.js} +1 -1
  27. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-DrBiLlBb.js → RolePanel.vue_vue_type_script_setup_true_lang-T5FN19eF.js} +3 -3
  28. package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-D4eReGaK.js → ScrollPanel.vue_vue_type_style_index_0_lang-CeYU2NrW.js} +1 -1
  29. package/dist/{Staff-C-5TE1Yn.js → Staff-3Rejxejf.js} +3 -3
  30. package/dist/{StaffInfo-CwJlL_Nr.js → StaffInfo-C94C3Gj7.js} +1 -1
  31. package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-C2BsoQlr.js → StaffInfo.vue_vue_type_script_setup_true_lang-Bm76KXps.js} +1 -1
  32. package/dist/{StaffPanel-QOv1pq2Z.js → StaffPanel-ClhiNL5a.js} +1 -1
  33. package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-BGQSHjaQ.js → StaffPanel.vue_vue_type_script_setup_true_lang-DjUOMmMr.js} +2 -2
  34. package/dist/{SysUser-Byug_VNY.js → SysUser-DUXK1KbY.js} +2 -2
  35. package/dist/{SysUserPanel-B-M2Yxjj.js → SysUserPanel-3HThXZFZ.js} +1 -1
  36. package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-DjbpSAOd.js +340 -0
  37. package/dist/{SystemMenu-Bs9a4BE0.js → SystemMenu-C1CrBLIy.js} +2 -2
  38. package/dist/{UserInfo-Ipp00UAF.js → UserInfo-C1tgO95t.js} +1 -1
  39. package/dist/{UserInfo.vue_vue_type_style_index_0_lang-DIcWs6vj.js → UserInfo.vue_vue_type_style_index_0_lang-CNLWkLRN.js} +1 -1
  40. package/dist/{childView-N1PkzqQK.js → childView-CCr-NwqZ.js} +1 -1
  41. package/dist/{childView-O-5baerB.js → childView-CeYGykew.js} +1 -1
  42. package/dist/{childView.vue_vue_type_style_index_0_lang--yGHgWVq.js → childView.vue_vue_type_style_index_0_lang-D9PsELsS.js} +1 -1
  43. package/dist/{childView.vue_vue_type_style_index_0_lang-srudWvXc.js → childView.vue_vue_type_style_index_0_lang-IhbVX2Xa.js} +1 -1
  44. package/dist/{code-rule-CRunTGXH.js → code-rule-BVjue1Qj.js} +1 -1
  45. package/dist/core.es.js +1 -1
  46. package/dist/{cron-task-IEuaI4Nt.js → cron-task-BfVSQIgT.js} +1 -1
  47. package/dist/{frameView-vGVXV1ZG.js → frameView-D_YJavxB.js} +1 -1
  48. package/dist/index-ZaDSQxcf.js +6495 -0
  49. package/dist/{layoutView-BJO8Hm5d.js → layoutView-DpxwrEJd.js} +1 -1
  50. package/dist/{login-CZyenjQX.js → login-8muEJPMg.js} +1 -1
  51. package/dist/{lov-view-6He1ZxGX.js → lov-view-DEp2h_qy.js} +2 -2
  52. package/dist/{menuInfo-CE5Cae2u.js → menuInfo-rPb4Ed8Q.js} +1 -1
  53. package/dist/{menuInfo.vue_vue_type_style_index_0_lang-BjshFg3S.js → menuInfo.vue_vue_type_style_index_0_lang-mtPuZDRn.js} +1 -1
  54. package/dist/{pda-app-DOiT57m1.js → pda-app-CSrTwUo7.js} +1 -1
  55. package/dist/{resource-BdlOJOcz.js → resource-B4Fsud2G.js} +1 -1
  56. package/dist/{su-welcome-BxRhJD8X.js → su-welcome-DkwJ8pW8.js} +1 -1
  57. package/dist/{sys-config-Csy-234G.js → sys-config-CnMkBejC.js} +1 -1
  58. package/dist/udp-core.css +1 -1
  59. package/package.json +1 -1
  60. package/src/components/udp/grid/index.vue +514 -513
  61. package/src/plugins/i18n/zh.ts +3 -2
  62. package/src/utils/udp/http/index.ts +294 -0
  63. package/src/utils/udp/http/types.d.ts +42 -0
  64. package/src/views/system/cron/cron-task.vue +2 -12
  65. package/src/views/system/sysUser/SysUserPanel.vue +346 -279
  66. package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-Dm1YyUXX.js +0 -298
  67. package/dist/index-D_tU_u2l.js +0 -4640
@@ -334,7 +334,7 @@ export default {
334
334
  imageCapacity: '图片大小{capacity}',
335
335
  singleImg: '仅支持设置单张图',
336
336
  emptyAuth: '无系统权限, 请先给用户分配角色重试',
337
- initPassword: `初始密码为:【123456】,请及时修改密码`,
337
+ initPassword: `初始密码为:【{code}】,请及时修改密码`,
338
338
  loginFailure: '用户名或密码不能为空',
339
339
  updatenow: '立即更新',
340
340
  newVersion: '检测到新版本',
@@ -353,6 +353,7 @@ export default {
353
353
  dictInfo: '【{name}】字典值',
354
354
  lovView: '值集视图',
355
355
  lovColConfig: '值集列配置',
356
- sequenceInfo: '{name}单据序列配置'
356
+ sequenceInfo: '{name}单据序列配置',
357
+ userInfo: '用户信息'
357
358
  }
358
359
  };
@@ -0,0 +1,294 @@
1
+ import Axios, { type AxiosInstance, type AxiosRequestConfig } from 'axios';
2
+ import type { SuHttpError, RequestMethods, SuHttpResponse, SuHttpRequestConfig } from './types.d';
3
+ import { NProgress, cookies, errorMessage } from '@utogether/utils';
4
+ import { isRef } from 'vue';
5
+ import { has } from 'xe-utils';
6
+
7
+ const kTOKENKEY = 'authorized-token';
8
+ const defaultConfig: AxiosRequestConfig = {
9
+ timeout: 180000,
10
+ headers: {
11
+ Accept: 'application/json, text/plain, */*',
12
+ 'Content-Type': 'application/json',
13
+ 'X-Requested-With': 'XMLHttpRequest'
14
+ }
15
+ };
16
+ class SuHttp {
17
+ constructor() {
18
+ this.httpInterceptorsRequest();
19
+ this.httpInterceptorsResponse();
20
+ }
21
+ router = undefined;
22
+ baseUrl = 'http: //192.168.101.138.8099';
23
+ /** token过期后,暂存待执行的请求 */
24
+ private static requests = [];
25
+
26
+ /** 防止重复刷新token */
27
+ private static isRefreshing = false;
28
+
29
+ /** 设置router调整 */
30
+ setRouter(router) {
31
+ this.router = router;
32
+ }
33
+
34
+ setBaseUrl(baseUrl) {
35
+ this.baseUrl = baseUrl;
36
+ }
37
+ // 初始化配置对象
38
+ private static initConfig: SuHttpRequestConfig = {};
39
+
40
+ // 保存当前Axios实例对象
41
+ private static axiosInstance: AxiosInstance = Axios.create(defaultConfig);
42
+
43
+ /** 重连原始请求 */
44
+ private static retryOriginalRequest(config: SuHttpRequestConfig) {
45
+ return new Promise(resolve => {
46
+ // @ts-ignore
47
+ SuHttp.requests.push((token: string) => {
48
+ config.headers!['Authorization'] = 'Bearer ' + token;
49
+ resolve(config);
50
+ });
51
+ });
52
+ }
53
+
54
+ // 请求拦截
55
+ private httpInterceptorsRequest(): void {
56
+ SuHttp.axiosInstance.interceptors.request.use(
57
+ (config: any) => {
58
+ if (has(config, 'loading') && isRef(config.loading)) {
59
+ config.loading.value = true;
60
+ }
61
+ // 开启进度条动画
62
+ NProgress.start();
63
+ // 优先判断post/get等方法是否传入回掉,否则执行初始化设置等回掉
64
+ if (typeof config.beforeRequestCallback === 'function') {
65
+ config.beforeRequestCallback(config);
66
+ return config;
67
+ }
68
+ if (SuHttp.initConfig.beforeRequestCallback) {
69
+ SuHttp.initConfig.beforeRequestCallback(config);
70
+ return config;
71
+ }
72
+ const whiteList = ['/refreshToken', '/login'];
73
+ if (whiteList.some(v => config.url.indexOf(v) > -1)) return config;
74
+ return new Promise(resolve => {
75
+ const token = cookies.get(kTOKENKEY);
76
+ if (token) {
77
+ const data = JSON.parse(token);
78
+ const now = new Date().getTime();
79
+ const expired = data.expires - now <= 0;
80
+ if (expired) {
81
+ if (!SuHttp.isRefreshing) {
82
+ SuHttp.isRefreshing = true;
83
+ // requests.push(() => SuHttp.axiosInstance(config));
84
+ this.get(this.baseUrl + '/uath/refreshToken', {
85
+ refreshToken: data.refreshToken
86
+ })
87
+ .then((res: any) => {
88
+ if (!res?.access_token) {
89
+ this.routeToLogin();
90
+ } else {
91
+ // 替换token
92
+ this.setToken(res);
93
+ config.headers['Authorization'] = 'Bearer ' + res.access_token;
94
+ // token 刷新后将数组的方法重新执行
95
+ SuHttp.requests.forEach(cb => cb(res.access_token));
96
+ SuHttp.requests = []; // 重新请求完清空
97
+ }
98
+ })
99
+ .catch(() => {
100
+ this.routeToLogin();
101
+ })
102
+ .finally(() => {
103
+ SuHttp.isRefreshing = false;
104
+ });
105
+ }
106
+ // @ts-ignore
107
+ resolve(SuHttp.retryOriginalRequest(config));
108
+ } else {
109
+ config.headers['Authorization'] = 'Bearer ' + data.accessToken;
110
+ resolve(config);
111
+ }
112
+ } else {
113
+ const sessionKey = cookies.get('kCookies_token') as string;
114
+ if (sessionKey) {
115
+ config.headers['X-Token'] = sessionKey;
116
+ }
117
+ resolve(config);
118
+ }
119
+ });
120
+ },
121
+ error => {
122
+ return Promise.reject(error);
123
+ }
124
+ );
125
+ }
126
+
127
+ private setToken(token) {
128
+ const { access_token, expires_in, refresh_token } = token;
129
+ const cache = {
130
+ accessToken: access_token,
131
+ refreshToken: refresh_token,
132
+ expires: Date.now() + expires_in * 1000
133
+ };
134
+ cookies.set(kTOKENKEY, JSON.stringify(cache));
135
+ // cookies.set(kTOKENKEY, JSON.stringify(cache), { expires: expires_in });
136
+ }
137
+
138
+ private routeToLogin() {
139
+ SuHttp.requests = []; // 重新请求完清空
140
+ cookies.remove('kCookies_token');
141
+ cookies.remove('authorized-token');
142
+ cookies.remove('loginer');
143
+ this.router.push({ name: 'login' });
144
+ }
145
+
146
+ // 响应拦截
147
+ private httpInterceptorsResponse(): void {
148
+ const instance = SuHttp.axiosInstance;
149
+ instance.interceptors.response.use(
150
+ (response: SuHttpResponse) => {
151
+ const $config = response.config;
152
+ if (has($config, 'loading') && isRef($config.loading)) {
153
+ $config.loading.value = false;
154
+ }
155
+ // 关闭进度条动画
156
+ NProgress.done();
157
+ // 优先判断post/get等方法是否传入回掉,否则执行初始化设置等回掉
158
+ if (typeof $config.beforeResponseCallback === 'function') {
159
+ $config.beforeResponseCallback(response);
160
+ return response.data;
161
+ }
162
+ if (SuHttp.initConfig.beforeResponseCallback) {
163
+ SuHttp.initConfig.beforeResponseCallback(response);
164
+ return response.data;
165
+ }
166
+ return response.data;
167
+ },
168
+ (error: SuHttpError) => {
169
+ const $error = error;
170
+ // @ts-ignore
171
+ if (has(error.config, 'loading') && isRef(error?.config?.loading)) {
172
+ // @ts-ignore
173
+ error.config.loading.value = false;
174
+ }
175
+ $error.isCancelRequest = Axios.isCancel($error);
176
+ // 关闭进度条动画
177
+ NProgress.done();
178
+ // 所有的响应异常 区分来源为取消请求/非取消请求
179
+ return Promise.reject($error);
180
+ }
181
+ );
182
+ }
183
+
184
+ private transformConfigByMethod(params: any, config: SuHttpRequestConfig): SuHttpRequestConfig {
185
+ const { method } = config;
186
+ const methods = ['get'];
187
+ const m = method!.toLocaleLowerCase();
188
+ const props = methods.includes(m) ? 'params' : 'data';
189
+ return {
190
+ ...config,
191
+ [props]: params
192
+ };
193
+ }
194
+
195
+ // 通用请求工具函数
196
+ public request<T>(
197
+ method: RequestMethods,
198
+ url: string,
199
+ param?: AxiosRequestConfig,
200
+ axiosConfig?: SuHttpRequestConfig
201
+ ): Promise<T> {
202
+ const config = this.transformConfigByMethod(param, {
203
+ method,
204
+ url,
205
+ ...axiosConfig
206
+ } as SuHttpRequestConfig);
207
+ // 单独处理自定义请求/响应回掉
208
+ return new Promise((resolve, reject) => {
209
+ SuHttp.axiosInstance
210
+ .request(config)
211
+ .then((res: any) => {
212
+ if (res && res?.code === '0') {
213
+ resolve(res.data);
214
+ } else if (res.code === '500') {
215
+ errorMessage(res.msg, { duration: 8000 });
216
+ if (config.method === 'get') {
217
+ resolve(res);
218
+ } else {
219
+ reject(res.msg);
220
+ }
221
+ } else if (res?.code !== '-1') {
222
+ resolve(res);
223
+ } else {
224
+ const msg = res?.msg || '服务异常';
225
+ errorMessage(msg, { duration: 8000 });
226
+ reject(msg);
227
+ }
228
+ })
229
+ .catch(e => {
230
+ if (e?.code) {
231
+ if (e?.response?.status === 401) {
232
+ // @ts-ignore
233
+ return this.router?.push({ path: '/login' });
234
+ }
235
+ errorMessage(this.getNetworkError(e?.response?.status) || e?.message, { duration: 8000 });
236
+ }
237
+ if (e.config.method === 'get') {
238
+ resolve(e);
239
+ } else {
240
+ reject(e);
241
+ }
242
+ });
243
+ });
244
+ }
245
+
246
+ getNetworkError = code => {
247
+ if (!code) return null;
248
+ const msgMap = {
249
+ 400: '错误的请求',
250
+ 401: '服务未授权,请重新登录',
251
+ 403: '拒绝访问',
252
+ 404: '请求错误,未找到该资源',
253
+ 408: '请求超时',
254
+ 500: '服务器端出差',
255
+ 502: '网络超时',
256
+ 503: '服务不可用',
257
+ 504: '网络超时'
258
+ };
259
+ return msgMap[code];
260
+ };
261
+
262
+ // 单独抽离的post工具函数
263
+ public post<T, P>(url: string, params?: T, config?: SuHttpRequestConfig): Promise<P> {
264
+ // @ts-ignore
265
+ return this.request<P>('post', url, params, config);
266
+ }
267
+
268
+ // 单独抽离的delete工具函数
269
+ public delete<T, P>(url: string, params?: T, config?: SuHttpRequestConfig): Promise<P> {
270
+ // @ts-ignore
271
+ return this.request<P>('delete', url, params, config);
272
+ }
273
+
274
+ // 单独抽离的put工具函数
275
+ public put<T, P>(url: string, params?: T, config?: SuHttpRequestConfig): Promise<P> {
276
+ // @ts-ignore
277
+ return this.request<P>('put', url, params, config);
278
+ }
279
+
280
+ // 单独抽离的get工具函数
281
+ public get<T, P>(url: string, params?: T, config?: SuHttpRequestConfig): Promise<P> {
282
+ for (const key in params) {
283
+ if (!params[key]) delete params[key];
284
+ }
285
+ // @ts-ignore
286
+ return this.request<P>('get', url, params, config);
287
+ }
288
+
289
+ public postRouter<T>(params?: any): Promise<T> {
290
+ return this.request<T>('post', 'route/service', params);
291
+ }
292
+ }
293
+
294
+ export const http = new SuHttp();
@@ -0,0 +1,42 @@
1
+ /*
2
+ * @Author: wei.li
3
+ * @Date: 2022-03-08 15:17:39
4
+ * @LastEditors: levi7754 levi7754@163.com
5
+ * @LastEditTime: 2023-12-01 13:55:46
6
+ * @Description: SuHttp Axios 类型定义文件
7
+ */
8
+ import type { Method, AxiosError, AxiosResponse, AxiosRequestConfig } from 'axios';
9
+
10
+ export type resultType = {
11
+ access_token: string;
12
+ refresh_token: string;
13
+ expires_in: number;
14
+ };
15
+
16
+ export type RequestMethods = Extract<Method, 'get' | 'post' | 'put' | 'delete' | 'patch' | 'option' | 'head'>;
17
+
18
+ export interface SuHttpError extends AxiosError {
19
+ isCancelRequest?: boolean;
20
+ }
21
+
22
+ export interface SuHttpResponse extends AxiosResponse {
23
+ config: SuHttpRequestConfig;
24
+ }
25
+
26
+ export interface SuHttpRequestConfig extends AxiosRequestConfig {
27
+ beforeRequestCallback?: (request: SuHttpRequestConfig) => void;
28
+ beforeResponseCallback?: (response: SuHttpResponse) => void;
29
+ loading?: any;
30
+ }
31
+
32
+ export default class SuHttp {
33
+ request<T>(
34
+ method: RequestMethods,
35
+ url: string,
36
+ param?: AxiosRequestConfig,
37
+ axiosConfig?: SuHttpRequestConfig
38
+ ): Promise<T>;
39
+ post<T, P>(url: string, params?: T, config?: SuHttpRequestConfig): Promise<P>;
40
+ postRouter<T, P>(url: string, params?: T, config?: SuHttpRequestConfig): Promise<P>;
41
+ get<T, P>(url: string, params?: T, config?: SuHttpRequestConfig): Promise<P>;
42
+ }
@@ -88,18 +88,8 @@ const columns = [
88
88
  return [
89
89
  <>
90
90
  {app}
91
- <ut-button
92
- content="stopTask"
93
- status="danger"
94
- icon="ri-close-line"
95
- onTap={() => handleStop(row)}
96
- />
97
- <ut-button
98
- content="taskLog"
99
- status="info"
100
- icon="ri-file-line"
101
- onTap={() => handleLog(row)}
102
- />
91
+ <ut-button content="stopTask" status="danger" icon="ri-close-line" onTap={() => handleStop(row)} />
92
+ <ut-button content="taskLog" status="info" icon="ri-file-line" onTap={() => handleLog(row)} />
103
93
  </>
104
94
  ];
105
95
  }