Procházet zdrojové kódy

菜单调整为默认展开

code4eat před 3 roky
rodič
revize
1ec0cb5495

+ 1 - 1
.prettierrc

@@ -1,7 +1,7 @@
 {
   "singleQuote": true,
   "trailingComma": "all",
-  "printWidth": 100,
+  "printWidth": 200,
   "overrides": [
     {
       "files": ".prettierrc",

+ 3 - 9
src/app.tsx

@@ -7,7 +7,7 @@
  * @FilePath: /KC-MiddlePlatform/src/app.ts
  */
 
-import React, { useState, useRef } from 'react';
+import { useState } from 'react';
 import { PageLoading } from '@ant-design/pro-layout';
 import { notification, Modal } from 'antd';
 import { RequestConfig, history } from 'umi';
@@ -61,9 +61,7 @@ export async function getInitialState(): Promise<InitialStateType> {
   };
 
   const getAppIcon = (name: string) => {
-    return Platforms.filter((i) => i.name == name).length > 0
-      ? Platforms.filter((i) => i.name == name)[0].logo
-      : '';
+    return Platforms.filter((i) => i.name == name).length > 0 ? Platforms.filter((i) => i.name == name)[0].logo : '';
   };
 
   //获取当前账号所有子应用列表
@@ -261,11 +259,7 @@ export function useQiankunStateForSlave() {
   };
 }
 
-export const layout = ({
-  initialState: { userData },
-}: {
-  initialState: InitialStateType;
-}): BasicLayoutProps => {
+export const layout = ({ initialState: { userData } }: { initialState: InitialStateType }): BasicLayoutProps => {
   return {
     headerRender: false,
     rightContentRender: () => <>right</>,

+ 10 - 42
src/components/topBar/index.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-11-16 09:12:37
- * @LastEditTime: 2022-03-09 10:26:06
+ * @LastEditTime: 2022-03-10 09:45:59
  * @LastEditors: Please set LastEditors
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: /KC-MiddlePlatform/src/pages/index/components/topBar/index.tsx
@@ -32,16 +32,7 @@ interface TopBarType {
 }
 
 const TopBar: React.FC<TopBarType> = (props) => {
-  const {
-    onTabChange,
-    sysList = [],
-    openedTabs = [],
-    currentTab,
-    userPannelTabClick,
-    onCloseTab,
-    onTabClick,
-    userData,
-  } = props;
+  const { onTabChange, sysList = [], openedTabs = [], currentTab, userPannelTabClick, onCloseTab, onTabClick, userData } = props;
   const [systemTabs, setSystemTabs] = useState<TopBar.Tab[]>([]); //已打开的tab
   const [currentSelectedTab, setCurrentSelectedTab] = useState<TopBar.Tab>();
   const [ifOpenPannel, setIfOpenPannel] = useState(false);
@@ -109,8 +100,8 @@ const TopBar: React.FC<TopBarType> = (props) => {
     console.log({ openedTabs });
     if (openedTabs.length == 1) {
       //当有且仅当只有一个的时候,默认激活
-      // setCurrentSelectedTab(openedTabs[0]);
-      // history.push(openedTabs[0].path);
+      setCurrentSelectedTab(openedTabs[0]);
+      history.push(openedTabs[0].path);
     }
     if (openedTabs.length == 0) {
       //当所有tab都关闭时
@@ -135,18 +126,11 @@ const TopBar: React.FC<TopBarType> = (props) => {
       <div className={styles.logoWrap}>
         <img className={styles.logo} src={logo} />
       </div>
-      <div
-        className={ifOpenPannel ? `${styles.platformMenu} ${styles.on}` : `${styles.platformMenu}`}
-        onClick={() => setIfOpenPannel(!ifOpenPannel)}
-      >
+      <div className={ifOpenPannel ? `${styles.platformMenu} ${styles.on}` : `${styles.platformMenu}`} onClick={() => setIfOpenPannel(!ifOpenPannel)}>
         <img src={platFormMenuIcon} />
         <div className={styles.systemPannel}>
           {sysList.map((item) => (
-            <div
-              key={item.id}
-              className={styles.systemList}
-              onClick={() => _systemListClickHandle(item)}
-            >
+            <div key={item.id} className={styles.systemList} onClick={() => _systemListClickHandle(item)}>
               <img src={item.icon} alt="" />
               <div className={styles.systemListName}>{item.name}</div>
             </div>
@@ -158,13 +142,7 @@ const TopBar: React.FC<TopBarType> = (props) => {
        */}
       <div className={styles.tabWrap}>
         {systemTabs.map((item) => (
-          <div
-            key={item.id}
-            className={
-              currentSelectedTab?.id == item.id ? `${styles.tab} ${styles.on}` : `${styles.tab}`
-            }
-            onClick={() => _systemTabClickHandle(item)}
-          >
+          <div key={item.id} className={currentSelectedTab?.id == item.id ? `${styles.tab} ${styles.on}` : `${styles.tab}`} onClick={() => _systemTabClickHandle(item)}>
             <div className={styles.tabText}>{item.name} </div>
             <div className={styles.closeIconWrap}>
               <img src={tabCloseIcon} onClick={(e) => closeTabHandle(item, e)} alt="close" />
@@ -174,23 +152,13 @@ const TopBar: React.FC<TopBarType> = (props) => {
       </div>
       <div className={styles.userRelaInfoWrap}>
         <div className={styles.notification}>
-          <img
-            className={styles.notificationIcon}
-            src={require('../../../public/images/notificationIcon.png')}
-          />
+          <img className={styles.notificationIcon} src={require('../../../public/images/notificationIcon.png')} />
         </div>
-        <Tooltip
-          title={<UserPannel />}
-          color="#fff"
-          onVisibleChange={(visible) => setArrowRotate(visible)}
-        >
+        <Tooltip title={<UserPannel />} color="#fff" onVisibleChange={(visible) => setArrowRotate(visible)}>
           <div className={styles.user}>
             <img className={styles.avator} src={require('../../../public/images/Mask.png')} />
             <span className={styles.name}>{userData?.name}</span>
-            <img
-              className={arrowRotate ? `${styles.arrow} ${styles.on}` : `${styles.arrow}`}
-              src={require('../../../public/images/arrow_white.png')}
-            />
+            <img className={arrowRotate ? `${styles.arrow} ${styles.on}` : `${styles.arrow}`} src={require('../../../public/images/arrow_white.png')} />
           </div>
         </Tooltip>
       </div>

+ 5 - 9
src/pages/platform/_layout.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2022-01-06 15:25:39
- * @LastEditTime: 2022-03-09 17:16:38
+ * @LastEditTime: 2022-03-10 16:53:56
  * @LastEditors: Please set LastEditors
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: /KC-MiddlePlatform/src/pages/platform/_layout.tsx
@@ -15,14 +15,7 @@ import './index.less';
 import { TreeItemType } from '@/utils';
 import { SpacicalPageParamsType } from '@/typings';
 
-export default function Layout({
-  children,
-  location,
-  route,
-  history,
-  match,
-  ...rest
-}: IRouteComponentProps) {
+export default function Layout({ children, location, route, history, match, ...rest }: IRouteComponentProps) {
   const { initialState, setInitialState } = useModel('@@initialState');
 
   return (
@@ -46,6 +39,9 @@ export default function Layout({
           {dom}
         </a>
       )}
+      menuProps={{
+        openKeys: ['1476445565880504320'],
+      }}
       menu={{
         autoClose: false,
         params: {},

+ 10 - 29
src/pages/platform/setting/roleManage/modals/modal.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2022-01-12 17:11:11
- * @LastEditTime: 2022-03-09 17:11:50
+ * @LastEditTime: 2022-03-10 16:36:29
  * @LastEditors: Please set LastEditors
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/userManage/modal.tsx
@@ -25,13 +25,7 @@ interface ActModalProps extends roleManageModelState {
   dispatch: Dispatch | undefined;
 }
 
-const ActModal: React.FC<ActModalProps> = ({
-  dispatch,
-  isShowModal,
-  tableAct,
-  currentEdit,
-  hospId,
-}) => {
+const ActModal: React.FC<ActModalProps> = ({ dispatch, isShowModal, tableAct, currentEdit, hospId }) => {
   const onVisibleChangeHandle = (bool: boolean) => {
     // console.log({bool});
     if (!bool) {
@@ -51,11 +45,7 @@ const ActModal: React.FC<ActModalProps> = ({
         });
     }
 
-    if (
-      tableAct == TableActType.EDIT ||
-      tableAct == TableActType.EDITMENU ||
-      tableAct == TableActType.EDITRELAUSER
-    ) {
+    if (tableAct == TableActType.EDIT || tableAct == TableActType.EDITMENU || tableAct == TableActType.EDITRELAUSER) {
       dispatch &&
         dispatch({
           type: 'roleManageModel/postEditData',
@@ -154,27 +144,18 @@ const ActModal: React.FC<ActModalProps> = ({
             width="md"
             name="youshuUserId"
             request={async () => {
-              if (currentEdit) {
-                const { roleId } = currentEdit;
-                const resp = await getYoushuUsers(roleId);
-                if (resp) {
-                  return resp.map((t) => ({
-                    label: t.account,
-                    value: t.id,
-                  }));
-                }
+              const resp = await getYoushuUsers();
+              if (resp) {
+                return resp.map((t) => ({
+                  label: t.name,
+                  value: t.id,
+                }));
               }
               return [];
             }}
           />
 
-          <ProFormTextArea
-            name="remark"
-            label="备注"
-            placeholder="请输入名称"
-            width="md"
-            fieldProps={{}}
-          />
+          <ProFormTextArea name="remark" label="备注" placeholder="请输入名称" width="md" fieldProps={{}} />
         </>
       )}
     </KCModal>

+ 7 - 7
src/service/user.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2022-01-12 09:55:49
- * @LastEditTime: 2022-03-03 11:24:07
+ * @LastEditTime: 2022-03-10 16:36:24
  * @LastEditors: Please set LastEditors
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: /KC-MiddlePlatform/src/service/user.ts
@@ -99,14 +99,14 @@ export const resetUserPwd = async (data: { userId: number }) => {
 //获取有数用户列表
 export type GetYoushuUsersRepType = {
   id: number;
-  account: string;
-  password: string;
-  isDefault: number;
+  name: string;
+  // account: string;
+  // password: string;
+  // isDefault: number;
 };
 
-export const getYoushuUsers = async (roleId: number) => {
-  return request<GetYoushuUsersRepType[]>('/master/centerSys/role/getYoushuUsersByRole', {
+export const getYoushuUsers = async () => {
+  return request<GetYoushuUsersRepType[]>('/master/centerSys/role/getYoushuUsersByHospId', {
     method: 'GET',
-    params: { roleId },
   });
 };