|
@@ -17,6 +17,7 @@ const ConnectCompany = ({ dataId, onSelect, preUrl }) => {
|
|
|
const [state, setState] = useState({
|
|
const [state, setState] = useState({
|
|
|
laoding: true,
|
|
laoding: true,
|
|
|
customer: [],
|
|
customer: [],
|
|
|
|
|
+ noMore: false,
|
|
|
searchVal: '',
|
|
searchVal: '',
|
|
|
current: 1,
|
|
current: 1,
|
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
@@ -89,12 +90,14 @@ const ConnectCompany = ({ dataId, onSelect, preUrl }) => {
|
|
|
scrollRef.current.scrollTop
|
|
scrollRef.current.scrollTop
|
|
|
) {
|
|
) {
|
|
|
// 已到底部
|
|
// 已到底部
|
|
|
-
|
|
|
|
|
|
|
+ if (state.current * state.pageSize > state.total) {
|
|
|
|
|
+ setState({ ...state, noMore: true })
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
state.current * state.pageSize < state.total &&
|
|
state.current * state.pageSize < state.total &&
|
|
|
initData({ current: state.current + 1, pageSize: state.pageSize, search: state.searchVal })
|
|
initData({ current: state.current + 1, pageSize: state.pageSize, search: state.searchVal })
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- // const { run: listScroller } = useThrottleFn(handleListScroll)
|
|
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<CustomModal
|
|
<CustomModal
|
|
@@ -106,7 +109,11 @@ const ConnectCompany = ({ dataId, onSelect, preUrl }) => {
|
|
|
onChange={handleInputChange}
|
|
onChange={handleInputChange}
|
|
|
/>
|
|
/>
|
|
|
}>
|
|
}>
|
|
|
- <div className={styles.modalContent} ref={scrollRef} onScroll={handleListScroll}>
|
|
|
|
|
|
|
+ <div
|
|
|
|
|
+ className={styles.modalContent}
|
|
|
|
|
+ ref={scrollRef}
|
|
|
|
|
+ onScroll={handleListScroll}
|
|
|
|
|
+ style={{ paddingBottom: 0 }}>
|
|
|
<Spin spinning={state.laoding}>
|
|
<Spin spinning={state.laoding}>
|
|
|
{state.customer.map(item => (
|
|
{state.customer.map(item => (
|
|
|
<div key={item.id} className={styles.card}>
|
|
<div key={item.id} className={styles.card}>
|
|
@@ -120,6 +127,7 @@ const ConnectCompany = ({ dataId, onSelect, preUrl }) => {
|
|
|
</div>
|
|
</div>
|
|
|
))}
|
|
))}
|
|
|
</Spin>
|
|
</Spin>
|
|
|
|
|
+ {state.noMore && <div className="text-center text-gray-400 my-4">已到底部</div>}
|
|
|
</div>
|
|
</div>
|
|
|
<div className={styles.modalFooter}>
|
|
<div className={styles.modalFooter}>
|
|
|
<AddCompany onConfirm={addConfirm} dataId={dataId} dataType={preUrl} />
|
|
<AddCompany onConfirm={addConfirm} dataId={dataId} dataType={preUrl} />
|