|
@@ -1,14 +1,14 @@
|
|
|
import React, { useState, useEffect } from 'react'
|
|
import React, { useState, useEffect } from 'react'
|
|
|
import ProTable from '@ant-design/pro-table'
|
|
import ProTable from '@ant-design/pro-table'
|
|
|
import useAutoTable from '@/hooks/useAutoTable'
|
|
import useAutoTable from '@/hooks/useAutoTable'
|
|
|
-import SvgIcon from '@/components/SvgIcon'
|
|
|
|
|
-import { Button, message } from 'antd'
|
|
|
|
|
|
|
+import { message } from 'antd'
|
|
|
import consts from '@/consts'
|
|
import consts from '@/consts'
|
|
|
import { queryCompany, apiAddCompany } from '@/services/company'
|
|
import { queryCompany, apiAddCompany } from '@/services/company'
|
|
|
import LazyCascader from '@/components/LazyCascader'
|
|
import LazyCascader from '@/components/LazyCascader'
|
|
|
import Companys from '@/components/PopContent/Companys'
|
|
import Companys from '@/components/PopContent/Companys'
|
|
|
import AddCompany from '@/pages/Customer/Company/AddCompany'
|
|
import AddCompany from '@/pages/Customer/Company/AddCompany'
|
|
|
import { useModal } from '@/components/Modal'
|
|
import { useModal } from '@/components/Modal'
|
|
|
|
|
+import { formatValues } from '@/components/LazyCascader'
|
|
|
|
|
|
|
|
const Company = props => {
|
|
const Company = props => {
|
|
|
const { toggleDrawer, setDrawerProps } = useModal()
|
|
const { toggleDrawer, setDrawerProps } = useModal()
|
|
@@ -39,7 +39,8 @@ const Company = props => {
|
|
|
}
|
|
}
|
|
|
const handleAddCompany = async values => {
|
|
const handleAddCompany = async values => {
|
|
|
setAddCompany({ ...addCompany, loading: true })
|
|
setAddCompany({ ...addCompany, loading: true })
|
|
|
- const { code = -1 } = await apiAddCompany(values)
|
|
|
|
|
|
|
+ const params = formatValues(values)
|
|
|
|
|
+ const { code = -1 } = await apiAddCompany(params)
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
message.success('新增成功')
|
|
message.success('新增成功')
|
|
|
setState({ ...state, data: values })
|
|
setState({ ...state, data: values })
|
|
@@ -50,7 +51,6 @@ const Company = props => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
- // props.getlist();
|
|
|
|
|
initData()
|
|
initData()
|
|
|
}, [])
|
|
}, [])
|
|
|
const handleSearch = value => {
|
|
const handleSearch = value => {
|
|
@@ -75,13 +75,6 @@ const Company = props => {
|
|
|
toggleDrawer()
|
|
toggleDrawer()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 隐藏drawer
|
|
|
|
|
- // const hideDrawer = () => {
|
|
|
|
|
- // setState({ ...state, visible: false, id: '' })
|
|
|
|
|
- // }
|
|
|
|
|
- // const onCreate = values => {
|
|
|
|
|
- // console.log(values)
|
|
|
|
|
- // }
|
|
|
|
|
const columns = [
|
|
const columns = [
|
|
|
{
|
|
{
|
|
|
title: '客户名称',
|
|
title: '客户名称',
|
|
@@ -202,14 +195,8 @@ const Company = props => {
|
|
|
onSearch: handleSearch
|
|
onSearch: handleSearch
|
|
|
},
|
|
},
|
|
|
actions: [
|
|
actions: [
|
|
|
- <LazyCascader onChange={onDistrictChange} key="LazyCascader" />,
|
|
|
|
|
- <Button
|
|
|
|
|
- key="button"
|
|
|
|
|
- type="primary"
|
|
|
|
|
- onClick={() => setAddCompany({ ...addCompany, visible: true })}>
|
|
|
|
|
- <SvgIcon type="icon-plus" />
|
|
|
|
|
- 客户
|
|
|
|
|
- </Button>
|
|
|
|
|
|
|
+ <LazyCascader onChange={onDistrictChange} key="lazyCascader" />,
|
|
|
|
|
+ <AddCompany onConfirm={handleAddCompany} key="addCompanyBtn" />
|
|
|
]
|
|
]
|
|
|
}}
|
|
}}
|
|
|
scroll={{ x, y }}
|
|
scroll={{ x, y }}
|
|
@@ -223,13 +210,6 @@ const Company = props => {
|
|
|
onChange: (page, size) => initData({ page, size })
|
|
onChange: (page, size) => initData({ page, size })
|
|
|
}}
|
|
}}
|
|
|
/>
|
|
/>
|
|
|
- <AddCompany
|
|
|
|
|
- onConfirm={handleAddCompany}
|
|
|
|
|
- loading={addCompany.loading}
|
|
|
|
|
- visible={addCompany.visible}
|
|
|
|
|
- onCancel={() => setAddCompany({ ...addCompany, visible: false })}
|
|
|
|
|
- />
|
|
|
|
|
- {/* <Companys onClose={hideDrawer} visible={state.visible} onCreate={onCreate} id={state.id} /> */}
|
|
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|