|
|
@@ -45,6 +45,7 @@ const LockModal = props => {
|
|
|
client: [],
|
|
|
searchVal: '',
|
|
|
status: 3,
|
|
|
+ noMore: false,
|
|
|
current: 1,
|
|
|
pageSize: 10,
|
|
|
total: 0
|
|
|
@@ -58,22 +59,35 @@ const LockModal = props => {
|
|
|
const initData = async params => {
|
|
|
setState({ ...state, loading: true })
|
|
|
if (type === lockTypeEnum.CHANGE) {
|
|
|
- const { data: { longle, total } = { longle: [], total: 0 }, code = -1 } = await queryLock(
|
|
|
- params
|
|
|
- )
|
|
|
+ const { data: { longle, total } = { longle: [], total: 0 }, code = -1 } = await queryLock({
|
|
|
+ ...params,
|
|
|
+ waiver: true
|
|
|
+ })
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
if (params?.current === 1) {
|
|
|
+ scrollRef.current?.scrollTo({ top: 0 })
|
|
|
// 请求的是第一页
|
|
|
- setState({ ...state, longle, total, laoding: false })
|
|
|
+ setState({ ...state, longle, total, laoding: false, ...params })
|
|
|
} else {
|
|
|
+<<<<<<< HEAD
|
|
|
setState({ ...state, longle: state.longle.concat(longle), total, loading: false })
|
|
|
+=======
|
|
|
+ setState({
|
|
|
+ ...state,
|
|
|
+ longle: state.longle.concat(longle),
|
|
|
+ total,
|
|
|
+ laoding: false,
|
|
|
+ ...params
|
|
|
+ })
|
|
|
+>>>>>>> 75ff7d4... fix: 锁库数据权限问题
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (type === lockTypeEnum.SALE) {
|
|
|
- const { data: { client, total } = { client: [], total: 0 }, code = -1 } = await queryClient(
|
|
|
- params
|
|
|
- )
|
|
|
+ const { data: { client, total } = { client: [], total: 0 }, code = -1 } = await queryClient({
|
|
|
+ ...params,
|
|
|
+ waiver: true
|
|
|
+ })
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
if (params?.current === 1) {
|
|
|
scrollRef.current?.scrollTo({ top: 0 })
|
|
|
@@ -172,7 +186,13 @@ const LockModal = props => {
|
|
|
scrollRef.current.scrollTop
|
|
|
) {
|
|
|
// 已到底部
|
|
|
- initData({ current: state.current + 1, pageSize: state.pageSize, status: state.status })
|
|
|
+ if (state.current * state.pageSize > state.total) {
|
|
|
+ setState({ ...state, noMore: true })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const params = { current: state.current + 1, pageSize: state.pageSize }
|
|
|
+ if (type === lockTypeEnum.SALE) params.status = state.status
|
|
|
+ state.current * state.pageSize < state.total && initData(params)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -216,18 +236,24 @@ const LockModal = props => {
|
|
|
)
|
|
|
}>
|
|
|
{type === lockTypeEnum.SALE ? (
|
|
|
- <>
|
|
|
- <div className="text-center mb-6">
|
|
|
- <Radio.Group value={state.status} buttonStyle="solid" onChange={checkGroupOnChange}>
|
|
|
- <Radio.Button value={3}>借出</Radio.Button>
|
|
|
- <Radio.Button value={4}>销售</Radio.Button>
|
|
|
- <Radio.Button value={9}>赠送</Radio.Button>
|
|
|
- </Radio.Group>
|
|
|
- </div>
|
|
|
- <div className={styles.modalContainer} ref={scrollRef} onScroll={handleListScroll}>
|
|
|
- <div className={styles.modalContent}>
|
|
|
- <Spin spinning={state.loading}>
|
|
|
- {state.client.map((item, index) => (
|
|
|
+ <div className="text-center mb-6">
|
|
|
+ <Radio.Group value={state.status} buttonStyle="solid" onChange={checkGroupOnChange}>
|
|
|
+ <Radio.Button value={3}>借出</Radio.Button>
|
|
|
+ <Radio.Button value={4}>销售</Radio.Button>
|
|
|
+ <Radio.Button value={9}>赠送</Radio.Button>
|
|
|
+ </Radio.Group>
|
|
|
+ </div>
|
|
|
+ ) : null}
|
|
|
+ {type === lockTypeEnum.CHANGE || type === lockTypeEnum.SALE ? (
|
|
|
+ <div
|
|
|
+ className={styles.modalContainer}
|
|
|
+ ref={scrollRef}
|
|
|
+ onScroll={handleListScroll}
|
|
|
+ style={{ paddingBottom: 0 }}>
|
|
|
+ <div className={styles.modalContent}>
|
|
|
+ <Spin spinning={state.loading}>
|
|
|
+ {type === lockTypeEnum.SALE &&
|
|
|
+ state.client.map((item, index) => (
|
|
|
<div key={index} className={styles.card}>
|
|
|
<span className="w-1/6">{item.clientName}</span>
|
|
|
<span className="w-1/6">{item.position}</span>
|
|
|
@@ -240,30 +266,20 @@ const LockModal = props => {
|
|
|
</span>
|
|
|
</div>
|
|
|
))}
|
|
|
- </Spin>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </>
|
|
|
- ) : null}
|
|
|
- {type === lockTypeEnum.CHANGE ? (
|
|
|
- <div
|
|
|
- className={[styles.modalContainer].join(' ')}
|
|
|
- ref={scrollRef}
|
|
|
- onScroll={handleListScroll}>
|
|
|
- <div className={styles.modalContent}>
|
|
|
- <Spin spinning={state.loading}>
|
|
|
- {state.longle.map(item => (
|
|
|
- <div key={item.id} className={styles.card}>
|
|
|
- <div className="w-1/3">{item.keyNum}</div>
|
|
|
- <div className="w-2/3 flex justify-between">
|
|
|
- <span>{item.product}</span>
|
|
|
- <Button type="primary" size="small" onClick={() => connectLongle(item.id)}>
|
|
|
- 更换
|
|
|
- </Button>
|
|
|
+ {type === lockTypeEnum.CHANGE &&
|
|
|
+ state.longle.map(item => (
|
|
|
+ <div key={item.id} className={styles.card}>
|
|
|
+ <div className="w-1/3">{item.keyNum}</div>
|
|
|
+ <div className="w-2/3 flex justify-between">
|
|
|
+ <span>{item.product}</span>
|
|
|
+ <Button type="primary" size="small" onClick={() => connectLongle(item.id)}>
|
|
|
+ 更换
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- ))}
|
|
|
+ ))}
|
|
|
</Spin>
|
|
|
+ {state.noMore && <div className="text-center text-gray-400 my-4">已到底部</div>}
|
|
|
</div>
|
|
|
</div>
|
|
|
) : null}
|
|
|
@@ -315,7 +331,6 @@ const LockModal = props => {
|
|
|
)
|
|
|
}
|
|
|
|
|
|
-// export default LockModal
|
|
|
export default connect(({ lock }) => ({
|
|
|
prodList: lock.prodList
|
|
|
}))(LockModal)
|