소스 검색

条文管理界面完成v0.1.6调整

code4eat 3 년 전
부모
커밋
ff36e14ac0

+ 2 - 2
config/config.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-03 14:28:27
- * @LastEditTime: 2021-12-20 16:32:12
+ * @LastEditTime: 2021-12-27 18:28:29
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/config/config.ts
@@ -69,7 +69,7 @@ export default defineConfig({
     },
   ],
   nodeModulesTransform: { type: 'none' },
-  mfsu: {},
+  // mfsu: {},
   webpack5: {},
   exportStatic: {},
   // qiankun: {

+ 1 - 1
config/defaultSettings.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-03 14:28:27
- * @LastEditTime: 2021-10-12 17:31:43
+ * @LastEditTime: 2021-12-27 16:34:38
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/config/defaultSettings.ts

BIN
public/pageEditIcon.png


BIN
public/ruleSettingIcon.png


+ 8 - 8
src/components/MccsClickableTabs/index.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-15 18:38:41
- * @LastEditTime: 2021-11-12 16:43:14
+ * @LastEditTime: 2021-12-27 17:39:06
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/components/MccsClickableTabs/index.tsx
@@ -12,7 +12,7 @@
 // import { Button } from 'antd';
 import React,{useState,useEffect} from 'react'
 
-import './index.less';
+import styles from './index.less';
 
 const MccsClickableTabs:React.FC<MccsClickableTabs.propsType> = (props)=>{
 
@@ -59,14 +59,14 @@ const MccsClickableTabs:React.FC<MccsClickableTabs.propsType> = (props)=>{
 
 
     return (
-        <div className={type==`multi`?`mutiwrap wrap ${classNames}`:`wrap ${classNames}`}>
+        <div className={type==`multi`?`${styles.mutiwrap} ${styles.wrap} ${classNames}`:`${styles.wrap} ${classNames}`}>
             {
                 type=='single'&&(
                     <>
                         {
                         list.map((item,index)=>{
                                 return (
-                                    <div className={activedTab?.value==item.value?(disabled?'tab on disabled':'tab on'):disabled?'disabled tab':'tab'} key={index} onClick={()=>clickHandle(item,{label:'null',value:'null'})}>{item.label}</div>
+                                    <div className={activedTab?.value==item.value?(disabled?`${styles.tab} ${styles.on} ${styles.disabled}`:`${styles.tab} ${styles.on}`):disabled?`${styles.disabled} ${styles.tab}`:`${styles.tab}`} key={index} onClick={()=>clickHandle(item,{label:'null',value:'null'})}>{item.label}</div>
                                 )
                         })
                         }
@@ -79,13 +79,13 @@ const MccsClickableTabs:React.FC<MccsClickableTabs.propsType> = (props)=>{
                         {
                         list.map((item,index)=>{
                                 return (
-                                    <div className='muti' key={index}>
-                                        <div className='label'>{item.label}</div>
-                                        <div className='valueWrap'>
+                                    <div className={styles.muti} key={index}>
+                                        <div className={styles.label}>{item.label}</div>
+                                        <div className={styles.valueWrap}>
                                               {
                                                  item.list&&item.list.map((val,i)=>{
                                                         return (
-                                                            <div className={activedTab?.label==item.label&&activedTab.value.label==val.label?(disabled?'tab on disabled':'tab on'):disabled?'disabled tab':'tab'} key={i} onClick={()=>clickHandle(item,val)}>{val.label}</div>
+                                                            <div className={activedTab?.label==item.label&&activedTab.value.label==val.label?(disabled?`${styles.tab} ${styles.on} ${styles.disabled}`:`${styles.tab} ${styles.on}`):disabled?`${styles.disabled} ${styles.tab}`:`${styles.tab}`} key={i} onClick={()=>clickHandle(item,val)}>{val.label}</div>
                                                         )
                                                  }) 
                                               }

+ 210 - 0
src/components/MccsLightTable/index.tsx

@@ -0,0 +1,210 @@
+/*
+ * @Author: your name
+ * @Date: 2021-12-24 09:43:04
+ * @LastEditTime: 2021-12-27 11:45:37
+ * @LastEditors: Please set LastEditors
+ * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ * @FilePath: /MedicalWisdomCheckSys/src/components/MccsLightTable/index.tsx
+ */
+
+import React, { useEffect, useState } from 'react';
+import { MccsLightTableTypes } from './typings';
+import { Empty, Tooltip, Pagination } from 'antd';
+
+import './style.less';
+
+
+
+const MccsLightTable: React.FC<{
+    columns: MccsLightTableTypes.MccsLightTableColumn[],
+    data?: [],
+    request?: (current:number,pageSize:number) => Promise<{
+        current: number,
+        list: any[],
+        pageSize: number,
+        totalCount: number,
+    }>,
+    renderRow?: (data: any) => React.Component<any>,
+}> = props => {
+
+    const {
+        columns,
+        renderRow,
+        request
+    } = props
+
+    const [dataList, setDataList] = useState<any[]>([]);
+    const [renderColumns, seRenderColumns] = useState<MccsLightTableTypes.MccsLightTableColumn[]>([]);
+    const [pageData, setPageData] = useState<{ pageSize: number, current: number }>({pageSize:10,current:1});
+    const [total,setTotal] = useState(0);  //数据总数
+
+    const getData = async (current:number,size:number) => {
+        if (!request) return [];
+        const data = await request(current,size);
+        if (data) {
+            const { list = [],totalCount } = data;
+            setTotal(totalCount);
+            setDataList(list);
+        }else {
+            return []
+        }
+
+    }
+
+    const onShowSizeChangeHandle = (current:number,size:number)=>{
+
+        setPageData({...pageData,current:current+1,pageSize:size});
+        getData(current+1,size); //current 默认从0开始
+    }
+
+    useEffect(() => {
+        const hasSetWidColumns = columns.filter(item => item.width);
+        const needCountWidCloumnsNum = columns.length - hasSetWidColumns.length;
+        const widArray = hasSetWidColumns.map(item => item.width)
+        const CountableWid = widArray.reduce((prev, curr) => (prev ? prev : 0) + (curr ? curr : 0), 0);
+        //初始化cell长度
+        const a = columns.map((item, index) => {
+
+            if (index == 0) {
+                // console.log({...item,width:(100-(CountableWid?CountableWid:0))/needCountWidCloumnsNum});
+                return item.width ? item : { ...item, width: (100 - (CountableWid ? CountableWid : 0)) / needCountWidCloumnsNum }
+            }
+
+
+            const beichushu = 100 - (CountableWid ? CountableWid : 0);
+            const chushu = needCountWidCloumnsNum;
+
+            return item.width ? item : { ...item, width: (beichushu / chushu) }
+        });
+
+        seRenderColumns(a);
+
+    }, [columns]);
+
+    useEffect(() => {
+        getData(pageData.current,pageData.pageSize);
+        // setDataList([
+        //     {
+        //         gradeLevel:'A',
+        //         pfmDataDirectoryList:[
+        //             {
+        //                 id:0,
+        //                 numStr:'1.1.1.1',
+        //                 directory:'directory',
+        //                 accountType:'accountType',
+        //                 accountStatus:0
+        //             },
+        //             {
+        //                 id:3,
+        //                 numStr:'1.1.1.1',
+        //                 directory:'directory',
+        //                 accountType:'accountType',
+        //                 accountStatus:0
+        //             }
+        //         ]
+        //     },
+        //     {
+        //         gradeLevel:'B',
+        //         pfmDataDirectoryList:[
+        //             {
+        //                 id:2,
+        //                 numStr:'1.1.1.1',
+        //                 directory:'directory',
+        //                 accountType:'accountType',
+        //                 accountStatus:0
+        //             }
+        //         ]
+        //     }
+        // ]);
+    }, []);
+
+    //自定义渲染表格内容
+    const renderTableRow = (data: any) => {
+        const { pfmDataDirectoryList: list, gradeLevel: grade } = data;
+        const _cpcolumns = Object.assign([], renderColumns);
+        _cpcolumns.splice(0, 1);  //剔除第一个
+
+        const headWid = renderColumns[0] && renderColumns[0].width ? renderColumns[0].width : 0;
+
+        return (
+            <div className='list' >
+                <div className='head' style={{ width: `${headWid}%` }}>{grade}</div>
+                <div className='headRelaData' style={{ position: 'relative', left: `${headWid}%` }}>
+                    {
+                        (list).map((item: any, index: number) => {
+                            return (
+                                <div className='subList' key={index}>
+                                    {
+                                        _cpcolumns.map((v: any, k: any) => {
+                                            let cellValue = item[v.key];
+                                            //自定义value结果
+                                            if (v.render) {
+                                                cellValue = v.render(item)
+                                            }
+                                            return (
+                                                <div className='cell' key={k} style={{ width: `${v.width}%` }}>
+                                                    <Tooltip title={cellValue}>
+                                                        {cellValue}
+                                                    </Tooltip>
+                                                </div>
+                                            )
+                                        })
+                                    }
+                                </div>
+                            )
+                        })
+                    }
+                </div>
+            </div>
+        )
+    }
+
+
+    return (
+        <>
+            <div className='mccsLighttable'>
+                <div className='columns'>
+                    {
+                        renderColumns.map((item, index) => {
+                            return (
+                                <div key={index} className='columnBlock' style={{ width: `${item.width}%` }}>{item.title}</div>
+                            )
+                        })
+                    }
+                </div>
+                <div className='listWrap'>
+
+                    {dataList.length == 0 && <div className='empty'><Empty image={Empty.PRESENTED_IMAGE_SIMPLE} /></div>}
+
+                    {
+                        dataList.length > 0 && (
+                            <div className='listRow'>
+                                {
+                                    dataList.map((item, index) => {
+                                        return <React.Fragment key={index}>{renderTableRow(item)}</React.Fragment>
+                                    })
+                                }
+                            </div>
+                        )
+                    }
+                </div>
+            </div>
+            {
+                request && (
+                    <div className='pagination'>
+                        <Pagination size="small" 
+                            total={total} 
+                            pageSize={pageData?.pageSize}
+                            showSizeChanger 
+                            showQuickJumper 
+                            onShowSizeChange={onShowSizeChangeHandle}
+                        />
+                    </div>
+                )
+            }
+        </>
+    )
+
+}
+
+export default MccsLightTable;

+ 124 - 0
src/components/MccsLightTable/style.less

@@ -0,0 +1,124 @@
+
+.pagination {
+    display: flex;
+    flex-direction: row;
+    justify-content: flex-end;
+    align-items: center;
+    margin-top: 16px;
+}
+.mccsLighttable {
+  width: 100%;
+  border-radius: 4px;
+  border:1px solid #CFD6E6;
+  overflow: hidden;
+  .columns {
+    display: flex;
+    width: 100%;
+    flex-direction: row;
+    justify-content: center;
+    align-items: center;
+    background-color: #F0F2F5;
+    border-bottom:1px solid #CFD6E6;
+    .columnBlock {
+      position: relative;
+      text-align: center;
+      height: 40px;
+      line-height: 40px;
+      font-size: 14px;
+      font-family: SourceHanSansCN-Medium, SourceHanSansCN;
+      font-weight: 500;
+      color: #17181A;
+
+      &::after {
+          display: block;
+          position: absolute;
+          right: 0;
+          top:0;
+          content: '';
+          width: 1px;
+          height:500px;
+          border-left:1px solid #CFD6E6;
+      }
+
+      &:last-child {
+          border-right: none;
+          &::after {
+              display: none;
+          }
+      }
+    }
+  }
+  .listWrap {
+      width: 100%;
+      .empty {
+           display: flex;
+           justify-content: center;
+           align-items: center;
+           min-height:172px;
+      }
+      .listRow {
+        width: 100%;
+        font-size: 0;
+          .list {
+              position: relative;
+              display: flex;
+              width: 100%;
+              flex-direction: row;
+              justify-content: flex-start;
+              align-items: center;
+              border-bottom: 1px solid #CFD6E6;
+              font-size: 0;
+              .head {
+                position: absolute;
+                left:0;
+                top:0;
+                display: flex;
+                height: 100%;
+                justify-content: center;
+                align-items: center;
+                font-size: 14px;
+                font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+                font-weight: 400;
+                color: #17181A;
+              }
+              
+              .headRelaData {
+                  display: flex;
+                  width: 100%;
+                  flex-direction: column;
+                  font-size: 0;
+                  .subList {
+                      width: 100%;
+                      display: flex;
+                      flex-direction: row;
+                      border-bottom:1px solid #CFD6E6;
+                    //   border-top: none;
+                    //   border-right: none;
+                      font-size: 0;
+                      .cell {
+                        text-align: center;
+                        height: 40px;
+                        line-height: 40px;
+                        font-size: 14px;
+                        font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+                        font-weight: 400;
+                        color: #17181A;
+                        overflow: hidden;
+                        text-overflow: ellipsis;
+                        white-space: nowrap;
+                        // border:1px solid #CFD6E6;
+                      }
+
+                      &:last-child {
+                          border-bottom: none;
+                      }
+                  }
+              }
+
+              &:last-child {
+                  border-bottom: none;
+              }
+          }
+      }
+  }
+}

+ 20 - 0
src/components/MccsLightTable/typings.d.ts

@@ -0,0 +1,20 @@
+/*
+ * @Author: your name
+ * @Date: 2021-12-24 10:03:33
+ * @LastEditTime: 2021-12-27 11:02:25
+ * @LastEditors: Please set LastEditors
+ * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ * @FilePath: /MedicalWisdomCheckSys/src/components/MccsLightTable/typings.d.ts
+ */
+
+import MccsLightTable from ".";
+
+
+declare namespace MccsLightTableTypes {
+       type MccsLightTableColumn = {
+            key:any,
+            title:string,
+            width?:number,
+            render?:(data:any)=>ReatNode
+       }
+}

+ 26 - 0
src/constant.ts

@@ -0,0 +1,26 @@
+/*
+ * @Author: your name
+ * @Date: 2021-12-23 11:05:25
+ * @LastEditTime: 2021-12-23 11:11:36
+ * @LastEditors: Please set LastEditors
+ * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ * @FilePath: /MedicalWisdomCheckSys/src/constant.ts
+ */
+
+
+
+export const getScoreColor = (key:string)=>{
+      
+    switch(key){
+         case 'A':
+             return '#69D1CC';
+         case 'B':
+             return '#80ABFF';
+         case 'C':
+             return '#FFC080';
+         case 'D': 
+             return '#3377FF';
+         case 'E':
+             return '#690'
+    }
+}

+ 230 - 12
src/pages/GradeHospitalAccreditation/articleManagement/index.less

@@ -1,15 +1,90 @@
-
 //overwrite antd css
 .ant-col-6 {
   margin-bottom: 10px;
 }
+
 .ant-space-align-center {
   align-items: flex-start;
 }
 
+.ant-pro-table-search {
+  padding-bottom: 0;
+}
+
+.ant-pro-page-container-warp {
+  display: none;
+}
+
+textarea.ant-input {
+  font-size: 14px !important;
+font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+font-weight: 400;
+color: #525866 !important;
+  background-color: #F0F2F5 !important;
+}
+
 //----------------
 
 
+
+.cardWrap {
+    height: calc(100vh - 364px);
+    border-bottom: 2px solid red;
+    overflow-y: scroll;
+}
+.card {
+  padding: 16px;
+  background: #FFFFFF;
+  border-radius: 2px;
+  margin-bottom: 16px;
+  &:last-child {
+    margin-bottom: 0;
+  }
+  .cardTitle {
+    font-size: 14px;
+    font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+    font-weight: 400;
+    color: #292C33;
+    margin-bottom: 16px;
+  }
+  .selfEvaluation {
+      display: flex;
+      flex-direction: row;
+      align-items:center;
+      span {
+        font-size: 20px;
+        font-family: SourceHanSansCN-Medium, SourceHanSansCN;
+        font-weight: 500;
+        padding-left: 16px;
+      }
+  }
+  .wrap {
+    .tab {
+      width: 20%;
+      height: 28px;
+      cursor: pointer;
+      text-align: center;
+      line-height: 28px;
+      background: #F7F8FA;
+      border-radius: 14px;
+      font-size: 14px;
+      font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+      font-weight: 400;
+      color: #525866;
+      margin-right:16px;
+  
+      &.on {
+        color: #3377FF;
+        background: #EBF1FF;
+      }
+
+      &:last-child {
+        margin-bottom: 0;
+      }
+    }
+  } 
+}
+
 .leafContent {
   .leafContentTitle {
     font-size: 16px;
@@ -43,6 +118,146 @@
     }
   }
 
+  .scoreRow {
+    display: flex;
+    flex-direction: row;
+    justify-content: space-between;
+    align-items: center;
+
+    .scoreInfo {
+      display: flex;
+      flex-direction: row;
+      justify-content: flex-start;
+      align-items: center;
+
+      .scoreBlock {
+        display: flex;
+        flex-direction: row;
+        justify-content: center;
+        align-items: center;
+        width: 117px;
+        height: 16px;
+        font-size: 12px;
+        font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+        font-weight: 400;
+        color: #525866;
+        border-right: 1px solid #DADEE6;
+
+        &>span {
+          position: relative;
+          top: -2px;
+          display: inline-block;
+          margin-left: 16px;
+          font-size: 20px;
+          font-family: SourceHanSansCN-Medium, SourceHanSansCN;
+          font-weight: 500;
+        }
+
+        &:last-child {
+          border: none;
+        }
+
+        &:first-child {
+          width: 94px;
+        }
+      }
+    }
+
+    .ruleSettingBtn,.editPageBtn {
+      font-size: 14px;
+      font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+      font-weight: 400;
+      color: #525966;
+      padding-right: 16px;
+      cursor: pointer;
+
+      &::before {
+        position: relative;
+        top: 3px;
+        display: inline-block;
+        content: '';
+        width: 16px;
+        height: 16px;
+        margin-right: 8px;
+        background: url('../../../../public/ruleSettingIcon.png');
+        background-size: contain;
+
+      }
+    }
+
+    .editPageBtn {
+      &::before {
+        position: relative;
+        top: 3px;
+        display: inline-block;
+        content: '';
+        width: 16px;
+        height: 16px;
+        margin-right: 8px;
+        background: url('../../../../public/pageEditIcon.png');
+        background-size: contain;
+
+      }
+    }
+  }
+
+  .scoreGradeDetail {
+    width: 100%;
+    margin-top: 26px;
+    border-radius: 2px;
+    overflow: hidden;
+    .scoreGradeDetailList {
+      position: relative;
+      display: flex;
+      width: 100%;
+      height: 100%;
+      flex-direction: row;
+      justify-content: flex-start;
+      align-items: stretch;
+      padding-left: 40px;
+      margin-bottom: 2px;
+
+      .head {
+        position: absolute;
+        top: 0;
+        left: 0;
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        width: 40px;
+        height: 100%;
+        background: #A3B1CC;
+        font-size: 16px;
+        font-family: SourceHanSansCN-Bold, SourceHanSansCN;
+        font-weight: bold;
+        color: #FFFFFF;
+      }
+
+      .detail {
+        width: 100%;
+        background: #F5F7FA;
+        padding: 9px 18px;
+
+        .textLine {
+          font-size: 12px;
+          font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+          font-weight: 400;
+          color: #5C7099;
+          line-height: 14px;
+          margin-bottom: 5px;
+
+          &:last-child {
+            margin-bottom: 0;
+          }
+        }
+      }
+
+      &:last-child {
+        margin-bottom: 0;
+      }
+    }
+  }
+
   .articleSetBtn {
     height: 50px;
     text-align: center;
@@ -62,15 +277,17 @@
     }
   }
 }
+
 .selfEvolutionTitle {
   text-align: left;
   font-size: 16px;
-   font-family: SourceHanSansCN-Normal, SourceHanSansCN;
-   font-weight: 400;
-   color: #7A8599;
-   margin-top: 20px;
+  font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+  font-weight: 400;
+  color: #7A8599;
+  margin-top: 20px;
 
 }
+
 .selfEvolutionArea {
   text-align: center;
   line-height: 50px;
@@ -82,14 +299,15 @@
   padding: 10px;
   padding-top: 40px;
 }
+
 .tabWrap {
-    justify-content: space-around;
+  justify-content: space-around;
 }
 
 .formItemTitle {
-    font-size: 16px;
-    font-family: SourceHanSansCN-Normal, SourceHanSansCN;
-    font-weight: 400;
-    color: #7A8599;
-    margin-bottom:16px;
-  }
+  font-size: 16px;
+  font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+  font-weight: 400;
+  color: #7A8599;
+  margin-bottom: 16px;
+}

+ 215 - 154
src/pages/GradeHospitalAccreditation/articleManagement/index.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-14 10:22:09
- * @LastEditTime: 2021-12-23 09:59:54
+ * @LastEditTime: 2021-12-27 18:25:26
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/articleManagement/index.tsx
@@ -14,18 +14,20 @@ import MccsProCard from '@/components/MccsProCard/index';
 import { useModel } from 'umi';
 import MccsFileTree from '@/components/MccsFileTree/index';
 import MccsTable from '@/components/MccsTable/index';
-import MccsScoreBanner from '@/components/MccsScoreBanner/index';
+
 import MccsRecordList from '@/components/MccsRecordList/index';
 import MccsDrawerForm from '@/components/MccsDrawerForm/index';
 import MccsClickableTabs from '@/components/MccsClickableTabs/index';
 import MccsUpload from '@/components/MccsUpload/index';
 import { MccsModal } from '@/components/MccsModal';
 import type { ProFormInstance, } from '@ant-design/pro-form';
-import {getScoreLevelData} from '@/pages/PlatformMana/generalSetting/serve';
-
+import { getScoreLevelData } from '@/pages/PlatformMana/generalSetting/serve';
+import { getScoreColor } from '@/constant';
+import MccsLightTable from '@/components/MccsLightTable';
 
+import { getCurrentLevelTable } from './server';
 
-import { Form, Table, Space, Row, Col, Button, Tabs } from 'antd'
+import { Form, Table, Space, Row, Col, Button, Tabs, Input } from 'antd'
 import {
     ProFormText,
     ProFormSelect,
@@ -34,6 +36,8 @@ import {
 
 import './index.less';
 
+const { TextArea } = Input;
+
 
 
 type ArticleManagementProps = {
@@ -106,16 +110,16 @@ const columns = [
                 return null;
             }
             return (
-                    <ProFormSelect
-                        name="selfEvaluation"
-                        request={async () => {
-                              const data = await getScoreLevelData();
-                              if(!data)return [];
-                              return data.map(item=>({label:item.levelNumber,value:item.levelNumber}))
-                        }}
-                        placeholder="选择自评"
-                        rules={[{ required:false}]}
-                    />
+                <ProFormSelect
+                    name="selfEvaluation"
+                    request={async () => {
+                        const data = await getScoreLevelData();
+                        if (!data) return [];
+                        return data.map(item => ({ label: item.levelNumber, value: item.levelNumber }))
+                    }}
+                    placeholder="选择自评"
+                    rules={[{ required: false }]}
+                />
             )
         },
     },
@@ -128,16 +132,16 @@ const columns = [
                 return null;
             }
             return (
-                    <ProFormSelect
-                        name="targetEvaluation"
-                        request={async () => {
-                            const data = await getScoreLevelData();
-                            if(!data)return [];
-                            return data.map(item=>({label:item.levelNumber,value:item.levelNumber}))
-                        }}
-                        placeholder="选择目标"
-                        rules={[{ required:false }]}
-                    />
+                <ProFormSelect
+                    name="targetEvaluation"
+                    request={async () => {
+                        const data = await getScoreLevelData();
+                        if (!data) return [];
+                        return data.map(item => ({ label: item.levelNumber, value: item.levelNumber }))
+                    }}
+                    placeholder="选择目标"
+                    rules={[{ required: false }]}
+                />
             )
         },
     },
@@ -187,6 +191,34 @@ const columns = [
     },
 ]
 
+const MccsLightTableColumns = [
+    {
+        key: 'gradeLevel',
+        title: '档次',
+        width: 10
+    },
+    {
+        key: 'directory',
+        title: '名称',
+        width: 60
+    },
+    {
+        key: 'accountType',
+        title: '类型',
+    },
+    {
+        key: 'accountStatus',
+        title: '需要台账',
+        render: (record: any) => {
+            return record.accountStatus == 0 ? '否' : '是'
+        }
+    },
+    // {
+    //     key:4,
+    //     title:'操作',
+    // }
+]
+
 //条文管理
 const ArticleManagement: React.FC<ArticleManagementProps> = (props) => {
     const { columnsFromProps = [], headerConcig, isModeTwo } = props;
@@ -215,7 +247,6 @@ const ArticleManagement: React.FC<ArticleManagementProps> = (props) => {
         setArticleSettingFormInit({});//清空默认值
         //重新获取数据
         tableRef?.current?.getTableRef().current?.reload();
-        restModelData.setTabKey('1');
     }
 
     const batchSelfAssessment = (rowkeys: number[] | string[]) => {
@@ -247,55 +278,41 @@ const ArticleManagement: React.FC<ArticleManagementProps> = (props) => {
 
     }
 
-    const upLoadFileHandle = (formInitData?: any) => {
-        //因为modalForm开启了request+params获取表单默认值,
-        //所以必须先设置默认值才能开启弹窗
-        if (formInitData) {
-            const { fileUrl, recordTypeName, accountType, fileName, cateId } = formInitData;
-            console.log({ formInitData });
-            restModelData.setUploadFormInitValue({
-                tab: { label: accountType, value: { label: recordTypeName, value: cateId } },
-                files: [{
-                    uid: new Date().getTime(),
-                    name: fileName,
-                    status: 'done',
-                    url: fileUrl
-                }]
-            });
-        } else {
-            restModelData.setUploadFormInitValue({})
-        }
-        restModelData.getUploadLedgerType().then(data => {
-            //设置上传台账类型
-            restModelData.setUploadLedgerTypeList(data);
-
-        })
-        restModelData.setModalVisible(true);
-    }
-
-    const actionNodeFunc = (data: any) => {
-        //渲染记录列表操作按钮
-        const { fileUrl } = data;
-        const reupload = () => {
-
-            upLoadFileHandle(data);
-        }
-
-        return isModeTwo ? (
-            //台账上传
-            <a onClick={reupload}>重新上传</a>
-        ) : (
-            //条文管理
-            <a href={fileUrl}>下载文件</a>
-        )
-    }
-
+    // const upLoadFileHandle = (formInitData?: any) => {
+    //     //因为modalForm开启了request+params获取表单默认值,
+    //     //所以必须先设置默认值才能开启弹窗
+    //     if (formInitData) {
+    //         const { fileUrl, recordTypeName, accountType, fileName, cateId } = formInitData;
+    //         console.log({ formInitData });
+    //         restModelData.setUploadFormInitValue({
+    //             tab: { label: accountType, value: { label: recordTypeName, value: cateId } },
+    //             files: [{
+    //                 uid: new Date().getTime(),
+    //                 name: fileName,
+    //                 status: 'done',
+    //                 url: fileUrl
+    //             }]
+    //         });
+    //     } else {
+    //         restModelData.setUploadFormInitValue({})
+    //     }
+    //     restModelData.getUploadLedgerType().then(data => {
+    //         //设置上传台账类型
+    //         restModelData.setUploadLedgerTypeList(data);
+
+    //     })
+    //     restModelData.setModalVisible(true);
+    // }
 
     const uploadLedgerChangeHandle = (tabData: any) => {
         //台账上传类型选择回调
 
     }
 
+    const setEditPageStatus = () => {
+        restModelData.setEditMode(!restModelData.editMode);
+    }
+
 
     useEffect(() => {
 
@@ -308,8 +325,9 @@ const ArticleManagement: React.FC<ArticleManagementProps> = (props) => {
 
 
     useEffect(() => {
+        //点击叶子结点时回调
         if (restModelData.leafData) {
-            const { responsibilityDepartmentId, responsibilityDepartmentName, responsibilityUserId, targetEvaluation, responsibilityUserName, accountType } = restModelData.leafData;
+            const { responsibilityDepartmentId, responsibilityDepartmentName, responsibilityUserId, targetEvaluation, responsibilityUserName, accountType } = restModelData.leafData.reviewArticle;
             if (responsibilityDepartmentName && responsibilityDepartmentId) {
                 setArticleSettingFormInit({
                     responsibilityDepartment: { label: responsibilityDepartmentName, value: responsibilityDepartmentId },
@@ -519,98 +537,141 @@ const ArticleManagement: React.FC<ArticleManagementProps> = (props) => {
                         )
                     }
                 </MccsProCard>
-                <MccsProCard colSpan={18} style={{ minHeight: '78vh' }} bodyStyle={{ padding: '16px' }}>
-                    {
-                        !isLeaf && (
-                            <MccsTable
-                                ref={tableRef}
-                                columns={columnsFromProps.length > 0 ? columnsFromProps : columns}
-                                request={getTableData}
-                                search={{
-                                    span: 6
-                                }}
-                                rowSelection={isModeTwo ? false : {
-                                    // 自定义选择项参考: https://ant.design/components/table-cn/#components-table-demo-row-selection-custom
-                                    // 注释该行则默认不显示下拉选项
-                                    selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
-                                }}
-                                rowKey="id"
-                                tableAlertOptionRender={({ selectedRowKeys, selectedRows, onCleanSelected }: { selectedRowKeys: number[] | string[], selectedRows: SelectedRowsType[], onCleanSelected: () => void }) => {
-                                    return (
-                                        <Space size={16}>
-                                            <Button type='primary' onClick={() => batchSelfAssessment(selectedRowKeys)}>批量设置</Button>
-                                            <Button type='ghost' onClick={onCleanSelected}>取消选择</Button>
-                                        </Space>
-                                    );
-                                }}
-                            // searchNode={searchNode()}
-                            />
-                        )
-                    }
+                <MccsProCard colSpan={18} bodyStyle={{ padding: 0, background: '#F2F5FA' }}>
+                    <div className='card'>
+                        {
+                            !isLeaf && (
+                                <MccsTable
+                                    ref={tableRef}
+                                    columns={columnsFromProps.length > 0 ? columnsFromProps : columns}
+                                    request={getTableData}
+                                    search={{
+                                        span: 6
+                                    }}
+                                    rowSelection={isModeTwo ? false : {
+                                        // 自定义选择项参考: https://ant.design/components/table-cn/#components-table-demo-row-selection-custom
+                                        // 注释该行则默认不显示下拉选项
+                                        selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
+                                    }}
+                                    rowKey="id"
+                                    tableAlertOptionRender={({ selectedRowKeys, selectedRows, onCleanSelected }: { selectedRowKeys: number[] | string[], selectedRows: SelectedRowsType[], onCleanSelected: () => void }) => {
+                                        return (
+                                            <Space size={16}>
+                                                <Button type='primary' onClick={() => batchSelfAssessment(selectedRowKeys)}>批量设置</Button>
+                                                <Button type='ghost' onClick={onCleanSelected}>取消选择</Button>
+                                            </Space>
+                                        );
+                                    }}
+                                // searchNode={searchNode()}
+                                />
+                            )
+                        }
+
+                        {
+                            isLeaf && (
+                                <div className='leafContent'>
+                                    <div className='leafContentTitle'>{currentActivedTree ? currentActivedTree.title : ''}</div>
+                                    <div className='peopleGroup'>
+                                        <span>条文组别:</span>
+                                        <span>{restModelData.leafData?.reviewArticle?.accountType}</span>
+                                        <span>负责单位:</span>
+                                        <span>{restModelData.leafData?.reviewArticle?.responsibilityDepartmentName}</span>
+                                        <span>负责人:</span>
+                                        <span>{restModelData.leafData?.reviewArticle?.responsibilityUserName}</span>
+                                    </div>
+                                    {/* <MccsScoreBanner list={scoreList} /> */}
+                                    <div className='scoreRow'>
+                                        <div className='scoreInfo'>
+                                            {
+                                                scoreList.map((item, index) => {
+                                                    return (
+                                                        <div key={index} className='scoreBlock'>
+                                                            {item.label}
+                                                            {item.value && item.value != '-' ? (<span style={{ color: getScoreColor(item.value) }}>{item.value}</span>) : ' -'}
+                                                        </div>
+                                                    )
+                                                })
+                                            }
+                                        </div>
+                                        {
+                                            //条文页面
+                                            !restModelData.moduleMode && <div className='ruleSettingBtn' onClick={articleSetBtnHandle}>条文设置</div>
+                                        }
+                                        {
+                                            //台账上传页面
+                                            restModelData.moduleMode && <div className='editPageBtn' onClick={() => setEditPageStatus()}>{restModelData.editMode ? '取消编辑' : '开启编辑'}</div>
+                                        }
+                                    </div>
+                                    <div className='scoreGradeDetail'>
+
+                                        {
+                                            restModelData.leafData?.pfmViewRuleDetailDataVoList.map((item, index) => (
+                                                <div className='scoreGradeDetailList' key={index}>
+                                                    <div className='head'>{item.evaluation}</div>
+                                                    <div className='detail'>
+                                                        {
+                                                            item.viewRuleAndLevelVos && item.viewRuleAndLevelVos.map((v, k) => (
+                                                                <div className='textLine' key={k}>{`${v.grade} ${v.detail}`}</div>
+                                                            ))
+                                                        }
+                                                    </div>
+                                                </div>
+                                            ))
+                                        }
+                                    </div>
+                                </div>
+                            )
+                        }
+                    </div>
+
 
                     {
                         isLeaf && (
-                            <div className='leafContent'>
-                                <div className='leafContentTitle'>{currentActivedTree ? currentActivedTree.title : ''}</div>
-                                <div className='peopleGroup'>
-                                    <span>条文组别:</span>
-                                    <span>{restModelData.leafData?.accountType}</span>
-                                    <span>负责单位:</span>
-                                    <span>{restModelData.leafData?.responsibilityDepartmentName}</span>
-                                    <span>负责人:</span>
-                                    <span>{restModelData.leafData?.responsibilityUserName}</span>
-                                </div>
-                                {/* <MccsScoreBanner list={scoreList} /> */}
-                                <div></div>
-                                { 
+                            <div className='cardWrap'>
+                                {
                                     isModeTwo && (
-                                        <div style={{ marginTop: 5 }}>
-                                            <Tabs activeKey={`${restModelData.tabKey}`} centered size='large' onChange={(key) => restModelData.setTabKey(key)}>
-                                                <TabPane tab="台账记录" key="1">
-                                                    <div className='articleSetBtn'>
-                                                        <span onClick={() => upLoadFileHandle()}>上传文件</span>
-                                                    </div> 
-                                                    <MccsRecordList
-                                                        title='台账记录'
-                                                        list={restModelData.records}
-                                                        actionFunc={(data) => restModelData.delHistoryRecordHandle(data)}
-                                                        actionNode={(data) => actionNodeFunc(data)}
-                                                    />
-                                                </TabPane>
-                                                <TabPane tab="自评结果" key="2">
-                                                    <div className='selfEvolutionTitle'>开始自评</div>
-                                                    <div className='selfEvolutionArea'>
-
-                                                        <MccsClickableTabs
-                                                            classNames='tabWrap'
-                                                            onChange={(value: { label: string, value: any }) => restModelData.onSelfEvolutionTabChange(value)}
-                                                            data={restModelData.targetScores}
-                                                            value={restModelData.selectedSelfEvolution}
-                                                        />
-                                                        <Button onClick={() => restModelData.commitSelfEvolution()}>提交自评</Button>
-                                                    </div>
-                                                    <MccsRecordList
-                                                        title='自评记录'
-                                                        list={restModelData.selfEvaluationRecords}
-                                                    />
-                                                </TabPane>
-                                            </Tabs>
+                                        <div className='card'>
+                                            <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', width: '100%' }}>
+                                                <div className='selfEvaluation'>
+                                                    自评等级
+                                                    {!restModelData.editMode && (
+                                                        <span style={{ color: getScoreColor(restModelData.leafData ? restModelData.leafData.reviewArticle.selfEvaluation : '') }}>{restModelData.leafData?.reviewArticle.selfEvaluation}</span>
+                                                    )}
+                                                </div>
+                                                {
+                                                    restModelData.editMode && (
+                                                        <div className='wrap' style={{ width: '60%', display: 'flex', flexDirection: 'row', justifyContent: 'flex-end' }}>
+                                                            {
+                                                                restModelData.targetScores.map((item, index) => (
+                                                                    <div className={restModelData.selectedSelfEvolution?.label == item.label ? 'tab on' : 'tab'} key={index} onClick={() => restModelData.onSelfEvolutionTabChange(item)}>{item.label}</div>
+                                                                ))
+                                                            }
+                                                        </div>
+                                                    )
+                                                }
+                                            </div>
                                         </div>
                                     )
                                 }
                                 {
-                                    !isModeTwo && (
-                                        <>
-                                            <div className='articleSetBtn'><span onClick={articleSetBtnHandle}>条文设置</span></div>
-                                            <MccsRecordList
-                                                title='台账记录'
-                                                list={restModelData.records}
-                                                actionFunc={(data) => { console.log({ data }) }}
-                                                //restModelData.delHistoryRecordHandle(data)
-                                                actionNode={(data) => actionNodeFunc(data)}
-                                            />
-                                        </>
-                                    )
+                                    restModelData.leafData?.pfmImplementations.map((item, index) => {
+                                        return (
+                                            <div className='card' key={index}>
+                                                <div className='cardTitle'>{`执行情况说明(等级${item.level})`}</div>
+                                                <TextArea allowClear showCount maxLength={2000} disabled={!restModelData.editMode} value={item.note} style={{ marginBottom: 20 }} />
+                                                <MccsLightTable
+                                                    columns={MccsLightTableColumns}
+                                                    request={(current, pageSize) => getCurrentLevelTable({
+                                                        level: item.level,
+                                                        numStr: currentActivedTree ? currentActivedTree.code : 'null',
+                                                        version: restModelData.leafData ? (restModelData.leafData.reviewArticle.version) : 'null',
+                                                        current,
+                                                        pageSize
+                                                    })}
+                                                />
+                                            </div>
+                                        )
+                                    })
                                 }
                             </div>
                         )

+ 308 - 349
src/pages/GradeHospitalAccreditation/articleManagement/model.ts

@@ -1,18 +1,31 @@
 /*
  * @Author: your name
  * @Date: 2021-09-14 10:46:45
- * @LastEditTime: 2021-11-12 18:05:38
+ * @LastEditTime: 2021-12-27 18:07:40
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/articleManagement/model.ts
  */
 
 import { useState, useEffect } from 'react';
-import { getTreeFileTableData,getDepartmentList,settingArticle,batchSettingArticle,getSelfEvaluation,
-  uploadFilePost,selfEvolutionCommit,delHistoryRecods,getUploadLedgerSelectableType,getCurrentHospSelfScore,getRuleChildrens,
+import {
+  getTreeFileTableData,
+  getDepartmentList,
+  settingArticle,
+  batchSettingArticle,
+  getSelfEvaluation,
+  uploadFilePost,
+  selfEvolutionCommit,
+  delHistoryRecods,
+  getUploadLedgerSelectableType,
+  getCurrentHospSelfScore,
+  getRuleChildrens,
 } from './server';
-import {getTreeList} from '@/pages/GradeHospitalAccreditation/accreditationDetail/service';
-import {getScoreLevelData,getAccreditationTypeData} from '@/pages/PlatformMana/generalSetting/serve';
+import { getTreeList } from '@/pages/GradeHospitalAccreditation/accreditationDetail/service';
+import {
+  getScoreLevelData,
+  getAccreditationTypeData,
+} from '@/pages/PlatformMana/generalSetting/serve';
 import { notification } from 'antd';
 
 //articleManagement
@@ -21,80 +34,86 @@ const articleManagement = () => {
   // const [tableData, setTableData] = useState([]);
   const [currentActivedTree, setCurrentActivedTree] = useState<MccsFileTree.childTree>();
   const [isLeaf, setIsLeaf] = useState(false);
-  const [scoreList, setScoreList] = useState<any[]>([]);
+  const [scoreList, setScoreList] = useState<{ label: string; value: string }[]>([]);
   const [leafData, setLeafData] = useState<API.LeafDataType>(); //叶子结点数据
-  const [departmentManagers, setDepartmentManagers] = useState([]);
-  const [selectedDepartment,setSelectedDepartment] = useState<any>();
-  const [targetScores,setTargetScores] = useState<MccsClickableTabs.TabType[]>([]);
-  const [ruleTypes,setRuleTypes] = useState<MccsClickableTabs.TabType[]>([]);
-  const [records,setRecords]=useState<MccsRecordList.MccsRecordListType>([]);
-  const [selfEvaluationRecords,setSelfEvaluationRecords] = useState<MccsRecordList.MccsRecordListType>([]);  //自评记录
-  const [selectedRowKeys,setSelectedRowKeys] = useState<number[]|string[]>([]);
+  const [departmentManagers, setDepartmentManagers] = useState<{label:string,value:number}[]>([]);
+  const [selectedDepartment, setSelectedDepartment] = useState<any>();
+  const [targetScores, setTargetScores] = useState<MccsClickableTabs.TabType[]>([]);
+  const [ruleTypes, setRuleTypes] = useState<MccsClickableTabs.TabType[]>([]);
+  const [records, setRecords] = useState<MccsRecordList.MccsRecordListType>([]);
+  const [selfEvaluationRecords, setSelfEvaluationRecords] = useState<MccsRecordList.MccsRecordListType>([]); //自评记录
+  const [selectedRowKeys, setSelectedRowKeys] = useState<number[] | string[]>([]);
 
   const [drawerVisible, setDrawerVisible] = useState(false);
-  const [drawerFormType,setDrawerFormType] = useState<'ARTICLE_SET'|'BATCHSETTING'>('ARTICLE_SET');  
+  const [drawerFormType, setDrawerFormType] = useState<'ARTICLE_SET' | 'BATCHSETTING'>(
+    'ARTICLE_SET',
+  );
 
-  const [reloadRightContent,setReloadRightContent] = useState(false);
+  const [reloadRightContent, setReloadRightContent] = useState(false);
 
-  const [moduleMode,setModuleMode] = useState(false);  //true台账上传 false条文管理
+  const [moduleMode, setModuleMode] = useState(false); //true台账上传 false条文管理
 
-  const [tabKey,setTabKey] = useState<string|number>();  //antd Tab切换
+  const [tabKey, setTabKey] = useState<string | number>(); //antd Tab切换
 
-  const [modalVisible,setModalVisible] = useState(false);
+  const [modalVisible, setModalVisible] = useState(false);
 
   const [uploadFormInitValue, setUploadFormInitValue] = useState<any>();
 
-  const [selectedSelfEvolution,setSelectedSelfEvolution] = useState<{label:string,value:any}>();  //MccsClickableTabs value值
+  const [selectedSelfEvolution, setSelectedSelfEvolution] =
+    useState<{ label: string; value: any }>(); //MccsClickableTabs value值
 
-  const [currentSelectedSelefEvolution,setCurrentSelectedSelefEvolution] = useState<{label:string,value:any}>(); //MccsClickableTabs 点击对象
+  const [currentSelectedSelefEvolution, setCurrentSelectedSelefEvolution] = useState<{ label: string; value: any }>(); //当前选中自评 点击对象
 
-  const [uploadLedgerTypeList,setUploadLedgerTypeList] = useState<MccsClickableTabs.TabType[]>([]); //上传台账可选类型
+  const [uploadLedgerTypeList, setUploadLedgerTypeList] = useState<MccsClickableTabs.TabType[]>([]); //上传台账可选类型
 
-  const [currentHospSelfScoreAndOthers,setCurrentHospSelfScoreAndOthers] = useState<string>();  //当前医院评分及自评结果
+  const [currentHospSelfScoreAndOthers, setCurrentHospSelfScoreAndOthers] = useState<string>(); //当前医院评分及自评结果
 
-  const getArticleTreeData = async (keyword?:string|number) => {
-        //获取树数据
-        const { list = [] } = await getTreeList(keyword);
-        setTreeData(list);
+  const [editMode,setEditMode] = useState(false);  //编辑模式,台帐上传页面用到
+
+
+  const getArticleTreeData = async (keyword?: string | number) => {
+    //获取树数据
+    const { list = [] } = await getTreeList(keyword);
+    setTreeData(list);
   };
-  
 
   const getTableData = async (params?: any, sorter?: any, filter?: any) => {
     //根据选中树结构的id获取对应的详情
     // console.log({params});
 
-    let specifyId:number|null = null;
+    let specifyId: number | null = null;
 
-    if(params&&params.id){
+    if (params && params.id) {
       //当存在指定id
-      specifyId = params.id
+      specifyId = params.id;
     }
 
-    if (currentActivedTree||specifyId) {
-      const resp = await getTreeFileTableData(specifyId?{
-        //传入树结构id指定获取某一节点对应数据
-        ...params,
-        id:specifyId
-      }:{
-        //直接拿树结构id
-        ...params,
-        id: currentActivedTree ? currentActivedTree.id : 0,
-      },moduleMode);
-  
+    if (currentActivedTree || specifyId) {
+      const resp = await getTreeFileTableData(
+        specifyId
+          ? {
+              //传入树结构id指定获取某一节点对应数据
+              ...params,
+              id: specifyId,
+            }
+          : {
+              //直接拿树结构id
+              ...params,
+              id: currentActivedTree ? currentActivedTree.id : 0,
+            },
+        moduleMode,
+      );
+
       if (resp) {
-        const {
-          page,
-          leafData,
-          isLeaf,
-        } = resp;
+        const { page, leafData, isLeaf } = resp;
 
-        if (!isLeaf&&page) {
+        if (!isLeaf && page) {
           //非叶子结点返回table数据
-          const { list = [],totalCount } = page;
+          const { list = [], totalCount } = page;
           return {
             data: list,
             success: true,
-            total:totalCount
+            total: totalCount,
           };
         }
 
@@ -106,387 +125,327 @@ const articleManagement = () => {
     }
   };
 
-
-  const getDepartmentRequest = async ()=>{
-        //获取单位列表
-        const resp =  await getDepartmentList();
-        if(resp){
-             const {list=[]} = resp;
-             return list.map((item:any)=>({
-                  label:item.name,
-                  value:item.id
-             }))
-        }
-    
-  }
+  const getDepartmentRequest = async () => {
+    //获取单位列表
+    const resp = await getDepartmentList();
+    if (resp) {
+      const { list = [] } = resp;
+      return list.map((item: any) => ({
+        label: item.name,
+        value: item.id,
+      }));
+    }else{
+      return []
+    }
+  };
 
   type FormValueType = {
-    articleType:{label:string,value:any},
-    responsibilityDepartment:{label:string,value:number,[key:string]:any},
-    responsibilityUser:{label:string,value:number,[key:string]:any},
-    targetScores:{label:string,value:any},
-  }
-
-  const batchSetting = async (values:FormValueType)=>{
-      //批量设置
-      const resp = await batchSettingArticle({
-        ruleIds:selectedRowKeys,
-        responsibilityDepartmentId:values.responsibilityDepartment.value,
-        responsibilityDepartmentName:values.responsibilityDepartment.label,
-        responsibilityUserId:values.responsibilityUser.value,
-        responsibilityUserName:values.responsibilityUser.label,
-        targetEvaluation:values.targetScores.value,
-        articleType:values.articleType.value
-      });
-
-      if(resp){
-          //重新刷新表格
-          setReloadRightContent(true);
-          return true;
-      }
-    
-  }
-
+    articleType: { label: string; value: any };
+    responsibilityDepartment: { label: string; value: number; [key: string]: any };
+    responsibilityUser: { label: string; value: number; [key: string]: any };
+    targetScores: { label: string; value: any };
+  };
 
-  
+  const batchSetting = async (values: FormValueType) => {
+    //批量设置
+    const resp = await batchSettingArticle({
+      ruleIds: selectedRowKeys,
+      responsibilityDepartmentId: values.responsibilityDepartment.value,
+      responsibilityDepartmentName: values.responsibilityDepartment.label,
+      responsibilityUserId: values.responsibilityUser.value,
+      responsibilityUserName: values.responsibilityUser.label,
+      targetEvaluation: values.targetScores.value,
+      articleType: values.articleType.value,
+    });
+
+    if (resp) {
+      //重新刷新表格
+      setReloadRightContent(true);
+      return true;
+    }
+  };
 
-  const setArticle = async (values:FormValueType)=>{
+  const setArticle = async (values: FormValueType) => {
     //条文设置
     // console.log({values});
-    if(currentActivedTree&&leafData){
-      const { id:ruleId } = currentActivedTree;
-      const {id} = leafData;
+    if (currentActivedTree && leafData) {
+      const { id: ruleId } = currentActivedTree;
+      const { id } = leafData.reviewArticle;
 
       let paramsData = {
         id,
-        ruleId:Number(ruleId),
-        responsibilityDepartmentId:values.responsibilityDepartment.value,
-        responsibilityDepartmentName:values.responsibilityDepartment.label,
-        responsibilityUserId:values.responsibilityUser.value,
-        responsibilityUserName:values.responsibilityUser.label,
-        targetEvaluation:values.targetScores.value,
-        articleType:values.articleType.value
-      }
+        ruleId: Number(ruleId),
+        responsibilityDepartmentId: values.responsibilityDepartment.value,
+        responsibilityDepartmentName: values.responsibilityDepartment.label,
+        responsibilityUserId: values.responsibilityUser.value,
+        responsibilityUserName: values.responsibilityUser.label,
+        targetEvaluation: values.targetScores.value,
+        articleType: values.articleType.value,
+      };
       const resp = await settingArticle(paramsData);
-      if(resp){
+      if (resp) {
         //更新界面信息
         getTableData();
         return true;
       }
     }
-  }
+  };
 
-  const getDepartment  = async (item:any,option:any)=>{
+  const getDepartment = async (item: any, option: any) => {
     //获取责任单位
     setSelectedDepartment(option);
 
-    const resp =  await getDepartmentList({'responsibilityDepartmentId':item.value});
-    if(resp){
-         const {list=[]} = resp;
-         const tempPeople =  list.map((item:any)=>({
-              label:item.deptManagerName,
-              value:item.deptManagerId
-         }));
-         setDepartmentManagers(tempPeople);
+    const resp = await getDepartmentList({ responsibilityDepartmentId: item.value });
+    if (resp) {
+      const { list = [] } = resp;
+      if (list.length > 0) {
+        const tempPeople = list[0].sysEmployeeVOList.map((item) => ({
+          label: item?item.name:'null',
+          value: item?item.id:0,
+        }));
+        setDepartmentManagers(tempPeople);
+      }
     }
-  }
+  };
 
- 
-  
-  const getSelfEvaluationRecordList = async (id:number)=>{
-
-      const resp = await getSelfEvaluation(id);
-
-      if(resp){
-        const {list}:{list:API.GetSelfEvaluationRequestType} = resp;
-        const tempArr = list.map(t =>({
-          evaluation:t.selfEvaluation,
-          details:[{
-            name:t.userName,
-            fileName:t.selfEvaluation,
-            fileUrl:'',
-            historyRecords:[],
+  const getSelfEvaluationRecordList = async (id: number) => {
+    const resp = await getSelfEvaluation(id);
+
+    if (resp) {
+      const { list }: { list: API.GetSelfEvaluationRequestType } = resp;
+      const tempArr = list.map((t) => ({
+        evaluation: t.selfEvaluation,
+        details: [
+          {
+            name: t.userName,
+            fileName: t.selfEvaluation,
+            fileUrl: '',
+            historyRecords: [],
             // recordTypeName:t.selfEvaluation,
-            createTime:t.createDate
-          }]
-        }));
-        setSelfEvaluationRecords(tempArr)
-      }
-    
-  }
-  
-  const uploadFile = async (values:any)=>{
-        console.log({'表单':values});
-
-        if(leafData){
-          // console.log({'上传表单':values});
-          try{
-            const {files:{fileList=[]},tab,publicCateId} = values;
-            const {id,accountType} = leafData;
-            let formData = new FormData();
-            fileList.map((t:MccsUpload.UploadFile)=>{
-              formData.append('file',t.originFileObj);
-            });
-            formData.append('id',id.toString());
-            formData.append('categoryType',accountType);
-            //应产品要求‘制度’是不可变,根据制度获取对应关系
-            tab.value.label == '制度'&&formData.append('publicCateId',publicCateId);
-        
-            if(uploadFormInitValue&&JSON.stringify(uploadFormInitValue) != '{}'){
-                 //重新上传不允许修改类型
-                 const {tab} = uploadFormInitValue;
-                 formData.append('accountType',tab.label);
-                 formData.append('accountName',tab.value.label);
-
-            }else{
-              formData.append('accountType',tab.label);
-              formData.append('accountName',tab.value.label);
-            }
-            
-            
-            const resp = await uploadFilePost(formData);
-            if(resp){
-                //上传成功,获取最新台账记录
-                getTableData();
-            }
-            setModalVisible(false);
-            //每次提交完清空表单默认值
-            setUploadFormInitValue(undefined);
-          }catch(err){
-              console.log({err});
-          }
-          
+            createTime: t.createDate,
+          },
+        ],
+      }));
+      setSelfEvaluationRecords(tempArr);
+    }
+  };
+
+  const uploadFile = async (values: any) => {
+    console.log({ 表单: values });
+
+    if (leafData) {
+      // console.log({'上传表单':values});
+      try {
+        const {
+          files: { fileList = [] },
+          tab,
+          publicCateId,
+        } = values;
+        const { id, accountType } = leafData.reviewArticle;
+        let formData = new FormData();
+        fileList.map((t: MccsUpload.UploadFile) => {
+          formData.append('file', t.originFileObj);
+        });
+        formData.append('id', id.toString());
+        formData.append('categoryType', accountType);
+        //应产品要求‘制度’是不可变,根据制度获取对应关系
+        tab.value.label == '制度' && formData.append('publicCateId', publicCateId);
+
+        if (uploadFormInitValue && JSON.stringify(uploadFormInitValue) != '{}') {
+          //重新上传不允许修改类型
+          const { tab } = uploadFormInitValue;
+          formData.append('accountType', tab.label);
+          formData.append('accountName', tab.value.label);
+        } else {
+          formData.append('accountType', tab.label);
+          formData.append('accountName', tab.value.label);
         }
-       
-  }
 
-  const onSelfEvolutionTabChange = (value:{label:string,value:any})=>{
+        const resp = await uploadFilePost(formData);
+        if (resp) {
+          //上传成功,获取最新台账记录
+          getTableData();
+        }
+        setModalVisible(false);
+        //每次提交完清空表单默认值
+        setUploadFormInitValue(undefined);
+      } catch (err) {
+        console.log({ err });
+      }
+    }
+  };
+
+  const onSelfEvolutionTabChange = (value: { label: string; value: any }) => {
     //自评tab切换回调
     // console.log({value});
-    value&&setCurrentSelectedSelefEvolution(value);
-    value&&setSelectedSelfEvolution(value);
-  }
+    value && setCurrentSelectedSelefEvolution(value);
+    value && setSelectedSelfEvolution(value);
+  };
 
-  const commitSelfEvolution = async ()=>{
+  const commitSelfEvolution = async () => {
     //提交自评
-    if(leafData&&currentSelectedSelefEvolution){
+    if (leafData && currentSelectedSelefEvolution) {
       //存在详情信息,且已选择评分
-      const {id} = leafData;
+      const { id } = leafData.reviewArticle;
       let _userData = localStorage.getItem('userData');
-      if(_userData){
-        let userData:{name:string,userId:number} = JSON.parse(_userData)
+      if (_userData) {
+        let userData: { name: string; userId: number } = JSON.parse(_userData);
         const params = {
-          id:Number(id),
-          selfEvaluation:`${currentSelectedSelefEvolution?currentSelectedSelefEvolution.value:'null'}`,
-          userId:userData?.userId,
-          userName:userData?.name,
-        }
-         const resp = await selfEvolutionCommit(params);
-         if(resp&&currentActivedTree){
-           //刷新自评记录
+          id: Number(id),
+          selfEvaluation: `${
+            currentSelectedSelefEvolution ? currentSelectedSelefEvolution.value : 'null'
+          }`,
+          userId: userData?.userId,
+          userName: userData?.name,
+        };
+        const resp = await selfEvolutionCommit(params);
+        if (resp && currentActivedTree) {
+          //刷新自评记录
           getSelfEvaluationRecordList(Number(currentActivedTree.id));
-          setSelectedSelfEvolution({label:'null',value:'null'});  //清空选中项
+          setSelectedSelfEvolution({ label: 'null', value: 'null' }); //清空选中项
           setCurrentSelectedSelefEvolution(undefined);
-         }
-      }  
-    }else{
+        }
+      }
+    } else {
       notification['info']({
         message: '请选择评分!',
       });
     }
-  }
+  };
 
-  const delHistoryRecordHandle = async (historyRecords:MccsRecordList.historyRecordsItem)=>{
+  const delHistoryRecordHandle = async (historyRecords: MccsRecordList.historyRecordsItem) => {
     //删除台账记录
     const resp = await delHistoryRecods(historyRecords.id);
-    if(resp){
+    if (resp) {
       getTableData();
     }
+  };
 
-  } 
-
-  const getScoreList = async ()=>{
-        //条文评级
-        const data =  await getScoreLevelData();
-        const tempArr = data.map((t:any)=>({label:t.levelNumber,value:t.levelNumber,configStatus:t.configStatus}));
-        return Promise.resolve(tempArr);
-  }
-
-  const accreditationGroupType = async ()=>{
-        //获取条文组别
-        const data =  await getAccreditationTypeData();
-        const tempArr = data.map((t:any)=>({label:t.categoryType,value:t.categoryType}));
-        return Promise.resolve(tempArr);
-  }
-
-  const getUploadLedgerType = async ()=>{
-        //台账类型
-        const data = await getUploadLedgerSelectableType();
-        if(data){
-          const tempArr = data.map((t:API.RuleChildsItemType)=>{
-            const tempList = t.generalNameList.map(a=>{
-                   return {
-                       label:a.generalName,
-                       value:a.id
-                   }
-            });
-            return {label:t.levelNumber,list:tempList}
-          });
-          return Promise.resolve(tempArr);
-        }
-  }
+  const getScoreList = async () => {
+    //条文评级
+    const data = await getScoreLevelData();
+    const tempArr = data.map((t: any) => ({
+      label: t.levelNumber,
+      value: t.levelNumber,
+      configStatus: t.configStatus,
+    }));
+    return Promise.resolve(tempArr);
+  };
 
-  const getCurrentHospScore = async ()=>{
-      //获取医院评分及自评信息
-      const resp = await getCurrentHospSelfScore();
-      setCurrentHospSelfScoreAndOthers(resp);
-  }
+  const accreditationGroupType = async () => {
+    //获取条文组别
+    const data = await getAccreditationTypeData();
+    const tempArr = data.map((t: any) => ({ label: t.categoryType, value: t.categoryType }));
+    return Promise.resolve(tempArr);
+  };
 
-  const getSelectableSelfScoreList = async ()=>{
+  const getUploadLedgerType = async () => {
+    //台账类型
+    const data = await getUploadLedgerSelectableType();
+    if (data) {
+      const tempArr = data.map((t: API.RuleChildsItemType) => {
+        const tempList = t.generalNameList.map((a) => {
+          return {
+            label: a.generalName,
+            value: a.id,
+          };
+        });
+        return { label: t.levelNumber, list: tempList };
+      });
+      return Promise.resolve(tempArr);
+    }
+  };
+
+  const getCurrentHospScore = async () => {
+    //获取医院评分及自评信息
+    const resp = await getCurrentHospSelfScore();
+    setCurrentHospSelfScoreAndOthers(resp);
+  };
+
+  const getSelectableSelfScoreList = async () => {
     //获取自评可选列表
     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}));
+    const listFilted = resp.filter((t: any) => t.configStatus != 0);
+    const list = listFilted.map((t: any) => ({ label: t.levelNumber, value: t.levelNumber }));
     setTargetScores(list);
-  }
-
-  const getSelectableRuleChilds = async (id:number)=>{
-     //获取台账上传时可选下拉类型
-     const resp = await getRuleChildrens(id);
-     return resp.map((t:{id:number,name:string})=>({label:t.name,value:t.id}));
-  }
+  };
 
+  const getSelectableRuleChilds = async (id: number) => {
+    //获取台账上传时可选下拉类型
+    const resp = await getRuleChildrens(id);
+    return resp.map((t: { id: number; name: string }) => ({ label: t.name, value: t.id }));
+  };
 
   useEffect(() => {
     if (currentActivedTree) {
-      const { isLeaf} = currentActivedTree;
+      const { isLeaf } = currentActivedTree;
       setIsLeaf(isLeaf);
       getTableData();
-      if(isLeaf){
-        getScoreList().then(data=>{
-          const dataFilted = data.filter((t:any)=>t.configStatus != 0);  //去掉不启动
+      if (isLeaf) {
+        getScoreList().then((data) => {
+          const dataFilted = data.filter((t: any) => t.configStatus != 0); //去掉不启动
           // console.log({data,dataFilted});
           setTargetScores(dataFilted);
         });
-        accreditationGroupType().then(data=>{
+        accreditationGroupType().then((data) => {
           setRuleTypes(data);
         });
       }
     }
-  
   }, [currentActivedTree]);
 
   useEffect(() => {
+    //叶子结点数据变化后相关回调
     if (leafData) {
-      const { systemEvaluation, targetEvaluation, selfEvaluation, siteEvaluation,records=[],accountRecords=[] } = leafData;
+
+      const {
+        systemEvaluation,
+        targetEvaluation,
+        selfEvaluation,
+      } = leafData.reviewArticle;
+
       const tempScoreList = [
+        {
+          label: '目标',
+          value: targetEvaluation ? targetEvaluation : '-',
+        },
         {
           label: '自评',
-          value: selfEvaluation?selfEvaluation:'-',
+          value: selfEvaluation ? selfEvaluation : '-',
         },
         // {
         //   label: '现场查核',
         //   value: siteEvaluation?siteEvaluation:'-',
         // },
-        {
-          label: '目标',
-          value: targetEvaluation?targetEvaluation:'-',
-        },
         {
           label: '系统评分',
-          value: systemEvaluation?systemEvaluation:'-',
+          value: systemEvaluation ? systemEvaluation : '-',
         },
       ];
-      // console.log({tempScoreList});
-      let recordsArray:API.RecordsItemType[]=[];
-
-      records&&records.length>0&&(recordsArray=records);  //条文管理
-      accountRecords&&accountRecords.length>0&&(recordsArray=accountRecords); //台账上传
-      // console.log({recordsArray,accountRecords,records});
-      const tempRecords = recordsArray.map((item)=>{
-
-         if(item.details){
-          //条文下
-          const tempArr:MccsRecordList.MccsRecordListItemInnerDetail[]  = item.details.map(val=>({
-            name:val.userName,
-            fileName:val.fileName,
-            fileUrl:val.fileUrl,
-            createTime:val.createTime,
-            recordTypeName:val.recordTypeName,
-             //条文管理无台账记录
-             historyRecords:[]
-           }))
-           return {
-            evaluation:item.evaluation,
-            details:tempArr
-           }
-         }
-
-         if(item.records){
-           //台账下
-          const tempArr:MccsRecordList.MccsRecordListItemInnerDetail[] = item.records.map(val=>({
-
-            name:val.uploadUserName,
-            fileName:val.fileName,
-            fileUrl:val.fileUrl,
-            createTime:val.uploadTime,
-            recordTypeName:val.accountName,
-            accountType:val.accountType,
-            cateId:val.cateId,
-            historyRecords:val.historyVersionVOList?val.historyVersionVOList.map(t=>({
-              versionName:t.versionName,name:val.uploadUserName,time:t.uploadTime,id:t.id
-            })):[]
-            
-           }))
-
-           return {
-            evaluation:item.evaluation,
-            details:tempArr
-           }
-          
-         }
-         
-         //后台接口字段缺失,保证组件正常运行
-         return {
-          evaluation:'null',
-          details:[]
-        };
-      });
+
       
+
       setScoreList(tempScoreList);
-      setRecords(tempRecords);
+      getSelectableSelfScoreList();
+      // setRecords(tempRecords);
     }
   }, [leafData]);
 
-  useEffect(()=>{
-       //tab切换时
-       //tab切换时重置
-       setSelectedSelfEvolution({label:'',value:''}); 
-       setCurrentSelectedSelefEvolution(undefined); 
-       if(tabKey==2){
-             //切换为自评记录
-             getSelfEvaluationRecordList(Number(currentActivedTree?.id));  //获取自评记录列表
-             getSelectableSelfScoreList();
-
-       }
-  },[tabKey]);
-
-  useEffect(()=>{
-       //当抽屉类型改变时
-       if(drawerFormType == 'BATCHSETTING'){
-        getScoreList().then(data=>{
-          const dataFilted = data.filter((t:any)=>t.configStatus != 0);  //去掉不启动
-          setTargetScores(dataFilted);
-        });
-        accreditationGroupType().then(data=>{
-          setRuleTypes(data);
-        });
-
-       }
-  },[drawerFormType]);
-
   
 
+  useEffect(() => {
+    //当抽屉类型改变时
+    if (drawerFormType == 'BATCHSETTING') {
+      getScoreList().then((data) => {
+        const dataFilted = data.filter((t: any) => t.configStatus != 0); //去掉不启动
+        setTargetScores(dataFilted);
+      });
+      accreditationGroupType().then((data) => {
+        setRuleTypes(data);
+      });
+    }
+  }, [drawerFormType]);
+
   return {
     isLeaf,
     treeData,
@@ -496,7 +455,7 @@ const articleManagement = () => {
     currentActivedTree,
     setCurrentActivedTree,
     scoreList, //评分
-    records,//台账记录
+    records, //台账记录
     getDepartmentRequest,
     departmentManagers,
     getDepartment,
@@ -514,8 +473,6 @@ const articleManagement = () => {
     setReloadRightContent,
     setModuleMode,
     moduleMode,
-    tabKey,
-    setTabKey,
     selfEvaluationRecords,
     modalVisible,
     setModalVisible,
@@ -533,6 +490,8 @@ const articleManagement = () => {
     currentHospSelfScoreAndOthers,
     getCurrentHospScore,
     getSelectableRuleChilds,
+    editMode,
+    setEditMode,
   };
 };
 

+ 111 - 100
src/pages/GradeHospitalAccreditation/articleManagement/server.ts

@@ -1,141 +1,152 @@
 /*
  * @Author: your name
  * @Date: 2021-09-14 10:22:20
- * @LastEditTime: 2021-10-26 10:55:45
+ * @LastEditTime: 2021-12-27 10:48:59
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/articleManagement/server.ts
  */
 
-
-
 import { request } from 'umi';
 
-
-
-
-
 //获取条文表格数据
-export const getTreeFileTableData  = async (query:{id:string|number,keyword?:string|number},mode?:boolean)=>{
-    
-    if(!mode){
-        //条文
-        return request('/api/pfm/reviewArticle/list', {
-            method: 'GET',
-            params:{...query}
-        });
-    }else {
-        //台账
-        return request('/api/pfm/recordUpload/list', {
-            method: 'GET',
-            params:{...query}
-        });
-    }
-}
+export const getTreeFileTableData = async (
+  query: { id: string | number; keyword?: string | number },
+  mode?: boolean,
+) => {
+  if (!mode) {
+    //条文
+    return request('/api/pfm/reviewArticle/list', {
+      method: 'GET',
+      params: { ...query },
+    });
+  } else {
+    //台账
+    return request('/api/pfm/recordUpload/list', {
+      method: 'GET',
+      params: { ...query },
+    });
+  }
+};
 
 //获取单位列表
-export const getDepartmentList  = async (query?:{responsibilityDepartmentId?:number,responsibilityUserId?:number})=>{
-  
-    return request('/api/pfm/sysdepartment/getSysDepartmentList', {
-        method: 'GET',
-        params:{...query}
-    });
 
-}
+type GetDepartmentListType = {
+  current: number;
+  list: {
+    hiId: number;
+    id: number;
+    name: string;
+    sysEmployeeVOList: {
+      code:string;
+      hiId: number;
+      id: number;
+      name:string;
+    }[];
+  }[];
+  pageSize: number;
+  totalCount: number;
+  totalPage: number;
+};
+
+export const getDepartmentList = async (query?: {
+  responsibilityDepartmentId?: number;
+  responsibilityUserId?: number;
+}) => {
+  return request<Promise<GetDepartmentListType>>('/api/pfm/sysdepartment/getSysDepartmentList', {
+    method: 'GET',
+    params: { ...query },
+  });
+};
 
 //条文设置
 
-export const settingArticle  = async (data:API.settingArticlePostDataType)=>{
-  
-    return request('/api/pfm/reviewArticle/setArticle', {
-        method: 'POST',
-        data:{...data}
-    });
-
-}
+export const settingArticle = async (data: API.settingArticlePostDataType) => {
+  return request('/api/pfm/reviewArticle/setArticle', {
+    method: 'POST',
+    data: { ...data },
+  });
+};
 
 //条文批量设置
 
-export const batchSettingArticle  = async (data:API.batchSettingArticleType)=>{
-  
-    return request('/api/pfm/reviewArticle/setTargetEvaluation', {
-        method: 'POST',
-        data:{...data}
-    });
-
-}
+export const batchSettingArticle = async (data: API.batchSettingArticleType) => {
+  return request('/api/pfm/reviewArticle/setTargetEvaluation', {
+    method: 'POST',
+    data: { ...data },
+  });
+};
 
 //获取自评记录
 
-export const getSelfEvaluation  = async (ruleId:string|number)=>{
-  
-    return request('/api/pfm/pfmarticlehistory/getSelfEvaluation', {
-        method: 'GET',
-        params:{ruleId}
-    });
-
-}
+export const getSelfEvaluation = async (ruleId: string | number) => {
+  return request('/api/pfm/pfmarticlehistory/getSelfEvaluation', {
+    method: 'GET',
+    params: { ruleId },
+  });
+};
 
 //获取制度下的子节点
 
-export const getRuleChildrens  = async (id:number)=>{
-  
-    return request('/api/pfm/publicResource/getPublicCateChildren', {
-        method: 'GET',
-        params:{id:id}
-    });
-
-}
+export const getRuleChildrens = async (id: number) => {
+  return request('/api/pfm/publicResource/getPublicCateChildren', {
+    method: 'GET',
+    params: { id: id },
+  });
+};
 
 //上传台账
 
-
-export const uploadFilePost  = async (uploadData:any)=>{
-    
-    return request('/api/pfm/recordUpload/setRecordFile', {
-        method: 'POST',
-        data:uploadData
-    });
-
-}
+export const uploadFilePost = async (uploadData: any) => {
+  return request('/api/pfm/recordUpload/setRecordFile', {
+    method: 'POST',
+    data: uploadData,
+  });
+};
 
 // 自评
 
-export const selfEvolutionCommit  = async (data:API.SelfEvolutionCommitType)=>{
-    
-    return request('/api/pfm/recordUpload/setSelfEvaluationResult', {
-        method: 'POST',
-        data:data
-    });
-
-}
+export const selfEvolutionCommit = async (data: API.SelfEvolutionCommitType) => {
+  return request('/api/pfm/recordUpload/setSelfEvaluationResult', {
+    method: 'POST',
+    data: data,
+  });
+};
 
 // 删除台账历史记录
 
-export const delHistoryRecods  = async (id:number)=>{
-    
-    return request('/api/pfm/recordUpload/deleteHistory', {
-        method: 'POST',
-        params:{id}
-    });
-
-}
+export const delHistoryRecods = async (id: number) => {
+  return request('/api/pfm/recordUpload/deleteHistory', {
+    method: 'POST',
+    params: { id },
+  });
+};
 
 //获取可选台账类型
-export const getUploadLedgerSelectableType = async ()=>{
-    return request('/api/pfm/sysgeneralconfig/getAccountConfigByType', {
-        method: 'GET',
-    });
-}
-
+export const getUploadLedgerSelectableType = async () => {
+  return request('/api/pfm/sysgeneralconfig/getAccountConfigByType', {
+    method: 'GET',
+  });
+};
 
 //获取当前医院目标和自评结果
-export const getCurrentHospSelfScore = async ()=>{
-    return request('/api/pfm/reviewArticle/getTargetAndSelf', {
-        method: 'GET',
+export const getCurrentHospSelfScore = async () => {
+  return request('/api/pfm/reviewArticle/getTargetAndSelf', {
+    method: 'GET',
+  });
+};
+
+//根据执行情况等级获取对应的表格数据
+export const getCurrentLevelTable = async (params:{
+    level:string,//等级
+    numStr:string, //四码
+    version:string,
+    current?:number,//当前页码
+    pageSize?:number,
+}) => {
+    return request('/api/pfm/pfmdatadirectory/getPfmDataDirectoryByLevel', {
+      method: 'GET',
+      params:params
     });
-}
-
-
-
+  };
 

+ 53 - 25
src/pages/GradeHospitalAccreditation/articleManagement/typings.d.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-14 10:22:42
- * @LastEditTime: 2021-11-12 18:05:10
+ * @LastEditTime: 2021-12-23 15:15:08
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/articleManagement/typings.d.ts
@@ -27,8 +27,8 @@ declare namespace API {
           fileUrl: string;
           uploadTime: string;
           accountName: string;
-          accountType:string,
-          cateId:number,
+          accountType: string;
+          cateId: number;
           historyVersionVOList: {
             versionName: string;
             accountName: string;
@@ -36,27 +36,59 @@ declare namespace API {
             fileName: string;
             fileUrl: string;
             uploadTime: string;
-            id:number
+            id: number;
           }[];
         }[]
       | [];
   };
 
-  type LeafDataType = {
+  type Type_fmImplementations = {
     id: number;
     numStr: string;
-    name: string;
-    accountType: string;
-    responsibilityDepartmentName:string;
-    responsibilityUserName: string;
-    responsibilityDepartmentId:number,
-    responsibilityUserId:number,
+    version: string;
+    level: string;
+    note: string;
+    userAccount: string;
+    userName: string;
+    hospId: number;
+    createTime: number;
+    updateTime: number;
+    deleteTime: number;
+  };
+
+  type Type_pfmViewRuleDetailDataVoList = {
+    evaluation: string;
+    viewRuleAndLevelVos: {
+      grade: string;
+      detail: string;
+    }[];
+  };
+
+  type Type_reviewArticle = {
+    id: number;
+    ruleId: number;
+    numStr: string;
+    version: string;
     selfEvaluation: string;
     targetEvaluation: string;
     systemEvaluation: string;
     siteEvaluation: string;
-    records?: RecordsItemType[];
-    accountRecords?: RecordsItemType[];
+    responsibilityDepartmentId: number;
+    responsibilityDepartmentName: string; //负责单位名称
+    responsibilityUserId: number;
+    responsibilityUserName: string; //负责人名称
+    accountType: string; //条文组别
+    hospId: number;
+    recordDay: number;
+    createTime: number;
+    updateTime: number;
+    deleteTime: number;
+  };
+
+  type LeafDataType = {
+    pfmImplementations: Type_fmImplementations[]; //执行情况
+    pfmViewRuleDetailDataVoList: Type_pfmViewRuleDetailDataVoList[]; //等级细则
+    reviewArticle: Type_reviewArticle; //四码对应的组别/负责人等数据
   };
 
   type settingArticlePostDataType = {
@@ -103,18 +135,14 @@ declare namespace API {
   }[];
 
   type SelfEvolutionCommitType = {
-    id:number,
-    selfEvaluation:string,
-    userId:number,
-    userName:string
-  }
-
+    id: number;
+    selfEvaluation: string;
+    userId: number;
+    userName: string;
+  };
 
   type RuleChildsItemType = {
-        levelNumber:string,
-        generalNameList:{id:number,generalName:string}[]
-  }
-
+    levelNumber: string;
+    generalNameList: { id: number; generalName: string }[];
+  };
 }
-
-

+ 1 - 15
src/pages/GradeHospitalAccreditation/ledgerUpload/index.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-14 10:22:09
- * @LastEditTime: 2021-11-12 17:43:12
+ * @LastEditTime: 2021-12-27 17:44:52
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/articleManagement/index.tsx
@@ -224,20 +224,6 @@ const LedgerUpload: React.FC<LedgerUploadPropsType> = (props) => {
     },[restArticleManagementModelData.modalVisible]);
 
     
-
-    useEffect(()=>{
-        //tab切换时
-        //tab切换时重置
-        // restArticleManagementModelData.setSelectedSelfEvolution(['null']); 
-        // restArticleManagementModelData.setCurrentSelectedSelefEvolution(undefined); 
-        if(tabKey==2){
-              //切换为自评记录
-              if(restLedgerUploadModelData.currentRecord){
-                restLedgerUploadModelData.getSelfEvaluationRecordList(restLedgerUploadModelData.currentRecord.id);  //获取自评记录列表
-              }
-
-        }
-    },[tabKey]);
     
     return (
         <React.Fragment>

+ 23 - 23
src/pages/GradeHospitalAccreditation/ledgerUpload/model.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-14 10:46:45
- * @LastEditTime: 2021-11-12 17:31:31
+ * @LastEditTime: 2021-12-27 16:58:04
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/articleManagement/model.ts
@@ -26,7 +26,7 @@ const ledgerUpload = () => {
   const [selfEvaluationRecords, setSelfEvaluationRecords] = useState<MccsRecordList.MccsRecordListType>([]); //自评记录
   // const [drawerFormType, setDrawerFormType] = useState<'ARTICLE_SET' | 'BATCHSETTING'>(  'ARTICLE_SET');
 
-  const [targetScores,setTargetScores] = useState<MccsClickableTabs.TabType[]>([]);
+  const [targetScores,setTargetScores] = useState<MccsClickableTabs.TabType[]>([]);  //可选等级列表
 
   const [selectedSelfEvolution,setSelectedSelfEvolution] = useState<{label:string,value:any}>();  //MccsClickableTabs value值
 
@@ -81,7 +81,7 @@ const ledgerUpload = () => {
     //提交自评
     if(currentLeafData&&currentSelectedSelefEvolution){
       //存在详情信息,且已选择评分
-      const {id} = currentLeafData;
+      const {id} = currentLeafData.reviewArticle;
       let _userData = localStorage.getItem('userData');
       if(_userData){
         let userData:{name:string,userId:number} = JSON.parse(_userData)
@@ -135,8 +135,8 @@ const ledgerUpload = () => {
         targetEvaluation,
         selfEvaluation,
         siteEvaluation,
-        records = [],
-      } = currentLeafData;
+        // records = [],
+      } = currentLeafData.reviewArticle;
       const tempScoreList = [
         {
           label: '自评',
@@ -157,26 +157,26 @@ const ledgerUpload = () => {
       ];
       // console.log({tempScoreList});
 
-      const tempRecords = records.map((item: API.RecordsItemType) => {
-        if (item.details) {
-          const tempArr = item.details.map((val) => ({
-            name: val.userName,
-            fileName: val.fileName,
-            fileUrl: val.fileUrl,
-            createTime: val.createTime,
-            recordTypeName: val.recordTypeName,
-            historyRecords: [],
-          }));
-          return {
-            evaluation: item.evaluation,
-            details: tempArr,
-          };
-        }
-        return { evaluation: 'null', details: [] };
-      });
+      // const tempRecords = records.map((item: API.RecordsItemType) => {
+      //   if (item.details) {
+      //     const tempArr = item.details.map((val) => ({
+      //       name: val.userName,
+      //       fileName: val.fileName,
+      //       fileUrl: val.fileUrl,
+      //       createTime: val.createTime,
+      //       recordTypeName: val.recordTypeName,
+      //       historyRecords: [],
+      //     }));
+      //     return {
+      //       evaluation: item.evaluation,
+      //       details: tempArr,
+      //     };
+      //   }
+      //   return { evaluation: 'null', details: [] };
+      // });
 
       setScoreList(tempScoreList);
-      setRecords(tempRecords);
+      // setRecords(tempRecords);
     }
   }, [currentLeafData]);