浏览代码

调整isLeaf为leaf及相关逻辑

code4eat 3 年之前
父节点
当前提交
ebb837ced4

+ 3 - 3
config/routes.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-03 14:28:27
- * @LastEditTime: 2022-07-29 12:45:10
+ * @LastEditTime: 2022-09-07 14:49:29
  * @LastEditors: code4eat awesomedema@gmail.com
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/config/routes.ts
@@ -30,8 +30,8 @@ export default [
     path: '/PlatformMana',
     name: '平台系统管理',
     icon: 'smile',
-    access:'normalRouteFilter',
-    redirect:'/PlatformMana/generalSetting',
+    // access:'normalRouteFilter',
+    // redirect:'/PlatformMana/generalSetting',
     routes: [
       {
         path: '/PlatformMana/generalSetting',

+ 33 - 8
src/app.tsx

@@ -21,6 +21,7 @@ import { getMenus } from './services/user';
 import { updateUserInfo } from '@/pages/user/Login/service';
 
 import type { RequestOptionsInit, Context } from 'umi-request';
+import { useState } from 'react';
 
 const isDev = process.env.NODE_ENV === 'development';
 
@@ -51,8 +52,15 @@ export type menuDataItemType = {
   component: string,
   softUrl?: string, // 帆软url
   children?: menuDataItemType[]
+
+  
 }
 
+// const [openKeys, set_openKeys] = useState<string[]>([]);
+//   const [selectedKeys, set_selectedKeys] = useState<string[]>([]);
+
+
+
 /**
  * @see  https://umijs.org/zh-CN/plugins/plugin-initial-state
  * */
@@ -180,7 +188,7 @@ const responseInterceptors = async (response: Response, options: responseInterce
       // 网络请求成功
       const _response = await response.clone().json();
       const restext = await response.clone().text();
-      console.log({restext});
+  
       const { status: dataStatus, errorCode, errorMessage, data } = _response;
       if (dataStatus == 200) {
 
@@ -188,8 +196,8 @@ const responseInterceptors = async (response: Response, options: responseInterce
         if (requestMethod == 'POST' && url != "/api/pfm/login" && !isCloseNotify) {
           if (responseSpecifyFeedback && responseSpecifyFeedback.isShow) {
             // 当指定了请求成功反馈时
-            console.log({ responseSpecifyFeedback });
-            console.log(responseSpecifyFeedback.successMessage);
+            // console.log({ responseSpecifyFeedback });
+            // console.log(responseSpecifyFeedback.successMessage);
             notification.success({
               message: responseSpecifyFeedback.successMessage
             });
@@ -284,16 +292,22 @@ const mappingIcon = (menuData: menuDataItemType[]) => {
 export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) => {
 
   const isShowMenu = localStorage.getItem('isChildShowMenu');
+
+  
   
   return {
     logo: initialState?.logo,
     rightContentRender: () => <RightContent />,
     disableContentMargin: false,
     menuProps:{
-      // onClick:({ key, keyPath, domEvent })=>{
-      //      console.log({ key, keyPath, domEvent});
-      //      history.push('/reports/a?w=1')
-      // }
+      // openKeys: [...openKeys],
+      // selectedKeys: [...selectedKeys],
+      // onSelect: ({ key, keyPath, selectedKeys, domEvent }) => {
+      //   set_selectedKeys(selectedKeys)
+      // },
+      // onOpenChange: (keys: string[]) => {
+      //   set_openKeys([...keys]);
+      // },
     },
     siderWidth:isShowMenu == 'true'?220:0,
     menu: {
@@ -314,7 +328,7 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
             const currentSelectedTab = localStorage.getItem('currentSelectedTab');
             
             if (currentSelectedTab) {
-              const { menuId } = JSON.parse(currentSelectedTab);
+              const { menuId,path } = JSON.parse(currentSelectedTab);
               const systemId = menuId;
               const data: any[] = await getMenus(systemId);
 
@@ -354,6 +368,17 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
 
                 /////////////////////////////--------临时处理----------///////////////////////////////////////////////
 
+
+            
+                  // if(data[0].children&&data[0].children.length>0){
+
+                  //   const childs = data[0].children;        
+                  //   set_openKeys([data[0].key]);
+                  //   set_selectedKeys([childs[0].key]);
+                  //   history.push(`${childs[0].path}`)
+                  // }
+                
+
                 return mappingIcon(data);
               }
             }

+ 3 - 15
src/components/MccsFileTree/index.tsx

@@ -1,15 +1,4 @@
-/*
- * @Author: your name
- * @Date: 2021-09-06 10:28:12
-<<<<<<< HEAD
- * @LastEditTime: 2022-03-04 17:32:24
-=======
- * @LastEditTime: 2022-03-04 18:34:17
->>>>>>> master
- * @LastEditors: Please set LastEditors
- * @Description: In User Settings Edit
- * @FilePath: /MedicalWisdomCheckSys/src/components/MccsFileTree/index.tsx
- */
+
 
 
 
@@ -105,7 +94,6 @@ const MccsFileTree: React.FC<MccsFileTreeProps> = (props) => {
   const loop = (data: MccsFileTree.childTree, i: number) => {
 
     const { title, children = [], ...restProps } = data;
-
     // const node = <div className="node">{`${restProps.code} ${title}`}</div>;
 
     const node = <NodeTextArea className="node" text={`${restProps.code} ${title}`}></NodeTextArea>
@@ -124,7 +112,7 @@ const MccsFileTree: React.FC<MccsFileTreeProps> = (props) => {
             if (item.isLeaf) {
               return <TreeNode currentActivedIndex={currentActivedIndex} setcurrentActivedIndex={setcurrentActivedIndex} key={index}   {...item} />
             } else {
-              return loop(item, index);
+              return loop({...item,isLeaf:item.leaf}, index);
             }
           })
         }
@@ -203,7 +191,7 @@ const MccsFileTree: React.FC<MccsFileTreeProps> = (props) => {
           isLoading ? <div className='spinWrap'><Spin delay={500} /></div> : (
             <>
               {treeData.map((node, i) => {
-                return loop(node, i);
+                return loop({...node,isLeaf:node.leaf}, i);
               })}
             </>
           )

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

@@ -2,7 +2,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-06 09:07:56
- * @LastEditTime: 2022-06-17 18:27:40
+ * @LastEditTime: 2022-09-07 15:18:24
  * @LastEditors: code4eat awesomedema@gmail.com
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/accreditationDetail/index.tsx
@@ -271,7 +271,7 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
       if (actionType == 'edit') {
 
         if (currentActived) {
-          const { id, isLeaf } = currentActived;
+          const { id, leaf:isLeaf } = currentActived;
           let details: any = [];
           if (formListRef.current && isLeaf) {
             // 当是叶子结点
@@ -322,7 +322,7 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
 
       if (currentActived) {
 
-        const { isLeaf, levelNum } = currentActived;
+        const { leaf:isLeaf, levelNum } = currentActived;
 
         isLeaf && setReloadMaterialDirData(true); // 点击叶子结点,刷新资料目录数据
         isLeaf && setShowMore(true);// 当新增或编辑第4层时也就是叶子节点,增加表单数据
@@ -533,7 +533,7 @@ const AccreditationDetail: React.FunctionComponent<AccreditationDetailProps> = p
                 <>
 
                   {
-                    detailRuleList.map((item, index) => {
+                    (detailRuleList&&detailRuleList).map((item, index) => {
                       return (
                         <div className='scoreList' key={index}>
                           <div className='score'>

+ 3 - 3
src/pages/GradeHospitalAccreditation/accreditationDetail/typings.d.ts

@@ -1,8 +1,8 @@
 /*
  * @Author: your name
  * @Date: 2021-09-09 16:00:09
- * @LastEditTime: 2021-12-09 16:05:40
- * @LastEditors: Please set LastEditors
+ * @LastEditTime: 2022-09-07 15:07:31
+ * @LastEditors: code4eat awesomedema@gmail.com
  * @Description: In User Settings Edit
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/accreditationDetail/typings.d.ts
  */
@@ -22,7 +22,7 @@ declare namespace API {
         title: string,
         id: string,
         code: string,
-        isLeaf: boolean,
+        leaf: boolean,
         levelNum: number,
         version: string,
         children?: ResultTreeData[]

+ 2 - 2
src/pages/GradeHospitalAccreditation/articleManagement/components/articleDetailModule/index.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2022-03-08 10:41:15
- * @LastEditTime: 2022-06-21 11:05:56
+ * @LastEditTime: 2022-09-07 15:22:49
  * @LastEditors: code4eat awesomedema@gmail.com
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/articleManagement/components/articleDetailModule/index.tsx
@@ -389,7 +389,7 @@ const ArticleDetail = ({ isModeTwo = false }) => {
                                         {
                                             restModelData.leafData?.reviewArticle.pfmReviewArticleDepartList.map((item, index) => {
                                                 return (
-                                                    <span key={index} style={{border:'1px solid #DADEE6',marginRight:2}}>{`${item.responsibilityDepartmentName}|${item.responsibilityUserName}`}</span>
+                                                    <span key={index} style={{marginRight:2}}>{`${item.responsibilityDepartmentName}|${item.responsibilityUserName}`}</span>
                                                 )
                                             })
                                         }