|
@@ -1,5 +1,5 @@
|
|
|
import React, { useState, useEffect, useRef } from 'react'
|
|
import React, { useState, useEffect, useRef } from 'react'
|
|
|
-import { Modal, Form, Select, Input, Spin, Button } from 'antd'
|
|
|
|
|
|
|
+import { Modal, Form, Select, Input, Spin, Button, Radio } from 'antd'
|
|
|
import styles from './index.less'
|
|
import styles from './index.less'
|
|
|
import { SearchOutlined } from '@ant-design/icons'
|
|
import { SearchOutlined } from '@ant-design/icons'
|
|
|
import { queryContact } from '@/services/contact'
|
|
import { queryContact } from '@/services/contact'
|
|
@@ -7,6 +7,7 @@ import { queryLock } from '@/services/lock'
|
|
|
import consts from '@/basic/consts'
|
|
import consts from '@/basic/consts'
|
|
|
import { useDebounceFn } from 'ahooks'
|
|
import { useDebounceFn } from 'ahooks'
|
|
|
import { apiSoftwareAddLonglelog } from '@/services/lock'
|
|
import { apiSoftwareAddLonglelog } from '@/services/lock'
|
|
|
|
|
+import { useDispatch } from 'dva'
|
|
|
|
|
|
|
|
export const lockTypeEnum = {
|
|
export const lockTypeEnum = {
|
|
|
SALE: 3,
|
|
SALE: 3,
|
|
@@ -27,6 +28,7 @@ const LockModal = props => {
|
|
|
6: '输入新锁号'
|
|
6: '输入新锁号'
|
|
|
}
|
|
}
|
|
|
const [form] = Form.useForm()
|
|
const [form] = Form.useForm()
|
|
|
|
|
+ const dispatch = useDispatch()
|
|
|
const { Option } = Select
|
|
const { Option } = Select
|
|
|
const scrollRef = useRef()
|
|
const scrollRef = useRef()
|
|
|
const { visible, onCancel, onConfirm, loading, type, longleId, keyNum, status } = props
|
|
const { visible, onCancel, onConfirm, loading, type, longleId, keyNum, status } = props
|
|
@@ -112,6 +114,27 @@ const LockModal = props => {
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
onCancel()
|
|
onCancel()
|
|
|
}
|
|
}
|
|
|
|
|
+ dispatch({
|
|
|
|
|
+ type: 'refresh/commitAction',
|
|
|
|
|
+ payload: 'longle'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 更换软件锁
|
|
|
|
|
+ const connectLongle = async id => {
|
|
|
|
|
+ const { code = -1 } = await apiSoftwareAddLonglelog({
|
|
|
|
|
+ id,
|
|
|
|
|
+ // newLongleId,
|
|
|
|
|
+ status: type,
|
|
|
|
|
+ longleId
|
|
|
|
|
+ })
|
|
|
|
|
+ if (code === consts.RET_CODE.SUCCESS) {
|
|
|
|
|
+ onCancel()
|
|
|
|
|
+ }
|
|
|
|
|
+ dispatch({
|
|
|
|
|
+ type: 'refresh/commitAction',
|
|
|
|
|
+ payload: 'longle'
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const handleListScroll = () => {
|
|
const handleListScroll = () => {
|
|
@@ -163,25 +186,34 @@ const LockModal = props => {
|
|
|
)
|
|
)
|
|
|
}>
|
|
}>
|
|
|
{type === lockTypeEnum.SALE ? (
|
|
{type === lockTypeEnum.SALE ? (
|
|
|
- <div className={styles.modalContainer} ref={scrollRef} onScroll={handleListScroll}>
|
|
|
|
|
- <div className={styles.modalContent}>
|
|
|
|
|
- <Spin spinning={state.laoding}>
|
|
|
|
|
- {state.client.map((item, index) => (
|
|
|
|
|
- <div key={index} className={styles.card}>
|
|
|
|
|
- <div className="zh-flex-sub">{item.clientName}</div>
|
|
|
|
|
- <div className="zh-flex-sub">{item.position}</div>
|
|
|
|
|
- <div className="zh-flex-sub">{item.telephone}</div>
|
|
|
|
|
- <div className="zh-flex-sub zh-justify-between">
|
|
|
|
|
- <span>{item.companyName}</span>
|
|
|
|
|
- <Button type="primary" size="small" onClick={() => connectClient(item.id)}>
|
|
|
|
|
- 选择ta
|
|
|
|
|
- </Button>
|
|
|
|
|
|
|
+ <>
|
|
|
|
|
+ <div className="zh-text-center zh-mg-bottom-25">
|
|
|
|
|
+ <Radio.Group defaultValue="3" buttonStyle="solid">
|
|
|
|
|
+ <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.laoding}>
|
|
|
|
|
+ {state.client.map((item, index) => (
|
|
|
|
|
+ <div key={index} className={styles.card}>
|
|
|
|
|
+ <div className="zh-flex-sub">{item.clientName}</div>
|
|
|
|
|
+ <div className="zh-flex-sub">{item.position}</div>
|
|
|
|
|
+ <div className="zh-flex-sub">{item.telephone}</div>
|
|
|
|
|
+ <div className="zh-flex-sub zh-justify-between">
|
|
|
|
|
+ <span>{item.companyName}</span>
|
|
|
|
|
+ <Button type="primary" size="small" onClick={() => connectClient(item.id)}>
|
|
|
|
|
+ 选择ta
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
- ))}
|
|
|
|
|
- </Spin>
|
|
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </Spin>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
|
|
+ </>
|
|
|
) : null}
|
|
) : null}
|
|
|
{type === lockTypeEnum.CHANGE ? (
|
|
{type === lockTypeEnum.CHANGE ? (
|
|
|
<div className={[styles.modalContainer].join(' ')}>
|
|
<div className={[styles.modalContainer].join(' ')}>
|
|
@@ -192,7 +224,7 @@ const LockModal = props => {
|
|
|
<div className="zh-flex-sub">{item.keyNum}</div>
|
|
<div className="zh-flex-sub">{item.keyNum}</div>
|
|
|
<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" onClick={() => connectLongle(item.id)}>
|
|
|
更换
|
|
更换
|
|
|
</Button>
|
|
</Button>
|
|
|
</div>
|
|
</div>
|