|
@@ -1,7 +1,7 @@
|
|
|
/*
|
|
|
* @Author: your name
|
|
|
* @Date: 2021-09-06 09:07:56
|
|
|
- * @LastEditTime: 2021-11-24 15:28:32
|
|
|
+ * @LastEditTime: 2021-12-14 14:22:14
|
|
|
* @LastEditors: Please set LastEditors
|
|
|
* @Description: In User Settings Edit
|
|
|
* @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/accreditationDetail/index.tsx
|
|
@@ -18,16 +18,17 @@ import MccsPageContainer from '@/components/MccsPageContainer/index'
|
|
|
import MccsProCard from '@/components/MccsProCard/index';
|
|
|
import MccsFileTree from '@/components/MccsFileTree/index';
|
|
|
import { useModel } from 'umi';
|
|
|
-import ProForm from '@ant-design/pro-form';
|
|
|
+import ProForm, { ProFormText, ProFormTextArea } from '@ant-design/pro-form';
|
|
|
|
|
|
import FormList from './components/FormList/index';
|
|
|
+import MaterialTable from './components/materialTable/index';
|
|
|
+import MccsSelect from '@/components/MccsProFormSelect/index';
|
|
|
|
|
|
-import './index.less';
|
|
|
+import { getMaterialListGrades, getMaterialList, getMaterialDirList, addMaterialDirList, delMaterialDirList,editMaterialDirList } from './service';
|
|
|
|
|
|
+import './index.less';
|
|
|
|
|
|
|
|
|
-const text = `1.医院符合卫生行政部门规定设置“二级综合医院基本标准”全部要求,获得批准等级至少正式执业三年以上。\n
|
|
|
-2.人员编制至少达到:(1)医院病床与工作人员之比,300床位以下的按1:1.30~1.40;300-500床位的按1:1.40~1.50;500床位以上的按1:1.60~1.70。(2)每床至少配备0.88名卫生技术人员。每床至少配备0.4名护士,且实际从事临床工作的在编护理人员数不少于卫技人员总数的50%。`
|
|
|
|
|
|
|
|
|
type AccreditationDetailProps = {
|
|
@@ -58,12 +59,13 @@ type ruleList = {
|
|
|
const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = props => {
|
|
|
|
|
|
const { accreditationDetail } = useModel('allModels');
|
|
|
- const { getTreeData, treeData, delDetailRuleHandle, addDetailRuleHandle, editDetailRulehandle, detailRuleList, getDetailRuleListHandle, setDetailRuleList,...restAccreditationModel } = accreditationDetail;
|
|
|
+ const { getTreeData, treeData, delDetailRuleHandle, addDetailRuleHandle, editDetailRulehandle, detailRuleList, getDetailRuleListHandle, setDetailRuleList, ...restAccreditationModel } = accreditationDetail;
|
|
|
|
|
|
|
|
|
const [mode, setMode] = useState(1); //1,2
|
|
|
const [currentActived, setCurrentActived] = useState<API.ResultTreeDataItem | treeItem>();
|
|
|
|
|
|
+ const [isLeaf, setIsLeaf] = useState(false);
|
|
|
const [childRuleList, setChildRuleList] = useState<ruleList>([]);
|
|
|
|
|
|
const [modalVisible, setModalVisible] = useState(false);
|
|
@@ -72,20 +74,34 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
|
|
|
|
|
|
const [formDefaultData, setFormDefaultData] = useState<any>(undefined);
|
|
|
const [defaultOpened, setDefaultOpened] = useState<string>();
|
|
|
-
|
|
|
+
|
|
|
+ const [selectOptions, setSelectOptions] = useState<{ label: string, value: string }[]>([]); //资料目录表格下拉筛选
|
|
|
+
|
|
|
+ const [showCardThree, setShowCardThree] = useState(false); //是否展示资料目录栏
|
|
|
+ const [materialDirModalVisible, setMaterialDirModalVisible] = useState(false); //资料目录弹窗展示/掩藏
|
|
|
+ const [allMaterialDirList, setAllMaterialDirList] = useState<{ label: string, value: string }[]>([]); //所有可选的资料目录
|
|
|
+ const [editMaterialDir,setEditMaterialDir] = useState(false); //是否编辑资料目录数据
|
|
|
+ const [currentEditMaterialDir,setCurrentEditMaterialDir] = useState<API.MaterialDirListItem>(); //当前编辑的资料目录项数据
|
|
|
+ const [reloadMaterialDirData,setReloadMaterialDirData] = useState(false); //是否刷新资料目录数据
|
|
|
|
|
|
const onSelectHandle = (data: treeItem) => {
|
|
|
|
|
|
setCurrentActived(data); //设置当前树数据
|
|
|
- const { isLeaf, children, id } = data;
|
|
|
+ const { isLeaf, children, id, code, version = 'ZJ201901' } = data;
|
|
|
|
|
|
if (isLeaf) {
|
|
|
//叶子结点
|
|
|
+ setIsLeaf(true);
|
|
|
getDetailRuleListHandle(id);
|
|
|
+ getMaterialListGradesFunc(code, version);
|
|
|
setMode(2);
|
|
|
+ setShowCardThree(true);
|
|
|
+
|
|
|
} else {
|
|
|
//文件夹结点
|
|
|
setMode(1);
|
|
|
+ setIsLeaf(false);
|
|
|
+ setShowCardThree(false);
|
|
|
let tempArr = children ? children.map((item) => ({
|
|
|
title: item.title,
|
|
|
code: item.code,
|
|
@@ -124,18 +140,134 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
|
|
|
getTreeData(val);
|
|
|
}
|
|
|
|
|
|
+ //获取该四码所有档次
|
|
|
+ const getMaterialListGradesFunc = async (code: string, version: string) => {
|
|
|
+ const gadeList = await getMaterialListGrades({ numStr: code, version });
|
|
|
+ if (gadeList) {
|
|
|
+ const grades = gadeList.map(t => ({ label: t.grade, value: t.grade }));
|
|
|
+ setSelectOptions(grades);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取资料目录表格数据
|
|
|
+ const getMaterialListFunc = async (params: MaterialTable.GeDataParams) => {
|
|
|
+ const { selectorFilter, keyword,pageSize=10,current } = params;
|
|
|
+ if (currentActived) {
|
|
|
+ const { code, version } = currentActived;
|
|
|
+ const resp = await getMaterialList({
|
|
|
+ grade: selectorFilter,
|
|
|
+ keyword,
|
|
|
+ numStr: code,
|
|
|
+ version,
|
|
|
+ pageSize,
|
|
|
+ current
|
|
|
+ });
|
|
|
+ if (resp) {
|
|
|
+ return {
|
|
|
+ total:resp.totalCount,
|
|
|
+ pageSize:resp.pageSize,
|
|
|
+ list:resp.list,
|
|
|
+ current:resp.current
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const getMaterialDirListFunc = async () => {
|
|
|
+ //获取所有资料目录集合用于弹窗表单
|
|
|
+ if (currentActived) {
|
|
|
+ console.log({currentActived});
|
|
|
+ const { code, version } = currentActived;
|
|
|
+ const resp = await getMaterialDirList({ numStr: code, version });
|
|
|
+ if (resp) {
|
|
|
+ setAllMaterialDirList(resp.map(t=>({label:t,value:t})));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const addMaterialDirHandle = () => {
|
|
|
+ //新增资料目录数据
|
|
|
+ setEditMaterialDir(false);
|
|
|
+ setMaterialDirModalVisible(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ const onMaterialDirModalVisibleChange = (bool: boolean) => {
|
|
|
+ bool&&getMaterialDirListFunc();
|
|
|
+ setMaterialDirModalVisible(bool);
|
|
|
+ }
|
|
|
+
|
|
|
+ type mateialDirModalValues = {
|
|
|
+ grade: string[],
|
|
|
+ note: string,
|
|
|
+ directory: string,
|
|
|
+ profileName: string,
|
|
|
+
|
|
|
+ }
|
|
|
+ //资料目录弹窗表单提交
|
|
|
+ const mateialDirModalFinishHandle = async (values: mateialDirModalValues) => {
|
|
|
+ console.log('commit', values);
|
|
|
+ const { grade, ...restVals } = values;
|
|
|
+ if(editMaterialDir&¤tEditMaterialDir){
|
|
|
+ //编辑
|
|
|
+ const resp = await editMaterialDirList({
|
|
|
+ grade: grade.join(','),
|
|
|
+ id:currentEditMaterialDir.id,
|
|
|
+ directory:restVals.directory,
|
|
|
+ note:restVals.note,
|
|
|
+ profileName:restVals.profileName
|
|
|
+ });
|
|
|
+ if (resp) {
|
|
|
+ setReloadMaterialDirData(true);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ //新增
|
|
|
+ if (currentActived) {
|
|
|
+ const { code, version, id } = currentActived;
|
|
|
+ const resp = await addMaterialDirList({
|
|
|
+ numStr: code,
|
|
|
+ version,
|
|
|
+ ruleId: id,
|
|
|
+ grade: grade.join(','),
|
|
|
+ ...restVals
|
|
|
+ });
|
|
|
+ if (resp) {
|
|
|
+ setReloadMaterialDirData(true);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //资料目录表格删除/编辑回调
|
|
|
+ const tableItemActionHandle = async (type: 'DEL' | "EDIT", data: API.MaterialDirListItem[]) => {
|
|
|
+ if (type == 'DEL') {
|
|
|
+ if (await delMaterialDirList(data.map(t=>t.id))) {
|
|
|
+ return true
|
|
|
+ } else {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (type == 'EDIT') {
|
|
|
+ setCurrentEditMaterialDir(data[0]);
|
|
|
+ setEditMaterialDir(true);
|
|
|
+ setMaterialDirModalVisible(true);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
const FormNode = ({ visible }: { visible: boolean }) => {
|
|
|
|
|
|
|
|
|
const [showMore, setShowMore] = useState(false);
|
|
|
const [list, setList] = useState<API.RuleDetailListItem[]>([]); //
|
|
|
- const [selecterList,setSelecterList] = useState<FormList.SelecterItem[]>([]);
|
|
|
+ const [selecterList, setSelecterList] = useState<FormList.SelecterItem[]>([]);
|
|
|
|
|
|
|
|
|
const formNodeSubmitHandle = (values: any) => {
|
|
|
- // console.log('表单', values);
|
|
|
- // console.log({formListRef});
|
|
|
|
|
|
const { name, numStr } = values;
|
|
|
let parentId = 0;
|
|
@@ -165,7 +297,7 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
|
|
|
const paramData = {
|
|
|
parentId,
|
|
|
name: name,
|
|
|
- numStr:numStr,
|
|
|
+ numStr: numStr,
|
|
|
detail: details
|
|
|
}
|
|
|
addDetailRuleHandle(paramData);
|
|
@@ -207,28 +339,30 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
|
|
|
setModalVisible(bool);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
+ console.log('222');
|
|
|
if (currentActived) {
|
|
|
|
|
|
const { isLeaf, levelNum } = currentActived;
|
|
|
-
|
|
|
+
|
|
|
+ isLeaf&&setReloadMaterialDirData(true); //点击叶子结点,刷新资料目录数据
|
|
|
isLeaf && setShowMore(true);//当新增或编辑第4层时也就是叶子节点,增加表单数据
|
|
|
(levelNum == 3 && actionType == 'add') && setShowMore(true); //当新增或编辑第4层时也就是叶子节点,增加表单数据
|
|
|
|
|
|
- if(isLeaf||(levelNum == 3 && actionType == 'add')){
|
|
|
- //展示子集时才请求
|
|
|
- restAccreditationModel.getScoreSelectableList().then(data=>{
|
|
|
- const tempArrFilted = data.filter((t:any)=>t.configStatus != 0);
|
|
|
- const tempArr = tempArrFilted.map((t:any)=>({label:t.levelNumber,value:t.levelNumber}));
|
|
|
+ if (isLeaf || (levelNum == 3 && actionType == 'add')) {
|
|
|
+ //展示子集时才请求
|
|
|
+ restAccreditationModel.getScoreSelectableList().then(data => {
|
|
|
+ const tempArrFilted = data.filter((t: any) => t.configStatus != 0);
|
|
|
+ const tempArr = tempArrFilted.map((t: any) => ({ label: t.levelNumber, value: t.levelNumber }));
|
|
|
setSelecterList(tempArr);
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}, [currentActived]);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
useEffect(() => {
|
|
|
setList(detailRuleList);
|
|
@@ -282,6 +416,10 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
|
|
|
}
|
|
|
}, [treeData]);
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+
|
|
|
+ }, [currentActived]);
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
getTreeData();
|
|
|
}, []);
|
|
@@ -290,10 +428,47 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
|
|
|
return (
|
|
|
<MccsPageContainer>
|
|
|
|
|
|
- {modalVisible&&<FormNode visible={modalVisible} />}
|
|
|
+ {modalVisible && <FormNode visible={modalVisible} />}
|
|
|
+
|
|
|
+ {
|
|
|
+ /**
|
|
|
+ * 新增编辑弹窗
|
|
|
+ */
|
|
|
+ }
|
|
|
+ <MccsModal
|
|
|
+ title={editMaterialDir?`编辑资料目录`:'新增资料目录'} visible={materialDirModalVisible}
|
|
|
+ onVisibleChange={onMaterialDirModalVisibleChange}
|
|
|
+ width={600} layout={'horizontal'} labelCol={{ span: 4 }}
|
|
|
+ initialValues={editMaterialDir?{...currentEditMaterialDir,grade:currentEditMaterialDir?.grade.split(',')}:{}}
|
|
|
+ onFinish={mateialDirModalFinishHandle}
|
|
|
+ >
|
|
|
+ <MccsSelect
|
|
|
+ selectList={selectOptions ? [...selectOptions] : []}
|
|
|
+ width="sm"
|
|
|
+ fieldProps={{
|
|
|
+ mode: 'multiple',
|
|
|
+ }}
|
|
|
+ name='grade'
|
|
|
+ label='档次'
|
|
|
+ />
|
|
|
+ <MccsSelect
|
|
|
+ showSearch
|
|
|
+ withInput={true}
|
|
|
+ selectList={allMaterialDirList}
|
|
|
+ width="sm"
|
|
|
+ name='directory'
|
|
|
+ label='目录'
|
|
|
+ />
|
|
|
+ <ProFormText width="sm" name="profileName" label="资料名称" placeholder="请输入名称" />
|
|
|
+ <ProFormTextArea
|
|
|
+ name="note"
|
|
|
+ label="备注"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ </MccsModal>
|
|
|
|
|
|
<MccsProCard gutter={16} ghost direction='row'>
|
|
|
- <MccsProCard colSpan={14} style={{ height: '78vh' }} bodyStyle={{ padding: '16px' }}>
|
|
|
+ <MccsProCard colSpan={8} style={{ height: '78vh' }} bodyStyle={{ padding: '16px' }}>
|
|
|
{
|
|
|
defaultOpened && (
|
|
|
<MccsFileTree
|
|
@@ -307,7 +482,7 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
|
|
|
)
|
|
|
}
|
|
|
</MccsProCard>
|
|
|
- <MccsProCard colSpan={10} className='rightCard' style={{ height: '78vh', overflow: 'hidden' }} >
|
|
|
+ <MccsProCard colSpan={showCardThree ? 9 : 16} className='rightCard' style={{ height: '78vh', overflow: 'hidden' }} >
|
|
|
<div className="detailRuleTitle">{currentActived?.title}</div>
|
|
|
<Divider />
|
|
|
<div className="ruleDetailContainer">
|
|
@@ -357,10 +532,19 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
|
|
|
)
|
|
|
}
|
|
|
</div>
|
|
|
- {/* <div className='bottomActionBtnGroup'>
|
|
|
- <Button className='prev'>上一项</Button>
|
|
|
- <Button className='next' type='primary'>下一项</Button>
|
|
|
- </div> */}
|
|
|
+ </MccsProCard>
|
|
|
+ <MccsProCard colSpan={showCardThree ? 7 : 0} className='rightCard' style={{ height: '78vh', overflow: 'hidden' }} >
|
|
|
+ {
|
|
|
+ showCardThree && (
|
|
|
+ <MaterialTable
|
|
|
+ selectOptions={selectOptions}
|
|
|
+ request={getMaterialListFunc}
|
|
|
+ addHandle={addMaterialDirHandle}
|
|
|
+ tableItemActionHandle={tableItemActionHandle}
|
|
|
+ reload={reloadMaterialDirData}
|
|
|
+ />
|
|
|
+ )
|
|
|
+ }
|
|
|
</MccsProCard>
|
|
|
</MccsProCard>
|
|
|
</MccsPageContainer>
|