|
@@ -2,7 +2,7 @@
|
|
|
/*
|
|
|
* @Author: your name
|
|
|
* @Date: 2021-09-06 09:07:56
|
|
|
- * @LastEditTime: 2022-06-06 10:37:56
|
|
|
+ * @LastEditTime: 2022-06-17 18:27:40
|
|
|
* @LastEditors: code4eat awesomedema@gmail.com
|
|
|
* @Description: In User Settings Edit
|
|
|
* @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/accreditationDetail/index.tsx
|
|
@@ -22,12 +22,13 @@ import { useModel } from 'umi';
|
|
|
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 { getMaterialListGrades, getMaterialList, getMaterialDirList, addMaterialDirList, delMaterialDirList,editMaterialDirList } from './service';
|
|
|
+import { getMaterialListGrades, getMaterialDirList, addMaterialDirList, editMaterialDirList } from './service';
|
|
|
|
|
|
import './index.less';
|
|
|
+import { getRuleSetType } from '@/pages/PlatformMana/generalSetting/serve';
|
|
|
|
|
|
|
|
|
|
|
@@ -59,6 +60,8 @@ type ruleList = {
|
|
|
|
|
|
const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = props => {
|
|
|
|
|
|
+ const { initialState } = useModel('@@initialState');
|
|
|
+
|
|
|
const { accreditationDetail } = useModel('allModels');
|
|
|
const { getTreeData, treeData, delDetailRuleHandle, addDetailRuleHandle, editDetailRulehandle, detailRuleList, getDetailRuleListHandle, setDetailRuleList, ...restAccreditationModel } = accreditationDetail;
|
|
|
|
|
@@ -81,9 +84,12 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
|
|
|
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 [editMaterialDir, setEditMaterialDir] = useState(false); // 是否编辑资料目录数据
|
|
|
+ const [currentEditMaterialDir, setCurrentEditMaterialDir] = useState<API.MaterialDirListItem>(); // 当前编辑的资料目录项数据
|
|
|
+ const [reloadMaterialDirData, setReloadMaterialDirData] = useState(false); // 是否刷新资料目录数据
|
|
|
+
|
|
|
+ const [formFiledShowTags, set_formFiledShowTags] = useState<{ [key: string]: boolean }>({}); //标单项展示控制
|
|
|
+
|
|
|
|
|
|
const onSelectHandle = (data: treeItem) => {
|
|
|
|
|
@@ -153,49 +159,20 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 获取叶子节点下资料目录表格数据
|
|
|
- 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) {
|
|
|
const { code, version } = currentActived;
|
|
|
const resp = await getMaterialDirList({ numStr: code, version });
|
|
|
if (resp) {
|
|
|
- setAllMaterialDirList(resp.map(t=>({label:t,value:t})));
|
|
|
+ setAllMaterialDirList(resp.map(t => ({ label: t, value: t })));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- const addMaterialDirHandle = () => {
|
|
|
- // 新增资料目录数据
|
|
|
- setEditMaterialDir(false);
|
|
|
- setMaterialDirModalVisible(true);
|
|
|
- }
|
|
|
|
|
|
const onMaterialDirModalVisibleChange = (bool: boolean) => {
|
|
|
- bool&&getMaterialDirListFunc();
|
|
|
+ bool && getMaterialDirListFunc();
|
|
|
setMaterialDirModalVisible(bool);
|
|
|
}
|
|
|
|
|
@@ -210,20 +187,20 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
|
|
|
const mateialDirModalFinishHandle = async (values: mateialDirModalValues) => {
|
|
|
console.log('commit', values);
|
|
|
const { grade, ...restVals } = values;
|
|
|
- if(editMaterialDir&¤tEditMaterialDir){
|
|
|
+ if (editMaterialDir && currentEditMaterialDir) {
|
|
|
// 编辑
|
|
|
const resp = await editMaterialDirList({
|
|
|
grade: grade.join(','),
|
|
|
- id:currentEditMaterialDir.id,
|
|
|
- directory:restVals.directory,
|
|
|
- note:restVals.note,
|
|
|
- profileName:restVals.profileName
|
|
|
+ id: currentEditMaterialDir.id,
|
|
|
+ directory: restVals.directory,
|
|
|
+ note: restVals.note,
|
|
|
+ profileName: restVals.profileName
|
|
|
});
|
|
|
if (resp) {
|
|
|
setReloadMaterialDirData(true);
|
|
|
return true;
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
// 新增
|
|
|
if (currentActived) {
|
|
|
const { code, version, id } = currentActived;
|
|
@@ -240,28 +217,11 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- // 资料目录表格删除/编辑回调
|
|
|
- const tableItemActionHandle = async (type: 'DEL' | "EDIT", data: API.MaterialDirListItem[]) => {
|
|
|
- if (type == 'DEL') {
|
|
|
- if (await delMaterialDirList(data.map(t=>t.id))) {
|
|
|
- return true
|
|
|
- }
|
|
|
- return false
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
- if (type == 'EDIT') {
|
|
|
- setCurrentEditMaterialDir(data[0]);
|
|
|
- setEditMaterialDir(true);
|
|
|
- setMaterialDirModalVisible(true);
|
|
|
- }
|
|
|
- return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
const FormNode = ({ visible }: { visible: boolean }) => {
|
|
|
|
|
|
|
|
@@ -272,7 +232,7 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
|
|
|
|
|
|
const formNodeSubmitHandle = (values: any) => {
|
|
|
|
|
|
- const { name, numStr } = values;
|
|
|
+ const { name, numStr,ruleType,ruleDetail='' } = values;
|
|
|
let parentId = 0;
|
|
|
if (currentActived) {
|
|
|
const { id } = currentActived;
|
|
@@ -301,6 +261,8 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
|
|
|
parentId,
|
|
|
name,
|
|
|
numStr,
|
|
|
+ ruleType,
|
|
|
+ ruleDetail,
|
|
|
detail: details
|
|
|
}
|
|
|
addDetailRuleHandle(paramData);
|
|
@@ -328,6 +290,8 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
|
|
|
const paramData = {
|
|
|
id: Number(id),
|
|
|
name,
|
|
|
+ ruleType,
|
|
|
+ ruleDetail,
|
|
|
detail: isLeaf ? details : [],
|
|
|
}
|
|
|
editDetailRulehandle(paramData);
|
|
@@ -342,14 +306,25 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
|
|
|
setModalVisible(bool);
|
|
|
}
|
|
|
|
|
|
+ const getRuleTypeList =async () => {
|
|
|
+ const resp = await getRuleSetType();
|
|
|
+ if(resp){
|
|
|
+ return resp.map(item=>({
|
|
|
+ label:item.generalName,
|
|
|
+ value:item.generalName
|
|
|
+ }))
|
|
|
+ }
|
|
|
+ return []
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
useEffect(() => {
|
|
|
-
|
|
|
+
|
|
|
if (currentActived) {
|
|
|
|
|
|
const { isLeaf, levelNum } = currentActived;
|
|
|
-
|
|
|
- isLeaf&&setReloadMaterialDirData(true); // 点击叶子结点,刷新资料目录数据
|
|
|
+
|
|
|
+ isLeaf && setReloadMaterialDirData(true); // 点击叶子结点,刷新资料目录数据
|
|
|
isLeaf && setShowMore(true);// 当新增或编辑第4层时也就是叶子节点,增加表单数据
|
|
|
(levelNum == 3 && actionType == 'add') && setShowMore(true); // 当新增或编辑第4层时也就是叶子节点,增加表单数据
|
|
|
|
|
@@ -394,8 +369,34 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
|
|
|
type='textArea'
|
|
|
placeholder="请输入名称"
|
|
|
/>
|
|
|
+
|
|
|
+ {
|
|
|
+ //湖北兼容
|
|
|
+ }
|
|
|
+
|
|
|
+ {formFiledShowTags['ruleType'] && <MccsSelect
|
|
|
+ label="条文类型" name="ruleType"
|
|
|
+ width="sm"
|
|
|
+ request={getRuleTypeList}
|
|
|
+ />}
|
|
|
+
|
|
|
+ {
|
|
|
+ formFiledShowTags['ruleDetail'] && (
|
|
|
+ <MccsProFormText
|
|
|
+ name="ruleDetail"
|
|
|
+ label="条文说明"
|
|
|
+ type='textArea'
|
|
|
+ fieldProps={{
|
|
|
+ width: '100%',
|
|
|
+ rows: 8
|
|
|
+ }}
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
{
|
|
|
- showMore && (
|
|
|
+ showMore && formFiledShowTags['dataSource'] && (
|
|
|
<ProForm.Item
|
|
|
label="等级明细"
|
|
|
name="dataSource"
|
|
@@ -425,6 +426,28 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
|
|
|
|
|
|
useEffect(() => {
|
|
|
getTreeData();
|
|
|
+
|
|
|
+ if (initialState?.currentUser?.ruleVersion == 'HB202001') {
|
|
|
+ //湖北版
|
|
|
+ set_formFiledShowTags({
|
|
|
+ 'numStr': true,
|
|
|
+ 'name': true,
|
|
|
+ 'ruleType': true,
|
|
|
+ 'ruleDetail': true,
|
|
|
+ 'dataSource': false
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ } else {
|
|
|
+ set_formFiledShowTags({
|
|
|
+ 'numStr': true,
|
|
|
+ 'name': true,
|
|
|
+ 'ruleType': false,
|
|
|
+ 'ruleDetail': false,
|
|
|
+ 'dataSource': true
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
}, []);
|
|
|
|
|
|
|
|
@@ -439,10 +462,10 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
|
|
|
*/
|
|
|
}
|
|
|
<MccsModal
|
|
|
- title={editMaterialDir?`编辑资料目录`:'新增资料目录'} visible={materialDirModalVisible}
|
|
|
+ title={editMaterialDir ? `编辑资料目录` : '新增资料目录'} visible={materialDirModalVisible}
|
|
|
onVisibleChange={onMaterialDirModalVisibleChange}
|
|
|
width={600} layout={'horizontal'} labelCol={{ span: 4 }}
|
|
|
- initialValues={editMaterialDir?{...currentEditMaterialDir,grade:currentEditMaterialDir?.grade.split(',')}:{}}
|
|
|
+ initialValues={editMaterialDir ? { ...currentEditMaterialDir, grade: currentEditMaterialDir?.grade.split(',') } : {}}
|
|
|
onFinish={mateialDirModalFinishHandle}
|
|
|
>
|
|
|
<MccsSelect
|