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
|
@@ -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
|
-
|
|
284
|
-
let
|
|
285
|
-
|
|
286
|
-
|
|
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
|
|
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
|
-
|
|
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
|
)}
|