beer-assembly-biz 1.1.2-alpha.9 → 1.1.3-alpha.10
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/UploadModals.d.ts +12 -0
- package/UploadModals.js +233 -0
- package/UserModals.d.ts +7 -3
- package/UserModals.js +6 -0
- package/auth/AuthPassword.d.ts +2 -3
- package/auth/AuthPassword.js +5 -5
- package/auth/AuthStyle01.d.ts +3 -4
- package/auth/AuthStyle01.js +4 -5
- package/auth/AuthStyle02.d.ts +3 -4
- package/auth/AuthStyle02.js +4 -5
- package/auth/AuthThirdPartyAuth.d.ts +2 -3
- package/auth/AuthThirdPartyAuth.js +1 -2
- package/content/ParentContext.d.ts +4 -2
- package/content/ParentContext.js +4 -2
- package/content/PermissionContext.d.ts +4 -2
- package/content/PermissionContext.js +4 -2
- package/icon/icon/directory.svg +12 -0
- package/icon/icon/empty.svg +43 -0
- package/icon/icon/media.png +0 -0
- package/icon/icon/volc.svg +96 -0
- package/images/images/assets_background_01.png +0 -0
- package/images/images/avatar.png +0 -0
- package/images/images/layout_01.png +0 -0
- package/images/images/layout_02.png +0 -0
- package/images/images/layout_03.png +0 -0
- package/index.d.ts +18 -0
- package/index.js +18 -0
- package/{AppLayout.d.ts → layout/AppLayout.d.ts} +4 -2
- package/{AppLayout.js → layout/AppLayout.js} +7 -5
- package/{BackPageContainer.d.ts → layout/BackPageContainer.d.ts} +5 -2
- package/{BackPageContainer.js → layout/BackPageContainer.js} +8 -3
- package/{MyPageContainer.d.ts → layout/MyPageContainer.d.ts} +4 -2
- package/{MyPageContainer.js → layout/MyPageContainer.js} +5 -3
- package/{SubMenusContainer.d.ts → layout/SubMenusContainer.d.ts} +5 -5
- package/{SubMenusContainer.js → layout/SubMenusContainer.js} +2 -3
- package/media/Media.d.ts +84 -0
- package/media/Media.js +241 -0
- package/media/MediaModals.d.ts +17 -0
- package/media/MediaModals.js +172 -0
- package/net-disk/DirectoryMenusPanel.d.ts +0 -0
- package/net-disk/DirectoryMenusPanel.js +337 -0
- package/net-disk/DirectorySelect.d.ts +0 -0
- package/net-disk/DirectorySelect.js +240 -0
- package/net-disk/FileItemList.d.ts +0 -0
- package/net-disk/FileItemList.js +126 -0
- package/net-disk/FileItemTable.d.ts +0 -0
- package/net-disk/FileItemTable.js +422 -0
- package/net-disk/FileNavigation.d.ts +0 -0
- package/net-disk/FileNavigation.js +43 -0
- package/net-disk/NetDisk.d.ts +0 -0
- package/net-disk/NetDisk.js +36 -0
- package/net-disk/NetDiskModals.d.ts +0 -0
- package/net-disk/NetDiskModals.js +40 -0
- package/package.json +30 -19
- package/{Permission.d.ts → permission/Permission.d.ts} +4 -2
- package/{Permission.js → permission/Permission.js} +5 -3
- package/promises.d.ts +48 -0
- package/promises.js +141 -0
- package/rich/AIEditor.css +1647 -0
- package/rich/AIEditor.d.ts +51 -0
- package/rich/AIEditor.js +90 -0
- package/slider/SliderCode.d.ts +23 -0
- package/slider/SliderCode.js +203 -0
- package/type.d.ts +3 -0
- package/type.js +1 -0
- package/InlineContainer.d.ts +0 -6
- package/InlineContainer.js +0 -28
- package/MediaModals.d.ts +0 -32
- package/MediaModals.js +0 -373
- package/NetDiskModals.d.ts +0 -15
- package/NetDiskModals.js +0 -28
- package/Upgrade.d.ts +0 -7
- package/Upgrade.js +0 -46
- package/fonts/harmony/HarmonyOS_Medium.a.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.a0.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.a1.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.aa.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.ab.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.ac.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.ad.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.ae.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.af.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.ag.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.ah.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.ai.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.aj.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.ak.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.al.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.am.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.an.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.ao.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.ap.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.aq.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.ar.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.as.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.at.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.au.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.av.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.aw.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.ax.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.ay.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.az.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.b.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.c.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.d.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.e.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.f.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.g.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.h.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.i.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.j.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.k.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.l.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.m.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.n.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.o.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.p.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.q.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.r.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.s.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.t.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.u.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.v.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.w.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.x.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.y.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Medium.z.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.a.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.a0.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.a1.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.aa.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.ab.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.ac.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.ad.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.ae.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.af.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.ag.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.ah.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.ai.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.aj.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.ak.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.al.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.am.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.an.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.ao.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.ap.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.aq.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.ar.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.as.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.at.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.au.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.av.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.aw.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.ax.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.ay.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.az.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.b.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.c.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.d.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.e.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.f.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.g.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.h.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.i.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.j.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.k.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.l.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.m.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.n.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.o.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.p.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.q.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.r.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.s.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.t.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.u.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.v.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.w.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.x.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.y.woff2 +0 -0
- package/fonts/harmony/HarmonyOS_Regular.z.woff2 +0 -0
- package/fonts/harmony/medium.css +0 -485
- package/fonts/harmony/regular.css +0 -485
package/package.json
CHANGED
|
@@ -1,39 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "beer-assembly-biz",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.3-alpha.10",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"pub-w": "tsc && copy package.json .\\dist\\package.json && npm publish ./dist",
|
|
7
|
-
"
|
|
7
|
+
"copy": "cp -a src/rich/AIEditor.css dist/rich/AIEditor.css && cp -a src/icon dist/icon && cp -a src/images dist/images",
|
|
8
|
+
"pub-m": "tsc && npm run copy && cp package.json ./dist/package.json && npm publish ./dist"
|
|
8
9
|
},
|
|
9
10
|
"dependencies": {
|
|
10
11
|
"@ant-design/icons": "5.5.2",
|
|
11
12
|
"@ant-design/pro-components": "2.8.4",
|
|
12
13
|
"@emotion/css": "^11.11.2",
|
|
14
|
+
"aieditor": "^1.3.6",
|
|
13
15
|
"antd": "5.23.2",
|
|
14
|
-
"beer-network": "
|
|
15
|
-
"beer-assembly": "
|
|
16
|
+
"beer-network": "1.2.3",
|
|
17
|
+
"beer-assembly-plus": "1.1.2-alpha.8",
|
|
16
18
|
"dayjs": "^1.11.13",
|
|
17
|
-
"history": "^5.3.0",
|
|
18
|
-
"lodash": "^4.17.21",
|
|
19
19
|
"react": "^18.2.0",
|
|
20
20
|
"react-dom": "^18.2.0",
|
|
21
21
|
"react-router-dom": "^6.15.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@babel/
|
|
25
|
-
"@
|
|
26
|
-
"@types/
|
|
27
|
-
"@types/
|
|
28
|
-
"@
|
|
29
|
-
"@
|
|
30
|
-
"
|
|
24
|
+
"@babel/core": "^7.16.0",
|
|
25
|
+
"@svgr/webpack": "^5.5.0",
|
|
26
|
+
"@types/lodash": "^4.17.16",
|
|
27
|
+
"@types/node": "^16.18.101",
|
|
28
|
+
"@types/react": "^18.3.3",
|
|
29
|
+
"@types/react-dom": "^18.3.0",
|
|
30
|
+
"@types/webpack": "^5.28.5",
|
|
31
|
+
"@typescript-eslint/eslint-plugin": "^8.26.1",
|
|
32
|
+
"@typescript-eslint/parser": "^8.26.1",
|
|
33
|
+
"babel-loader": "^8.2.3",
|
|
34
|
+
"babel-plugin-named-asset-import": "^0.3.8",
|
|
35
|
+
"babel-preset-react-app": "^10.0.1",
|
|
36
|
+
"customize-cra": "^1.0.0",
|
|
37
|
+
"dotenv": "^16.4.7",
|
|
38
|
+
"eslint": "^8.3.0",
|
|
31
39
|
"eslint-config-airbnb": "^19.0.4",
|
|
32
|
-
"eslint-config-
|
|
33
|
-
"eslint-plugin-import": "^2.
|
|
34
|
-
"eslint-plugin-react": "^7.
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
40
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
41
|
+
"eslint-plugin-import": "^2.29.1",
|
|
42
|
+
"eslint-plugin-react": "^7.37.4",
|
|
43
|
+
"less": "^4.2.2",
|
|
44
|
+
"less-loader": "^12.2.0",
|
|
45
|
+
"react-app-rewired": "^2.2.1",
|
|
46
|
+
"react-scripts": "^5.0.1",
|
|
47
|
+
"serve": "^14.2.4",
|
|
48
|
+
"typescript": "^5.7.3"
|
|
38
49
|
}
|
|
39
50
|
}
|
|
@@ -4,5 +4,7 @@ export declare type PermissionProps = {
|
|
|
4
4
|
permission: string;
|
|
5
5
|
children?: React.ReactNode | undefined;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* 权限组件.
|
|
9
|
+
*/
|
|
10
|
+
export declare const Permission: FC<PermissionProps>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
-
import PermissionContext from '
|
|
3
|
-
|
|
2
|
+
import { PermissionContext } from '../content/PermissionContext';
|
|
3
|
+
/**
|
|
4
|
+
* 权限组件.
|
|
5
|
+
*/
|
|
6
|
+
export const Permission = (props) => {
|
|
4
7
|
const { isPermission } = useContext(PermissionContext);
|
|
5
8
|
return React.createElement(React.Fragment, null, isPermission(props.domain, props.permission) ? props?.children : undefined);
|
|
6
9
|
};
|
|
7
|
-
export default Component;
|
package/promises.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 异步函数增强工具库.
|
|
3
|
+
*/
|
|
1
4
|
export declare class Promises {
|
|
2
5
|
/**
|
|
3
6
|
* 获取异步任务结果
|
|
@@ -5,3 +8,48 @@ export declare class Promises {
|
|
|
5
8
|
*/
|
|
6
9
|
static result(promise: Promise<any>): Promise<boolean>;
|
|
7
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* 异步任务管理工具.
|
|
13
|
+
*/
|
|
14
|
+
export declare class Async {
|
|
15
|
+
private isRun;
|
|
16
|
+
/**
|
|
17
|
+
* 同时只有一个函数能运行.
|
|
18
|
+
* @param func
|
|
19
|
+
*/
|
|
20
|
+
run<T>(func: () => Promise<T>): Promise<T | undefined>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 简单的数值工具类.
|
|
24
|
+
*/
|
|
25
|
+
export declare class NumberUtils {
|
|
26
|
+
static isNumeric(value: any): boolean;
|
|
27
|
+
static ifGeZeroNumeric(value: any, defaultValue?: any): any;
|
|
28
|
+
static number(value: any): string;
|
|
29
|
+
static format(value: number): string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 级联选择工具类.
|
|
33
|
+
*/
|
|
34
|
+
export declare class CascadeUtils {
|
|
35
|
+
static recursionFind(dataList: any[], parentId: string): string[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 数组工具类.
|
|
39
|
+
*/
|
|
40
|
+
export declare class ArrayUtils {
|
|
41
|
+
static flat(array?: any[], index?: number): any;
|
|
42
|
+
static toArray(value?: string | number): (string | number)[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 后退导航工具类.
|
|
46
|
+
*/
|
|
47
|
+
export declare class NavigateUtils {
|
|
48
|
+
/**
|
|
49
|
+
* 功能性后退页面.
|
|
50
|
+
* <li>页面依赖浏览器堆栈非常不可靠的,因此在实际操作中是前进页面</li>
|
|
51
|
+
* <li><b>默认是</b>根据当前 <b>路径参数</b> 以及 <b>分页规则</b> 后退到根路径</li>
|
|
52
|
+
* @param param 路径参数 (数值类型:如果是则根据数值后退 字符串:根据指定路径后退).
|
|
53
|
+
*/
|
|
54
|
+
static useBack(param?: string | number): (value?: string | number) => void;
|
|
55
|
+
}
|
package/promises.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import { useLocation, useNavigate } from 'react-router-dom';
|
|
2
|
+
const pathPartition = (sessionStorage.getItem('DETAIL_PARTITION') || '') === ''
|
|
3
|
+
? ['CREATE', 'EDIT', 'AUDIT', 'PREVIEW', 'DETAIL', 'READ', 'IN', 'INPUT', 'OUTPUT']
|
|
4
|
+
: JSON.parse(sessionStorage.getItem('DETAIL_PARTITION') || '[]');
|
|
5
|
+
/**
|
|
6
|
+
* 异步函数增强工具库.
|
|
7
|
+
*/
|
|
1
8
|
export class Promises {
|
|
2
9
|
/**
|
|
3
10
|
* 获取异步任务结果
|
|
@@ -10,3 +17,137 @@ export class Promises {
|
|
|
10
17
|
});
|
|
11
18
|
}
|
|
12
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* 异步任务管理工具.
|
|
22
|
+
*/
|
|
23
|
+
export class Async {
|
|
24
|
+
constructor() {
|
|
25
|
+
this.isRun = false;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 同时只有一个函数能运行.
|
|
29
|
+
* @param func
|
|
30
|
+
*/
|
|
31
|
+
async run(func) {
|
|
32
|
+
try {
|
|
33
|
+
if (this.isRun) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
this.isRun = true;
|
|
37
|
+
return await func();
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
this.isRun = false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 简单的数值工具类.
|
|
46
|
+
*/
|
|
47
|
+
export class NumberUtils {
|
|
48
|
+
static isNumeric(value) {
|
|
49
|
+
if (typeof value === 'number') {
|
|
50
|
+
return !Number.isNaN(value);
|
|
51
|
+
}
|
|
52
|
+
if (typeof value === 'string' && value.trim() !== '') {
|
|
53
|
+
return !Number.isNaN(Number(value)) && !Number.isNaN(Number.parseFloat(value));
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
static ifGeZeroNumeric(value, defaultValue) {
|
|
58
|
+
return this.isNumeric(value) && Number(value) > 0 ? value : defaultValue;
|
|
59
|
+
}
|
|
60
|
+
static number(value) {
|
|
61
|
+
if (value === undefined || value === null || value === '') {
|
|
62
|
+
return '';
|
|
63
|
+
}
|
|
64
|
+
return Number(value)
|
|
65
|
+
.toFixed(2);
|
|
66
|
+
}
|
|
67
|
+
static format(value) {
|
|
68
|
+
return (Math.floor(value * 100) / 100).toFixed(2);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 级联选择工具类.
|
|
73
|
+
*/
|
|
74
|
+
export class CascadeUtils {
|
|
75
|
+
static recursionFind(dataList, parentId) {
|
|
76
|
+
if (parentId === '0') {
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
if (dataList === undefined || dataList.length <= 0) {
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
82
|
+
for (const item of dataList) {
|
|
83
|
+
if (item.children === undefined || item.children.length <= 0) {
|
|
84
|
+
// 如果没有子集, 能匹配则匹配 不能则跳过循环
|
|
85
|
+
if (item.value === parentId) {
|
|
86
|
+
return [item.value];
|
|
87
|
+
}
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
else if (item.value === parentId) {
|
|
91
|
+
return [item.value];
|
|
92
|
+
}
|
|
93
|
+
const result = this.recursionFind(item.children, parentId);
|
|
94
|
+
if (result.length <= 0) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
return [item.value, ...result];
|
|
98
|
+
}
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* 数组工具类.
|
|
104
|
+
*/
|
|
105
|
+
export class ArrayUtils {
|
|
106
|
+
static flat(array, index) {
|
|
107
|
+
const value = array?.[index || 0];
|
|
108
|
+
return (value === undefined || value === null) ? undefined : value;
|
|
109
|
+
}
|
|
110
|
+
static toArray(value) {
|
|
111
|
+
if (value === undefined || value === null) {
|
|
112
|
+
return [];
|
|
113
|
+
}
|
|
114
|
+
return [value];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* 后退导航工具类.
|
|
119
|
+
*/
|
|
120
|
+
export class NavigateUtils {
|
|
121
|
+
/**
|
|
122
|
+
* 功能性后退页面.
|
|
123
|
+
* <li>页面依赖浏览器堆栈非常不可靠的,因此在实际操作中是前进页面</li>
|
|
124
|
+
* <li><b>默认是</b>根据当前 <b>路径参数</b> 以及 <b>分页规则</b> 后退到根路径</li>
|
|
125
|
+
* @param param 路径参数 (数值类型:如果是则根据数值后退 字符串:根据指定路径后退).
|
|
126
|
+
*/
|
|
127
|
+
static useBack(param) {
|
|
128
|
+
const location = useLocation();
|
|
129
|
+
const navigate = useNavigate();
|
|
130
|
+
const getPath = () => {
|
|
131
|
+
let partition = pathPartition.find(path => {
|
|
132
|
+
return location.pathname.toUpperCase()
|
|
133
|
+
.indexOf(`/${path}/`) > -1;
|
|
134
|
+
});
|
|
135
|
+
// 无法确认是否是子页面 则后退一步
|
|
136
|
+
if (partition === undefined) {
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
// 如果确认是子页面 则前进路由
|
|
140
|
+
partition = partition.toLowerCase();
|
|
141
|
+
return location.pathname.split(`/${partition}/`)[0];
|
|
142
|
+
};
|
|
143
|
+
return (value) => {
|
|
144
|
+
const to = value ?? param ?? getPath() ?? -1;
|
|
145
|
+
if (typeof to === 'string') {
|
|
146
|
+
navigate(to);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
navigate(to);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
}
|