outaozhen 5 năm trước cách đây
mục cha
commit
fe652ff7f5

+ 9 - 2
src/pages/Product/Lock/Lockcount/index.jsx

@@ -1,6 +1,6 @@
-import React from 'react'
+import React, { useState } from 'react'
 import ProTable from '@ant-design/pro-table'
-// import { Table } from 'antd'
+import { useTableScroll } from '@/hooks/useAutoTable'
 
 const Lockcount = () => {
   // const { modalVisible, onCancel } = props;
@@ -44,6 +44,9 @@ const Lockcount = () => {
       ]
     }
   ]
+
+  const [selectKeys, setSelectKeys] = useState([])
+  const { getScrollRef, redoHeight } = useTableScroll(columns, selectKeys)
   return (
     <div>
       <ProTable
@@ -52,6 +55,10 @@ const Lockcount = () => {
         headerTitle="使用统计"
         bordered
         columns={columns}
+        scroll={getScrollRef}
+        onLoadingChange={loadingStatus => {
+          loadingStatus && redoHeight()
+        }}
         // toolbar={{
         //   search: {
         //     allowClear: true

+ 21 - 20
src/pages/Product/Lock/Lockstore/index.jsx

@@ -142,27 +142,28 @@ const Lockstore = () => {
       width: 150
     }
   ]
-  const { getScrollRef } = useTableScroll(columns, selectKeys)
+  const { getScrollRef, redoHeight } = useTableScroll(columns, selectKeys)
   return (
-    <div>
-      <ProTable
-        rowKey={record => record.id}
-        search={false}
-        headerTitle="公共锁库"
-        bordered
-        columns={columns}
-        dataSource={state.data}
-        scroll={getScrollRef}
-        toolbar={{
-          search: {
-            allowClear: true,
-            onSearch: handleSearch,
-            onChange: handleSearchInputChange
-          }
-        }}
-      />
-      {/* <Locks onClose={hideDrawer} visible={state.visible} onCreate={onCreate} id={state.id} /> */}
-    </div>
+    <ProTable
+      rowKey={record => record.id}
+      search={false}
+      headerTitle="公共锁库"
+      bordered
+      columns={columns}
+      dataSource={state.data}
+      onLoadingChange={loadingStatus => {
+        loadingStatus && redoHeight()
+      }}
+      scroll={getScrollRef}
+      toolbar={{
+        search: {
+          allowClear: true,
+          onSearch: handleSearch,
+          onChange: handleSearchInputChange
+        }
+      }}
+    />
+    // {/* <Locks onClose={hideDrawer} visible={state.visible} onCreate={onCreate} id={state.id} /> */}
   )
 }