@jiangood/open-admin 2.5.5 → 2.5.6
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/package.json +3 -2
- package/src/.umi-production/appData.json +75 -74
- package/src/.umi-production/core/route.tsx +6 -6
- package/src/framework/GlobalData.d.ts +8 -0
- package/src/framework/GlobalData.js +33 -0
- package/src/framework/{components/system → biz}/HasPerm.tsx +1 -1
- package/src/framework/{components/OrgTree/index.tsx → biz/OrgTree.tsx} +12 -2
- package/src/framework/{components/system/ButtonList.tsx → biz/PermActions.tsx} +6 -5
- package/src/framework/{components/RoleTree/index.tsx → biz/RoleTree.tsx} +13 -3
- package/src/framework/{components/system → biz}/index.tsx +4 -2
- package/src/framework/components/ContextMenu/index.tsx +1 -1
- package/src/framework/components/DownloadModal/index.tsx +332 -0
- package/src/framework/components/ErrorBoundary/index.tsx +18 -0
- package/src/framework/components/NamedIcon/{index.jsx → index.tsx} +8 -3
- package/src/framework/components/Page/index.tsx +2 -2
- package/src/framework/components/ProTable/index.tsx +3 -10
- package/src/framework/components/index.ts +2 -6
- package/src/framework/fields/BaseRemoteSelect/index.tsx +2 -3
- package/src/framework/fields/FieldEditor/index.tsx +35 -44
- package/src/framework/fields/FieldNumberRange/index.tsx +2 -2
- package/src/framework/fields/FieldRemoteTree/index.tsx +1 -1
- package/src/framework/fields/FieldTable/index.tsx +20 -22
- package/src/framework/fields/FieldUploadFile/index.tsx +3 -3
- package/src/framework/fields/index.ts +1 -3
- package/src/framework/index.ts +2 -0
- package/src/framework/utils/ArrayUtils.d.ts +6 -0
- package/src/framework/utils/ArrayUtils.js +30 -0
- package/src/framework/utils/DateUtils.d.ts +20 -0
- package/src/framework/utils/DateUtils.js +81 -0
- package/src/framework/utils/DeviceUtils.d.ts +3 -0
- package/src/framework/utils/DeviceUtils.js +10 -0
- package/src/framework/utils/EventBus.d.ts +6 -0
- package/src/framework/utils/EventBus.js +51 -0
- package/src/framework/utils/MessageUtils.d.ts +10 -0
- package/src/framework/utils/MessageUtils.js +43 -0
- package/src/framework/utils/ObjectUtils.d.ts +14 -0
- package/src/framework/utils/ObjectUtils.js +12 -0
- package/src/framework/utils/StorageUtils.d.ts +4 -0
- package/src/framework/utils/{StorageUtils.ts → StorageUtils.js} +7 -11
- package/src/framework/utils/StringUtils.d.ts +17 -0
- package/src/framework/utils/StringUtils.js +107 -0
- package/src/framework/utils/TreeUtils.d.ts +13 -0
- package/src/framework/utils/TreeUtils.js +63 -0
- package/src/framework/utils/UrlUtils.d.ts +6 -0
- package/src/framework/utils/UrlUtils.js +71 -0
- package/src/framework/utils/index.ts +1 -5
- package/src/framework/utils/system/DictUtils.d.ts +20 -0
- package/src/framework/utils/system/DictUtils.js +31 -0
- package/src/framework/utils/system/FormRegistry.d.ts +8 -0
- package/src/framework/utils/system/FormRegistry.js +31 -0
- package/src/framework/utils/system/HttpUtils.d.ts +14 -0
- package/src/framework/utils/system/HttpUtils.js +87 -0
- package/src/framework/utils/system/PageUtils.d.ts +14 -0
- package/src/framework/utils/system/PageUtils.js +59 -0
- package/src/framework/utils/system/PermUtils.d.ts +5 -0
- package/src/framework/utils/system/PermUtils.js +27 -0
- package/src/framework/utils/system/ThemeUtils.d.ts +6 -0
- package/src/framework/utils/system/{ThemeUtils.ts → ThemeUtils.js} +19 -19
- package/src/framework/utils/system/index.ts +1 -2
- package/src/framework/views/ViewFile/index.tsx +1 -2
- package/src/framework/views/ViewImage/index.tsx +3 -3
- package/src/framework/views/{ViewBooleanEnableDisable → ViewSwitch}/index.tsx +1 -1
- package/src/framework/views/index.ts +3 -4
- package/src/layouts/admin/HeaderRight.jsx +32 -44
- package/src/layouts/admin/index.jsx +5 -29
- package/src/layouts/index.jsx +26 -17
- package/src/pages/about.jsx +24 -4
- package/src/pages/{userCenter/ChangePassword.jsx → account/changePassword.jsx} +1 -2
- package/src/pages/{userCenter → account}/index.jsx +2 -6
- package/src/pages/forceUpdatePwd.jsx +89 -0
- package/src/pages/login.jsx +5 -5
- package/src/pages/system/dict/index.jsx +6 -6
- package/src/pages/system/file/index.jsx +4 -4
- package/src/pages/system/job/index.jsx +2 -2
- package/src/pages/system/org/index.jsx +2 -2
- package/src/pages/system/role/index.jsx +4 -4
- package/src/pages/system/role/{perm.jsx → rolePerm.jsx} +2 -2
- package/src/pages/system/user/index.jsx +4 -4
- package/src/framework/components/DownloadFileButton/index.tsx +0 -33
- package/src/framework/components/NamedIcon/index.d.ts +0 -7
- package/src/framework/components/ProTable/utils/index.ts +0 -62
- package/src/framework/fields/FieldRemoteSelectMultipleInline/index.tsx +0 -33
- package/src/framework/fields/FieldRemoteTreeSelectMultiple/index.tsx +0 -43
- package/src/framework/utils/ArrayUtils.ts +0 -186
- package/src/framework/utils/ColorsUtils.ts +0 -378
- package/src/framework/utils/DateUtils.ts +0 -187
- package/src/framework/utils/DeviceUtils.ts +0 -46
- package/src/framework/utils/DomUtils.ts +0 -50
- package/src/framework/utils/EventBusUtils.ts +0 -143
- package/src/framework/utils/Logger.ts +0 -40
- package/src/framework/utils/MessageUtils.tsx +0 -90
- package/src/framework/utils/ObjectUtils.ts +0 -118
- package/src/framework/utils/StringUtils.ts +0 -436
- package/src/framework/utils/TreeUtils.ts +0 -251
- package/src/framework/utils/UrlUtils.ts +0 -152
- package/src/framework/utils/UuidUtils.ts +0 -88
- package/src/framework/utils/ValidateUtils.ts +0 -28
- package/src/framework/utils/system/DictUtils.ts +0 -96
- package/src/framework/utils/system/FormRegistryUtils.ts +0 -76
- package/src/framework/utils/system/HttpUtils.ts +0 -251
- package/src/framework/utils/system/PageUtils.ts +0 -163
- package/src/framework/utils/system/PermUtils.ts +0 -79
- package/src/framework/utils/system/SysUtils.ts +0 -105
- package/src/framework/views/ViewProcessInstanceProgress/index.tsx +0 -98
- package/src/framework/views/ViewProcessInstanceProgressButton/index.tsx +0 -23
- package/src/pages/userCenter/message.jsx +0 -105
- /package/src/framework/{components → views}/ViewRange/index.tsx +0 -0
- /package/src/pages/system/user/{UserPerm.jsx → userPerm.jsx} +0 -0
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import {history} from "umi";
|
|
2
|
-
import {StringUtils} from "../StringUtils";
|
|
3
|
-
import {UrlUtils} from "../UrlUtils";
|
|
4
|
-
import {MessageUtils} from "../MessageUtils";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 页面相关的工具类,主要用于路由、URL参数和页面跳转操作。
|
|
8
|
-
*/
|
|
9
|
-
export class PageUtils {
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* 重定向到登录页,并携带当前页面的URL作为回跳参数。
|
|
13
|
-
*/
|
|
14
|
-
static redirectToLogin(): void {
|
|
15
|
-
const url = PageUtils.currentUrl();
|
|
16
|
-
// 对URL进行编码,确保参数安全传递
|
|
17
|
-
const encodedUrl = encodeURIComponent(url);
|
|
18
|
-
history.push(`/login?redirect=${encodedUrl}`);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated 请使用 currentParams() 代替。
|
|
23
|
-
* 获取当前 URL 的查询参数对象。
|
|
24
|
-
* @returns {Record<string, string | undefined>} 包含查询参数的键值对对象。
|
|
25
|
-
*/
|
|
26
|
-
static currentLocationQuery(): Record<string, string | undefined> {
|
|
27
|
-
return this.currentParams();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* 获取当前 URL 的查询参数对象。
|
|
32
|
-
* @returns {Record<string, string | undefined>} 包含查询参数的键值对对象。
|
|
33
|
-
*/
|
|
34
|
-
static currentParams(): Record<string, string | undefined> {
|
|
35
|
-
const url = window.location.href;
|
|
36
|
-
|
|
37
|
-
// 检查是否存在查询参数
|
|
38
|
-
const hasQuery = url.indexOf('?') > 0;
|
|
39
|
-
if (!hasQuery) {
|
|
40
|
-
return {};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// 提取问号后面的查询字符串
|
|
44
|
-
const search = url.substring(url.indexOf('?') + 1);
|
|
45
|
-
const kvs = search.split('&');
|
|
46
|
-
|
|
47
|
-
const rs: Record<string, string | undefined> = {};
|
|
48
|
-
for (const kv of kvs) {
|
|
49
|
-
const kvArr = kv.split('=');
|
|
50
|
-
const k = kvArr[0];
|
|
51
|
-
let v = kvArr[1];
|
|
52
|
-
|
|
53
|
-
// 值存在时才进行解码
|
|
54
|
-
if (v) {
|
|
55
|
-
// 使用 decodeURIComponent 更安全地处理 URL 编码的值
|
|
56
|
-
try {
|
|
57
|
-
v = decodeURIComponent(v);
|
|
58
|
-
} catch (e) {
|
|
59
|
-
console.error("Failed to decode URL parameter value:", v, e);
|
|
60
|
-
// 解码失败时保留原值
|
|
61
|
-
}
|
|
62
|
-
} else {
|
|
63
|
-
v = undefined; // 如果值为空,设置为 undefined
|
|
64
|
-
}
|
|
65
|
-
rs[k] = v;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return rs;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* 获取当前 URL 的路径名(不带查询参数和 Hash 符号 #)。
|
|
73
|
-
* 例如:"http://localhost:8000/#/login?id=1" -> "/login"
|
|
74
|
-
* @returns {string} 不带参的路径。
|
|
75
|
-
*/
|
|
76
|
-
static currentPathname(): string {
|
|
77
|
-
// window.location.hash.substring(1) 得到 "/login?id=1"
|
|
78
|
-
const path = window.location.hash.substring(1);
|
|
79
|
-
return StringUtils.subBefore(path, '?');
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* @deprecated 请使用 currentUrl() 代替。
|
|
84
|
-
* 获取 hash 后的完整路径 (带参数)。
|
|
85
|
-
* @returns {string} 例如:"/login?id=1"
|
|
86
|
-
*/
|
|
87
|
-
static currentPath(): string {
|
|
88
|
-
// window.location.hash.substring(1) 得到 "/login?id=1"
|
|
89
|
-
return window.location.hash.substring(1);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* 获取 hash 后的完整路径 (带参数)。
|
|
94
|
-
* @returns {string} 例如:"/login?id=1"
|
|
95
|
-
*/
|
|
96
|
-
static currentUrl(): string {
|
|
97
|
-
return window.location.hash.substring(1);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* 当前路由的最后一个斜杠后面的单词,通常用于基于路径的路由。
|
|
102
|
-
* 例如:"/user/detail/123" -> "123"
|
|
103
|
-
* @returns {string | undefined} 路径的最后一部分或 undefined。
|
|
104
|
-
*/
|
|
105
|
-
static currentPathnameLastPart(): string | undefined {
|
|
106
|
-
const path = this.currentPathname();
|
|
107
|
-
return StringUtils.subAfterLast(path, '/') || undefined;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* 打开一个新页面,可选择添加一个 '_label' 参数。
|
|
112
|
-
* @param path 要跳转的路径。
|
|
113
|
-
* @param label 可选,用于在 URL 中添加一个 '_label' 参数。
|
|
114
|
-
*/
|
|
115
|
-
static open(path: string, label: string = '未命名'): void {
|
|
116
|
-
let targetPath = path;
|
|
117
|
-
if (label) {
|
|
118
|
-
// 假设 UrlUtil.setParam(url, key, value) 存在并返回设置参数后的 URL
|
|
119
|
-
targetPath = UrlUtils.setParam(targetPath, '_label', label);
|
|
120
|
-
}
|
|
121
|
-
history.push(targetPath);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* 打开一个不带菜单、Header 等布局元素的页面。
|
|
127
|
-
* 通过在 URL 中添加 '_noLayout=true' 参数实现。
|
|
128
|
-
* @param path 要跳转的路径。
|
|
129
|
-
*/
|
|
130
|
-
static openNoLayout(path: string): void {
|
|
131
|
-
// 假设 UrlUtil.setParam(url, key, value) 存在
|
|
132
|
-
const targetPath = UrlUtils.setParam(path, '_noLayout', true);
|
|
133
|
-
history.push(targetPath);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* 获取当前 URL 参数中名为 '_label' 的值。
|
|
138
|
-
* @returns {string | undefined} '_label' 参数的值。
|
|
139
|
-
*/
|
|
140
|
-
static currentLabel(): string | undefined {
|
|
141
|
-
// currentParams 返回 Record<string, string | undefined>
|
|
142
|
-
return this.currentParams()['_label'];
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* 发送一个自定义事件来关闭当前页面。
|
|
147
|
-
* 依赖外部监听 'close-page-event' 事件的处理机制。
|
|
148
|
-
*/
|
|
149
|
-
static closeCurrent() {
|
|
150
|
-
const event = new CustomEvent<{ url: string }>('close-page-event', {
|
|
151
|
-
detail: {url: PageUtils.currentUrl()}
|
|
152
|
-
});
|
|
153
|
-
document.dispatchEvent(event);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
static closeCurrentAndOpenPage(alertMessage:string,path:string,label:string){
|
|
157
|
-
MessageUtils.alert(alertMessage).then(()=>{
|
|
158
|
-
this.closeCurrent()
|
|
159
|
-
this.open(path,label)
|
|
160
|
-
})
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import {SysUtils} from "./SysUtils";
|
|
2
|
-
import {ArrayUtils} from "../ArrayUtils";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 登录用户信息接口,
|
|
6
|
-
*/
|
|
7
|
-
interface LoginInfo {
|
|
8
|
-
// ... 其他登录信息字段
|
|
9
|
-
permissions: string[];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* 权限控制工具类
|
|
14
|
-
*/
|
|
15
|
-
export class PermUtils {
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* 获取当前用户的权限列表信息。
|
|
19
|
-
* @private
|
|
20
|
-
* @returns {string[]} 权限码数组。
|
|
21
|
-
*/
|
|
22
|
-
private static getPermissions(): string[] {
|
|
23
|
-
// 假设 SysUtil.getLoginInfo() 返回 LoginInfo 类型的对象
|
|
24
|
-
const info: LoginInfo = SysUtils.getLoginInfo();
|
|
25
|
-
const { permissions } = info;
|
|
26
|
-
|
|
27
|
-
if (permissions == null || permissions.length === 0) {
|
|
28
|
-
return [];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return permissions;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* 是否拥有权限
|
|
36
|
-
* * @param perm 权限码 (string)
|
|
37
|
-
* @returns {boolean} 如果拥有权限则为 true,否则为 false。
|
|
38
|
-
*/
|
|
39
|
-
public static hasPermission(perm: string | null | undefined): boolean {
|
|
40
|
-
if (perm === null || perm === undefined || perm === '') {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const permissions: string[] = PermUtils.getPermissions();
|
|
45
|
-
|
|
46
|
-
if (permissions.length === 0) {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// 检查是否拥有超级权限 '*'
|
|
51
|
-
// 假设 ArrUtils.contains(array, item) 存在且返回 boolean
|
|
52
|
-
if (ArrayUtils.contains(permissions, "*")) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// 检查是否包含指定的权限码
|
|
57
|
-
return permissions.indexOf(perm) > -1;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* 是否授权,功能上与 hasPermission 相同。
|
|
62
|
-
* * @param p 权限码 (string)
|
|
63
|
-
* @returns {boolean} 如果拥有权限则为 true,否则为 false。
|
|
64
|
-
*/
|
|
65
|
-
public static isPermitted(p: string | null | undefined): boolean {
|
|
66
|
-
// 直接调用内部方法
|
|
67
|
-
return PermUtils.hasPermission(p);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* 是否没有权限。
|
|
72
|
-
* * @param p 权限码 (string)
|
|
73
|
-
* @returns {boolean} 如果没有权限则为 true,否则为 false。
|
|
74
|
-
*/
|
|
75
|
-
public static notPermitted(p: string | null | undefined): boolean {
|
|
76
|
-
// 使用!取反,并确保方法返回布尔值
|
|
77
|
-
return !PermUtils.isPermitted(p);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// --- 常量定义 ---
|
|
3
|
-
import {StorageUtils} from "../StorageUtils";
|
|
4
|
-
|
|
5
|
-
const SITE_INFO_KEY = "siteInfo";
|
|
6
|
-
const LOGIN_INFO_KEY = "loginInfo";
|
|
7
|
-
const DICT_INFO_KEY = "dictInfo";
|
|
8
|
-
|
|
9
|
-
// 假设 SiteInfo, LoginInfo, DictInfo 是工具类操作的数据结构。
|
|
10
|
-
// 请根据你的实际情况替换为正确的接口或类型。
|
|
11
|
-
interface SiteInfo {
|
|
12
|
-
// 示例属性
|
|
13
|
-
name: string;
|
|
14
|
-
version: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface LoginInfo {
|
|
18
|
-
// 示例属性
|
|
19
|
-
token: string;
|
|
20
|
-
userId: number;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// 字典数据通常是键值对或数组,这里假设是 Record<string, any>
|
|
24
|
-
type DictInfo = Record<string, any> | null;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* 系统工具类 (Utils Pattern)
|
|
28
|
-
*/
|
|
29
|
-
export class SysUtils {
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* 获取请求头信息。
|
|
33
|
-
* @returns 一个包含请求头键值对的对象。
|
|
34
|
-
*/
|
|
35
|
-
public static getHeaders(): Record<string, string> {
|
|
36
|
-
const headers: Record<string, string> = {};
|
|
37
|
-
// 实际的 headers 逻辑(如添加认证 token 等)应在此处实现
|
|
38
|
-
return headers;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* 设置站点信息。
|
|
43
|
-
* @param data 要存储的站点信息数据。
|
|
44
|
-
* @returns StorageUtil.set 的返回值 (通常是 void 或 Promise<void>)
|
|
45
|
-
*/
|
|
46
|
-
public static setSiteInfo(data: SiteInfo): void {
|
|
47
|
-
// 假设 StorageUtil.set 返回 void
|
|
48
|
-
// 请根据实际 StorageUtil 的实现调整返回值类型
|
|
49
|
-
StorageUtils.set(SITE_INFO_KEY, data);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* 获取站点信息。
|
|
54
|
-
* @returns 站点信息对象,如果不存在则返回一个空对象。
|
|
55
|
-
*/
|
|
56
|
-
public static getSiteInfo(): SiteInfo {
|
|
57
|
-
// 假设 StorageUtil.getDefinition 内部处理了 JSON.parse,并返回对应类型或 null
|
|
58
|
-
return StorageUtils.get(SITE_INFO_KEY) || {} as SiteInfo;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* 设置登录信息。
|
|
63
|
-
* @param data 要存储的登录信息数据。
|
|
64
|
-
*/
|
|
65
|
-
public static setLoginInfo(data: LoginInfo): void {
|
|
66
|
-
StorageUtils.set(LOGIN_INFO_KEY, data);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* 获取登录信息。
|
|
71
|
-
* @returns 登录信息对象,如果不存在则返回一个空对象。
|
|
72
|
-
*/
|
|
73
|
-
public static getLoginInfo(): LoginInfo {
|
|
74
|
-
return StorageUtils.get(LOGIN_INFO_KEY) || {} as LoginInfo;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* 设置字典信息。
|
|
79
|
-
* @param data 要存储的字典信息数据。
|
|
80
|
-
*/
|
|
81
|
-
public static setDictInfo(data: DictInfo): void {
|
|
82
|
-
StorageUtils.set(DICT_INFO_KEY, data);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* 获取字典信息。
|
|
87
|
-
* @returns 字典信息对象,如果不存在则返回 null。
|
|
88
|
-
*/
|
|
89
|
-
public static getDictInfo(): DictInfo {
|
|
90
|
-
return StorageUtils.get(DICT_INFO_KEY);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* 拼接 servlet context-path,例如 contextPath('/admin/auth/login') → '/open-admin/admin/auth/login'
|
|
95
|
-
*/
|
|
96
|
-
public static contextPath(path: string): string {
|
|
97
|
-
const base = (typeof SERVLET_CONTEXT !== 'undefined' && SERVLET_CONTEXT) || '';
|
|
98
|
-
return base + path;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// 导出常量(保持不变,但通常将常量放在类内部作为 static readonly 属性更符合 class 模式,
|
|
103
|
-
// 不过为了兼容性,我先保留外部导出,同时建议在类中使用常量)
|
|
104
|
-
|
|
105
|
-
export { SITE_INFO_KEY, LOGIN_INFO_KEY, DICT_INFO_KEY };
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {Empty, Modal, Skeleton, Table, Typography} from "antd";
|
|
3
|
-
import {Gap} from "../../components"; import {HttpUtils} from "../../utils";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 查看流程处理情况(不含表单)
|
|
7
|
-
*/
|
|
8
|
-
export class ViewProcessInstanceProgress extends React.Component {
|
|
9
|
-
|
|
10
|
-
state = {
|
|
11
|
-
instanceCommentList: [],
|
|
12
|
-
vars: {},
|
|
13
|
-
|
|
14
|
-
id: null,
|
|
15
|
-
starter: null,
|
|
16
|
-
startTime: null,
|
|
17
|
-
name: null,
|
|
18
|
-
|
|
19
|
-
data: {
|
|
20
|
-
commentList: [],
|
|
21
|
-
img: null
|
|
22
|
-
},
|
|
23
|
-
loading: true,
|
|
24
|
-
|
|
25
|
-
errorMsg: null
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
componentDidMount() {
|
|
30
|
-
const {value} = this.props;
|
|
31
|
-
HttpUtils.get("admin/flowable/my/getInstanceInfo", {businessKey: value}).then(rs => {
|
|
32
|
-
this.setState(rs)
|
|
33
|
-
this.setState({data: rs})
|
|
34
|
-
}).catch(e => {
|
|
35
|
-
console.error('[ViewProcessInstanceProgress] 加载流程实例失败:', e);
|
|
36
|
-
this.setState({errorMsg: e})
|
|
37
|
-
}).finally(() => {
|
|
38
|
-
this.setState({loading: false})
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
onImgClick = () => {
|
|
44
|
-
const {data} = this.state
|
|
45
|
-
|
|
46
|
-
const {img} = data
|
|
47
|
-
Modal.info({
|
|
48
|
-
title: '流程图',
|
|
49
|
-
width: '70vw',
|
|
50
|
-
content: <div style={{width: '100%', overflow: 'auto', maxHeight: '80vh'}}><img src={img}/></div>
|
|
51
|
-
})
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
render() {
|
|
55
|
-
if (this.state.errorMsg) {
|
|
56
|
-
return <Empty description={this.state.errorMsg}></Empty>
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const {data, loading} = this.state
|
|
60
|
-
const {commentList, img} = data
|
|
61
|
-
if (loading) {
|
|
62
|
-
return <Skeleton/>
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return <>
|
|
67
|
-
<Typography.Title level={4}>{data.name}</Typography.Title>
|
|
68
|
-
<Typography.Text type="secondary">{data.starter} {data.startTime}</Typography.Text>
|
|
69
|
-
<Gap></Gap>
|
|
70
|
-
<img src={img} style={{maxWidth: '100%'}}
|
|
71
|
-
onClick={this.onImgClick}/>
|
|
72
|
-
<Gap></Gap>
|
|
73
|
-
<Table dataSource={commentList}
|
|
74
|
-
|
|
75
|
-
size='small'
|
|
76
|
-
pagination={false}
|
|
77
|
-
rowKey='id'
|
|
78
|
-
columns={[
|
|
79
|
-
{
|
|
80
|
-
dataIndex: 'content',
|
|
81
|
-
title: '操作'
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
dataIndex: 'user',
|
|
85
|
-
title: '处理人'
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
dataIndex: 'time',
|
|
89
|
-
title: '处理时间'
|
|
90
|
-
},
|
|
91
|
-
]}
|
|
92
|
-
/>
|
|
93
|
-
</>
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {Button} from "antd";
|
|
3
|
-
import {MessageUtils} from "../../utils";
|
|
4
|
-
import {ViewProcessInstanceProgress} from "../ViewProcessInstanceProgress";
|
|
5
|
-
|
|
6
|
-
export class ViewProcessInstanceProgressButton extends React.Component {
|
|
7
|
-
state = {
|
|
8
|
-
open:false,
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
onClick = () => {
|
|
12
|
-
const content = <ViewProcessInstanceProgress value={this.props.value} />;
|
|
13
|
-
MessageUtils.alert(content,{
|
|
14
|
-
title:'流程审批信息',
|
|
15
|
-
width:800
|
|
16
|
-
})
|
|
17
|
-
};
|
|
18
|
-
render() {
|
|
19
|
-
return <Button onClick={this.onClick} size='small'>追踪流程</Button>
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {Button, Card, Tabs, Tag} from "antd";
|
|
3
|
-
import {HttpUtils, Page, ProTable} from "../../framework";
|
|
4
|
-
|
|
5
|
-
export default class extends React.Component {
|
|
6
|
-
|
|
7
|
-
tableRef = React.createRef()
|
|
8
|
-
|
|
9
|
-
read = (record) => {
|
|
10
|
-
HttpUtils.post("admin/user/msg/read", record).then(rs => {
|
|
11
|
-
this.tableRef.current.reload()
|
|
12
|
-
})
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
columns = [
|
|
16
|
-
{
|
|
17
|
-
title: '时间',
|
|
18
|
-
dataIndex: 'createTime',
|
|
19
|
-
width: 150
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
title: '标题',
|
|
23
|
-
dataIndex: 'title',
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
title: '内容',
|
|
27
|
-
dataIndex: 'content',
|
|
28
|
-
render(content, row) {
|
|
29
|
-
return <div dangerouslySetInnerHTML={{__html: content}}/>
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
title: '已读时间',
|
|
34
|
-
dataIndex: 'readTime',
|
|
35
|
-
width: 150
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
title: '状态',
|
|
39
|
-
dataIndex: 'isRead',
|
|
40
|
-
render: (v, row) => {
|
|
41
|
-
return v == true ? <Tag color='green'>已读</Tag> : <Tag color='red'>未读</Tag>;
|
|
42
|
-
},
|
|
43
|
-
width: 80
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
{
|
|
47
|
-
title: '-',
|
|
48
|
-
dataIndex: 'option',
|
|
49
|
-
render: (read, row) => {
|
|
50
|
-
if (!row.isRead)
|
|
51
|
-
return <Button size='small' onClick={() => this.read(row)}> 标记已读 </Button>
|
|
52
|
-
}, width: 80
|
|
53
|
-
}
|
|
54
|
-
]
|
|
55
|
-
|
|
56
|
-
render() {
|
|
57
|
-
return <Page title="消息中心" description="查看系统消息通知">
|
|
58
|
-
<Card variant={"borderless"}>
|
|
59
|
-
|
|
60
|
-
<Tabs defaultActiveKey="0" destroyOnClose
|
|
61
|
-
>
|
|
62
|
-
<Tabs.TabPane key='0' tab='所有消息'>
|
|
63
|
-
<ProTable
|
|
64
|
-
actionRef={this.tableRef}
|
|
65
|
-
request={(params) => HttpUtils.get("admin/user/msg/page", params)}
|
|
66
|
-
columns={this.columns}
|
|
67
|
-
toolbarOptions={{showSearch: false}}
|
|
68
|
-
size='small'
|
|
69
|
-
/>
|
|
70
|
-
</Tabs.TabPane>
|
|
71
|
-
<Tabs.TabPane key='1' tab='未读消息'>
|
|
72
|
-
<ProTable
|
|
73
|
-
actionRef={this.tableRef}
|
|
74
|
-
request={(params) => HttpUtils.get("admin/user/msg/page?read=false", params)}
|
|
75
|
-
columns={this.columns}
|
|
76
|
-
rowSelection={false}
|
|
77
|
-
rowKey='id'
|
|
78
|
-
toolbarOptions={{showSearch: false}}
|
|
79
|
-
size='small'
|
|
80
|
-
/>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
</Tabs.TabPane>
|
|
84
|
-
<Tabs.TabPane key='2' tab='已读消息'>
|
|
85
|
-
|
|
86
|
-
<ProTable
|
|
87
|
-
actionRef={this.tableRef}
|
|
88
|
-
request={(params) => HttpUtils.get("admin/user/msg/page?read=true", params)}
|
|
89
|
-
rowSelection={false}
|
|
90
|
-
rowKey='id'
|
|
91
|
-
toolbarOptions={{showSearch: false}}
|
|
92
|
-
options={false}
|
|
93
|
-
size='small'
|
|
94
|
-
columns={this.columns}
|
|
95
|
-
/>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
</Tabs.TabPane>
|
|
99
|
-
|
|
100
|
-
</Tabs>
|
|
101
|
-
|
|
102
|
-
</Card>
|
|
103
|
-
</Page>
|
|
104
|
-
}
|
|
105
|
-
}
|
|
File without changes
|
|
File without changes
|