|
@@ -18,11 +18,13 @@ function OrgManager() {
|
|
// setTableHt(window.innerHeight - 260);
|
|
// setTableHt(window.innerHeight - 260);
|
|
// });
|
|
// });
|
|
//刷新列表
|
|
//刷新列表
|
|
|
|
+ setOrgType(localStorage.getItem('type'))
|
|
getTableData();
|
|
getTableData();
|
|
//解绑事件
|
|
//解绑事件
|
|
// return function clear() {
|
|
// return function clear() {
|
|
// window.removeEventListener("resize");
|
|
// window.removeEventListener("resize");
|
|
// }
|
|
// }
|
|
|
|
+
|
|
}, []);
|
|
}, []);
|
|
|
|
|
|
const [dataSource, setDataSource] = useState([]); //列表数据
|
|
const [dataSource, setDataSource] = useState([]); //列表数据
|
|
@@ -37,14 +39,14 @@ function OrgManager() {
|
|
const [orgName, setOrgName] = useState(''); //上级组织名称,新增修改用
|
|
const [orgName, setOrgName] = useState(''); //上级组织名称,新增修改用
|
|
const [orgDetail, setOrgDetail] = useState(null);
|
|
const [orgDetail, setOrgDetail] = useState(null);
|
|
const [typeId, setTypeId] = useState('');
|
|
const [typeId, setTypeId] = useState('');
|
|
-
|
|
|
|
|
|
+ const [orgType, setOrgType] = useState(localStorage.getItem('type'));
|
|
|
|
+ // const [hisTypeList, setHisTypeList] = useState([]);
|
|
const [type, setType] = useState('');
|
|
const [type, setType] = useState('');
|
|
//从state中取出状态、类型列表
|
|
//从state中取出状态、类型列表
|
|
const staticInfo = useSelector(state => {
|
|
const staticInfo = useSelector(state => {
|
|
return state.staticInfo;
|
|
return state.staticInfo;
|
|
});
|
|
});
|
|
const { hisTypeList, statusList } = staticInfo;
|
|
const { hisTypeList, statusList } = staticInfo;
|
|
-
|
|
|
|
const tipText = {
|
|
const tipText = {
|
|
1: '确定要删除该组织?',
|
|
1: '确定要删除该组织?',
|
|
2: '当前组织内可能包含子组织或其相关用户,删除后所包含信息将一并被删除',
|
|
2: '当前组织内可能包含子组织或其相关用户,删除后所包含信息将一并被删除',
|
|
@@ -58,7 +60,17 @@ function OrgManager() {
|
|
function getTableData(param = {}) {
|
|
function getTableData(param = {}) {
|
|
post(api.getHospitalListInfo, param).then((res) => {
|
|
post(api.getHospitalListInfo, param).then((res) => {
|
|
if (res.data.code === 200) {
|
|
if (res.data.code === 200) {
|
|
- const data = res.data.data;
|
|
|
|
|
|
+ let data = res.data.data
|
|
|
|
+ let obj = {};
|
|
|
|
+ if (orgType == 4) {
|
|
|
|
+ data.map((it, i) => {
|
|
|
|
+ delete it.children
|
|
|
|
+ it.depts.forEach(its => {
|
|
|
|
+ its.hospitalId = it.hospitalId
|
|
|
|
+ });
|
|
|
|
+ it.children = it.depts
|
|
|
|
+ });
|
|
|
|
+ }
|
|
setOrgId(data[0] ? data[0].hospitalId : '');
|
|
setOrgId(data[0] ? data[0].hospitalId : '');
|
|
setOrgName(data[0] ? data[0].hospitalName : '')
|
|
setOrgName(data[0] ? data[0].hospitalName : '')
|
|
setDataSource(data);
|
|
setDataSource(data);
|
|
@@ -98,7 +110,7 @@ function OrgManager() {
|
|
}
|
|
}
|
|
//删除
|
|
//删除
|
|
function onDelete() {
|
|
function onDelete() {
|
|
- const param = { HospitalId: operId, type:typeId };
|
|
|
|
|
|
+ const param = { HospitalId: operId, type: typeId };
|
|
xPost(api.deleteHospital, param).then((res) => {
|
|
xPost(api.deleteHospital, param).then((res) => {
|
|
if (res.data.code === 200) {
|
|
if (res.data.code === 200) {
|
|
getTableData();
|
|
getTableData();
|
|
@@ -141,11 +153,12 @@ function OrgManager() {
|
|
setOrgDetail({
|
|
setOrgDetail({
|
|
parentId: orgId,
|
|
parentId: orgId,
|
|
parentName: orgName,
|
|
parentName: orgName,
|
|
- status: 1
|
|
|
|
|
|
+ status: 1,
|
|
|
|
+ type: orgType==4?'科室':''
|
|
})
|
|
})
|
|
}
|
|
}
|
|
function getOrgDetail(id, type) {
|
|
function getOrgDetail(id, type) {
|
|
- xPost(api.getHospitalById, { HospitalId: id, type }).then((res) => {
|
|
|
|
|
|
+ xPost(api.getHospitalById, { HospitalId: id, type:type }).then((res) => {
|
|
const { data, code } = res.data;
|
|
const { data, code } = res.data;
|
|
if (code === 200) {
|
|
if (code === 200) {
|
|
structDetail(data);
|
|
structDetail(data);
|
|
@@ -157,7 +170,7 @@ function OrgManager() {
|
|
}
|
|
}
|
|
function structDetail(data) {
|
|
function structDetail(data) {
|
|
const content = JSON.parse(JSON.stringify(data).replace(/getHospitalUserDTO/g, "addHospitalUserVO"));
|
|
const content = JSON.parse(JSON.stringify(data).replace(/getHospitalUserDTO/g, "addHospitalUserVO"));
|
|
- const menuData = content.getRoleDTO.loginUserMenuResourceTree;
|
|
|
|
|
|
+ const menuData = content.getRoleDTO?content.getRoleDTO.loginUserMenuResourceTree:[];
|
|
content.confirmPsd = content.addHospitalUserVO.password
|
|
content.confirmPsd = content.addHospitalUserVO.password
|
|
let softwares = [], sids = [];
|
|
let softwares = [], sids = [];
|
|
for (let i = 0; i < menuData.length; i++) {
|
|
for (let i = 0; i < menuData.length; i++) {
|
|
@@ -184,11 +197,14 @@ function OrgManager() {
|
|
return it;
|
|
return it;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+ if (orgType == 4){
|
|
|
|
+ param.type = 4
|
|
|
|
+ }
|
|
if (type == 2) {
|
|
if (type == 2) {
|
|
url = api.updateHospital
|
|
url = api.updateHospital
|
|
param.id = operId
|
|
param.id = operId
|
|
- // delete param.addHospitalUserVO
|
|
|
|
- // delete param.confirmPsd
|
|
|
|
|
|
+ delete param.addHospitalUserVO
|
|
|
|
+ delete param.confirmPsd
|
|
}
|
|
}
|
|
formData.softwares = arr;
|
|
formData.softwares = arr;
|
|
post(url, param).then((res) => {
|
|
post(url, param).then((res) => {
|
|
@@ -197,7 +213,7 @@ function OrgManager() {
|
|
setAddVisible(false);
|
|
setAddVisible(false);
|
|
setOrgDetail(null)
|
|
setOrgDetail(null)
|
|
message.success("添加成功");
|
|
message.success("添加成功");
|
|
-
|
|
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
message.warning(res.data.msg || '操作失败');
|
|
message.warning(res.data.msg || '操作失败');
|
|
}
|
|
}
|
|
@@ -211,56 +227,106 @@ function OrgManager() {
|
|
}
|
|
}
|
|
//表格渲染
|
|
//表格渲染
|
|
function RenderTable() {
|
|
function RenderTable() {
|
|
- const columns = [
|
|
|
|
- { title: '组织机构层级', dataIndex: 'hospitalName', key: 'hospitalName' },
|
|
|
|
- {
|
|
|
|
- title: '类型', width: 150, key: 'type', render: (row) => {
|
|
|
|
- if (row.children) {
|
|
|
|
- return '-'
|
|
|
|
- } else {
|
|
|
|
- return row.typeName;
|
|
|
|
|
|
+ let columns
|
|
|
|
+ if (orgType == 4) {
|
|
|
|
+ columns = [
|
|
|
|
+ { title: '组织机构层级', dataIndex: 'hospitalName', key: 'hospitalName' },
|
|
|
|
+ {
|
|
|
|
+ title: '病区', width: 150, key: 'type', render: (row) => {
|
|
|
|
+ if (row.children) {
|
|
|
|
+ return '-'
|
|
|
|
+ } else {
|
|
|
|
+ return row.deptName;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '状态', width: 120, key: 'status', render: (row) => {
|
|
|
|
- if (row.children) {
|
|
|
|
- return '-'
|
|
|
|
- } else {
|
|
|
|
- return (<span className={(row.status === '1') ? 'Enable' : 'Disable'}>{row.statusName}</span>);
|
|
|
|
|
|
+ },
|
|
|
|
+ { title: '类型', width: 150, key: 'type', dataIndex: 'typeName'},
|
|
|
|
+ {
|
|
|
|
+ title: '状态', width: 120, key: 'status', render: (row) => {
|
|
|
|
+ if (row.children) {
|
|
|
|
+ return '-'
|
|
|
|
+ } else {
|
|
|
|
+ return (<span className={(row.status === '1') ? 'Enable' : 'Disable'}>{row.statusName}</span>);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
- },
|
|
|
|
- { title: '创建时间', width: 240, dataIndex: 'gmtCreate', key: 'gmtCreate' },
|
|
|
|
- {
|
|
|
|
- title: '操作', width: 240, key: 'operation', render: (row) => {
|
|
|
|
- //console.log(21,row)
|
|
|
|
- if (row.rootFlag) {
|
|
|
|
- return '-'
|
|
|
|
|
|
+ },
|
|
|
|
+ { title: '创建时间', width: 240, dataIndex: 'gmtCreate', key: 'gmtCreate' },
|
|
|
|
+ {
|
|
|
|
+ title: '操作', width: 240, key: 'operation', render: (row) => {
|
|
|
|
+ //console.log(21,row)
|
|
|
|
+ if (row.rootFlag) {
|
|
|
|
+ return '-'
|
|
|
|
+ }
|
|
|
|
+ const menu = (
|
|
|
|
+ <Menu>
|
|
|
|
+ <Menu.Item key="0" onClick={() => showModal(5, row.hospitalId)}>重置密码</Menu.Item>
|
|
|
|
+ <Menu.Item key="1" onClick={() => showModal((row.hasUserFlag || row.hasHospitalFlag ? 2 : 1), row.hospitalId, row.type)}>删除</Menu.Item>
|
|
|
|
+ </Menu>
|
|
|
|
+ );
|
|
|
|
+ return (<Space size="middle">
|
|
|
|
+ <a onClick={() => editSubOrg(row.hospitalId, row.type)}>修改</a>
|
|
|
|
+ {row.status === '1' ? (<a onClick={() => showModal(row.hasUserFlag || row.hasHospitalFlag ? 4 : 3, row.hospitalId, row.type)}>禁用</a>) : (<a onClick={() => enable(1, row.hospitalId, row.type)}>启用</a>)}
|
|
|
|
+ <Dropdown overlay={menu} trigger={['click']}>
|
|
|
|
+ <a className="ant-dropdown-link">
|
|
|
|
+ 更多 <DownOutlined />
|
|
|
|
+ </a>
|
|
|
|
+ </Dropdown>
|
|
|
|
+ </Space>)
|
|
}
|
|
}
|
|
- const menu = (
|
|
|
|
- <Menu>
|
|
|
|
- <Menu.Item key="0" onClick={() => showModal(5, row.hospitalId)}>重置密码</Menu.Item>
|
|
|
|
- <Menu.Item key="1" onClick={() => showModal((row.hasUserFlag || row.hasHospitalFlag ? 2 : 1), row.hospitalId, row.type)}>删除</Menu.Item>
|
|
|
|
- </Menu>
|
|
|
|
- );
|
|
|
|
- return (<Space size="middle">
|
|
|
|
- <a onClick={() => editSubOrg(row.hospitalId, row.type)}>修改</a>
|
|
|
|
- {row.status === '1' ? (<a onClick={() => showModal(row.hasUserFlag || row.hasHospitalFlag ? 4 : 3, row.hospitalId, row.type)}>禁用</a>) : (<a onClick={() => enable(1, row.hospitalId, row.type)}>启用</a>)}
|
|
|
|
- <Dropdown overlay={menu} trigger={['click']}>
|
|
|
|
- <a className="ant-dropdown-link">
|
|
|
|
- 更多 <DownOutlined />
|
|
|
|
- </a>
|
|
|
|
- </Dropdown>
|
|
|
|
- </Space>)
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- ];
|
|
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+ } else {
|
|
|
|
+ columns = [
|
|
|
|
+ { title: '组织机构层级', dataIndex: 'hospitalName', key: 'hospitalName' },
|
|
|
|
+ {
|
|
|
|
+ title: '类型', width: 150, key: 'type', render: (row) => {
|
|
|
|
+ if (row.children) {
|
|
|
|
+ return '-'
|
|
|
|
+ } else {
|
|
|
|
+ return row.typeName;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '状态', width: 120, key: 'status', render: (row) => {
|
|
|
|
+ if (row.children) {
|
|
|
|
+ return '-'
|
|
|
|
+ } else {
|
|
|
|
+ return (<span className={(row.status === '1') ? 'Enable' : 'Disable'}>{row.statusName}</span>);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ { title: '创建时间', width: 240, dataIndex: 'gmtCreate', key: 'gmtCreate' },
|
|
|
|
+ {
|
|
|
|
+ title: '操作', width: 240, key: 'operation', render: (row) => {
|
|
|
|
+ //console.log(21,row)
|
|
|
|
+ if (row.rootFlag) {
|
|
|
|
+ return '-'
|
|
|
|
+ }
|
|
|
|
+ const menu = (
|
|
|
|
+ <Menu>
|
|
|
|
+ <Menu.Item key="0" onClick={() => showModal(5, row.hospitalId)}>重置密码</Menu.Item>
|
|
|
|
+ <Menu.Item key="1" onClick={() => showModal((row.hasUserFlag || row.hasHospitalFlag ? 2 : 1), row.hospitalId, row.type)}>删除</Menu.Item>
|
|
|
|
+ </Menu>
|
|
|
|
+ );
|
|
|
|
+ return (<Space size="middle">
|
|
|
|
+ <a onClick={() => editSubOrg(row.hospitalId, row.type)}>修改</a>
|
|
|
|
+ {row.status === '1' ? (<a onClick={() => showModal(row.hasUserFlag || row.hasHospitalFlag ? 4 : 3, row.hospitalId, row.type)}>禁用</a>) : (<a onClick={() => enable(1, row.hospitalId, row.type)}>启用</a>)}
|
|
|
|
+ <Dropdown overlay={menu} trigger={['click']}>
|
|
|
|
+ <a className="ant-dropdown-link">
|
|
|
|
+ 更多 <DownOutlined />
|
|
|
|
+ </a>
|
|
|
|
+ </Dropdown>
|
|
|
|
+ </Space>)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
return (
|
|
return (
|
|
<Table
|
|
<Table
|
|
pagination={false}
|
|
pagination={false}
|
|
className="components-table-demo-nested"
|
|
className="components-table-demo-nested"
|
|
- rowKey={record => record.hospitalId}
|
|
|
|
|
|
+ rowKey={record => record.hospitalId + record.deptId}
|
|
columns={columns}
|
|
columns={columns}
|
|
dataSource={dataSource}
|
|
dataSource={dataSource}
|
|
/>
|
|
/>
|
|
@@ -278,7 +344,7 @@ function OrgManager() {
|
|
};
|
|
};
|
|
if (addVisible && orgDetail) {
|
|
if (addVisible && orgDetail) {
|
|
return (
|
|
return (
|
|
- <OrgContext.Provider value={{ type,hisTypeList, save: addSubOrg, detail: orgDetail }}>
|
|
|
|
|
|
+ <OrgContext.Provider value={{ type, save: addSubOrg, detail: orgDetail }}>
|
|
<AddSubOrg back={goBack} />
|
|
<AddSubOrg back={goBack} />
|
|
</OrgContext.Provider>
|
|
</OrgContext.Provider>
|
|
)
|
|
)
|
|
@@ -294,7 +360,7 @@ function OrgManager() {
|
|
</Form.Item>
|
|
</Form.Item>
|
|
</Col>
|
|
</Col>
|
|
<Col span={5} key={1}>
|
|
<Col span={5} key={1}>
|
|
- <Form.Item name="type" label="类型">
|
|
|
|
|
|
+ <Form.Item name="type" label={orgType == 4 ? '所属病区' : '类型'}>
|
|
<Select
|
|
<Select
|
|
allowClear
|
|
allowClear
|
|
>
|
|
>
|