@jiangood/springboot-admin-starter 0.0.7 → 0.0.8
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 +1 -1
- package/src/framework/components/ProTable/index.jsx +9 -5
- package/src/framework/components/ProTable/index.less +12 -0
- package/src/framework/components/view/ViewText.tsx +1 -1
- package/src/framework/utils/StorageUtils.ts +3 -20
- package/src/layouts/index.jsx +22 -24
- package/src/pages/index.jsx +3 -0
- package/src/pages/system/role/perm.jsx +11 -14
package/package.json
CHANGED
|
@@ -7,6 +7,8 @@ import {StringUtils} from "../../utils";
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
export class ProTable extends React.Component {
|
|
10
|
+
|
|
11
|
+
|
|
10
12
|
state = {
|
|
11
13
|
selectedRowKeys: [],
|
|
12
14
|
selectedRows: [],
|
|
@@ -173,7 +175,7 @@ export class ProTable extends React.Component {
|
|
|
173
175
|
if (!this.props.children) {
|
|
174
176
|
return
|
|
175
177
|
}
|
|
176
|
-
if (this.props
|
|
178
|
+
if (this.props["searchFormItemsRender"]) {
|
|
177
179
|
throw new Error('不再支持 searchFormItemsRender,请直接放到ProTable的子节点')
|
|
178
180
|
}
|
|
179
181
|
|
|
@@ -188,15 +190,17 @@ export class ProTable extends React.Component {
|
|
|
188
190
|
}
|
|
189
191
|
}}
|
|
190
192
|
style={{gap: '8px 0px'}}
|
|
191
|
-
labelCol={{flex: '
|
|
193
|
+
labelCol={{flex: '80px'}}
|
|
194
|
+
wrapperCol={{flex: '200px'}}
|
|
195
|
+
className='search-form'
|
|
192
196
|
>
|
|
193
197
|
|
|
194
198
|
{this.props.children}
|
|
195
|
-
|
|
196
|
-
<Form.Item style={{marginLeft: this.props.children.length > 2 ? 'auto' : 'inherit'}}>
|
|
199
|
+
<div style={{marginLeft: '16px'}}>
|
|
197
200
|
<Button type='primary' htmlType="submit" icon={<SearchOutlined/>}> 查询
|
|
198
201
|
</Button>
|
|
199
|
-
</
|
|
202
|
+
</div>
|
|
203
|
+
|
|
200
204
|
</Form>
|
|
201
205
|
</div>;
|
|
202
206
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { DateUtils } from "./DateUtils";
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* 存储工具类
|
|
5
3
|
* 使用 localStorage 进行数据的存取,并包含时间戳和默认值处理。
|
|
@@ -13,21 +11,13 @@ export class StorageUtils {
|
|
|
13
11
|
* @returns 存储的值或默认值。
|
|
14
12
|
*/
|
|
15
13
|
static get<T>(key: string, defaultValue: T | null = null): T | null {
|
|
16
|
-
// 尝试从 localStorage 获取原始字符串
|
|
17
14
|
const vStr = localStorage.getItem(key);
|
|
18
|
-
|
|
19
|
-
// 如果没有存储项
|
|
20
15
|
if (vStr == null) {
|
|
21
16
|
return defaultValue;
|
|
22
17
|
}
|
|
23
18
|
|
|
24
19
|
try {
|
|
25
|
-
|
|
26
|
-
const item: { createTime: number; data: T } = JSON.parse(vStr);
|
|
27
|
-
|
|
28
|
-
// 返回实际存储的数据
|
|
29
|
-
return item.data;
|
|
30
|
-
|
|
20
|
+
return JSON.parse(vStr);
|
|
31
21
|
} catch (error) {
|
|
32
22
|
// 如果 JSON 解析失败 (例如,存储的值不是一个包含 createTime 和 data 的有效 JSON 结构)
|
|
33
23
|
console.error(`Error parsing storage item for key: ${key}`, error);
|
|
@@ -48,20 +38,13 @@ export class StorageUtils {
|
|
|
48
38
|
return;
|
|
49
39
|
}
|
|
50
40
|
|
|
51
|
-
// 构造包含时间戳的对象
|
|
52
|
-
const item = {
|
|
53
|
-
createTime: DateUtils.now(), // 假设 DateUtil.now() 返回 number 类型的时间戳
|
|
54
|
-
data: value
|
|
55
|
-
};
|
|
56
41
|
|
|
57
42
|
try {
|
|
58
|
-
|
|
59
|
-
const dataStr = JSON.stringify(item);
|
|
60
|
-
// 存储到 localStorage
|
|
43
|
+
const dataStr = JSON.stringify(value);
|
|
61
44
|
localStorage.setItem(key, dataStr);
|
|
62
45
|
} catch (error) {
|
|
63
46
|
// 捕获 JSON.stringify 错误 (例如,如果 value 包含循环引用)
|
|
64
|
-
console.error(`Error
|
|
47
|
+
console.error(`Error stringify storage value for key: ${key}`, error);
|
|
65
48
|
}
|
|
66
49
|
}
|
|
67
50
|
}
|
package/src/layouts/index.jsx
CHANGED
|
@@ -5,12 +5,7 @@ import {ConfigProvider} from "antd";
|
|
|
5
5
|
|
|
6
6
|
import {Outlet, withRouter} from "umi";
|
|
7
7
|
import zhCN from 'antd/locale/zh_CN';
|
|
8
|
-
import {
|
|
9
|
-
ArrUtils,
|
|
10
|
-
HttpUtils,
|
|
11
|
-
PageLoading, PageUtils,
|
|
12
|
-
SysUtils, ThemeUtils,
|
|
13
|
-
} from "../framework";
|
|
8
|
+
import {ArrUtils, HttpUtils, PageLoading, PageUtils, SysUtils, ThemeUtils,} from "../framework";
|
|
14
9
|
import dayjs from 'dayjs';
|
|
15
10
|
import 'dayjs/locale/zh-cn';
|
|
16
11
|
|
|
@@ -82,24 +77,6 @@ class _Layouts extends React.Component {
|
|
|
82
77
|
|
|
83
78
|
|
|
84
79
|
|
|
85
|
-
renderContent = () => {
|
|
86
|
-
if (this.state.siteInfoLoading) {
|
|
87
|
-
return <PageLoading message='加载站点信息...'/>
|
|
88
|
-
}
|
|
89
|
-
let {params = {}} = this.props.location;
|
|
90
|
-
console.log('layout: params', params)
|
|
91
|
-
let simple = this.isSimplePage();
|
|
92
|
-
if (simple || params.hasOwnProperty('_noLayout')) {
|
|
93
|
-
return <Outlet/>
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (!this.state.loginInfoFinish) {
|
|
97
|
-
return <PageLoading message='加载登录信息...'/>
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return <AdminLayout path={this.state.path} logo={this.props.logo}/>
|
|
102
|
-
};
|
|
103
80
|
|
|
104
81
|
|
|
105
82
|
render() {
|
|
@@ -146,8 +123,29 @@ class _Layouts extends React.Component {
|
|
|
146
123
|
</ConfigProvider>
|
|
147
124
|
}
|
|
148
125
|
|
|
126
|
+
renderContent = () => {
|
|
127
|
+
if (this.state.siteInfoLoading) {
|
|
128
|
+
return <PageLoading message='加载站点信息...'/>
|
|
129
|
+
}
|
|
130
|
+
let {params = {}} = this.props.location;
|
|
131
|
+
console.log('layout: params', params)
|
|
132
|
+
let simple = this.isSimplePage();
|
|
133
|
+
if (simple || params.hasOwnProperty('_noLayout')) {
|
|
134
|
+
return <Outlet/>
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (!this.state.loginInfoFinish) {
|
|
138
|
+
return <PageLoading message='加载登录信息...'/>
|
|
139
|
+
}
|
|
149
140
|
|
|
150
141
|
|
|
142
|
+
return <AdminLayout path={this.state.path} logo={this.props.logo}/>
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
renderMessages = () => {
|
|
146
|
+
|
|
147
|
+
};
|
|
148
|
+
|
|
151
149
|
}
|
|
152
150
|
|
|
153
151
|
export const Layouts = withRouter(_Layouts);
|
package/src/pages/index.jsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {Button, Card, Checkbox, Table, Typography} from "antd";
|
|
3
3
|
import {SaveOutlined} from "@ant-design/icons";
|
|
4
4
|
import {ArrUtils, HttpUtils, PageUtils} from "../../../framework";
|
|
5
5
|
|
|
@@ -22,21 +22,18 @@ export default class extends React.Component {
|
|
|
22
22
|
|
|
23
23
|
{
|
|
24
24
|
title: '权限',
|
|
25
|
-
dataIndex: '
|
|
26
|
-
render: (
|
|
27
|
-
if (
|
|
28
|
-
if (record.path) {
|
|
29
|
-
return <Alert type='error' message='错误:无按钮权限,请在application-data-**.yml中添加'/>
|
|
30
|
-
}
|
|
31
|
-
// 文件夹
|
|
25
|
+
dataIndex: 'permCodes',
|
|
26
|
+
render: (permCodes, record) => {
|
|
27
|
+
if (permCodes == null) {
|
|
32
28
|
return
|
|
33
29
|
}
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
const {permNames} = record
|
|
31
|
+
const options = [];
|
|
32
|
+
for (let i = 0; i < permCodes.length; i++) {
|
|
33
|
+
const label = permNames[i];
|
|
34
|
+
const value = permCodes[i];
|
|
35
|
+
options.push({label, value});
|
|
36
|
+
}
|
|
40
37
|
|
|
41
38
|
|
|
42
39
|
let rowSelectedKey = this.state.rowSelectedKeys[record.id];
|