@utogether/udp-core 1.0.1-beta.21 → 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 (79) hide show
  1. package/dist/{403-B_l9Q9w_.js → 403-CVk0Zv7-.js} +1 -1
  2. package/dist/{404-33KZO3Vz.js → 404-ndDOUJxF.js} +1 -1
  3. package/dist/{500-oI74ZkQH.js → 500-CBFigQjv.js} +1 -1
  4. package/dist/{AuthorityInfo-CNoxrmPS.js → AuthorityInfo-BDf4I8In.js} +1 -1
  5. package/dist/{AuthorityInfo.vue_vue_type_style_index_0_lang-CO01EWKQ.js → AuthorityInfo.vue_vue_type_style_index_0_lang-cEIXuHBK.js} +1 -1
  6. package/dist/{Company-DOCRUvUs.js → Company-DYDDIDa5.js} +3 -3
  7. package/dist/{CompanyPanel-Do2JlJ3U.js → CompanyPanel-DggYD4kC.js} +1 -1
  8. package/dist/{Department-BAlx8Am2.js → Department-DqrAvwmT.js} +3 -3
  9. package/dist/{DepartmentPanel-BvQUkRaM.js → DepartmentPanel-BjhhDlhw.js} +1 -1
  10. package/dist/{DesignPanel-BMr-c76z.js → DesignPanel-DAR2pcpF.js} +1 -1
  11. package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-COERxrYp.js → DesignPanel.vue_vue_type_style_index_0_lang-B8GPGq0h.js} +2 -2
  12. package/dist/{DictView-DkG5lo6m.js → DictView-BcLgE6q2.js} +1 -1
  13. package/dist/{InvOrganization-D_PuTpPt.js → InvOrganization-B61NWug9.js} +1 -1
  14. package/dist/{Org-CtVfZAjI.js → Org-9tL7q4mS.js} +1 -1
  15. package/dist/{Preview-Cuj_akRk.js → Preview-Bn4QDJ6s.js} +1 -1
  16. package/dist/{ReportDefine-CM2aNEVp.js → ReportDefine-BMGU8p3z.js} +1 -1
  17. package/dist/{ReportDesign-B1y79NKM.js → ReportDesign-DkwxPGCT.js} +2 -2
  18. package/dist/{ReportQuery-CZEfKCWP.js → ReportQuery-DOFFL8Nn.js} +1 -1
  19. package/dist/{ReportQueryFrom-C_cUB8bs.js → ReportQueryFrom-BDDlluNb.js} +1 -1
  20. package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-DBqJnvTQ.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-Yqw26YrX.js} +1 -1
  21. package/dist/{ReportTemplate-BprAuCb1.js → ReportTemplate-DmFqn7ji.js} +1 -1
  22. package/dist/{Role-CAaLVGNy.js → Role-DGw_eao_.js} +3 -3
  23. package/dist/{RoleAssign-DuFp2Ty7.js → RoleAssign-BJ32jpGq.js} +3 -3
  24. package/dist/{RolePanel-FnyN7LiS.js → RolePanel-B2O0mFtr.js} +1 -1
  25. package/dist/{RolePanel-BRStoO0e.js → RolePanel-DHS9C-hf.js} +1 -1
  26. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-CNIA7zdk.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-CS7drFhn.js → RolePanel.vue_vue_type_script_setup_true_lang-T5FN19eF.js} +3 -3
  28. package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-CEnqhlSE.js → ScrollPanel.vue_vue_type_style_index_0_lang-CeYU2NrW.js} +1 -1
  29. package/dist/{Staff-D493jHwR.js → Staff-3Rejxejf.js} +3 -3
  30. package/dist/{StaffInfo-suU_pcyD.js → StaffInfo-C94C3Gj7.js} +1 -1
  31. package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-DV16a2Nz.js → StaffInfo.vue_vue_type_script_setup_true_lang-Bm76KXps.js} +1 -1
  32. package/dist/{StaffPanel-BbYWu-xZ.js → StaffPanel-ClhiNL5a.js} +1 -1
  33. package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-CfRIanr5.js → StaffPanel.vue_vue_type_script_setup_true_lang-DjUOMmMr.js} +2 -2
  34. package/dist/{SysUser-YXOsIVpJ.js → SysUser-DUXK1KbY.js} +2 -2
  35. package/dist/{SysUserPanel-C1tQzih_.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-DzKl8RAz.js → SystemMenu-C1CrBLIy.js} +2 -2
  38. package/dist/{UserInfo-CYeYQNq8.js → UserInfo-C1tgO95t.js} +1 -1
  39. package/dist/{UserInfo.vue_vue_type_style_index_0_lang-DYVdi2Ck.js → UserInfo.vue_vue_type_style_index_0_lang-CNLWkLRN.js} +1 -1
  40. package/dist/{childView-BNYdfnMx.js → childView-CCr-NwqZ.js} +1 -1
  41. package/dist/{childView-C6rHVrT6.js → childView-CeYGykew.js} +1 -1
  42. package/dist/{childView.vue_vue_type_style_index_0_lang-O_zWFjYY.js → childView.vue_vue_type_style_index_0_lang-D9PsELsS.js} +1 -1
  43. package/dist/{childView.vue_vue_type_style_index_0_lang-6o00J0a7.js → childView.vue_vue_type_style_index_0_lang-IhbVX2Xa.js} +1 -1
  44. package/dist/{code-rule-MxcRbYZR.js → code-rule-BVjue1Qj.js} +2 -2
  45. package/dist/core.es.js +12 -11
  46. package/dist/{cron-task-B0yfTtm6.js → cron-task-BfVSQIgT.js} +1 -1
  47. package/dist/flow-task-B07st2aD.js +10 -0
  48. package/dist/{frameView-DtHY5dLd.js → frameView-D_YJavxB.js} +1 -1
  49. package/dist/index-ZaDSQxcf.js +6495 -0
  50. package/dist/{layoutView-D0Q7EG0u.js → layoutView-DpxwrEJd.js} +164 -164
  51. package/dist/{login-CuO8YgN1.js → login-8muEJPMg.js} +1 -1
  52. package/dist/{lov-view-DcRVGqsD.js → lov-view-DEp2h_qy.js} +2 -2
  53. package/dist/{menuInfo-ccOqhCC8.js → menuInfo-rPb4Ed8Q.js} +1 -1
  54. package/dist/{menuInfo.vue_vue_type_style_index_0_lang-DTBPgTe_.js → menuInfo.vue_vue_type_style_index_0_lang-mtPuZDRn.js} +1 -1
  55. package/dist/{pda-app-D7n4oxyn.js → pda-app-CSrTwUo7.js} +1 -1
  56. package/dist/{resource-_h2OtsKS.js → resource-B4Fsud2G.js} +1 -1
  57. package/dist/{su-welcome-Co6e4akE.js → su-welcome-DkwJ8pW8.js} +1 -1
  58. package/dist/{sys-config-C6Es9vZl.js → sys-config-CnMkBejC.js} +1 -1
  59. package/dist/udp-core.css +1 -1
  60. package/index.ts +49 -48
  61. package/package.json +1 -1
  62. package/src/components/udp/grid/index.vue +514 -509
  63. package/src/components/udp/utils.ts +7 -4
  64. package/src/layout/hooks/useTag.ts +5 -1
  65. package/src/plugins/i18n/module/u-workflow.ts +71 -71
  66. package/src/plugins/i18n/zh.ts +359 -356
  67. package/src/router/index.ts +3 -1
  68. package/src/router/modules/flow.ts +35 -0
  69. package/src/router/utils.ts +27 -1
  70. package/src/store/modules/multiTags.ts +4 -4
  71. package/src/utils/udp/http/index.ts +294 -0
  72. package/src/utils/udp/http/types.d.ts +42 -0
  73. package/src/views/system/cron/cron-task.vue +2 -12
  74. package/src/views/system/sysUser/SysUserPanel.vue +346 -279
  75. package/src/views/udev/coderule/code-rule.vue +2 -2
  76. package/src/views/udev/lov/childView.vue +174 -180
  77. package/src/views/utask/flow-task.vue +18 -0
  78. package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-BfT40pDr.js +0 -298
  79. package/dist/index-BWtOrjW2.js +0 -4603
@@ -10,6 +10,7 @@ import { kLOGINER } from '../contant';
10
10
  import homeRouter from './modules/home';
11
11
  import errorRouter from './modules/error';
12
12
  import remainingRouter from './modules/remaining';
13
+ import flow from './modules/flow';
13
14
 
14
15
  const systemRouter = import.meta.glob([
15
16
  '../views/system/**/*.{vue,tsx}',
@@ -19,12 +20,13 @@ const systemRouter = import.meta.glob([
19
20
  '../views/urpt/**/*.{vue,tsx}',
20
21
  '../views/organization/**/*.{vue,tsx}',
21
22
  '../views/udev/**/*.{vue, tsx}'
23
+ // '../views/uflow/**/*.{vue, tsx}'
22
24
  ]);
23
25
 
24
26
  export const remainingRouters = remainingRouter;
25
27
 
26
28
  // 原始静态路由(未做任何处理)
27
- const routes = [homeRouter, errorRouter];
29
+ const routes = [homeRouter, errorRouter, flow];
28
30
  /** 导出处理后的静态路由(三级及以上的路由全部拍成二级) */
29
31
  export const constantRoutes: Array<RouteRecordRaw> = formatTwoStageRoutes(
30
32
  formatFlatteningRoutes(buildHierarchyTree(ascending(routes)))
@@ -0,0 +1,35 @@
1
+ /*
2
+ * @Author: levi7754 levi7754@163.com
3
+ * @Date: 2023-10-10 11:31:53
4
+ * @LastEditors: levi7754 levi7754@163.com
5
+ * @LastEditTime: 2025-11-05 19:17:32
6
+ * @FilePath: /sitzone-mes/src/router/modules/tabs.ts
7
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
8
+ */
9
+ const Layout = () => import('../../layout/layoutView.vue');
10
+
11
+ const tabsRouter: RouteConfigsTable = {
12
+ component: Layout,
13
+ path: '/utask',
14
+ redirect: '/utask/task/flow-task',
15
+ meta: {
16
+ showLink: false,
17
+ icon: 'IF-pure-iconfont-tabs',
18
+ title: 'message.udp.flowTask'
19
+ },
20
+ children: [
21
+ // query 传参模式
22
+ {
23
+ path: '/utask/task/flow-task',
24
+ name: 'FlowTask',
25
+ component: () => import('../../views/utask/flow-task.vue'),
26
+ meta: {
27
+ // 不在menu菜单中显示
28
+ title: '',
29
+ showLink: false,
30
+ activePath: '/uflow/index'
31
+ }
32
+ }
33
+ ]
34
+ };
35
+ export default tabsRouter;
@@ -1,3 +1,11 @@
1
+ /*
2
+ * @Author: levi7754 levi7754@163.com
3
+ * @Date: 2024-08-01 21:42:39
4
+ * @LastEditors: levi7754 levi7754@163.com
5
+ * @LastEditTime: 2025-11-10 09:22:45
6
+ * @FilePath: \udp-front\packages\udp-core\src\router\utils.ts
7
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
8
+ */
1
9
  import type { RouteRecordRaw, RouteComponent } from 'vue-router';
2
10
  import { isProxy, toRaw, defineAsyncComponent } from 'vue';
3
11
  import { useTimeoutFn } from '@vueuse/core';
@@ -273,6 +281,9 @@ const menuI18n = {
273
281
  zh: {},
274
282
  en: {}
275
283
  };
284
+
285
+ const processMenus = [];
286
+
276
287
  const addAsyncRoutes = (arrRoutes: Array<any>) => {
277
288
  const modulesRoutes = getViews();
278
289
 
@@ -286,7 +297,17 @@ const addAsyncRoutes = (arrRoutes: Array<any>) => {
286
297
  v.redirect = v.children[0].path;
287
298
  }
288
299
  const { icon, permissionCode, extraIcon, frameSrc } = v;
289
- v.meta = { keepAlive: true, rank: v.sort, title: `${v.i18nField}` };
300
+ // 流程菜单保存
301
+ v.isFlowMenu && processMenus.push(v);
302
+
303
+ v.meta = {
304
+ keepAlive: true,
305
+ rank: v.sort,
306
+ title: `${v.i18nField}`,
307
+ // 审批流设计页面和审批页面的code写死,只需配置页面即可(保底方式)
308
+ showLink: !['UdpFlowDesign', 'UDPFlowTask'].includes(v.menuCode) ? null : false
309
+ };
310
+ v.hiddenTag = null;
290
311
  Object.assign(v.meta, { icon, permissionCode, extraIcon, frameSrc });
291
312
  menuI18n.zh[v.i18nField] = v.menuName || v.menuNameEn;
292
313
  menuI18n.en[v.i18nField] = v.menuNameEn || v.menuName;
@@ -377,11 +398,16 @@ function getTopMenu(tag = false) {
377
398
  return topMenu;
378
399
  }
379
400
 
401
+ function getProcessMenu() {
402
+ return processMenus;
403
+ }
404
+
380
405
  export {
381
406
  ascending,
382
407
  filterTree,
383
408
  initRouter,
384
409
  getTopMenu,
410
+ getProcessMenu,
385
411
  hasPermissions,
386
412
  addAsyncRoutes,
387
413
  getParentPaths,
@@ -2,11 +2,11 @@
2
2
  * @Author: wei.li
3
3
  * @Date: 2021-12-23 17:33:20
4
4
  * @LastEditors: levi7754 levi7754@163.com
5
- * @LastEditTime: 2025-10-19 12:01:05
5
+ * @LastEditTime: 2025-11-06 17:48:20
6
6
  * @Description: file content
7
7
  */
8
8
  import { defineStore } from 'pinia';
9
- import { isEqual, isBoolean } from 'xe-utils';
9
+ import { isEqual } from 'xe-utils';
10
10
  import { storageLocal, isUrl } from '@utogether/utils';
11
11
  import { store } from '../index';
12
12
  import { routerArrays } from '../../layout/types';
@@ -54,8 +54,8 @@ export const useMultiTagsStore = defineStore('udp-multiTags', {
54
54
  if (isUrl(tagVal?.name)) return;
55
55
  // 如果title为空拒绝添加空信息到标签页
56
56
  if (tagVal?.meta?.title?.length === 0) return;
57
- // showLink:false 不添加到标签页
58
- if (isBoolean(tagVal?.meta?.showLink) && !tagVal?.meta?.showLink) return;
57
+ // showLink:false 不添加到标签页 -- 因审批流注释2025/11/6
58
+ // if (isBoolean(tagVal?.meta?.showLink) && !tagVal?.meta?.showLink) return;
59
59
  const tagPath = tagVal.path;
60
60
  // 判断tag是否已存在
61
61
  const tagHasExits = this.multiTags.some(tag => {
@@ -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
  }