|
@@ -1,12 +1,12 @@
|
|
|
import React, { useState, useEffect } from 'react'
|
|
import React, { useState, useEffect } from 'react'
|
|
|
import { Tag } from 'antd'
|
|
import { Tag } from 'antd'
|
|
|
import ProTable from '@ant-design/pro-table'
|
|
import ProTable from '@ant-design/pro-table'
|
|
|
-import useAutoTable from '@/hooks/useAutoTable'
|
|
|
|
|
import consts from '@/consts'
|
|
import consts from '@/consts'
|
|
|
import { queryLock } from '@/services/lock'
|
|
import { queryLock } from '@/services/lock'
|
|
|
import LocksDetail from '@/pages/product/lock/Lockstore/components/LocksDetail'
|
|
import LocksDetail from '@/pages/product/lock/Lockstore/components/LocksDetail'
|
|
|
import { useDebounceFn } from 'ahooks'
|
|
import { useDebounceFn } from 'ahooks'
|
|
|
import { useModal } from '@/components/Modal'
|
|
import { useModal } from '@/components/Modal'
|
|
|
|
|
+import { useTableScroll } from '@/hooks/useAutoTable'
|
|
|
|
|
|
|
|
// 渲染产品标签
|
|
// 渲染产品标签
|
|
|
export const ProductLabel = ({ data }) => {
|
|
export const ProductLabel = ({ data }) => {
|
|
@@ -27,11 +27,8 @@ export const ProductLabel = ({ data }) => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const Lockstore = () => {
|
|
const Lockstore = () => {
|
|
|
|
|
+ const [selectKeys, setSelectKeys] = useState([])
|
|
|
const { toggleDrawer, setDrawerProps } = useModal()
|
|
const { toggleDrawer, setDrawerProps } = useModal()
|
|
|
- const needSubtractHeight = 48 + 48 + 48 + 64 + 24 + 32 // 需要被裁掉的高度
|
|
|
|
|
- const needSubtractWidth = 48 + 48 + 48 // 需要被裁掉的高度
|
|
|
|
|
-
|
|
|
|
|
- const [x, y] = useAutoTable(needSubtractHeight, needSubtractWidth)
|
|
|
|
|
const [state, setState] = useState({
|
|
const [state, setState] = useState({
|
|
|
data: [],
|
|
data: [],
|
|
|
total: 0,
|
|
total: 0,
|
|
@@ -132,6 +129,7 @@ const Lockstore = () => {
|
|
|
width: 150
|
|
width: 150
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
|
|
|
+ const { getScrollRef } = useTableScroll(columns, selectKeys)
|
|
|
return (
|
|
return (
|
|
|
<div>
|
|
<div>
|
|
|
<ProTable
|
|
<ProTable
|
|
@@ -141,7 +139,7 @@ const Lockstore = () => {
|
|
|
bordered
|
|
bordered
|
|
|
columns={columns}
|
|
columns={columns}
|
|
|
dataSource={state.data}
|
|
dataSource={state.data}
|
|
|
- scroll={{ x, y }}
|
|
|
|
|
|
|
+ scroll={getScrollRef}
|
|
|
toolbar={{
|
|
toolbar={{
|
|
|
search: {
|
|
search: {
|
|
|
allowClear: true,
|
|
allowClear: true,
|