Browse Source

fix 台账上传相关表单问题

code4eat 3 years ago
parent
commit
2ca7ffbf83

+ 2 - 2
config/proxy.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-03 14:28:27
- * @LastEditTime: 2022-01-01 13:38:08
+ * @LastEditTime: 2022-01-05 15:03:31
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/config/proxy.ts
@@ -20,7 +20,7 @@
 export default { 
   dev: {
     '/api': {
-      target: 'http://112.124.59.133:8083/',
+      target: 'http://118.31.245.65:8083/',
       changeOrigin: true,
       pathRewrite: { '^/api': '' },
     },

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "MedicalWisdomCheckSys",
-  "version": "0.0.2",
+  "version": "0.1.6",
   "private": true,
   "author": {
     "name": "xieyunhui"

+ 7 - 1
src/app.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-03 14:28:27
- * @LastEditTime: 2022-01-04 17:47:22
+ * @LastEditTime: 2022-01-05 09:22:09
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/app.tsx
@@ -174,10 +174,16 @@ const responseInterceptors = async (response: Response, options: responseInterce
         const _response = await response.clone().json();
         const { status: dataStatus,errorCode,errorMessage,data} = _response;
         if(dataStatus == 200){
+         
              //接口请求成功
              if(requestMethod=='POST'&&url != "/api/pfm/login"&&!isCloseNotify){
                if(responseSpecifyFeedback&&responseSpecifyFeedback.isShow){
                  //当指定了请求成功反馈时
+                 console.log({responseSpecifyFeedback});
+                 console.log(responseSpecifyFeedback.successMessage);
+                 notification.success({
+                  message:responseSpecifyFeedback.successMessage
+                 });
                    
                }else{
                  //否则用默认提示

+ 3 - 12
src/components/MccsEditableTable/index.tsx

@@ -15,16 +15,6 @@ import { Key } from 'antd/lib/table/interface';
 
 //仅仅对pro-table简单的包装,详细使用参考antd pro
 
-const objectSimpleFilter = (obj: object, keyToDel: string) => {
-    return JSON.parse(JSON.stringify(obj, function (key, value) {
-        if (key == keyToDel) {
-            return undefined;
-        } else {
-            return value;
-        }
-    }))
-}
-
 const MccsEditableTable: React.FC<MccsEditableTableType.MccsEditableTableProps> = (props) => {
 
     const { columns = [], request, addHandle, pagination, editHandle, delHandle, reload, edit = true, ...rest } = props;
@@ -161,10 +151,11 @@ const MccsEditableTable: React.FC<MccsEditableTableType.MccsEditableTableProps>
                     },
                     onSave: async (rowKey, data, row) => {
                         const { id } = data;
-                        console.log({dataSource});
+                        // console.log({dataSource});
                         if (typeof id == 'string') {
                             //新增
-                            addHandle && addHandle(objectSimpleFilter(data, 'id'));
+                            // addHandle && addHandle(objectSimpleFilter(data, 'id'));
+                            addHandle && addHandle(data);
                         } else if(typeof id == 'number') {
     
                             editHandle && editHandle(data);

+ 13 - 2
src/pages/DataManagement/publicData/index.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-23 08:49:14
- * @LastEditTime: 2021-11-16 10:47:33
+ * @LastEditTime: 2022-01-05 14:54:32
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/pages/DataManagement/publicData/index.tsx
@@ -332,6 +332,17 @@ const PublicData: React.FC<PublicDataType> = (props) => {
     }, [publicData.reloadTable])
 
 
+    useEffect(() => {
+        if (publicData.treeData.length > 0) {
+            //默认展开书结构第一个结点
+            //树结构组件会默认执行一遍onSelectHandle,将选中结点信息传出来
+            console.log(publicData.treeData);
+            // const { id } = publicData.treeData[0].childre[0];
+            // setDefaultOpened(`${id}`);
+        }
+    }, [publicData.treeData]);
+
+
     useEffect(() => {
         //默认获取数据
         publicData.getTreeData();
@@ -437,7 +448,7 @@ const PublicData: React.FC<PublicDataType> = (props) => {
                 <MccsProCard colSpan={6} style={{ height: '78vh' }} bodyStyle={{ padding: '16px' }}>
                     <MccsFileTree
                         treeData={publicData.treeData}
-                        // defaultSelected={defaultOpened}
+                        defaultSelected={defaultOpened}
                         onSelectHandle={onSelectHandle}
                         actionHandle={actionHandle}
                         searchHandle={searchHandle}

+ 22 - 18
src/pages/DataManagement/publicData/model.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-23 09:02:09
- * @LastEditTime: 2021-11-12 18:22:17
+ * @LastEditTime: 2022-01-05 15:08:21
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/pages/DataManagement/publicData/model.ts
@@ -41,24 +41,28 @@ const publicData = () => {
     //   console.log({params});
     const { current,pageSize, keyword, date = [] } = params;
     if (currentActivedTree) {
+      // console.log({currentActivedTree});
       const { id, cateType } = currentActivedTree;
-      const resp = await getTreeTableList({
-        id: Number(id),
-        cateType: `${cateType}`,
-        current,
-        keyword,
-        pageSize,
-        startDate: date[0],
-        endDate: date[1],
-      });
-      const { list = [],totalCount } = resp;
-      //每次刷新完数据将是否刷新置为false
-      setReloadTable(false);
-      return {
-        data: list,
-        success: true,
-        total:totalCount
-      };
+      if(id){
+        const resp = await getTreeTableList({
+          id: Number(id),
+          cateType: `${cateType}`,
+          current,
+          keyword,
+          pageSize,
+          startDate: date[0],
+          endDate: date[1],
+        });
+        const { list = [],totalCount } = resp;
+        //每次刷新完数据将是否刷新置为false
+        setReloadTable(false);
+        return {
+          data: list,
+          success: true,
+          total:totalCount
+        };
+      }
+      
     }
     return {
       data: [],

+ 2 - 2
src/pages/GradeHospitalAccreditation/accreditationDetail/index.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-06 09:07:56
- * @LastEditTime: 2022-01-04 08:58:30
+ * @LastEditTime: 2022-01-05 14:29:11
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/accreditationDetail/index.tsx
@@ -343,7 +343,7 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
 
 
     useEffect(() => {
-      console.log('222');
+  
       if (currentActived) {
 
         const { isLeaf, levelNum } = currentActived;

+ 8 - 0
src/pages/GradeHospitalAccreditation/articleManagement/index.less

@@ -366,3 +366,11 @@ textarea.ant-input {
 }
 
 }
+
+.formItemTitle {
+  font-size: 16px;
+  font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+  font-weight: 400;
+  color: #7A8599;
+  margin-bottom: 16px;
+}

+ 57 - 19
src/pages/GradeHospitalAccreditation/articleManagement/index.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-14 10:22:09
- * @LastEditTime: 2022-01-04 16:50:00
+ * @LastEditTime: 2022-01-05 14:29:28
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/articleManagement/index.tsx
@@ -219,6 +219,7 @@ const MccsLightTableColumns = [
 ]
 
 
+
 //条文管理
 const ArticleManagement: React.FC<ArticleManagementProps> = (props) => {
     const { columnsFromProps = [], headerConcig, isModeTwo } = props;
@@ -321,15 +322,7 @@ const ArticleManagement: React.FC<ArticleManagementProps> = (props) => {
             dataIndex: 'accountStatus',
             width: '10%',
             valueType: 'switch',
-            // renderFormItem: (_: any, { isEditable }: { isEditable: boolean }) => {
-            //     return isEditable?(
-            //         <Form.Item name='accountStatus' valuePropName='checked'>
-            //             <Switch size='small'   />
-            //         </Form.Item>
-            //     ):<Input />
-            // },
             render: (_: any, row: any) => {
-                // return <Switch size='small' defaultChecked={_=='0'?false:true}/>
                 return (
                     <Switch size='small' disabled checked={row.accountStatus} />
                 )
@@ -452,18 +445,54 @@ const ArticleManagement: React.FC<ArticleManagementProps> = (props) => {
 
     const taizhangDataDerectoryEditHandle = (data: any, actType: ActType) => {
         //台账资料目录编辑回调
-        // console.log({data,actType});
-
+        console.log({data,actType});
         const version = restModelData.leafData?.reviewArticle.version;
         let prevData = restModelData.taizhangDataDirectoryCommitList;
         const numStr = restModelData.leafData?.reviewArticle.numStr;
 
+        const objectSimpleFilter = (obj: object, keyToDel: string) => {
+            return JSON.parse(JSON.stringify(obj, function (key, value) {
+                if (key == keyToDel) {
+                    return undefined;
+                } else {
+                    return value;
+                }
+            }))
+        }
+
+
         if (actType == ActType.DEL && (typeof data.id == 'string')) {
             //如果是删除操作且删除的不是数据库已有数据时,剔除之前暂时保留数据
             prevData = prevData.filter(item => item.directory != data.directory);
             restModelData.setTaizhangDataDirectoryCommitList([...prevData]);
             return;
         }
+        
+        const replaceData = (item:any,index:number)=>{
+            prevData[index] = {
+                ...item,dataStatus: actType, version: version ? version : '',
+                grade: data.grade.join(','), numStr: numStr, accountStatus: data.accountStatus?'1':'0'
+            };
+            restModelData.setTaizhangDataDirectoryCommitList([...prevData]);
+          
+        }
+
+        const findeIndex = prevData.findIndex(item=>item.id == data.id);
+    
+        if(findeIndex != -1){
+            //之前已有操作记录的,替换为最新状态
+            replaceData(data,findeIndex);
+            return;
+        }
+        
+        // if(findeIndex == -1){
+        //     //不存在id的情况下,有可能编辑的不是服务已有的数据,比较directory
+        //     const findIndexBydirectory = prevData.findIndex(item=>item.directory == data.directory);
+        //     if(findIndexBydirectory != -1){
+        //         replaceData(data,findIndexBydirectory);
+        //         return;
+        //     }
+        // }
 
         restModelData.setTaizhangDataDirectoryCommitList(
             [...prevData, {
@@ -478,14 +507,15 @@ const ArticleManagement: React.FC<ArticleManagementProps> = (props) => {
         restModelData.commitTaizhangImplementationHandle();
     }
 
-    const followWindowResize = ()=>{
-        //    console.log('resize',window);
+    const followWindowResize = (num?:number)=>{
+           const _num = num?num:0;
+
            if(leafContentRef.current){
             const leafContentH = leafContentRef.current.clientHeight + 50;  //加上padding
             const headerH = 48 + 16;
             const scoreH = isModeTwo?(60+32):0;
             const h =   window.innerHeight - (leafContentH + headerH + scoreH);
-            setScrollAreaH(h);
+            setScrollAreaH(h-_num);
           }
     }
 
@@ -553,7 +583,7 @@ const ArticleManagement: React.FC<ArticleManagementProps> = (props) => {
                 var myEvent = new Event('resize');
                 window.dispatchEvent(myEvent); 
                 document.body.style.overflowY = 'hidden';  //叶子节点下锁住页面滚动
-            },100);
+            },500);
         }
         
         if(!isLeaf){
@@ -562,6 +592,15 @@ const ArticleManagement: React.FC<ArticleManagementProps> = (props) => {
     },[isLeaf]);
 
 
+    useEffect(()=>{
+          if(restModelData.editMode){
+            followWindowResize(40);
+          }else{
+            followWindowResize(0);
+          }
+    },[restModelData.editMode]);
+
+
     useEffect(() => {
         //页面加载完
         //获取左侧输结构
@@ -570,11 +609,10 @@ const ArticleManagement: React.FC<ArticleManagementProps> = (props) => {
         restModelData.getCurrentHospScore();
         
         // followWindowResize();
-    
-        window.addEventListener("resize",followWindowResize);
+        window.addEventListener("resize",()=>followWindowResize());
 
         return ()=>{
-            window.removeEventListener("resize",followWindowResize);
+            window.removeEventListener("resize",()=>followWindowResize());
         }
         
     }, [])
@@ -870,7 +908,7 @@ const ArticleManagement: React.FC<ArticleManagementProps> = (props) => {
                                             restModelData.editMode && (
                                                 <div className='wrap' style={{ width: '60%', display: 'flex', flexDirection: 'row', justifyContent: 'flex-end' }}>
                                                     {
-                                                        restModelData.targetScores.map((item, index) => (
+                                                        (restModelData.targetScores).map((item, index) => (
                                                             <div className={restModelData.selectedSelfEvolution?.label == item.label ? 'tab on' : 'tab'} key={index} onClick={() => restModelData.onSelfEvolutionTabChange(item)}>{item.label}</div>
                                                         ))
                                                     }

+ 15 - 10
src/pages/GradeHospitalAccreditation/articleManagement/model.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-14 10:46:45
- * @LastEditTime: 2022-01-04 11:21:25
+ * @LastEditTime: 2022-01-05 14:02:15
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/articleManagement/model.ts
@@ -403,7 +403,7 @@ const articleManagement = () => {
     }));
     const resultData = implementationDataFilter(implementData); //得到改造过的数据
     /**
-     * 为什么不直接赋值渲染?
+     * 
      * 应业务要求,自评等级切换时保留之前填写数据
      * 所以额外建立一个键值对象进行缓存
      */
@@ -502,7 +502,7 @@ const articleManagement = () => {
     const resp = await getScoreLevelData();
     const listFilted = resp.filter((t: any) => t.configStatus != 0);
     const list = listFilted.map((t: any) => ({ label: t.levelNumber, value: t.levelNumber }));
-    setTargetScores(list);
+    setTargetScores(list.reverse());
   };
 
   const getSelectableRuleChilds = async (id: number) => {
@@ -529,14 +529,19 @@ const articleManagement = () => {
         implementationDtoList: list,
       });
 
-      if (taizhangDataDirectoryCommitList.length > 0) {
-        //需要操作的列表数大于0
-        const respDataDirectoryTable = await commitTaizhangDataDirectoryTableList(
-          taizhangDataDirectoryCommitList,
-        );
-      }
+      const respDataDirectoryTable = await commitTaizhangDataDirectoryTableList(
+        taizhangDataDirectoryCommitList,
+      );
+      
       setEditMode(false);
-      getTableData();
+      // console.log({respDataDirectoryTable,respImplementation})
+      if(respDataDirectoryTable&&respImplementation){
+        //每次服务保存数据成功后,清空台账上传的缓存数据
+        setImplementationData({}); //清空执行情况说明
+        setTaizhangDataDirectoryCommitList([]); //清空台账上传资料目录
+        
+        getTableData(); //两个保存都成功时刷新数据
+      }
     }
   };
 

+ 11 - 3
src/pages/GradeHospitalAccreditation/articleManagement/server.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-14 10:22:20
- * @LastEditTime: 2022-01-04 17:23:50
+ * @LastEditTime: 2022-01-05 09:23:19
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/articleManagement/server.ts
@@ -199,7 +199,11 @@ export const commitTaizhangImplementation = async (params:{
 }) => {
    return request('/api/pfm/recordUpload/addAccountData', {
      method: 'POST',
-     data:params
+     data:params,
+     responseSpecifyFeedback:{
+        isShow:true,
+        successMessage:'执行情况说明保存成功'
+     }
    });
 };
 
@@ -208,7 +212,11 @@ export const commitTaizhangImplementation = async (params:{
 export const commitTaizhangDataDirectoryTableList = async (params:API.TaizhangDataDirectoryCommitListItem[]) => {
    return request('/api/pfm/pfmdatadirectory/addPfmDataDirectory', {
      method: 'POST',
-     data:params
+     data:params,
+     responseSpecifyFeedback:{
+      isShow:true,
+      successMessage:'资料目录保存成功'
+   }
    });
 };
 

+ 33 - 4
src/pages/GradeHospitalAccreditation/ledgerUpload/componets/deitailModule/detail.tsx

@@ -1,14 +1,14 @@
 /*
  * @Author: your name
  * @Date: 2021-12-30 18:57:21
- * @LastEditTime: 2022-01-04 08:49:19
+ * @LastEditTime: 2022-01-05 10:21:17
  * @LastEditors: Please set LastEditors
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/ledgerUpload/detail.tsx
  */
 
 
-import React, { useEffect, useState } from 'react';
+import React, { useEffect, useState,useRef} from 'react';
 import { useModel } from 'umi';
 import { Select, Input, Switch } from 'antd'
 import { getScoreColor } from '@/constant';
@@ -53,6 +53,9 @@ const DetailModule = () => {
 
     const [isModeTwo, setIsModeTwo] = useState(true);
 
+    const [scrollAreaH,setScrollAreaH] = useState(100);
+    const leafContentRef = useRef<HTMLDivElement>(null);
+
     const MccsLightTableColumns = [
         {
             key: 'gradeLevel',
@@ -178,6 +181,17 @@ const DetailModule = () => {
         restModelData.setEditMode(true);
     }
 
+    const followWindowResize = ()=>{
+
+        if(leafContentRef.current){
+         const leafContentH = leafContentRef.current.clientHeight + 50;  //加上padding
+         const headerH = 0;
+         const scoreH = isModeTwo?(60+32):0;
+         const h =   window.innerHeight - (leafContentH + headerH + scoreH);
+         setScrollAreaH(h);
+       }
+    }
+
     const taizhangDataDerectoryEditHandle = (data: any, actType: ActType) => {
         //台账资料目录编辑回调
         const version = restModelData.leafData?.reviewArticle.version;
@@ -234,11 +248,25 @@ const DetailModule = () => {
         restModelData.getAccoutTypeOptions();
         restModelData.getGradeOptions();
 
+        window.addEventListener("resize",followWindowResize);
+
+        setTimeout(()=>{
+            //首次加载叶子节点内容触发一次
+            var myEvent = new Event('resize');
+            window.dispatchEvent(myEvent); 
+            document.body.style.overflowY = 'hidden';  //叶子节点下锁住页面滚动
+        },100);
+
+        return ()=>{
+            window.removeEventListener("resize",followWindowResize);
+        }
+
     }, [])
 
 
     return (
         <div className='DetailModule'>
+            <div ref={leafContentRef}>
             <div className='leafContentTitle'>{currentActivedTree ? currentActivedTree.title : ''}</div>
             <div className='peopleGroup'>
                 <span>条文组别:</span>
@@ -268,7 +296,7 @@ const DetailModule = () => {
                     !restModelData.editMode && restModelData.hasEditAuthority && <div className='editPageBtn' onClick={() => setEditStatus()}>{restModelData.editMode ? '取消编辑' : '开启编辑'}</div>
                 }
             </div>
-
+       
             <div className='scoreGradeDetail'>
 
                 {
@@ -286,6 +314,7 @@ const DetailModule = () => {
                     ))
                 }
             </div>
+            </div>
 
             {
                 true && (
@@ -316,7 +345,7 @@ const DetailModule = () => {
             {
                 restModelData.leafData && (
                     //台账上传页面时,背景色统一白色,cardWrap提供容器实现上下滑动
-                    <div className={isModeTwo ? 'cardWrap isModeTwo' : 'cardWrap'}>
+                    <div className={isModeTwo ? 'cardWrap isModeTwo' : 'cardWrap'} style={{height:`${scrollAreaH}px`}}>
                         <div>
                             {
                                 //渲染执行情况说明

+ 2 - 4
src/pages/GradeHospitalAccreditation/ledgerUpload/componets/deitailModule/style.less

@@ -165,7 +165,7 @@
     padding: 16px;
     background: #FFFFFF;
     border-radius: 2px;
-    margin-bottom: 16px;
+    margin-bottom: 0px;
     margin-top: 16px;
 
     .selfEvaluation {
@@ -211,9 +211,7 @@
   }
 
   .cardWrap {
-    // padding-top: 16px;
-    height: calc(100vh - 364px);
-    // border-bottom: 2px solid red;
+
     overflow-y: scroll;
     padding-bottom: 16px;
 

+ 5 - 2
src/pages/GradeHospitalAccreditation/ledgerUpload/index.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-14 10:22:09
- * @LastEditTime: 2022-01-01 16:15:18
+ * @LastEditTime: 2022-01-05 14:18:54
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/articleManagement/index.tsx
@@ -197,7 +197,7 @@ const LedgerUpload: React.FC<LedgerUploadPropsType> = (props) => {
             restArticleManagementModelData.setUploadFormInitValue({})
         }
 
-        restArticleManagementModelData.getUploadLedgerType().then(data => {
+        restArticleManagementModelData.getUploadLedgerType().then((data:any) => {
             //设置上传台账可选类型
             restArticleManagementModelData.setUploadLedgerTypeList(data);
 
@@ -249,6 +249,9 @@ const LedgerUpload: React.FC<LedgerUploadPropsType> = (props) => {
                 title={restLedgerUploadModelData.currentRecord?.name}
                 visible={restLedgerUploadModelData.drawerVisible}
                 onVisibleChange={onVisibleChangeHandle}
+                headerStyle={{
+                    display:'none'
+                }}
                 noFormMode={true}
                 width={'60%'}
                 closable={!editMode}