lanjianrong 5 tahun lalu
induk
melakukan
6f2e8567d1

+ 4 - 2
src/hooks/useAutoTable.js

@@ -60,9 +60,11 @@ export function useTableScroll(columnsRef, selectKeysRef) {
 
     if (!headEl) return
     // Table height from bottom
-    const { bottomIncludeBody } = getViewportOffset(headEl)
+    const { bottomIncludeBody, top } = getViewportOffset(headEl)
+    console.log('top', top)
 
-    const paddingHeight = 32
+    // const margginHeight = 48
+    const paddingHeight = 64
 
     // Pager height
     let paginationHeight = 2

+ 49 - 53
src/pages/Customer/Contact/index.jsx

@@ -358,59 +358,55 @@ const Contact = () => {
   }
 
   return (
-    <>
-      <div className={styles.tableContent}>
-        <ProTable
-          rowKey={record => record.id}
-          bordered
-          columns={columns}
-          dataSource={state.data}
-          summary={() => (
-            <ProTable.Summary.Row>
-              <ProTable.Summary.Cell>统计: 总数</ProTable.Summary.Cell>
-              <ProTable.Summary.Cell />
-              <ProTable.Summary.Cell>未填写: {state.tail.department}</ProTable.Summary.Cell>
-              <ProTable.Summary.Cell>未填写: {state.tail.telephone}</ProTable.Summary.Cell>
-              <ProTable.Summary.Cell>未填写: {state.tail.email}</ProTable.Summary.Cell>
-            </ProTable.Summary.Row>
-          )}
-          pagination={{
-            pageSize: consts.PAGE_SIZE,
-            total: state.total,
-            onChange: (page, size) => initData({ page, size })
-          }}
-          tableAlertRender={({ selectedRowKeys }) => {
-            return <div>2222</div>
-          }}
-          rowSelection={{
-            onChange: hanleRowSelectChange,
-            type: 'checkbox'
-          }}
-          search={false}
-          toolbar={{
-            search: {
-              allowClear: true,
-              onSearch: handleSearch,
-              onChange: handleSearchInputChange
-            },
-            actions: [
-              <LazyCascader onChange={onDistrictChange} key="lazyCascader" />,
-              <Addcontact onConfirm={handleAddClient} key="addContactBtn" />
-            ]
-          }}
-          scroll={getScrollRef}
-          columnsStateMap={columnsStateMap}
-          onColumnsStateChange={map => setColumnsStateMap(map)}
-          headerTitle="联系人"
-          // toolBarRender={() => [
-          //   <Button key="button" type="primary">
-          //     <SvgIcon type="icon-plus" />
-          //     联系人
-          //   </Button>
-          // ]}
-        />
-      </div>
-    </>
+    <ProTable
+      rowKey={record => record.id}
+      bordered
+      columns={columns}
+      dataSource={state.data}
+      summary={() => (
+        <ProTable.Summary.Row>
+          <ProTable.Summary.Cell>统计: 总数</ProTable.Summary.Cell>
+          <ProTable.Summary.Cell />
+          <ProTable.Summary.Cell>未填写: {state.tail.department}</ProTable.Summary.Cell>
+          <ProTable.Summary.Cell>未填写: {state.tail.telephone}</ProTable.Summary.Cell>
+          <ProTable.Summary.Cell>未填写: {state.tail.email}</ProTable.Summary.Cell>
+        </ProTable.Summary.Row>
+      )}
+      pagination={{
+        pageSize: consts.PAGE_SIZE,
+        total: state.total,
+        onChange: (page, size) => initData({ page, size })
+      }}
+      tableAlertRender={({ selectedRowKeys }) => {
+        return <div>2222</div>
+      }}
+      rowSelection={{
+        onChange: hanleRowSelectChange,
+        type: 'checkbox'
+      }}
+      search={false}
+      toolbar={{
+        search: {
+          allowClear: true,
+          onSearch: handleSearch,
+          onChange: handleSearchInputChange
+        },
+        actions: [
+          <LazyCascader onChange={onDistrictChange} key="lazyCascader" />,
+          <Addcontact onConfirm={handleAddClient} key="addContactBtn" />
+        ]
+      }}
+      scroll={getScrollRef}
+      columnsStateMap={columnsStateMap}
+      onColumnsStateChange={map => setColumnsStateMap(map)}
+      headerTitle="联系人"
+      // toolBarRender={() => [
+      //   <Button key="button" type="primary">
+      //     <SvgIcon type="icon-plus" />
+      //     联系人
+      //   </Button>
+      // ]}
+    />
   )
 }
 

+ 0 - 3
src/pages/Customer/Contact/index.less

@@ -1,5 +1,2 @@
 .tableContent {
-  :global(.ant-table-body) {
-    height: calc(100vh - 48px - 48px - 64px - 24px - 32px - 47px);
-  }
 }