|
@@ -1,7 +1,7 @@
|
|
/*
|
|
/*
|
|
* @Author: your name
|
|
* @Author: your name
|
|
* @Date: 2022-01-13 15:22:48
|
|
* @Date: 2022-01-13 15:22:48
|
|
- * @LastEditTime: 2023-06-08 14:20:08
|
|
|
|
|
|
+ * @LastEditTime: 2023-08-18 19:06:08
|
|
* @LastEditors: code4eat awesomedema@gmail.com
|
|
* @LastEditors: code4eat awesomedema@gmail.com
|
|
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
* @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/hospManage/index.tsx
|
|
* @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/hospManage/index.tsx
|
|
@@ -9,7 +9,7 @@
|
|
|
|
|
|
import { FC, Key, useEffect, useMemo, useState } from 'react';
|
|
import { FC, Key, useEffect, useMemo, useState } from 'react';
|
|
import { hospManageModelState, ConnectProps, Loading, connect } from 'umi';
|
|
import { hospManageModelState, ConnectProps, Loading, connect } from 'umi';
|
|
-import { Button, Checkbox, Divider, Drawer, Dropdown, Input, Popconfirm, Switch, Table, Tree, TreeProps } from 'antd';
|
|
|
|
|
|
+import { Button, Checkbox, Divider, Drawer, Dropdown, Input, Popconfirm, Switch, Table, Tree, TreeProps, message } from 'antd';
|
|
import KCTable from '@/components/kcTable';
|
|
import KCTable from '@/components/kcTable';
|
|
import type { ProColumns } from '@ant-design/pro-table';
|
|
import type { ProColumns } from '@ant-design/pro-table';
|
|
import { getAllHosp, getHospOwnSys, getHospYoushuAccounts, getMenuRelaPerm, hospInit, saveHospMenuApiPerm, setReadOnly } from '@/service/hospList';
|
|
import { getAllHosp, getHospOwnSys, getHospYoushuAccounts, getMenuRelaPerm, hospInit, saveHospMenuApiPerm, setReadOnly } from '@/service/hospList';
|
|
@@ -22,12 +22,14 @@ import { KCInput } from '@/components/KCInput';
|
|
import { createFromIconfontCN, DownOutlined } from '@ant-design/icons';
|
|
import { createFromIconfontCN, DownOutlined } from '@ant-design/icons';
|
|
import { DrawerForm } from '@ant-design/pro-form';
|
|
import { DrawerForm } from '@ant-design/pro-form';
|
|
import { DataNode } from 'antd/es/tree';
|
|
import { DataNode } from 'antd/es/tree';
|
|
-import { getTreeDataRespType } from '../systemNavMana/service';
|
|
|
|
|
|
+import { getTableDataRequest, getTreeDataRespType } from '../systemNavMana/service';
|
|
|
|
|
|
import expandedIcon from '../../../../../public/images/treenode_open.png';
|
|
import expandedIcon from '../../../../../public/images/treenode_open.png';
|
|
import closeIcon from '../../../../../public/images/treenode_collapse.png';
|
|
import closeIcon from '../../../../../public/images/treenode_collapse.png';
|
|
import { getDeepestTreeData, uniqueFunc } from '@/utils';
|
|
import { getDeepestTreeData, uniqueFunc } from '@/utils';
|
|
import { CheckboxValueType } from 'antd/lib/checkbox/Group';
|
|
import { CheckboxValueType } from 'antd/lib/checkbox/Group';
|
|
|
|
+import NavSelecter, { NavSelecterData, NavSelecterItemType } from '@/components/NavSelecter';
|
|
|
|
+import { FastEntryTabType } from '@/pages/index/components/FastEntry';
|
|
|
|
|
|
export enum TableActType {
|
|
export enum TableActType {
|
|
NOACT,
|
|
NOACT,
|
|
@@ -50,6 +52,47 @@ interface PageProps extends ConnectProps {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+interface TreeNode {
|
|
|
|
+ [key:string]:any;
|
|
|
|
+ children?: TreeNode[];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function findParents(
|
|
|
|
+ nodes: TreeNode[],
|
|
|
|
+ targetId: string,
|
|
|
|
+ path: TreeNode[] = []
|
|
|
|
+): TreeNode[] | null {
|
|
|
|
+ for (const node of nodes) {
|
|
|
|
+ if (node.menuId === targetId) {
|
|
|
|
+ return path;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (node.children) {
|
|
|
|
+ const result = findParents(node.children, targetId, [...path, node]);
|
|
|
|
+ if (result) return result;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return null;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function extractAttributeValues(tree: TreeNode, attributeName: keyof TreeNode): any[] {
|
|
|
|
+ let values: any[] = [];
|
|
|
|
+
|
|
|
|
+ // 提取当前节点的属性值
|
|
|
|
+ values.push(tree[attributeName]);
|
|
|
|
+
|
|
|
|
+ // 如果当前节点有子节点,递归处理每个子节点
|
|
|
|
+ if (tree.children) {
|
|
|
|
+ for (const child of tree.children) {
|
|
|
|
+ values = values.concat(extractAttributeValues(child, attributeName));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return values;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
const DrawerActBtn = ({ record }: { record: any }) => {
|
|
const DrawerActBtn = ({ record }: { record: any }) => {
|
|
|
|
|
|
@@ -68,8 +111,14 @@ const DrawerActBtn = ({ record }: { record: any }) => {
|
|
|
|
|
|
const [oldSelectedMenuIds, set_oldSelectedMenuIds] = useState<any[]>([]);
|
|
const [oldSelectedMenuIds, set_oldSelectedMenuIds] = useState<any[]>([]);
|
|
|
|
|
|
|
|
+ const [checkedMenuParentsIds,set_checkedMenuParentsIds] = useState<Key[]>([]); //所有需要保存的菜单id
|
|
|
|
+
|
|
const [drawerVisible, set_drawerVisible] = useState(false);
|
|
const [drawerVisible, set_drawerVisible] = useState(false);
|
|
|
|
|
|
|
|
+ const [ifFrozze, set_ifFrozze] = useState(false); //冻结勾选菜单及功能操作
|
|
|
|
+
|
|
|
|
+ const [hospAllMenuTree,set_hospAllMenuTree] = useState<any[]>([]); //医院全量菜单
|
|
|
|
+
|
|
const columnsData: ProColumns<TableListItem>[] = [
|
|
const columnsData: ProColumns<TableListItem>[] = [
|
|
{
|
|
{
|
|
title: '名称',
|
|
title: '名称',
|
|
@@ -116,16 +165,15 @@ const DrawerActBtn = ({ record }: { record: any }) => {
|
|
const options = record.functionList.map((item: any, index: number) => ({ label: item.name, value: item.code }))
|
|
const options = record.functionList.map((item: any, index: number) => ({ label: item.name, value: item.code }))
|
|
|
|
|
|
const needItem = checkBoxCodes.filter(a => a.menuId == record.menuId);
|
|
const needItem = checkBoxCodes.filter(a => a.menuId == record.menuId);
|
|
-
|
|
|
|
- const codes = needItem && needItem.length > 0 ? needItem[0].function.map((a: any) => a.code) : [];
|
|
|
|
|
|
+
|
|
|
|
+ const codes = (needItem && needItem.length > 0 && needItem[0].function) ? needItem[0].function.map((a: any) => a.code) : [];
|
|
|
|
|
|
const onCheckGroupChange = (checkedValue: CheckboxValueType[]) => {
|
|
const onCheckGroupChange = (checkedValue: CheckboxValueType[]) => {
|
|
|
|
|
|
if (checkedValue.length > 0) {
|
|
if (checkedValue.length > 0) {
|
|
- const _temp = checkBoxCodes;
|
|
|
|
- const index = checkBoxCodes.findIndex((item) => item.menuId == record.menuId);
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
+ const _temp = [...checkBoxCodes];
|
|
|
|
+ const index = checkBoxCodes.findIndex((item) => item.menuId == record.menuId);
|
|
const needed = options.filter((item: any) => checkedValue.includes(item.value));
|
|
const needed = options.filter((item: any) => checkedValue.includes(item.value));
|
|
const transfered = needed.map((item: any) => ({ name: item.label, code: item.value }));
|
|
const transfered = needed.map((item: any) => ({ name: item.label, code: item.value }));
|
|
|
|
|
|
@@ -151,8 +199,8 @@ const DrawerActBtn = ({ record }: { record: any }) => {
|
|
|
|
|
|
_temp.splice(index, 1);
|
|
_temp.splice(index, 1);
|
|
|
|
|
|
- const menuIdsArr = _temp.map((item: any) => item.menuId);
|
|
|
|
- set_checkedTableMenuIds([...menuIdsArr])
|
|
|
|
|
|
+ // const menuIdsArr = _temp.map((item: any) => item.menuId);
|
|
|
|
+ // set_checkedTableMenuIds([...menuIdsArr])
|
|
set_checkBoxCodes([..._temp]);
|
|
set_checkBoxCodes([..._temp]);
|
|
|
|
|
|
}
|
|
}
|
|
@@ -164,6 +212,7 @@ const DrawerActBtn = ({ record }: { record: any }) => {
|
|
<Checkbox.Group
|
|
<Checkbox.Group
|
|
options={options}
|
|
options={options}
|
|
value={codes}
|
|
value={codes}
|
|
|
|
+ disabled={ifFrozze}
|
|
onChange={checkedValue => onCheckGroupChange(checkedValue)}
|
|
onChange={checkedValue => onCheckGroupChange(checkedValue)}
|
|
/>
|
|
/>
|
|
)
|
|
)
|
|
@@ -175,7 +224,7 @@ const DrawerActBtn = ({ record }: { record: any }) => {
|
|
];
|
|
];
|
|
|
|
|
|
const getTreeReqFunc = async (hospId: string) => {
|
|
const getTreeReqFunc = async (hospId: string) => {
|
|
- if(hospId){
|
|
|
|
|
|
+ if (hospId) {
|
|
const resp = await getHospOwnSys(hospId);
|
|
const resp = await getHospOwnSys(hospId);
|
|
set_treeData(resp);
|
|
set_treeData(resp);
|
|
}
|
|
}
|
|
@@ -242,18 +291,18 @@ const DrawerActBtn = ({ record }: { record: any }) => {
|
|
generateList(treeData as any);
|
|
generateList(treeData as any);
|
|
|
|
|
|
|
|
|
|
- const getTableData = async (params: any, sort: any, filter: any) => {
|
|
|
|
|
|
+ const setInitCheckData = async () => {
|
|
|
|
|
|
set_drawerTablereload(false);
|
|
set_drawerTablereload(false);
|
|
if (currentSelectedTreeNode) {
|
|
if (currentSelectedTreeNode) {
|
|
- const resp = await getMenuRelaPerm({ ...params, hospId: record.id });
|
|
|
|
|
|
+ const resp = await getMenuRelaPerm({hospId: record.id,systemId:currentSelectedTreeNode.code});
|
|
if (resp) {
|
|
if (resp) {
|
|
let temp: { menuId: any; function: any; }[] = [];
|
|
let temp: { menuId: any; function: any; }[] = [];
|
|
const setTreeRecursion = (data: any) => {
|
|
const setTreeRecursion = (data: any) => {
|
|
data.map((item: any, index: number) => {
|
|
data.map((item: any, index: number) => {
|
|
|
|
|
|
|
|
|
|
- if (item.type == 1 && item.functionCheckList) {
|
|
|
|
|
|
+ if (item.type == 1) {
|
|
//菜单
|
|
//菜单
|
|
temp.push({
|
|
temp.push({
|
|
menuId: item.menuId,
|
|
menuId: item.menuId,
|
|
@@ -268,6 +317,15 @@ const DrawerActBtn = ({ record }: { record: any }) => {
|
|
});
|
|
});
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ let initCheckedMenuIds:any[] = [];
|
|
|
|
+
|
|
|
|
+ resp.forEach((item:any) => {
|
|
|
|
+ const ids = extractAttributeValues(item,'menuId');
|
|
|
|
+ initCheckedMenuIds = initCheckedMenuIds.concat(ids);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ set_checkedMenuParentsIds(initCheckedMenuIds);
|
|
|
|
|
|
setTreeRecursion(resp);
|
|
setTreeRecursion(resp);
|
|
|
|
|
|
@@ -289,22 +347,49 @@ const DrawerActBtn = ({ record }: { record: any }) => {
|
|
return []
|
|
return []
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ const getTableData = async (params: any, sort: any, filter: any) => {
|
|
|
|
+
|
|
|
|
+ set_drawerTablereload(false);
|
|
|
|
+ if (currentSelectedTreeNode) {
|
|
|
|
+ const resp = await getTableDataRequest({...params,systemId:currentSelectedTreeNode.code});
|
|
|
|
+ if (resp) {
|
|
|
|
+
|
|
|
|
+ set_hospAllMenuTree(resp);
|
|
|
|
+ return {
|
|
|
|
+ data: resp,
|
|
|
|
+ success: true,
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return {
|
|
|
|
+ data: [],
|
|
|
|
+ success: true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return []
|
|
|
|
+ }
|
|
|
|
+
|
|
const saveResult = async () => {
|
|
const saveResult = async () => {
|
|
|
|
|
|
- let old = oldSelectedMenuIds;
|
|
|
|
-
|
|
|
|
|
|
+ let old = [...oldSelectedMenuIds];
|
|
|
|
+
|
|
const result = checkBoxCodes.map((item: any) => {
|
|
const result = checkBoxCodes.map((item: any) => {
|
|
-
|
|
|
|
- old.splice(old.findIndex(a=>a == item.menuId),1);
|
|
|
|
|
|
|
|
- return { ...item, hospId: record.id, systemId: currentSelectedTreeNode.code }
|
|
|
|
|
|
+ old.splice(old.findIndex(a => a == item.menuId), 1);
|
|
|
|
|
|
|
|
+ return { ...item, hospId: record.id, systemId: currentSelectedTreeNode.code }
|
|
|
|
+
|
|
});
|
|
});
|
|
|
|
|
|
const needCancelMenus = old.map(a => ({ hospId: record.id, systemId: currentSelectedTreeNode.code, function: [], menuId: a }));
|
|
const needCancelMenus = old.map(a => ({ hospId: record.id, systemId: currentSelectedTreeNode.code, function: [], menuId: a }));
|
|
|
|
|
|
- const data = [...result, ...needCancelMenus];
|
|
|
|
-
|
|
|
|
|
|
+ const data = {
|
|
|
|
+ hospId:record.id,
|
|
|
|
+ systemId: currentSelectedTreeNode.code,
|
|
|
|
+ menuIds:[...new Set(checkedMenuParentsIds)],
|
|
|
|
+ functionRequestList:[...result,...needCancelMenus]
|
|
|
|
+ };
|
|
|
|
+
|
|
const resp = await saveHospMenuApiPerm(result.length == 0 ? [{ hospId: record.id, systemId: currentSelectedTreeNode.code }] : data);
|
|
const resp = await saveHospMenuApiPerm(result.length == 0 ? [{ hospId: record.id, systemId: currentSelectedTreeNode.code }] : data);
|
|
|
|
|
|
if (resp) {
|
|
if (resp) {
|
|
@@ -328,30 +413,32 @@ const DrawerActBtn = ({ record }: { record: any }) => {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ const clearFunction = () => {
|
|
|
|
+ if (ifFrozze) return;
|
|
|
|
+ let emptyFunc = checkBoxCodes.map((a) => ({ ...a, function: [] }));
|
|
|
|
+ set_checkBoxCodes(emptyFunc);
|
|
|
|
+ }
|
|
|
|
|
|
- // const oneKeySetReadOnly = (bool: boolean) => {
|
|
|
|
-
|
|
|
|
- // if (bool) {
|
|
|
|
- // const _temp = checkBoxCodes.map((item: any) => {
|
|
|
|
- // const needed = item.function.filter((a: any) => a.code == 'search');
|
|
|
|
- // return { ...item, function: needed }
|
|
|
|
- // })
|
|
|
|
- // set_checkBoxCodes([..._temp]);
|
|
|
|
- // }
|
|
|
|
|
|
|
|
- // }
|
|
|
|
|
|
+ const oneKeySetAll = async (bool: boolean) => {
|
|
|
|
+ set_ifFrozze(bool);
|
|
|
|
+ const resp = await saveHospMenuApiPerm([{ hospId: record.id, systemId: currentSelectedTreeNode.code, checkAll: bool ? 1 : 0 }]);
|
|
|
|
+ // if (resp) {
|
|
|
|
+ // set_drawerTablereload(true);
|
|
|
|
+ // set_checkBoxCodes([]);
|
|
|
|
+ // set_checkedTableMenuIds([]);
|
|
|
|
+ // }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
- if (currentSelectedTreeNode) {
|
|
|
|
- set_drawerTableDataFilterParams({ ...drawerTableDataFilterParams, systemId: currentSelectedTreeNode.code })
|
|
|
|
|
|
+ if (currentSelectedTreeNode && !currentSelectedTreeNode.children) {
|
|
|
|
+ set_drawerTableDataFilterParams({ ...drawerTableDataFilterParams, systemId: currentSelectedTreeNode.code });
|
|
|
|
+ //切换系统清空数据
|
|
|
|
+ set_checkBoxCodes([]);
|
|
|
|
+ set_checkedTableMenuIds([]);
|
|
}
|
|
}
|
|
|
|
|
|
- //切换系统清空数据
|
|
|
|
- set_checkBoxCodes([]);
|
|
|
|
- set_checkedTableMenuIds([]);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
}, [currentSelectedTreeNode]);
|
|
}, [currentSelectedTreeNode]);
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
@@ -371,15 +458,16 @@ const DrawerActBtn = ({ record }: { record: any }) => {
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
- getTreeReqFunc(record.id);
|
|
|
|
-
|
|
|
|
- }, []);
|
|
|
|
|
|
+ if (drawerVisible) {
|
|
|
|
+ getTreeReqFunc(record.id);
|
|
|
|
+ }
|
|
|
|
+ }, [drawerVisible]);
|
|
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
<DrawerForm
|
|
<DrawerForm
|
|
trigger={
|
|
trigger={
|
|
- <a key="link3" onClick={(e) => { set_drawerVisible(true); }}>功能</a>
|
|
|
|
|
|
+ <a key="link3" onClick={(e) => { set_drawerVisible(true); }}>菜单</a>
|
|
}
|
|
}
|
|
width={908}
|
|
width={908}
|
|
// visible={drawerVisible}
|
|
// visible={drawerVisible}
|
|
@@ -395,6 +483,7 @@ const DrawerActBtn = ({ record }: { record: any }) => {
|
|
<div className='topbar'>
|
|
<div className='topbar'>
|
|
<div className='title'>{`院区功能权限设置(${record.hospName})`}</div>
|
|
<div className='title'>{`院区功能权限设置(${record.hospName})`}</div>
|
|
<div className='btnGroup'>
|
|
<div className='btnGroup'>
|
|
|
|
+ <span className={ifFrozze ? 'clearBtn disabled' : 'clearBtn'} onClick={() => clearFunction()}>清除功能权限</span>
|
|
<span className='cancel' onClick={() => onCancel()}>取消</span>
|
|
<span className='cancel' onClick={() => onCancel()}>取消</span>
|
|
<span className='save' onClick={() => saveResult()}>保存</span>
|
|
<span className='save' onClick={() => saveResult()}>保存</span>
|
|
</div>
|
|
</div>
|
|
@@ -491,16 +580,19 @@ const DrawerActBtn = ({ record }: { record: any }) => {
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div className={'btnGroup'}>
|
|
<div className={'btnGroup'}>
|
|
- {/* <a style={{color: '#17181A'}}><Switch style={{position:'relative',marginRight:4}} size='small' onChange={(bool)=>oneKeySetReadOnly(bool)} />只读</a> */}
|
|
|
|
|
|
+ <a style={{ color: '#17181A' }}><Switch style={{ position: 'relative', marginRight: 4 }} size='small' onChange={(bool) => oneKeySetAll(bool)} />全部</a>
|
|
{/* <UpDataActBtn key={'act'} record={undefined} type='ADD' /> */}
|
|
{/* <UpDataActBtn key={'act'} record={undefined} type='ADD' /> */}
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
{currentSelectedTreeNode && <KCTable
|
|
{currentSelectedTreeNode && <KCTable
|
|
|
|
+ tableAlertRender={false}
|
|
|
|
+ onLoad={()=>setInitCheckData()}
|
|
rowSelection={{
|
|
rowSelection={{
|
|
// 自定义选择项参考: https://ant.design/components/table-cn/#components-table-demo-row-selection-custom
|
|
// 自定义选择项参考: https://ant.design/components/table-cn/#components-table-demo-row-selection-custom
|
|
// 注释该行则默认不显示下拉选项
|
|
// 注释该行则默认不显示下拉选项
|
|
checkStrictly: false,
|
|
checkStrictly: false,
|
|
|
|
+
|
|
onChange(selectedRowKeys, selectedRows, info) {
|
|
onChange(selectedRowKeys, selectedRows, info) {
|
|
//console.log({selectedRowKeys, selectedRows, info});
|
|
//console.log({selectedRowKeys, selectedRows, info});
|
|
if (selectedRowKeys.length == 0) {
|
|
if (selectedRowKeys.length == 0) {
|
|
@@ -511,22 +603,42 @@ const DrawerActBtn = ({ record }: { record: any }) => {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
selectedRowKeys: checkedTableMenuIds,
|
|
selectedRowKeys: checkedTableMenuIds,
|
|
- selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
|
|
|
|
onSelect: (record, selected, selectedRows, nativeEvent) => {
|
|
onSelect: (record, selected, selectedRows, nativeEvent) => {
|
|
- //console.log({ record, selected, selectedRows, nativeEvent });
|
|
|
|
- let checkedData = checkBoxCodes;
|
|
|
|
|
|
+ // console.log({ record, selected, selectedRows, nativeEvent });
|
|
|
|
+
|
|
|
|
+ if (ifFrozze) return;
|
|
|
|
+
|
|
|
|
+ let checkedData = [...checkBoxCodes];
|
|
|
|
|
|
if (selected) {
|
|
if (selected) {
|
|
//选中
|
|
//选中
|
|
|
|
+
|
|
|
|
+ const parents = findParents(hospAllMenuTree,record.menuId);
|
|
|
|
+ const ids = (parents as TreeNode[]).map((a)=>a.menuId);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if(record.children){
|
|
|
|
+ const childIds = extractAttributeValues(record,'menuId');
|
|
|
|
+ set_checkedMenuParentsIds([...checkedMenuParentsIds,...ids,...childIds,record.menuId]);
|
|
|
|
+ }else{
|
|
|
|
+ set_checkedMenuParentsIds([...checkedMenuParentsIds,...ids,record.menuId]);
|
|
|
|
+ }
|
|
|
|
+
|
|
selectedRows.forEach(a => {
|
|
selectedRows.forEach(a => {
|
|
if (a.functionList) {
|
|
if (a.functionList) {
|
|
checkedData.push({
|
|
checkedData.push({
|
|
menuId: a.menuId,
|
|
menuId: a.menuId,
|
|
function: a.functionList
|
|
function: a.functionList
|
|
});
|
|
});
|
|
|
|
+ } else {
|
|
|
|
+ checkedData.push({
|
|
|
|
+ menuId: a.menuId,
|
|
|
|
+ function: []
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
});
|
|
});
|
|
|
|
+
|
|
//更新表格row选中状态
|
|
//更新表格row选中状态
|
|
if (record.type == 0) {
|
|
if (record.type == 0) {
|
|
//选中的是目录
|
|
//选中的是目录
|
|
@@ -541,18 +653,22 @@ const DrawerActBtn = ({ record }: { record: any }) => {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- set_checkBoxCodes([...uniqueFunc(checkedData,'menuId')]);
|
|
|
|
|
|
+ set_checkBoxCodes([...uniqueFunc(checkedData, 'menuId')]);
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
- let _tempCheckedCodes = checkBoxCodes;
|
|
|
|
|
|
+ const ids = extractAttributeValues(record,'menuId');
|
|
|
|
+
|
|
|
|
+ const filtedMenuIds = checkedMenuParentsIds.filter((a)=>!ids.includes(a));
|
|
|
|
+ set_checkedMenuParentsIds(filtedMenuIds);
|
|
|
|
+
|
|
|
|
+ let _tempCheckedCodes = [...checkBoxCodes];
|
|
|
|
|
|
const leftCheckedMenuIds = selectedRows.map(a => a.menuId);
|
|
const leftCheckedMenuIds = selectedRows.map(a => a.menuId);
|
|
|
|
|
|
const filtedCheckCodes = _tempCheckedCodes.filter(a => (leftCheckedMenuIds.includes(a.menuId)));
|
|
const filtedCheckCodes = _tempCheckedCodes.filter(a => (leftCheckedMenuIds.includes(a.menuId)));
|
|
|
|
|
|
set_checkedTableMenuIds([...leftCheckedMenuIds]);
|
|
set_checkedTableMenuIds([...leftCheckedMenuIds]);
|
|
-
|
|
|
|
set_checkBoxCodes([...uniqueFunc(filtedCheckCodes, 'menuId')]);
|
|
set_checkBoxCodes([...uniqueFunc(filtedCheckCodes, 'menuId')]);
|
|
|
|
|
|
}
|
|
}
|
|
@@ -576,8 +692,11 @@ const HospManage: FC<PageProps> = ({ hospManageModel: state, dispatch }) => {
|
|
|
|
|
|
const [tableDataFilterParams, set_tableDataFilterParams] = useState<any | undefined>();
|
|
const [tableDataFilterParams, set_tableDataFilterParams] = useState<any | undefined>();
|
|
const [tableDataSearchKeywords, set_tableDataSearchKeywords] = useState<string>('');
|
|
const [tableDataSearchKeywords, set_tableDataSearchKeywords] = useState<string>('');
|
|
|
|
+ const [tabIds, set_tabIds] = useState<Key[]>([]);
|
|
|
|
+ const [open, set_open] = useState(false);
|
|
|
|
+ const [navSelecterData, set_navSelecterData] = useState<NavSelecterData[]>([]);
|
|
|
|
+
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -645,10 +764,24 @@ const HospManage: FC<PageProps> = ({ hospManageModel: state, dispatch }) => {
|
|
key: 'option',
|
|
key: 'option',
|
|
valueType: 'option',
|
|
valueType: 'option',
|
|
render: (text, record) => [
|
|
render: (text, record) => [
|
|
- <a key="link" onClick={() => editHandle(record)}>
|
|
|
|
- 编辑
|
|
|
|
- </a>,
|
|
|
|
- <Divider key="1" type="vertical" style={{ margin: '0 1px' }} />,
|
|
|
|
|
|
+ // <a key="link" onClick={() => editHandle(record)}>
|
|
|
|
+ // 编辑
|
|
|
|
+ // </a>,
|
|
|
|
+ // <Divider key="1" type="vertical" style={{ margin: '0 1px' }} />,
|
|
|
|
+ // <Popconfirm
|
|
|
|
+ // title="是否确定删除?"
|
|
|
|
+ // onConfirm={() => delHandle(record)}
|
|
|
|
+ // // onCancel={cancel}
|
|
|
|
+ // okText="确定"
|
|
|
|
+ // cancelText="取消"
|
|
|
|
+ // key="link2"
|
|
|
|
+ // >
|
|
|
|
+ // <a>删除</a>
|
|
|
|
+ // </Popconfirm>,
|
|
|
|
+ <a onClick={() => { editHospSystemPermissions(record); set_open(true); }}>系统</a>,
|
|
|
|
+ <Divider key="2" type="vertical" style={{ margin: '0 1px' }} />,
|
|
|
|
+ <DrawerActBtn record={record} />,
|
|
|
|
+ <Divider key="3" type="vertical" style={{ margin: '0 1px' }} />,
|
|
<Popconfirm
|
|
<Popconfirm
|
|
title="是否确定删除?"
|
|
title="是否确定删除?"
|
|
onConfirm={() => delHandle(record)}
|
|
onConfirm={() => delHandle(record)}
|
|
@@ -659,17 +792,19 @@ const HospManage: FC<PageProps> = ({ hospManageModel: state, dispatch }) => {
|
|
>
|
|
>
|
|
<a>删除</a>
|
|
<a>删除</a>
|
|
</Popconfirm>,
|
|
</Popconfirm>,
|
|
- <Divider key="2" type="vertical" style={{ margin: '0 1px' }} />,
|
|
|
|
- <a key="link3" onClick={() => editMenuBind(record)}>
|
|
|
|
- 菜单
|
|
|
|
- </a>,
|
|
|
|
- <Divider key="3" type="vertical" style={{ margin: '0 1px' }} />,
|
|
|
|
|
|
+ <Divider key="10" type="vertical" style={{ margin: '0 1px' }} />,
|
|
<Dropdown key='4' menu={{
|
|
<Dropdown key='4' menu={{
|
|
items: [
|
|
items: [
|
|
{ key: '1', label: <a key="link4" onClick={() => youshuAccountBind(record)}>报告</a> },
|
|
{ key: '1', label: <a key="link4" onClick={() => youshuAccountBind(record)}>报告</a> },
|
|
- { key: '2', label: <DrawerActBtn record={record} /> },
|
|
|
|
- { key: '3', label: <a key="link5" onClick={() => initHospData(record)}>初始化</a> },
|
|
|
|
|
|
+ // { key: '2', label: <DrawerActBtn record={record} /> },
|
|
|
|
+ // { key: '3', label: <a key="link5" onClick={() => initHospData(record)}>初始化</a> },
|
|
{ key: '4', label: <a key="link6" onClick={() => setOnlyRead(record)}>初始化只读</a> },
|
|
{ key: '4', label: <a key="link6" onClick={() => setOnlyRead(record)}>初始化只读</a> },
|
|
|
|
+ {
|
|
|
|
+ key: '6', label: <a key="link5" onClick={() => initHospData(record)}>初始化</a>,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ key: '5', label: <a key="link7" onClick={() => editHandle(record)}>编辑</a>,
|
|
|
|
+ },
|
|
]
|
|
]
|
|
}}>
|
|
}}>
|
|
<a>
|
|
<a>
|
|
@@ -743,6 +878,24 @@ const HospManage: FC<PageProps> = ({ hospManageModel: state, dispatch }) => {
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+
|
|
|
|
+ //编辑系统权限
|
|
|
|
+ const editHospSystemPermissions = async (record: TableListItem) => {
|
|
|
|
+ const { selectedMenuIds, allMenuVO } = await getSpacifyHospMenu({ hospId: record.id });
|
|
|
|
+ set_navSelecterData(allMenuVO);
|
|
|
|
+ set_tabIds(selectedMenuIds);
|
|
|
|
+
|
|
|
|
+ dispatch &&
|
|
|
|
+ dispatch({
|
|
|
|
+ type: 'hospManageModel/edit',
|
|
|
|
+ payload: {
|
|
|
|
+ data: { ...record, bindMenuIds: selectedMenuIds },
|
|
|
|
+ act: TableActType.EDITMENU,
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
const editMenuBind = async (record: TableListItem) => {
|
|
const editMenuBind = async (record: TableListItem) => {
|
|
//编辑菜单绑定关系
|
|
//编辑菜单绑定关系
|
|
const { selectedMenuIds } = await getSpacifyHospMenu({ hospId: record.id });
|
|
const { selectedMenuIds } = await getSpacifyHospMenu({ hospId: record.id });
|
|
@@ -801,9 +954,24 @@ const HospManage: FC<PageProps> = ({ hospManageModel: state, dispatch }) => {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ const onCheckedHandle = async (data: NavSelecterItemType[]) => {
|
|
|
|
+
|
|
|
|
+ dispatch &&
|
|
|
|
+ dispatch({
|
|
|
|
+ type: 'hospManageModel/postEditData',
|
|
|
|
+ payload: { bindMenuIds: data.map(a => a.menuId) },
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
return (
|
|
return (
|
|
<div className="HospManage">
|
|
<div className="HospManage">
|
|
<ActModal {...state} dispatch={dispatch} />
|
|
<ActModal {...state} dispatch={dispatch} />
|
|
|
|
+ {
|
|
|
|
+ open && (
|
|
|
|
+ <NavSelecter title='系统权限设置' data={navSelecterData} onVisibleChange={(bool) => set_open(bool)} value={tabIds} onChecked={onCheckedHandle} />
|
|
|
|
+ )
|
|
|
|
+ }
|
|
<div className='toolBar'>
|
|
<div className='toolBar'>
|
|
<div className='filter'>
|
|
<div className='filter'>
|
|
<div className='filterItem'>
|
|
<div className='filterItem'>
|