|
|
@@ -8,7 +8,7 @@ import React, { useEffect, useState } from 'react'
|
|
|
import SvgIcon from '@/components/SvgIcon'
|
|
|
import useAutoTable from '@/hooks/useAutoTable'
|
|
|
import consts from '@/consts'
|
|
|
-import { queryContact } from '@/services/contact'
|
|
|
+import { queryContact,apiAddClient } from '@/services/contact'
|
|
|
import styles from './index.less'
|
|
|
import LazyCascader from '@/components/LazyCascader'
|
|
|
|
|
|
@@ -33,7 +33,10 @@ const Contact = props => {
|
|
|
|
|
|
const handleAddClient = async (values) => {
|
|
|
setAddClient({ ...addClient, loading: true })
|
|
|
- // const xx =
|
|
|
+ const { code = -1 } = await apiAddClient(values)
|
|
|
+ if (code === consts.RET_CODE.SUCCESS) {
|
|
|
+ setState({ ...state, data:values })
|
|
|
+ }
|
|
|
// 请求完了
|
|
|
setAddClient({ ...addClient, loading: false, visible: false })
|
|
|
await initData()
|
|
|
@@ -360,7 +363,7 @@ const Contact = props => {
|
|
|
},
|
|
|
actions: [
|
|
|
<LazyCascader onSelect={handleOnselect} key="LazyCascader" />,
|
|
|
- <Button key="button" type="primary" onClick={() => setVisible(true)}>
|
|
|
+ <Button key="button" type="primary" onClick={() => setAddClient({ ...addClient, visible: true })}>
|
|
|
<SvgIcon type="icon-plus" />
|
|
|
联系人
|
|
|
</Button>
|