@jiangood/open-admin 3.0.1 → 3.0.2
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
CHANGED
|
@@ -6,9 +6,28 @@ import ErrorBoundary from '../components/ErrorBoundary';
|
|
|
6
6
|
|
|
7
7
|
interface PageFrameProps {
|
|
8
8
|
url: string;
|
|
9
|
+
show?: boolean;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export class PageFrame extends React.Component<PageFrameProps> {
|
|
13
|
+
componentRef = React.createRef<any>();
|
|
14
|
+
|
|
15
|
+
componentDidMount() {
|
|
16
|
+
this.callOnShowIfActive();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
componentDidUpdate(prevProps: PageFrameProps) {
|
|
20
|
+
if (!prevProps.show && this.props.show) {
|
|
21
|
+
this.callOnShowIfActive();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
callOnShowIfActive() {
|
|
26
|
+
if (this.props.show && this.componentRef.current?.onShow) {
|
|
27
|
+
this.componentRef.current.onShow();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
12
31
|
render() {
|
|
13
32
|
const {url} = this.props;
|
|
14
33
|
const qIndex = url.indexOf('?');
|
|
@@ -21,7 +40,7 @@ export class PageFrame extends React.Component<PageFrameProps> {
|
|
|
21
40
|
if (matched) {
|
|
22
41
|
const {component: Comp, params} = matched;
|
|
23
42
|
const location = {pathname, search, query: UrlUtils.getParams(url)};
|
|
24
|
-
content = <Comp params={params} location={location}/>;
|
|
43
|
+
content = <Comp ref={this.componentRef} params={params} location={location}/>;
|
|
25
44
|
} else {
|
|
26
45
|
content = <Result status={404} title='页面不存在!' subTitle={<div>路由地址:{pathname}</div>}/>;
|
|
27
46
|
}
|
|
@@ -113,7 +113,7 @@ export class TabLayout extends React.Component {
|
|
|
113
113
|
<div style={{flex: 1, overflow: 'hidden'}}>
|
|
114
114
|
{tabs.map(t => (
|
|
115
115
|
<div key={t.key} style={{display: t.key === activeKey ? 'block' : 'none', height: '100%'}}>
|
|
116
|
-
<PageFrame key={t.refreshKey} url={t.key}/>
|
|
116
|
+
<PageFrame key={t.refreshKey} url={t.key} show={t.key === activeKey}/>
|
|
117
117
|
</div>
|
|
118
118
|
))}
|
|
119
119
|
</div>
|
|
@@ -8,6 +8,7 @@ export default class extends React.Component {
|
|
|
8
8
|
|
|
9
9
|
state = {
|
|
10
10
|
usersModalOpen: false,
|
|
11
|
+
usersModalLoading: false,
|
|
11
12
|
selectedRecord: null,
|
|
12
13
|
|
|
13
14
|
userList: [],
|
|
@@ -132,12 +133,15 @@ export default class extends React.Component {
|
|
|
132
133
|
]
|
|
133
134
|
|
|
134
135
|
handleSaveUsers = () => {
|
|
136
|
+
this.setState({usersModalLoading: true})
|
|
135
137
|
const params = {
|
|
136
138
|
id: this.state.selectedRecord.id,
|
|
137
139
|
userIdList: this.state.targetKeys
|
|
138
140
|
}
|
|
139
141
|
HttpUtils.post('admin/sysRole/grant-users', params).then(rs => {
|
|
140
|
-
this.setState({usersModalOpen: false})
|
|
142
|
+
this.setState({usersModalOpen: false, usersModalLoading: false})
|
|
143
|
+
}).catch(() => {
|
|
144
|
+
this.setState({usersModalLoading: false})
|
|
141
145
|
})
|
|
142
146
|
}
|
|
143
147
|
|
|
@@ -213,6 +217,7 @@ export default class extends React.Component {
|
|
|
213
217
|
|
|
214
218
|
<Modal title={'角色用户' + "【" + this.state.selectedRecord?.name + '】'}
|
|
215
219
|
open={this.state.usersModalOpen}
|
|
220
|
+
confirmLoading={this.state.usersModalLoading}
|
|
216
221
|
destroyOnHidden
|
|
217
222
|
mask={{ closable: false }}
|
|
218
223
|
width={800}
|