|
@@ -1,13 +1,31 @@
|
|
|
-import { Tabs, Button, Table } from 'antd'
|
|
|
|
|
-import React, { useEffect,useState } from 'react'
|
|
|
|
|
|
|
+import { message, Tabs, Button, Table } from 'antd'
|
|
|
|
|
+import React, { useEffect, useState } from 'react'
|
|
|
|
|
+import consts from '@/consts'
|
|
|
import SvgIcon from '@/components/SvgIcon'
|
|
import SvgIcon from '@/components/SvgIcon'
|
|
|
|
|
+import { apiAddService } from '@/services/contact'
|
|
|
|
|
+import AddRecord from '@/components/PopContent/Contacts/AddRecord'
|
|
|
// import { connect } from 'umi'
|
|
// import { connect } from 'umi'
|
|
|
|
|
|
|
|
const ContanctTabList = props => {
|
|
const ContanctTabList = props => {
|
|
|
|
|
+ const [state, setState] = useState({
|
|
|
|
|
+ visible: false
|
|
|
|
|
+ })
|
|
|
const [addService, setAddService] = useState({
|
|
const [addService, setAddService] = useState({
|
|
|
visible: false,
|
|
visible: false,
|
|
|
loading: false
|
|
loading: false
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+ const handleAddService = async values => {
|
|
|
|
|
+ setAddService({ ...addService, loading: true })
|
|
|
|
|
+ const { code = -1 } = await apiAddService(values)
|
|
|
|
|
+ if (code === consts.RET_CODE.SUCCESS) {
|
|
|
|
|
+ message.success('新增成功')
|
|
|
|
|
+ setState({ ...state, data: values })
|
|
|
|
|
+ }
|
|
|
|
|
+ // 请求完了
|
|
|
|
|
+ setAddService({ ...addService, loading: false, visible: false })
|
|
|
|
|
+ await initData()
|
|
|
|
|
+ }
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
// const curinglisData = () => {
|
|
// const curinglisData = () => {
|
|
|
// const { dispatch } = props
|
|
// const { dispatch } = props
|
|
@@ -59,10 +77,20 @@ const ContanctTabList = props => {
|
|
|
{/* <Button type="primary" ghost>
|
|
{/* <Button type="primary" ghost>
|
|
|
<SvgIcon type="icon-link" /> 绑定加密锁
|
|
<SvgIcon type="icon-link" /> 绑定加密锁
|
|
|
</Button> */}
|
|
</Button> */}
|
|
|
- <Button type="primary" ghost onClick={() => setAddService({ ...addService, visible: true })}>
|
|
|
|
|
|
|
+ <Button
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ ghost
|
|
|
|
|
+ onClick={() => setAddService({ ...setAddService, visible: true })}
|
|
|
|
|
+ >
|
|
|
<SvgIcon type="icon-plus" /> 添加服务记录
|
|
<SvgIcon type="icon-plus" /> 添加服务记录
|
|
|
</Button>
|
|
</Button>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <AddRecord
|
|
|
|
|
+ onConfirm={handleAddService}
|
|
|
|
|
+ loading={addService.loading}
|
|
|
|
|
+ visible={addService.visible}
|
|
|
|
|
+ onCancel={() => setAddService({ ...addService, visible: false })}
|
|
|
|
|
+ />
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|