Browse Source

fix: 主体列表逻辑的优化

outaozhen 3 năm trước cách đây
mục cha
commit
79c26c0634

+ 4 - 1
src/pages/Business/RuleCode/components/LeftMenu/index.less

@@ -4,9 +4,12 @@
   }
   :global(.ant-menu-root.ant-menu-inline) {
     height: calc(100vh - 200px);
-    overflow: auto;
+    overflow: hidden;
     border: none;
   }
+  :global(.ant-menu-root.ant-menu-inline:hover) {
+    overflow: auto;
+  }
   :global(::-webkit-scrollbar) {
     width: 6px;
     height: 6px;

+ 6 - 4
src/pages/Business/RuleCode/components/LeftMenu/index.tsx

@@ -9,7 +9,7 @@ import { approvalTypeMap } from '../..'
 
 type LeftMenuProps = {
   title?: string
-  onChange: (key: string, option: { key: string; label: string }) => void
+  onChange?: (key: string, option: { key: string; label: string }) => void
 }
 
 export const businessOptions = [
@@ -30,10 +30,12 @@ const LeftMenu: React.FC<LeftMenuProps> = ({ title = '业务主体列表', onCha
   const handleOnSelect = ({ key }) => {
     const [value, label] = key.split('_')
     const option = {
-      key: value,
+      value,
       label: approvalTypeMap[label] + '审核'
     }
-    onChange(key, option)
+    if (onChange) {
+      onChange(key, option)
+    }
   }
   useRequest(() => querySubjectList({ current: 1, pageSize: 214000 }), {
     onSuccess: async result => {
@@ -44,7 +46,7 @@ const LeftMenu: React.FC<LeftMenuProps> = ({ title = '业务主体列表', onCha
         activeKey,
         openKeys: [result?.items[0]?.ID]
       })
-      handleOnSelect({ key: activeKey, selectedKeys: activeKey })
+      handleOnSelect({ key: activeKey })
     }
   })
   const rootSubmenuKeys = state.subjectList.map(item => item.ID)