|
|
@@ -1,114 +1,77 @@
|
|
|
-import React from 'react'
|
|
|
-import { Form, Input, Modal, Row, Col, Select } from 'antd'
|
|
|
+import React, { useEffect } from 'react'
|
|
|
+import { Form, Row, Col, Button } from 'antd'
|
|
|
import LazyCascader from '@/components/LazyCascader'
|
|
|
-import { useForm } from 'antd/lib/form/Form'
|
|
|
+import { ModalForm, ProFormSelect, ProFormText } from '@ant-design/pro-form'
|
|
|
+import { connect } from 'dva'
|
|
|
+import SvgIcon, { IconPark } from '@/components/SvgIcon'
|
|
|
|
|
|
-const index = props => {
|
|
|
- const [form] = useForm()
|
|
|
- const { visible, onCancel, onConfirm, loading } = props
|
|
|
- const { Option } = Select
|
|
|
+const AddCompany = props => {
|
|
|
+ const { natures, onConfirm, dispatch } = props
|
|
|
const layout = {
|
|
|
- labelCol: { flex: "100px" }
|
|
|
+ layout: 'horizontal',
|
|
|
+ labelCol: { flex: '100px' }
|
|
|
}
|
|
|
+ useEffect(() => {
|
|
|
+ const getNatures = () => {
|
|
|
+ dispatch({
|
|
|
+ type: 'customer/fetch'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ !natures.length && getNatures()
|
|
|
+ }, [])
|
|
|
return (
|
|
|
- <div>
|
|
|
- <Modal
|
|
|
- title="添加客户"
|
|
|
- width={800}
|
|
|
- onCancel={onCancel}
|
|
|
- visible={visible}
|
|
|
- confirmLoading={loading}
|
|
|
- onOk={() => {
|
|
|
- form.validateFields().then(values => {
|
|
|
- form.resetFields()
|
|
|
- onConfirm(values)
|
|
|
- })
|
|
|
- }}
|
|
|
- >
|
|
|
- <Form {...layout} form={form} name="basic">
|
|
|
- <Row>
|
|
|
- <Col span={24}>
|
|
|
- <Form.Item
|
|
|
- label="公司全称"
|
|
|
- name="companyName"
|
|
|
- rules={[{ required: true, message: '公司全称' }]}>
|
|
|
- <Input />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={12}>
|
|
|
- <Form.Item label="公司地区" name="" rules={[{ message: '公司地区' }]}>
|
|
|
- <LazyCascader key="LazyCascader" />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={12}>
|
|
|
- <Form.Item label="公司性质" name="gender" rules={[{ message: '公司性质' }]}>
|
|
|
- <Select>
|
|
|
- <Option key="设计" value="设计">设计</Option>
|
|
|
- <Option key="咨询" value="咨询">咨询</Option>
|
|
|
- </Select>
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={24}>
|
|
|
- <Form.Item
|
|
|
- label="公司地址"
|
|
|
- name="address"
|
|
|
- rules={[{ message: '公司地址' }]}>
|
|
|
- <Input />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={12}>
|
|
|
- <Form.Item
|
|
|
- label="公司传真"
|
|
|
- name="fax"
|
|
|
- rules={[{ message: '公司传真' }]}>
|
|
|
- <Input />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={12}>
|
|
|
- <Form.Item
|
|
|
- label="网址"
|
|
|
- name="webservice"
|
|
|
- rules={[{ message: '网址' }]}>
|
|
|
- <Input />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={24}>
|
|
|
- <Form.Item
|
|
|
- label="乘车路线"
|
|
|
- name="ride"
|
|
|
- rules={[{ message: '乘车路线' }]}>
|
|
|
- <Input />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={24}>
|
|
|
- <Form.Item
|
|
|
- label="地标建筑"
|
|
|
- name="landmarks"
|
|
|
- rules={[{ message: '地标建筑' }]}>
|
|
|
- <Input />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={24}>
|
|
|
- <Form.Item
|
|
|
- label="参考住宿"
|
|
|
- name="stay"
|
|
|
- rules={[{ message: '参考住宿' }]}>
|
|
|
- <Input />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={24}>
|
|
|
- <Form.Item
|
|
|
- label="备注"
|
|
|
- name="remarks"
|
|
|
- rules={[{ message: '备注' }]}>
|
|
|
- <Input />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- </Row>
|
|
|
- </Form>
|
|
|
- </Modal>
|
|
|
- </div>
|
|
|
+ <ModalForm
|
|
|
+ title="添加客户"
|
|
|
+ {...layout}
|
|
|
+ trigger={
|
|
|
+ <Button key="button" type="primary">
|
|
|
+ <IconPark type="plus" theme="filled" />
|
|
|
+ <span>客户</span>
|
|
|
+ </Button>
|
|
|
+ }
|
|
|
+ onFinish={async values => {
|
|
|
+ await onConfirm(values)
|
|
|
+ return true
|
|
|
+ }}>
|
|
|
+ <ProFormText
|
|
|
+ name="companyName"
|
|
|
+ label="公司全称"
|
|
|
+ rules={[{ required: true, message: '请输入公司全称' }]}
|
|
|
+ />
|
|
|
+ <Row>
|
|
|
+ <Col span={10}>
|
|
|
+ <Form.Item
|
|
|
+ label="公司地区"
|
|
|
+ name="district"
|
|
|
+ rules={[{ required: true, message: '请选择公司地区' }]}>
|
|
|
+ <LazyCascader />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={14}>
|
|
|
+ <ProFormSelect label="公司性质" name="natureIds" options={natures} mode="multiple" />
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ <ProFormText
|
|
|
+ name="address"
|
|
|
+ label="公司地址"
|
|
|
+ rules={[{ required: true, message: '请填写公司地址' }]}
|
|
|
+ />
|
|
|
+ <Row>
|
|
|
+ <Col span={12}>
|
|
|
+ <ProFormText name="fax" label="公司传真" />
|
|
|
+ </Col>
|
|
|
+ <Col span={12}>
|
|
|
+ <ProFormText name="webservice" label="网址" />
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ <ProFormText name="ride" label="乘车路线" />
|
|
|
+ <ProFormText name="landmarks" label="地标建筑" />
|
|
|
+ <ProFormText name="stay" label="参考住宿" />
|
|
|
+ <ProFormText name="remarks" label="备注" />
|
|
|
+ </ModalForm>
|
|
|
)
|
|
|
}
|
|
|
|
|
|
-export default index
|
|
|
+export default connect(({ customer }) => ({
|
|
|
+ natures: customer.natures
|
|
|
+}))(AddCompany)
|