|
@@ -1,14 +1,14 @@
|
|
|
import Contacts from '@/components/PopContent/Contacts'
|
|
import Contacts from '@/components/PopContent/Contacts'
|
|
|
-import Addcontact from'@/pages/Customer/Contact/components/AddContact'
|
|
|
|
|
|
|
+import Addcontact from '@/pages/Customer/Contact/components/AddContact'
|
|
|
import ProTable from '@ant-design/pro-table'
|
|
import ProTable from '@ant-design/pro-table'
|
|
|
// import { PageHeaderWrapper } from '@ant-design/pro-layout';
|
|
// import { PageHeaderWrapper } from '@ant-design/pro-layout';
|
|
|
-import { Button, Tag } from 'antd'
|
|
|
|
|
|
|
+import { Button, message, Tag } from 'antd'
|
|
|
import { connect } from 'dva'
|
|
import { connect } from 'dva'
|
|
|
import React, { useEffect, useState } from 'react'
|
|
import React, { useEffect, useState } from 'react'
|
|
|
import SvgIcon from '@/components/SvgIcon'
|
|
import SvgIcon from '@/components/SvgIcon'
|
|
|
import useAutoTable from '@/hooks/useAutoTable'
|
|
import useAutoTable from '@/hooks/useAutoTable'
|
|
|
import consts from '@/consts'
|
|
import consts from '@/consts'
|
|
|
-import { queryContact,apiAddClient } from '@/services/contact'
|
|
|
|
|
|
|
+import { queryContact, apiAddClient } from '@/services/contact'
|
|
|
import styles from './index.less'
|
|
import styles from './index.less'
|
|
|
import LazyCascader from '@/components/LazyCascader'
|
|
import LazyCascader from '@/components/LazyCascader'
|
|
|
|
|
|
|
@@ -21,7 +21,7 @@ const Contact = props => {
|
|
|
|
|
|
|
|
const [state, setState] = useState({
|
|
const [state, setState] = useState({
|
|
|
data: [],
|
|
data: [],
|
|
|
- journal:[],
|
|
|
|
|
|
|
+ journal: [],
|
|
|
total: 0,
|
|
total: 0,
|
|
|
id: '',
|
|
id: '',
|
|
|
visible: false
|
|
visible: false
|
|
@@ -31,11 +31,12 @@ const Contact = props => {
|
|
|
loading: false
|
|
loading: false
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- const handleAddClient = async (values) => {
|
|
|
|
|
|
|
+ const handleAddClient = async values => {
|
|
|
setAddClient({ ...addClient, loading: true })
|
|
setAddClient({ ...addClient, loading: true })
|
|
|
const { code = -1 } = await apiAddClient(values)
|
|
const { code = -1 } = await apiAddClient(values)
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
- setState({ ...state, data:values })
|
|
|
|
|
|
|
+ message.success('新增成功')
|
|
|
|
|
+ setState({ ...state, data: values })
|
|
|
}
|
|
}
|
|
|
// 请求完了
|
|
// 请求完了
|
|
|
setAddClient({ ...addClient, loading: false, visible: false })
|
|
setAddClient({ ...addClient, loading: false, visible: false })
|
|
@@ -44,7 +45,7 @@ const Contact = props => {
|
|
|
const initData = async payload => {
|
|
const initData = async payload => {
|
|
|
const {
|
|
const {
|
|
|
code = -1,
|
|
code = -1,
|
|
|
- data: { client = [], log = [], total = 0 } = { client: [], log:[], total: 0 }
|
|
|
|
|
|
|
+ data: { client = [], log = [], total = 0 } = { client: [], log: [], total: 0 }
|
|
|
} = await queryContact(payload)
|
|
} = await queryContact(payload)
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
setState({ ...state, data: client, journal: log, total })
|
|
setState({ ...state, data: client, journal: log, total })
|
|
@@ -305,20 +306,20 @@ const Contact = props => {
|
|
|
stay: {
|
|
stay: {
|
|
|
show: false
|
|
show: false
|
|
|
},
|
|
},
|
|
|
- keynum:{
|
|
|
|
|
- show:false
|
|
|
|
|
|
|
+ keynum: {
|
|
|
|
|
+ show: false
|
|
|
},
|
|
},
|
|
|
- mark:{
|
|
|
|
|
- show:false
|
|
|
|
|
|
|
+ mark: {
|
|
|
|
|
+ show: false
|
|
|
},
|
|
},
|
|
|
- ride:{
|
|
|
|
|
- show:false
|
|
|
|
|
|
|
+ ride: {
|
|
|
|
|
+ show: false
|
|
|
},
|
|
},
|
|
|
- landmarks:{
|
|
|
|
|
- show:false
|
|
|
|
|
|
|
+ landmarks: {
|
|
|
|
|
+ show: false
|
|
|
},
|
|
},
|
|
|
- address:{
|
|
|
|
|
- show:false
|
|
|
|
|
|
|
+ address: {
|
|
|
|
|
+ show: false
|
|
|
},
|
|
},
|
|
|
dasikong: {
|
|
dasikong: {
|
|
|
show: false
|
|
show: false
|
|
@@ -326,8 +327,8 @@ const Contact = props => {
|
|
|
yanghuyun: {
|
|
yanghuyun: {
|
|
|
show: false
|
|
show: false
|
|
|
},
|
|
},
|
|
|
- chuanpeople:{
|
|
|
|
|
- show:false
|
|
|
|
|
|
|
+ chuanpeople: {
|
|
|
|
|
+ show: false
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
@@ -363,7 +364,10 @@ const Contact = props => {
|
|
|
},
|
|
},
|
|
|
actions: [
|
|
actions: [
|
|
|
<LazyCascader onSelect={handleOnselect} key="LazyCascader" />,
|
|
<LazyCascader onSelect={handleOnselect} key="LazyCascader" />,
|
|
|
- <Button key="button" type="primary" onClick={() => setAddClient({ ...addClient, visible: true })}>
|
|
|
|
|
|
|
+ <Button
|
|
|
|
|
+ key="button"
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ onClick={() => setAddClient({ ...addClient, visible: true })}>
|
|
|
<SvgIcon type="icon-plus" />
|
|
<SvgIcon type="icon-plus" />
|
|
|
联系人
|
|
联系人
|
|
|
</Button>
|
|
</Button>
|
|
@@ -381,7 +385,12 @@ const Contact = props => {
|
|
|
// ]}
|
|
// ]}
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
- <Addcontact onOk={handleAddClient} loading={addClient.loading} visible={addClient.visible} onCancel={() => setAddClient({ ...addClient, visible: false })}/>
|
|
|
|
|
|
|
+ <Addcontact
|
|
|
|
|
+ onConfirm={handleAddClient}
|
|
|
|
|
+ loading={addClient.loading}
|
|
|
|
|
+ visible={addClient.visible}
|
|
|
|
|
+ onCancel={() => setAddClient({ ...addClient, visible: false })}
|
|
|
|
|
+ />
|
|
|
<Contacts onClose={hideDrawer} visible={state.visible} onCreate={onCreate} id={state.id} />
|
|
<Contacts onClose={hideDrawer} visible={state.visible} onCreate={onCreate} id={state.id} />
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|