cfel-base-components 2.3.1 → 2.3.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cfel-base-components",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "cfel-base-components",
5
5
  "main": "/src/index.tsx",
6
6
  "types": "src/index.d.ts",
@@ -14,3 +14,13 @@
14
14
  align-items: center;
15
15
  margin: 10px 0px;
16
16
  }
17
+ .deviceTopTitle{
18
+ display: flex;
19
+ align-items: center;
20
+ .deviceTopDivider{
21
+ flex: 1;
22
+ }
23
+ .deviceTopButton{
24
+ margin: 0px 5px;
25
+ }
26
+ }
@@ -16,6 +16,7 @@ import {
16
16
  message,
17
17
  Tabs,
18
18
  Table,
19
+ Spin
19
20
  } from "antd";
20
21
  import EditAccountDrawer from "./EditAccountDrawer/index";
21
22
  import { timeFormatter, getUrlParams } from "../../../utils";
@@ -51,6 +52,7 @@ export default function RoleInfo({ isShowTab, getAuthTree }: RoleInfoProps) {
51
52
 
52
53
  const [ResourceTableData, setResourceTableData]: any = useState([]); //关联资源
53
54
  const [isTableLoading, setisTableLoading] = useState(false);
55
+ const [loading, setLoading] = useState(false)
54
56
 
55
57
  const [TableItemData, setTableItemData]: any = useState([
56
58
  {
@@ -173,6 +175,7 @@ export default function RoleInfo({ isShowTab, getAuthTree }: RoleInfoProps) {
173
175
  ];
174
176
  useEffect(() => {
175
177
  init();
178
+ getRoleFunc({ roleCode });
176
179
  }, []);
177
180
 
178
181
  const init = () => {
@@ -200,7 +203,8 @@ export default function RoleInfo({ isShowTab, getAuthTree }: RoleInfoProps) {
200
203
  }
201
204
  setTableItemData([...TableItemData, ...data]);
202
205
  };
203
- useEffect(() => {
206
+
207
+ const tabCheckFunc = () => {
204
208
  if (tabCheck == "tableEmpower") {
205
209
  policy?.execute({
206
210
  subjectCodes: [roleCode],
@@ -208,8 +212,11 @@ export default function RoleInfo({ isShowTab, getAuthTree }: RoleInfoProps) {
208
212
  } else if (tabCheck == "tableResource") {
209
213
  getAuthTreeFunc(); // 获取关联资源
210
214
  } else {
211
- initGetData();
215
+ execute({ roleCode: roleCode });
212
216
  }
217
+ };
218
+ useEffect(() => {
219
+ tabCheckFunc();
213
220
  }, [tabCheck]);
214
221
 
215
222
  //获取关联资源
@@ -240,19 +247,16 @@ export default function RoleInfo({ isShowTab, getAuthTree }: RoleInfoProps) {
240
247
  }
241
248
  };
242
249
 
243
- //初始化请求数据
244
- const initGetData = () => {
245
- if (roleCode) {
246
- getRoleFunc({ roleCode });
247
- execute({ roleCode: roleCode });
248
- }
249
- };
250
+
250
251
  const getRoleFunc = (data: any) => {
251
252
  setRoleInfo({});
253
+ setLoading(true);
252
254
  getRole({
253
255
  ...data,
254
256
  }).then((res: any) => {
257
+ setLoading(false);
255
258
  setRoleInfo(res || {});
259
+ tabCheckFunc();
256
260
  });
257
261
  };
258
262
  const roleUnboundAccountsFunc = (account: any) => {
@@ -350,7 +354,15 @@ export default function RoleInfo({ isShowTab, getAuthTree }: RoleInfoProps) {
350
354
 
351
355
  return (
352
356
  <PageContainer>
353
- <Divider orientation="left">{roleInfo?.roleName || "-"}</Divider>
357
+ <Spin spinning={loading}>
358
+ <div className="deviceTopTitle">
359
+ <div className="deviceTopDivider">
360
+ <Divider orientation="left">{roleInfo?.roleName || "-"}</Divider>
361
+ </div>
362
+ <Button className="deviceTopButton" onClick={(() => {
363
+ getRoleFunc({ roleCode });
364
+ })} >刷新</Button>
365
+ </div>
354
366
  <Descriptions className="basicInfoWrap">
355
367
  <Descriptions.Item label="角色名称">
356
368
  {roleInfo?.roleName || ""}
@@ -463,6 +475,7 @@ export default function RoleInfo({ isShowTab, getAuthTree }: RoleInfoProps) {
463
475
  {tabCheck == "tableData" && <></>}
464
476
  </div>
465
477
  </div>
478
+ </Spin>
466
479
  {/* */}
467
480
  <EditAccountDrawer
468
481
  open={editAccountOpen} // 状态