|
@@ -5,7 +5,7 @@ import { SearchOutlined, CloseOutlined } from '@ant-design/icons'
|
|
|
import { queryContact } from '@/services/contact'
|
|
import { queryContact } from '@/services/contact'
|
|
|
import { queryLock } from '@/services/lock'
|
|
import { queryLock } from '@/services/lock'
|
|
|
import consts from '@/basic/consts'
|
|
import consts from '@/basic/consts'
|
|
|
-import { useDebounceFn, useThrottleFn } from 'ahooks'
|
|
|
|
|
|
|
+import { useDebounceFn } from 'ahooks'
|
|
|
|
|
|
|
|
export const lockTypeEnum = {
|
|
export const lockTypeEnum = {
|
|
|
SALE: 3,
|
|
SALE: 3,
|
|
@@ -34,21 +34,38 @@ const LockModal = props => {
|
|
|
const [state, setState] = useState({
|
|
const [state, setState] = useState({
|
|
|
laoding: true,
|
|
laoding: true,
|
|
|
longle: [],
|
|
longle: [],
|
|
|
|
|
+ client: [],
|
|
|
searchVal: '',
|
|
searchVal: '',
|
|
|
page: 1,
|
|
page: 1,
|
|
|
size: 10,
|
|
size: 10,
|
|
|
total: 0
|
|
total: 0
|
|
|
})
|
|
})
|
|
|
const initData = async params => {
|
|
const initData = async params => {
|
|
|
- const { data: { longle, total } = { longle: [], total: 0 }, code = -1 } = await queryLock(
|
|
|
|
|
- params
|
|
|
|
|
- )
|
|
|
|
|
- if (code === consts.RET_CODE.SUCCESS) {
|
|
|
|
|
- setState({ ...state, longle: state.longle.concat(longle), total, laoding: false })
|
|
|
|
|
|
|
+ if (type !== lockTypeEnum.UPDATE) {
|
|
|
|
|
+ const { data: { longle, total } = { longle: [], total: 0 }, code = -1 } = await queryLock(
|
|
|
|
|
+ params
|
|
|
|
|
+ )
|
|
|
|
|
+ if (code === consts.RET_CODE.SUCCESS) {
|
|
|
|
|
+ setState({ ...state, longle: state.longle.concat(longle), total, laoding: false })
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (type !== lockTypeEnum.SALE) {
|
|
|
|
|
+ const { data: { client, total } = { client: [], total: 0 }, code = -1 } = await queryContact(
|
|
|
|
|
+ params
|
|
|
|
|
+ )
|
|
|
|
|
+ if (code === consts.RET_CODE.SUCCESS) {
|
|
|
|
|
+ setState({ ...state, client: state.client.concat(client), total, laoding: false })
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
- initData({ page: 1, size: 10 })
|
|
|
|
|
|
|
+ if (type !== lockTypeEnum.UPDATE) {
|
|
|
|
|
+ initData({ page: 1, size: 10 })
|
|
|
|
|
+ }
|
|
|
|
|
+ if (type !== lockTypeEnum.SALE) {
|
|
|
|
|
+ initData({ page: 1, size: 10 })
|
|
|
|
|
+ }
|
|
|
|
|
+ // initData({ page: 1, size: 10 })
|
|
|
}, [])
|
|
}, [])
|
|
|
const onChange = e => {
|
|
const onChange = e => {
|
|
|
const { value = '' } = e.target || e.currentTarget
|
|
const { value = '' } = e.target || e.currentTarget
|
|
@@ -65,9 +82,11 @@ const LockModal = props => {
|
|
|
}
|
|
}
|
|
|
}, [visible, type])
|
|
}, [visible, type])
|
|
|
|
|
|
|
|
- const handleOk = values => {
|
|
|
|
|
- values.status = type
|
|
|
|
|
- onConfirm(values)
|
|
|
|
|
|
|
+ const handleonOk = () => {
|
|
|
|
|
+ form.validateFields().then(values => {
|
|
|
|
|
+ values.status = type
|
|
|
|
|
+ onConfirm(values)
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
@@ -93,7 +112,39 @@ const LockModal = props => {
|
|
|
// })
|
|
// })
|
|
|
// }}
|
|
// }}
|
|
|
width={800}
|
|
width={800}
|
|
|
- footer={null}>
|
|
|
|
|
|
|
+ footer={
|
|
|
|
|
+ type !== lockTypeEnum.UPDATE &&
|
|
|
|
|
+ type !== lockTypeEnum.RECOVER &&
|
|
|
|
|
+ type !== lockTypeEnum.REMARK ? null : (
|
|
|
|
|
+ <div className={['zh-text-right', styles.modalFooter].join(' ')}>
|
|
|
|
|
+ <Button className="zh-mg-right-10" onClick={onCancel}>
|
|
|
|
|
+ 取消
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ <Button key="submit" type="primary" loading={loading} onClick={handleonOk}>
|
|
|
|
|
+ 确定
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )
|
|
|
|
|
+ }>
|
|
|
|
|
+ {type === lockTypeEnum.SALE ? (
|
|
|
|
|
+ <div className={[styles.modalContainer].join(' ')}>
|
|
|
|
|
+ <div className={styles.modalContent}>
|
|
|
|
|
+ <Spin spinning={state.laoding}>
|
|
|
|
|
+ {state.longle.map(item => (
|
|
|
|
|
+ <div key={item.id} className={styles.card}>
|
|
|
|
|
+ <div className="zh-flex-sub">{item.clientName}</div>
|
|
|
|
|
+ <div className="zh-flex-sub zh-justify-between">
|
|
|
|
|
+ <span>{item.companyName}</span>
|
|
|
|
|
+ <Button type="primary" size="small">
|
|
|
|
|
+ 选择ta
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </Spin>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ ) : null}
|
|
|
{type === lockTypeEnum.CHANGE ? (
|
|
{type === lockTypeEnum.CHANGE ? (
|
|
|
<div className={[styles.modalContainer].join(' ')}>
|
|
<div className={[styles.modalContainer].join(' ')}>
|
|
|
<div className={styles.modalContent}>
|
|
<div className={styles.modalContent}>
|
|
@@ -104,7 +155,7 @@ const LockModal = props => {
|
|
|
<div className="zh-flex-sub zh-justify-between">
|
|
<div className="zh-flex-sub zh-justify-between">
|
|
|
<span>{item.product}</span>
|
|
<span>{item.product}</span>
|
|
|
<Button type="primary" size="small">
|
|
<Button type="primary" size="small">
|
|
|
- 关联
|
|
|
|
|
|
|
+ 更换
|
|
|
</Button>
|
|
</Button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -123,14 +174,6 @@ const LockModal = props => {
|
|
|
<Option key="广东算量新定额">广东算量新定额</Option>
|
|
<Option key="广东算量新定额">广东算量新定额</Option>
|
|
|
</Select>
|
|
</Select>
|
|
|
</Form.Item>
|
|
</Form.Item>
|
|
|
- <div className={['zh-text-right', styles.modalFooter].join(' ')}>
|
|
|
|
|
- <Button className="zh-mg-right-10" onClick={onCancel}>
|
|
|
|
|
- 取消
|
|
|
|
|
- </Button>
|
|
|
|
|
- <Button key="submit" type="primary" loading={loading} onClick={handleOk}>
|
|
|
|
|
- 确定
|
|
|
|
|
- </Button>
|
|
|
|
|
- </div>
|
|
|
|
|
</>
|
|
</>
|
|
|
) : null}
|
|
) : null}
|
|
|
|
|
|
|
@@ -139,14 +182,6 @@ const LockModal = props => {
|
|
|
<Form.Item name="mark" label="备注">
|
|
<Form.Item name="mark" label="备注">
|
|
|
<Input.TextArea />
|
|
<Input.TextArea />
|
|
|
</Form.Item>
|
|
</Form.Item>
|
|
|
- <div className={['zh-text-right', styles.modalFooter].join(' ')}>
|
|
|
|
|
- <Button className="zh-mg-right-10" onClick={onCancel}>
|
|
|
|
|
- 取消
|
|
|
|
|
- </Button>
|
|
|
|
|
- <Button key="submit" type="primary" loading={loading} onClick={handleOk}>
|
|
|
|
|
- 确定
|
|
|
|
|
- </Button>
|
|
|
|
|
- </div>
|
|
|
|
|
</>
|
|
</>
|
|
|
) : null}
|
|
) : null}
|
|
|
|
|
|
|
@@ -158,14 +193,6 @@ const LockModal = props => {
|
|
|
<Form.Item name="longleId" hidden>
|
|
<Form.Item name="longleId" hidden>
|
|
|
<Input />
|
|
<Input />
|
|
|
</Form.Item>
|
|
</Form.Item>
|
|
|
- <div className={['zh-text-right', styles.modalFooter].join(' ')}>
|
|
|
|
|
- <Button className="zh-mg-right-10" onClick={onCancel}>
|
|
|
|
|
- 取消
|
|
|
|
|
- </Button>
|
|
|
|
|
- <Button key="submit" type="primary" loading={loading} onClick={handleOk}>
|
|
|
|
|
- 确定
|
|
|
|
|
- </Button>
|
|
|
|
|
- </div>
|
|
|
|
|
</>
|
|
</>
|
|
|
) : null}
|
|
) : null}
|
|
|
</Form>
|
|
</Form>
|