|
@@ -43,9 +43,9 @@ const LockModal = props => {
|
|
|
longle: [],
|
|
longle: [],
|
|
|
client: [],
|
|
client: [],
|
|
|
searchVal: '',
|
|
searchVal: '',
|
|
|
- radioVal: 3,
|
|
|
|
|
- page: 1,
|
|
|
|
|
- size: 10,
|
|
|
|
|
|
|
+ status: 3,
|
|
|
|
|
+ current: 1,
|
|
|
|
|
+ pageSize: 10,
|
|
|
total: 0
|
|
total: 0
|
|
|
})
|
|
})
|
|
|
// 获取软件锁产品列表
|
|
// 获取软件锁产品列表
|
|
@@ -61,7 +61,7 @@ const LockModal = props => {
|
|
|
params
|
|
params
|
|
|
)
|
|
)
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
- if (params?.page === 1) {
|
|
|
|
|
|
|
+ if (params?.current === 1) {
|
|
|
// 请求的是第一页
|
|
// 请求的是第一页
|
|
|
setState({ ...state, longle, total, laoding: false })
|
|
setState({ ...state, longle, total, laoding: false })
|
|
|
} else {
|
|
} else {
|
|
@@ -74,14 +74,15 @@ const LockModal = props => {
|
|
|
params
|
|
params
|
|
|
)
|
|
)
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
- if (params?.page === 1) {
|
|
|
|
|
|
|
+ if (params?.current === 1) {
|
|
|
|
|
+ scrollRef.current?.scrollTo({ top: 0 })
|
|
|
// 请求的是第一页
|
|
// 请求的是第一页
|
|
|
setState({
|
|
setState({
|
|
|
...state,
|
|
...state,
|
|
|
client,
|
|
client,
|
|
|
total,
|
|
total,
|
|
|
laoding: false,
|
|
laoding: false,
|
|
|
- radioVal: params.status || lockTypeEnum.SALE
|
|
|
|
|
|
|
+ ...params
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
|
setState({
|
|
setState({
|
|
@@ -89,28 +90,30 @@ const LockModal = props => {
|
|
|
client: state.client.concat(client),
|
|
client: state.client.concat(client),
|
|
|
total,
|
|
total,
|
|
|
laoding: true,
|
|
laoding: true,
|
|
|
- radioVal: params.status
|
|
|
|
|
|
|
+ ...params
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- useEffect(() => {
|
|
|
|
|
- if (type === lockTypeEnum.CHANGE || type === lockTypeEnum.SALE) {
|
|
|
|
|
- initData({ page: 1, size: 10 })
|
|
|
|
|
- }
|
|
|
|
|
- }, [type])
|
|
|
|
|
const onChange = e => {
|
|
const onChange = e => {
|
|
|
const { value = '' } = e.target || e.currentTarget
|
|
const { value = '' } = e.target || e.currentTarget
|
|
|
if (type === lockTypeEnum.CHANGE || type === lockTypeEnum.SALE) {
|
|
if (type === lockTypeEnum.CHANGE || type === lockTypeEnum.SALE) {
|
|
|
- initData({ search: value, page: state.page, size: state.size })
|
|
|
|
|
|
|
+ initData({ search: value, current: 1, pageSize: state.pageSize })
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const { run: handleInputChange } = useDebounceFn(onChange)
|
|
const { run: handleInputChange } = useDebounceFn(onChange)
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
if (visible) {
|
|
if (visible) {
|
|
|
- setState({ ...state, searchVal: '' })
|
|
|
|
|
|
|
+ if (type === lockTypeEnum.CHANGE) {
|
|
|
|
|
+ initData({ current: 1, pageSize: 10 })
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if (type === lockTypeEnum.SALE) {
|
|
|
|
|
+ initData({ current: 1, pageSize: 10, status: state.status })
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
form.resetFields()
|
|
form.resetFields()
|
|
|
if (type === lockTypeEnum.RECOVER) {
|
|
if (type === lockTypeEnum.RECOVER) {
|
|
|
form.setFieldsValue({ longleId, status })
|
|
form.setFieldsValue({ longleId, status })
|
|
@@ -125,15 +128,15 @@ const LockModal = props => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const checkGroupOnChange = e => {
|
|
const checkGroupOnChange = e => {
|
|
|
- const { value = '' } = e.target
|
|
|
|
|
- initData({ status: value, page: 1, size: 10 })
|
|
|
|
|
|
|
+ const { value = '' } = e.target || {}
|
|
|
|
|
+ initData({ status: value, current: 1, pageSize: 10 })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 关联联系人
|
|
// 关联联系人
|
|
|
const connectClient = async id => {
|
|
const connectClient = async id => {
|
|
|
const { code = -1 } = await apiSoftwareAddLonglelog({
|
|
const { code = -1 } = await apiSoftwareAddLonglelog({
|
|
|
clientId: id,
|
|
clientId: id,
|
|
|
- status: state.radioVal,
|
|
|
|
|
|
|
+ status: state.status,
|
|
|
longleId
|
|
longleId
|
|
|
})
|
|
})
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
@@ -168,7 +171,7 @@ const LockModal = props => {
|
|
|
scrollRef.current.scrollTop
|
|
scrollRef.current.scrollTop
|
|
|
) {
|
|
) {
|
|
|
// 已到底部
|
|
// 已到底部
|
|
|
- initData({ page: state.page + 1, size: state.size })
|
|
|
|
|
|
|
+ initData({ current: state.current + 1, pageSize: state.pageSize, status: state.status })
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -214,7 +217,7 @@ const LockModal = props => {
|
|
|
{type === lockTypeEnum.SALE ? (
|
|
{type === lockTypeEnum.SALE ? (
|
|
|
<>
|
|
<>
|
|
|
<div className="text-center mb-6">
|
|
<div className="text-center mb-6">
|
|
|
- <Radio.Group value={state.radioVal} buttonStyle="solid" onChange={checkGroupOnChange}>
|
|
|
|
|
|
|
+ <Radio.Group value={state.status} buttonStyle="solid" onChange={checkGroupOnChange}>
|
|
|
<Radio.Button value={3}>借出</Radio.Button>
|
|
<Radio.Button value={3}>借出</Radio.Button>
|
|
|
<Radio.Button value={4}>销售</Radio.Button>
|
|
<Radio.Button value={4}>销售</Radio.Button>
|
|
|
<Radio.Button value={9}>赠送</Radio.Button>
|
|
<Radio.Button value={9}>赠送</Radio.Button>
|