Bladeren bron

feat: 优化AnimateContent,增加对面包屑可能带有title的高度计算

lanjianrong 3 jaren geleden
bovenliggende
commit
e59041145c

+ 6 - 2
src/components/AnimateContent/index.tsx

@@ -15,6 +15,10 @@ const AnimateContent: FC<PropsWithChildren<AnimateContentProps>> = ({
   children,
   ...others
 }) => {
+  const headerHeight = document.querySelector('.ant-page-header-heading')?.clientHeight + 8 || 0
+  const breadcrumbHeight = disableBreadcrumb ? 0 : 50
+  console.log(headerHeight + breadcrumbHeight)
+
   return (
     <div className={styles.pageContainer}>
       <Drawer
@@ -25,9 +29,9 @@ const AnimateContent: FC<PropsWithChildren<AnimateContentProps>> = ({
         onClose={() => onVisibleChange(false)}
         mask={false}
         width="calc(100vw - 256px)"
-        style={{ right: '24px', top: `${!disableBreadcrumb ? 72 + 50 : 72}px` }}
+        style={{ right: '24px', top: `${72 + headerHeight + breadcrumbHeight}px` }}
         contentWrapperStyle={{
-          height: `calc(100vh - 96px ${!disableBreadcrumb ? '- 50px' : ''})`
+          height: `calc(100vh - 96px - ${headerHeight + breadcrumbHeight}px)`
         }}
         // closeIcon={<Button onClick={() => onVisibleChange(false)}>返回</Button>}>
       >

+ 5 - 5
src/pages/Institutions/Company/Detail/components/Staff.tsx

@@ -54,11 +54,11 @@ const Staff: React.FC<ListProps> = ({ schema, dataID, dispatch, accountTypeList
       dataIndex: 'name',
       title: '姓名'
     },
-    {
-      dataIndex: 'password',
-      key: 'password',
-      title: '密码'
-    },
+    // {
+    //   dataIndex: 'password',
+    //   key: 'password',
+    //   title: '密码'
+    // },
     {
       dataIndex: 'gender',
       key: 'gender',

+ 2 - 2
src/pages/Institutions/Company/Detail/index.tsx

@@ -23,7 +23,7 @@ export enum TabEnum {
 type CompanyDetailProps = RouteComponentProps
 
 const CompanyDetail: React.FC<CompanyDetailProps> = ({ location }) => {
-  const { dataID, structureType } = location.state
+  const { dataID, structureType, name } = location.state
 
   const menuMap: Record<string, React.ReactNode> = {
     [TabEnum.STAFF]: '人员管理',
@@ -80,7 +80,7 @@ const CompanyDetail: React.FC<CompanyDetailProps> = ({ location }) => {
   }
 
   return (
-    <PageContainer title={false}>
+    <PageContainer title={name}>
       <GridContent>
         <div
           className={styles.main}

+ 3 - 1
src/pages/Institutions/Company/List/index.tsx

@@ -67,7 +67,9 @@ const CompanyList: React.FC<ListProps> = ({ base, dispatch, pTypeList }) => {
       title: '企事业单位名称',
       render: (name, record) => (
         <span
-          onClick={() => goToDetail({ dataID: record.ID, structureType: state.structureType })}
+          onClick={() =>
+            goToDetail({ dataID: record.ID, structureType: state.structureType, name: record.name })
+          }
           className="text-primary cursor-pointer">
           {name}
         </span>