cfel-base-components 2.3.4-base2 → 2.3.4-base3

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.4-base2",
3
+ "version": "2.3.4-base3",
4
4
  "description": "cfel-base-components",
5
5
  "main": "/src/index.tsx",
6
6
  "types": "src/index.d.ts",
@@ -99,7 +99,7 @@ export default function Role({
99
99
  pathname: `/role-info`,
100
100
  search: `?roleCode=${rowdata.roleCode}`,
101
101
  });
102
- }}>赋予账号</a>
102
+ }}>配置</a>
103
103
  {
104
104
  rowdata.source !== "system" &&
105
105
  <a onClick={() => {
@@ -55,7 +55,8 @@ export default function RoleInfo({ isShowTab, getAuthTree , empowerCom}: RoleInf
55
55
  const [isTableLoading, setisTableLoading] = useState(false);
56
56
  const [loading, setLoading] = useState(false);
57
57
  const [rowKeys, setRowKeys]: any = useState([]); //关联多选数据
58
-
58
+ const [selectedRowKeys, setselectedRowKeys]: any = useState([]);
59
+ const [defaultExpandedRowKeys, setdefaultExpandedRowKeys]: any = useState([]);
59
60
  const [TableItemData, setTableItemData]: any = useState([
60
61
  {
61
62
  key: "main",
@@ -241,7 +242,7 @@ export default function RoleInfo({ isShowTab, getAuthTree , empowerCom}: RoleInf
241
242
  icon: <InteractionOutlined />,
242
243
  });
243
244
  }
244
- if (isShowTab?.tableEmpower) {
245
+ if (isShowTab?.tableEmpower && roleCode !== "admin") {
245
246
  data.push({
246
247
  label: "关联授权",
247
248
  key: "tableEmpower",
@@ -280,24 +281,34 @@ export default function RoleInfo({ isShowTab, getAuthTree , empowerCom}: RoleInf
280
281
  getAuthTree({
281
282
  roleCode: roleCode,
282
283
  }).then((res: any) => {
283
- setisTableLoading(false);
284
- let data: any = resourceAction(res);
285
- console.log(data, "data2");
286
- setResourceTableData(data);
284
+ let listId :Array<[]>= []
285
+ let defaultRowKeys :Array<[]>= []
286
+ let {data,list,drkey}: any = resourceAction(res,listId,defaultRowKeys);
287
+ setselectedRowKeys(list)
288
+ setdefaultExpandedRowKeys(drkey)
289
+ setResourceTableData(data);
290
+ setisTableLoading(false);
287
291
  });
288
292
  };
289
293
 
290
- const resourceAction: any = (data: any) => {
294
+ const resourceAction: any = (data: any,list:any,drkey:any) => {
291
295
  if (Object.prototype.toString.call(data) === "[object Array]") {
292
296
  data.map((item: any) => {
293
- return resourceAction(item);
297
+ return resourceAction(item,list,drkey);
294
298
  });
295
- return data;
299
+ return {
300
+ data,
301
+ list,
302
+ drkey
303
+ }
296
304
  } else if (Object.prototype.toString.call(data) === "[object Object]") {
297
305
  if (data.children && data.children.length !== 0) {
298
- return resourceAction(data.children);
306
+ drkey.push(data.id)
307
+ return resourceAction(data.children,list,drkey);
299
308
  } else {
300
309
  delete data.children;
310
+ if(data.checked)list.push(data.id)
311
+ drkey.push(data.id)
301
312
  return data;
302
313
  }
303
314
  }
@@ -513,6 +524,12 @@ export default function RoleInfo({ isShowTab, getAuthTree , empowerCom}: RoleInf
513
524
  pagination={false}
514
525
  columns={TableResource}
515
526
  dataSource={ResourceTableData || []}
527
+ rowSelection={{
528
+ selectedRowKeys:selectedRowKeys,
529
+ }}
530
+ expandable={{
531
+ expandedRowKeys:defaultExpandedRowKeys, //defaultExpandAllRows 无效
532
+ }}
516
533
  />
517
534
  </>
518
535
  )}