Ver código fonte

更新条文管理

code4eat 3 anos atrás
pai
commit
3d4e5c472a

+ 9 - 11
config/config.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-03 14:28:27
- * @LastEditTime: 2021-09-16 09:44:48
+ * @LastEditTime: 2021-12-20 16:32:12
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/config/config.ts
@@ -28,25 +28,17 @@ export default defineConfig({
     siderWidth: 208,
     ...defaultSettings,
   },
-  // https://umijs.org/zh-CN/plugins/plugin-locale
-  // locale: {
-  //   // default zh-CN
-  //   default: 'zh-CN',
-  //   antd: true,
-  //   // default true, when it is true, will use `navigator.language` overwrite default
-  //   baseNavigator: true,
-  // },
   dynamicImport: {
     loading: '@ant-design/pro-layout/es/PageLoading',
   },
   targets: {
     ie: 11,
   },
-  // umi routes: https://umijs.org/docs/routing
+
   routes,
-  // Theme for antd: https://ant.design/docs/react/customize-theme-cn
   theme: {
     'primary-color': defaultSettings.primaryColor,
+    
   },
   // esbuild is father build tools
   // https://umijs.org/plugins/plugin-esbuild
@@ -56,6 +48,9 @@ export default defineConfig({
   proxy: proxy[REACT_APP_ENV || 'dev'],
   manifest: {
     basePath: '/',
+  },
+  autoprefixer:{
+
   },
   // Fast Refresh 热更新
   fastRefresh: {},
@@ -77,4 +72,7 @@ export default defineConfig({
   mfsu: {},
   webpack5: {},
   exportStatic: {},
+  // qiankun: {
+  //   slave: {},
+  // },
 });

+ 5 - 5
config/proxy.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-03 14:28:27
- * @LastEditTime: 2021-11-25 09:52:25
+ * @LastEditTime: 2021-12-07 14:33:34
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/config/proxy.ts
@@ -15,12 +15,12 @@
  * https://pro.ant.design/docs/deploy
  */
 
-//118.31.245.65
-//112.124.59.133
-export default {
+//118.31.245.65   线上
+//112.124.59.133  测试
+export default { 
   dev: {
     '/api': {
-      target: 'http://118.31.245.65:8083/',
+      target: 'http://112.124.59.133:8083/',
       changeOrigin: true,
       pathRewrite: { '^/api': '' },
     },

+ 6 - 5
package.json

@@ -25,7 +25,7 @@
     "precommit": "lint-staged",
     "prettier": "prettier -c --write \"src/**/*\"",
     "start": "cross-env UMI_ENV=dev umi dev",
-    "start:dev": "cross-env REACT_APP_ENV=dev MOCK=none UMI_ENV=dev umi dev",
+    "start:dev": "cross-env REACT_APP_ENV=dev MOCK=none UMI_ENV=dev PORT=8804 umi dev",
     "start:mock": "cross-env REACT_APP_ENV=mock UMI_ENV=dev umi dev",
     "start:no-mock": "cross-env MOCK=none UMI_ENV=dev umi dev",
     "start:no-ui": "cross-env UMI_UI=none UMI_ENV=dev umi dev",
@@ -64,9 +64,9 @@
     "lodash": "^4.17.11",
     "moment": "^2.25.3",
     "omit.js": "^2.0.2",
-    "react": "^17.0.0",
+    "react": "^16.0.0",
     "react-dev-inspector": "^1.1.1",
-    "react-dom": "^17.0.0",
+    "react-dom": "^16.0.0",
     "react-helmet-async": "^1.0.4",
     "umi": "^3.5.0",
     "umi-serve": "^1.9.10",
@@ -78,14 +78,15 @@
     "@types/history": "^4.7.2",
     "@types/jest": "^26.0.0",
     "@types/lodash": "^4.14.144",
-    "@types/react": "^17.0.0",
-    "@types/react-dom": "^17.0.0",
+    "@types/react": "^16.0.0",
+    "@types/react-dom": "^16.0.0",
     "@types/react-helmet": "^6.1.0",
     "@umijs/fabric": "^2.6.2",
     "@umijs/openapi": "^1.1.14",
     "@umijs/plugin-blocks": "^2.0.5",
     "@umijs/plugin-esbuild": "^1.0.1",
     "@umijs/plugin-openapi": "^1.2.0",
+    "@umijs/plugin-qiankun": "^2.35.4",
     "@umijs/preset-ant-design-pro": "^1.2.0",
     "@umijs/preset-dumi": "^1.1.7",
     "@umijs/preset-react": "^1.8.17",

BIN
public/fullArrow.jpg


+ 29 - 7
src/app.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-03 14:28:27
- * @LastEditTime: 2021-11-25 11:06:53
+ * @LastEditTime: 2021-12-21 10:23:15
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/app.tsx
@@ -41,9 +41,9 @@ if(history){
 
 
 /** 获取用户信息比较慢的时候会展示一个 loading */
-export const initialStateConfig = {
-  loading: <PageLoading />,
-};
+// export const initialStateConfig = {
+//   loading: <PageLoading />,
+// };
 
 
 export type menuDataItemType = {
@@ -69,6 +69,7 @@ export async function getInitialState(): Promise<{
   menu?:menuDataItemType[],
   clearUserData?:() => Promise<boolean>;  //清空用户数据
   fetchUserInfo?: () => Promise<API.CurrentUser | undefined>;
+  postDataToTop?:(data:any)=>Promise<boolean>,
 }> {
 
   const fetchUserInfo = async () => {
@@ -79,8 +80,7 @@ export async function getInitialState(): Promise<{
       }
       throw Error;
     } catch (error) {
-     
-      history.push(`${loginPath}?hospSign=${hospSign}`);
+        history.push(`${loginPath}?hospSign=${hospSign}`);    
     }
     return undefined;
   };
@@ -92,6 +92,8 @@ export async function getInitialState(): Promise<{
       }
   }
 
+ 
+
   const resetPasswordHandle = async (data:API.EditUserInfoType)=>{
         const resp = await updateUserInfo(data);
         if(resp){
@@ -178,6 +180,7 @@ const responseInterceptors = async (response: Response, options: RequestOptionsI
               title: '抱歉,登录已过期请重新登录!',
               onOk: () => {
                 ifStopNextRequet = false;
+                
                 loginOut();
               }
             });
@@ -250,6 +253,25 @@ const mappingIcon = (menuData:menuDataItemType[]) => {
 
 
 
+// export const qiankun = {
+//   // 应用加载之前
+//   async bootstrap(props:any) {
+//     console.log('MedicalWisdomCheckSys bootstrap', props);
+//   },
+//   // 应用 render 之前触发
+//   async mount(props:any) {
+//     console.log('MedicalWisdomCheckSys mount', props);
+//   },
+//   // 应用卸载之后触发
+//   async unmount(props:any) {
+//     console.log('MedicalWisdomCheckSys unmount', props);
+//   },
+// };
+
+
+
+
+
 // ProLayout 支持的api https://procomponents.ant.design/components/layout
 export const layout: RunTimeLayoutConfig = ({ initialState,setInitialState }) => {
  
@@ -261,7 +283,7 @@ export const layout: RunTimeLayoutConfig = ({ initialState,setInitialState }) =>
       // content: initialState?.currentUser?.name,
     },
     // footerRender: () => <Footer />,
-    onPageChange: () => {
+    onPageChange:() => {
       const { location } = history;
       // 如果没有登录,重定向到 login
       if (!initialState?.currentUser && location.pathname !== loginPath) {

+ 2 - 2
src/components/MccsFileTree/components/DirectoryTree/index.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-07 16:40:33
- * @LastEditTime: 2021-11-24 15:06:44
+ * @LastEditTime: 2021-12-07 09:18:41
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/components/MccsFileTree/components/directoryTree.tsx
@@ -96,7 +96,7 @@ const DirectoryTree: React.FC<DirectoryTreeProps> = (props) => {
                   isLeaf:false,
                   code:props.code,
             })}>
-                <div className={props.currentActivedIndex==props.id?'inner showActionBtn':'inner'}>
+                <div className={props.currentActivedIndex==props.id&&action?'inner showActionBtn':'inner'}>
                     {arrow}
                     {nodeLabel}
                 </div>

+ 6 - 4
src/components/MccsModal/index.tsx

@@ -1,8 +1,8 @@
 /*
  * @Author: your name
  * @Date: 2021-09-08 17:09:34
- * @LastEditTime: 2021-11-29 14:57:59
- * @LastEditors: your name
+ * @LastEditTime: 2021-12-09 09:08:37
+ * @LastEditors: Please set LastEditors
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: /MedicalWisdomCheckSys/src/components/MccsModal/index.tsx
  */
@@ -23,7 +23,8 @@ import {
 
 type MccsModalProps = {
     title:string,
-    visible?:boolean,
+    visible:boolean,
+    onVisibleChange?:(bool:boolean)=>void,
     [propName: string]: any;
 }
 
@@ -35,7 +36,7 @@ const MccsModalContext: React.Context<MccsModal.MccsModalContextT> = createConte
 
 
 const MccsModal: React.FC<MccsModalProps> = (props) => {
-  const { title,visible=false,children,...restProps } = props;
+  const { title,visible=false,children,onVisibleChange,...restProps } = props;
   const formRef = useRef<ProFormInstance>();
   // const [ifVisible, setIfVisible] = useState(false)
   return (
@@ -43,6 +44,7 @@ const MccsModal: React.FC<MccsModalProps> = (props) => {
       title={title}
       visible={visible}
       formRef={formRef}
+      onVisibleChange={onVisibleChange}
       modalProps={{destroyOnClose:true}}
       {...restProps}
     >

+ 1 - 0
src/components/MccsPageContainer/index.less

@@ -10,6 +10,7 @@
     min-width: 1100px;
     .ant-pro-grid-content {
         padding:16px;
+        padding-top: 0;
     }
 }
 

+ 2 - 1
src/components/MccsProCard/style.less

@@ -2,5 +2,6 @@
 
 
 .ant-pro-card-body {
-    overflow-y: scroll;
+    // overflow-y: scroll;
+    padding:16px;
 }

+ 111 - 0
src/components/MccsProFormSelect/index.tsx

@@ -0,0 +1,111 @@
+/*
+ * @Author: your name
+ * @Date: 2021-12-07 09:47:50
+ * @LastEditTime: 2021-12-09 15:32:45
+ * @LastEditors: Please set LastEditors
+ * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ * @FilePath: /MedicalWisdomCheckSys/src/components/MccsProFormSelect/index.tsx
+ */
+
+import { useState } from 'react'
+
+import {
+    ProFormSelect,
+} from '@ant-design/pro-form';
+import { ProFormSelectProps } from '@ant-design/pro-form/lib/components/Select';
+import { Input,Form } from 'antd';
+
+
+
+import './style.less';
+
+
+type MccsSelectProps = {
+    withInput?: boolean, //是否带有输入功能
+    selectList?: { label: string, value: string }[], //select可选项
+} & ProFormSelectProps
+
+//props 参考proComponent
+const MccsSelect = (props: MccsSelectProps) => {
+
+    const { withInput, fieldProps, selectList,name,label, ...restProperty } = props;
+    const [selectMode, setSelectMode] = useState<'SELECT' | 'INPUT'>('SELECT');
+    const [value,setValue] = useState<string>('');  //输入关键字
+    const [find,setFind] = useState(false);
+
+    const onSearchHandle = (val: string) => {
+        setValue(val);
+        if (selectList&&withInput&&val.length>0) {
+            //且需要带有输入框时
+            const findeIndex = selectList.findIndex((t) => {
+                return t.value == val;
+            });
+            if (findeIndex != -1) {
+                setFind(true);
+                setSelectMode('SELECT');
+            } else {
+                setFind(false);
+                setSelectMode('INPUT');
+            }
+        }
+    }
+
+    const inputOnChange = (e:any)=>{
+        // console.log(e.target.value);
+        setValue(e.target.value);
+        if (selectList&&withInput) {
+            //且需要带有输入框时
+            const findeIndex = selectList.findIndex((t) => {
+                return t.value == e.target.value;
+            });
+            if (findeIndex != -1) {
+                setSelectMode('SELECT');
+            } else {
+                setSelectMode('INPUT');
+            }
+        }
+    }
+
+    const onSelectionchange = (values:any)=>{
+        // console.log({values});
+        if(withInput){
+            //带有输入框且单选的时候
+            if(Object.prototype.toString.call(values) == '[object String]'){
+                setValue(values);
+            }
+        }
+    }
+
+    return (
+        <>
+            {
+                selectMode === 'SELECT' && (
+                    <ProFormSelect
+                        options={selectList}
+                        label={label}
+                        name={name}
+                        fieldProps={{
+                            onSearch: onSearchHandle,
+                            searchValue:value,
+                            autoFocus:true,
+                            onChange:onSelectionchange,
+                            ...fieldProps
+                        }}
+                        {...restProperty}
+                    />
+                )
+            }
+            {
+                selectMode === 'INPUT' && (
+                    <Form.Item name={name} label={label} >
+                        <Input style={{width:'216px'}} onChange={inputOnChange} value={value} placeholder="请输入" />
+                    </Form.Item>
+                )
+            }
+
+
+        </>
+    )
+}
+
+export default MccsSelect;

+ 7 - 0
src/components/MccsProFormSelect/style.less

@@ -0,0 +1,7 @@
+
+
+
+
+// .ant-select  {
+//     border-radius:4px;
+// }

+ 1 - 0
src/global.less

@@ -4,6 +4,7 @@ html,
 body,
 #root {
   height: 100%;
+  min-width:1100px;
 }
 
 //---------------custom------------

+ 204 - 0
src/pages/GradeHospitalAccreditation/accreditationDetail/components/materialTable/index.tsx

@@ -0,0 +1,204 @@
+/*
+ * @Author: your name
+ * @Date: 2021-12-07 09:28:41
+ * @LastEditTime: 2021-12-14 14:34:15
+ * @LastEditors: Please set LastEditors
+ * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/accreditationDetail/components/materialTable/index.tsx
+ */
+
+
+import React, { useEffect, useState } from 'react';
+import MccsSelect from '@/components/MccsProFormSelect/index';
+
+import { Input, Row, Col, Button, Checkbox, Divider, Pagination, Empty,Spin } from 'antd';
+
+import './style.less';
+import { CheckboxChangeEvent } from 'antd/lib/checkbox';
+
+
+const { Search } = Input;
+
+const TableItem: React.FC<any> = ({ data, actionHandle,checkBoxChangeHandle }) => {
+
+    //注意!!!!data类型有待补充
+
+    return (
+        <div className='tableChild'>
+            <Checkbox className='check' onChange={(e:CheckboxChangeEvent)=>checkBoxChangeHandle(e,data)} />
+            <div className='tableChildContent'>
+                <div className='mainText'>{`${data.sort}.${data.profileName}`}</div>
+                <div className='subText'>{`档次:${data.grade}   目录:${data.directory}`}</div>
+            </div>
+            <div className='action'>
+                <a onClick={() => actionHandle('EDIT',[data])}>修改</a><Divider type='vertical' /><a onClick={() => actionHandle('DEL',[data])}>删除</a>
+            </div>
+        </div>
+    )
+}
+
+const MaterialTable: React.FC<MaterialTable.MaterialTableProps> = (props) => {
+
+    const { selectOptions, request, addHandle, tableItemActionHandle, reload } = props;
+    const [list, setList] = useState<any[]>([]);
+    const [selectorFilter, setSelectorFilter] = useState<string>('');  //下拉筛选
+    const [keyword, setKeyword] = useState<string>('');
+    const [relaodData, setRelaodData] = useState(false);
+    const [loading,setLoading] = useState(false); //加载中
+    const [pageData, setPageData] = useState<{
+        pageSize: number,
+        current: number,
+    }>({ current: 1, pageSize: 10 });
+    const [total,setTotal] = useState(0);
+    const [checkedList,setCheckedList] = useState<any[]>([]); //已勾选的项集合
+
+
+    const geData = async () => {
+        if (request) {
+            setLoading(true);
+            const res = await request({ ...pageData, keyword, selectorFilter:selectorFilter=='全部'?'':selectorFilter });
+            if (res) {
+                setList(res.list);
+                setPageData({
+                    pageSize: res.pageSize,
+                    current: res.current
+                });
+                setTotal(res.total);
+                setRelaodData(false);
+                setLoading(false);
+            }
+        }
+    }
+
+    const tableItemAction = async (type: 'EDIT' | 'DEL', data: any[]) => {
+        if (tableItemActionHandle) {
+            const resp = await tableItemActionHandle(type, data);
+            if (resp) {
+                geData();
+            }
+        }
+    }
+
+    const checkBoxChangeHandle = (e:CheckboxChangeEvent,data:any)=>{
+       if(e.target.checked){
+        setCheckedList([...checkedList,data]);
+       }else{
+          let _checkedList = checkedList;
+          _checkedList.splice(_checkedList.findIndex(t=>t.id == data.id),1);
+          setCheckedList([..._checkedList]);
+       }
+    }
+    
+    //批量删除
+    const batchDelList = async ()=>{
+        if (tableItemActionHandle) {
+            const resp = await tableItemActionHandle('DEL',checkedList);
+            if (resp) {
+                geData();
+                setCheckedList([]);
+            }
+        }
+    }
+
+    // useEffect(()=>{
+    //      console.log({checkedList});
+    // },[checkedList]);
+
+    useEffect(() => {
+        //刷新数据
+        if (relaodData) {
+            geData();
+        }
+    }, [relaodData]);
+
+    useEffect(() => {
+        if (props.reload) {
+            setRelaodData(true);
+        }
+    }, [props]);
+
+    useEffect(() => {
+        geData();
+    }, [])
+
+    return (
+        <div className='materialTable'>
+            <div className='tableFilter'>
+                <Row>
+                    <Col span={8}>
+                        <MccsSelect
+                            selectList={selectOptions ? [{ label: '全部', value: '全部' }, ...selectOptions] : []}
+                            width="sm"
+                            fieldProps={{
+                                defaultValue: '全部',
+                                onChange: val => {
+                                    setSelectorFilter(val);
+                                    setRelaodData(true);
+                                }
+                            }}
+                        />
+                    </Col>
+                    <Col span={15} offset={1}>
+                        <Search placeholder={'请输入'}
+                            allowClear
+                            onSearch={val => {
+                                setKeyword(val);
+                                setRelaodData(true);
+                            }}
+                            onChange={e => {
+                                const key = e.target.value;
+                                if (!key || key.length == 0) {
+                                    setKeyword(key);
+                                    setRelaodData(true);
+                                }
+                            }}
+                        />
+                    </Col>
+                </Row>
+            </div>
+            <div className='titleAndAction'>
+                <div className='tableTitle'>资料目录</div>
+                <div className='actionBtnGroup'>
+                    {checkedList.length>0&&<Button className='actionBtn' onClick={batchDelList}>{`批量删除(${checkedList.length})`}</Button>}
+                    <Button type='primary' className='addBtn actionBtn' onClick={() => addHandle && addHandle()}>新增</Button>
+                </div>
+            </div>
+            <div className='tableList'>
+                {loading&&<div style={{display:'flex',width:'100%',height:'100%',justifyContent:'center',alignItems:'center'}}><Spin /></div>}
+                {
+                    (list.length == 0&&!loading) && (
+                        <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
+                    )
+                }
+                {
+                    !loading&&list.map((item, index) => (
+                        <TableItem key={index} data={item} actionHandle={tableItemAction} checkBoxChangeHandle={checkBoxChangeHandle} />
+                    ))
+                }
+            </div>
+            <div style={{ display: 'flex', justifyContent: 'center',alignItems:'center' }}>
+                {/* <Pagination size="small" total={50} /> */}
+                <Pagination
+                    size="small"
+                    hideOnSinglePage={true}
+                    showLessItems={true}
+                    showSizeChanger
+                    simple={true}
+                    current={pageData.current}
+                    onChange={(page, pageSize) => {
+                        setPageData({
+                            current:page,
+                            pageSize:pageSize?pageSize:10
+                        });
+                        setRelaodData(true);
+                    }}
+                    defaultCurrent={3}
+                    total={total}
+                />
+                <div style={{fontSize:12}}>10条/页</div>
+            </div>
+        </div>
+    )
+}
+
+export default MaterialTable;

+ 82 - 0
src/pages/GradeHospitalAccreditation/accreditationDetail/components/materialTable/style.less

@@ -0,0 +1,82 @@
+
+
+//overwrite antd css
+.ant-form-item {
+    margin-bottom:12px;
+}
+// .ant-pagination-item {
+//     min-width: 25px;
+//     height: 25px;
+// }
+//
+
+
+.materialTable {
+    height: 100%;
+    .titleAndAction {
+        display: flex;
+        flex-direction: row;
+        justify-content: space-between;
+        align-items: center;
+        padding-bottom: 16px;
+        margin-bottom: 16px;
+        border-bottom:  1px solid #DADEE6;
+        .tableTitle {
+            font-size: 16px;
+            font-family: SourceHanSansCN-Bold, SourceHanSansCN;
+            font-weight: bold;
+            color: #17181A;
+        }
+        .actionBtn {
+            height: 32px;
+        }
+        .addBtn {
+            margin-left:8px;
+        }
+    }
+    .tableList {
+        height:75%;
+        margin-bottom: 4%;
+        overflow-y: scroll;
+        .tableChild {
+            position: relative;
+             width: 100%;
+             display: flex;
+             flex-direction: row;
+             justify-content: flex-start;
+             margin-bottom: 10px;
+             .check {
+                 margin-right: 2%;
+             }
+             .tableChildContent {
+                 .mainText {
+                    font-size: 14px;
+                    font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+                    font-weight: 400;
+                    color: #17181A;
+                    margin-bottom: 1px;
+                    overflow: hidden;
+                    white-space: nowrap;
+                    text-overflow: ellipsis;
+                 }
+                 .subText {
+                    font-size: 12px;
+                    font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+                    font-weight: 400;
+                    color: #525866;
+                    overflow: hidden;
+                    white-space: nowrap;
+                    text-overflow: ellipsis;
+                 }
+             }
+             .action {
+                 position: absolute;
+                 right: 0;
+                 a {
+                     white-space: nowrap;
+                     font-size: 12px;
+                 }
+             }
+        }
+    }
+}

+ 34 - 0
src/pages/GradeHospitalAccreditation/accreditationDetail/components/materialTable/typings.d.ts

@@ -0,0 +1,34 @@
+/*
+ * @Author: your name
+ * @Date: 2021-12-07 17:09:18
+ * @LastEditTime: 2021-12-10 11:12:21
+ * @LastEditors: Please set LastEditors
+ * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/accreditationDetail/components/materialTable/index.d.ts
+ */
+
+
+declare namespace MaterialTable {
+
+    type GeDataParams = {
+        selectorFilter?:string,
+        keyword?:string,
+        pageSize:number,
+        current:number,
+    }
+
+    type MaterialTableProps = {
+        selectOptions?: { label: string, value: string }[],
+        request?:(params:GeDataParams)=>Promise<{
+            total:number,//总数
+            pageSize:number,
+            current:number,
+            list:any[],
+        }|undefined>
+        addHandle?:()=>void,
+        reload?:boolean,
+        tableItemActionHandle?:(type:'DEL'|"EDIT",data:any[])=>Promise<boolean|null>,
+    }
+    
+}
+

+ 212 - 28
src/pages/GradeHospitalAccreditation/accreditationDetail/index.tsx

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

+ 70 - 1
src/pages/GradeHospitalAccreditation/accreditationDetail/service.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-07 09:29:27
- * @LastEditTime: 2021-09-13 19:21:14
+ * @LastEditTime: 2021-12-09 17:33:10
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/accreditationDetail/service.ts
@@ -68,5 +68,74 @@ export const getDetailRuleList = (id:string|number)=>{
 
 }
 
+//查询叶子对应的资料目录表格数据
+export const getMaterialList = (params:API.GetMaterialListApiParams)=>{
+
+    return request<Promise<API.GetMaterialListApiResult>>('/api/pfm/pfmdatadirectory/getPfmDataDirectory', {
+        method: 'GET',
+        params:params
+    });
+
+}
+
+//查询叶子对应的所有目录数据
+export const getMaterialDirList = (params:{
+    numStr:string,  //四码
+    version:string //版本
+})=>{
+
+    return request<string[]>('/api/pfm/pfmdatadirectory/getDirectoryList', {
+        method: 'GET',
+        params:params
+    });
+
+}
+
+//查询叶子对应的资料目录所有档次
+export const getMaterialListGrades = (params:{numStr:string,version:string})=>{
+    return request<Promise<{grade:string,detail:string}[]>>('/api/pfm/pfmdatadirectory/getGradeList', {
+        method: 'GET',
+        params:params
+    });
+}
+
+//添加叶子对应的资料目录
+export const addMaterialDirList = (data:{
+    numStr:string, //四码
+    version:string,
+    directory:string,
+    grade:string,
+    note?:string,
+    profileName:string,
+    ruleId:string, //四码Id
+})=>{
+    return request<Promise<{data:any}>>('/api/pfm/pfmdatadirectory/addPfmDataDirectory', {
+        method: 'POST',
+        data:data
+    });
+}
+
+//删除叶子对应的资料目录
+export const delMaterialDirList = (data:number[])=>{
+    return request<Promise<{data:any}>>('/api/pfm/pfmdatadirectory/deletePfmDataDirectoryById', {
+        method: 'POST',
+        data:data
+    });
+}
+
+//修改叶子对应的资料目录
+export const editMaterialDirList = (data:{
+    directory:string,
+    grade:string,
+    id:number,
+    note:string,
+    profileName:string
+})=>{
+    return request<Promise<{data:any}>>('/api/pfm/pfmdatadirectory/updatePfmDataDirectory', {
+        method: 'POST',
+        data:data
+    });
+}
+
 
 

+ 31 - 1
src/pages/GradeHospitalAccreditation/accreditationDetail/typings.d.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-09 16:00:09
- * @LastEditTime: 2021-09-14 10:01:03
+ * @LastEditTime: 2021-12-09 16:05:40
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/accreditationDetail/typings.d.ts
@@ -24,6 +24,7 @@ declare namespace API {
         code:string,
         isLeaf:boolean,
         levelNum:number,
+        version:string,
         children?:ResultTreeData[]
       }
       type RuleDetailListItem = {
@@ -59,5 +60,34 @@ declare namespace API {
     
       type ResultTreeData =ResultTreeDataItem[]
 
+      type GetMaterialListApiParams = {
+        numStr:string,//四码
+        version:string,//版本
+        current?:number,//当前页码
+        grade?:string,//档次
+        keyword?:string,//关键词
+        pageSize?:number,
+      }
+
+      type MaterialDirListItem = {  //资料目录表格项数据
+        directory:string,
+        grade:string,
+        id:number,
+        note:string,
+        numStr:string,
+        profileName:string,
+        ruleId:number,
+        sort:number
+      }
+
+      type GetMaterialListApiResult = {  //资料目录获取表格数据接口返回
+          current:number,
+          list:MaterialDirListItem[],
+          pageSize:number,
+          totalCount:number,
+          totalPage:number,
+      }
+
+  
 
 }

+ 4 - 3
src/pages/GradeHospitalAccreditation/articleManagement/index.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-14 10:22:09
- * @LastEditTime: 2021-11-23 09:37:46
+ * @LastEditTime: 2021-12-06 17:08:43
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/articleManagement/index.tsx
@@ -31,7 +31,6 @@ import {
     ProFormDependency,
 } from '@ant-design/pro-form';
 
-
 import './index.less';
 
 
@@ -280,6 +279,7 @@ const ArticleManagement: React.FC<ArticleManagementProps> = (props) => {
         >
             {
                 restModelData.modalVisible && (
+                    //台账上传弹窗
                     <MccsModal title='台账上传' visible={restModelData.modalVisible}
                         onFinish={(values: any) => restModelData.uploadFile(values)}
                         initialValues={!restModelData.uploadFormInitValue ? {} : restModelData.uploadFormInitValue}
@@ -297,6 +297,7 @@ const ArticleManagement: React.FC<ArticleManagementProps> = (props) => {
                             },
                         ]}>
                             <MccsClickableTabs
+                                //重新上传不允许更改类型
                                 disabled={(restModelData.uploadFormInitValue && JSON.stringify(restModelData.uploadFormInitValue) != '{}') ? true : false}
                                 type='multi'
                                 onChange={uploadLedgerChangeHandle}
@@ -306,7 +307,7 @@ const ArticleManagement: React.FC<ArticleManagementProps> = (props) => {
                         <ProFormDependency name={['tab']}>
                               {
                                   ({tab})=>{
-                                    console.log({tab});
+                                     //制度特殊处理
                                     return tab&&tab.value.label == '制度'&&(
                                         <ProFormSelect
                                         name="publicCateId"

+ 5 - 5
src/pages/user/Login/index.tsx

@@ -3,7 +3,7 @@ import {
   UserOutlined,
 } from '@ant-design/icons';
 import { Alert, message } from 'antd';
-import React, { useState } from 'react';
+import React, { useState,useEffect} from 'react';
 import ProForm, { ProFormText } from '@ant-design/pro-form';
 import { Link, history, useModel } from 'umi';
 import Footer from '@/components/Footer';
@@ -71,13 +71,13 @@ const Login: React.FC = () => {
       // setUserLoginState({status,msg,data});
 
     } catch (error) {
-      const defaultLoginFailureMessage = '登录失败,请重试!';
-
-      message.error(defaultLoginFailureMessage);
+         console.log({error});
     }
     setSubmitting(false);
   };
 
+ 
+
 
   return (
     <div className={styles.container}>
@@ -91,7 +91,7 @@ const Login: React.FC = () => {
           </div>
          
         </div>
-
+        
         <div className={styles.main}>
           <ProForm
             submitter={{