|
@@ -1,5 +1,5 @@
|
|
|
import React, { Fragment, useState, useEffect, useRef, useMemo } from 'react';
|
|
|
-import { Table, Icon, message, Spin, Button, Form, DatePicker, Row, Col, Modal, Input, Upload } from 'antd';
|
|
|
+import { Table, Icon, message, Spin, Button, Form, DatePicker, Row, Col, Modal, Input, Upload, Select } from 'antd';
|
|
|
import dayjs from 'dayjs';
|
|
|
import { getToken, GetTokenFromUrl } from '@/utils/utils';
|
|
|
const { RangePicker } = DatePicker;
|
|
@@ -11,9 +11,12 @@ function FirmModal(props) {
|
|
|
visible,
|
|
|
item = null,
|
|
|
disabled = true,
|
|
|
- form
|
|
|
+ form,
|
|
|
+ typeDisabled
|
|
|
} = props;
|
|
|
const [formRef] = Form.useForm();
|
|
|
+ const [type, setType] = useState(item?.type || 1);
|
|
|
+ console.log(type);
|
|
|
const handleOnOk = async () => {
|
|
|
formRef
|
|
|
.validateFields()
|
|
@@ -39,6 +42,11 @@ function FirmModal(props) {
|
|
|
formRef.resetFields();
|
|
|
onCancel?.()
|
|
|
}
|
|
|
+ const handleType = value => {
|
|
|
+ formRef.resetFields();
|
|
|
+ formRef.setFieldValue('type', value);
|
|
|
+ setType(value);
|
|
|
+ }
|
|
|
const token = getToken() || GetTokenFromUrl();
|
|
|
const uploadProps = {
|
|
|
name: 'files',
|
|
@@ -60,7 +68,10 @@ function FirmModal(props) {
|
|
|
};
|
|
|
useEffect(() => {
|
|
|
formRef.resetFields();
|
|
|
- }, [item]);
|
|
|
+ if (visible)
|
|
|
+ setType(item?.type || 1)
|
|
|
+ }, [visible]);
|
|
|
+
|
|
|
return <Modal
|
|
|
maskClosable={false}
|
|
|
open={visible}
|
|
@@ -78,6 +89,7 @@ function FirmModal(props) {
|
|
|
// layout="inline"
|
|
|
labelCol={{ span: 4 }}
|
|
|
wrapperCol={{ span: 20 }}
|
|
|
+ preserve={false}
|
|
|
initialValues={{
|
|
|
name: item?.name || '',
|
|
|
tax_code: item?.tax_code || '',
|
|
@@ -85,91 +97,113 @@ function FirmModal(props) {
|
|
|
phone_number: item?.phone_number || '',
|
|
|
bank_account: item?.bank_account || '',
|
|
|
bank_number: item?.bank_number || '',
|
|
|
- address: item?.address || ''
|
|
|
+ address: item?.address || '',
|
|
|
+ type: item?.type || 1,
|
|
|
+ id_type: item?.id_type || '',
|
|
|
+ id_card: item?.id_card || ''
|
|
|
}}
|
|
|
>
|
|
|
<Row gutter={[48, 24]}>
|
|
|
<Col span={12}>
|
|
|
- <Form.Item style={{ width: '100%' }} label="供应商名称:" name='name' rules={
|
|
|
+ <Form.Item style={{ width: '100%' }} label="主体类型:" name='type' rules={
|
|
|
[
|
|
|
{
|
|
|
required: true,
|
|
|
- message: '请输入供应商名称',
|
|
|
+ message: '请选择主体类型',
|
|
|
}]}>
|
|
|
- <Input disabled={disabled} placeholder="请输入供应商名称" />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={12}>
|
|
|
- <Form.Item style={{ width: '100%' }} label="税号:" name="tax_code" rules={[
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请输入税号',
|
|
|
- },
|
|
|
- ]}>
|
|
|
- <Input disabled={disabled} placeholder="请输入税号" />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- </Row>
|
|
|
- <Row gutter={[48, 24]}>
|
|
|
- <Col span={12}>
|
|
|
- <Form.Item style={{ width: '100%' }} label="联系人:" name="contact" rules={
|
|
|
- [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请输入联系人',
|
|
|
- },
|
|
|
- ]
|
|
|
- }>
|
|
|
- <Input disabled={disabled} placeholder="请输入联系人" />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={12}>
|
|
|
- <Form.Item style={{ width: '100%' }} label="联系电话:" name="phone_number" rules={[
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请输入联系电话',
|
|
|
- },
|
|
|
- ]}>
|
|
|
- <Input disabled={disabled} placeholder="请输入联系电话" />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- </Row>
|
|
|
- <Row gutter={[48, 24]}>
|
|
|
- <Col span={12}>
|
|
|
- <Form.Item style={{ width: '100%' }} label="开户银行:" name='bank_account' rules={[
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请输入开户银行',
|
|
|
- },
|
|
|
- ]}>
|
|
|
- <Input disabled={disabled} placeholder="请输入开户银行" />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={12}>
|
|
|
- <Form.Item style={{ width: '100%' }} label="银行账号:" name='bank_number' rules={[
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请输入银行账号',
|
|
|
- },
|
|
|
- ]}>
|
|
|
- <Input disabled={disabled} placeholder="请输入银行账号" />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- </Row>
|
|
|
- <Row>
|
|
|
- <Col span={24}>
|
|
|
- <Form.Item labelCol={{ span: 2 }}
|
|
|
- wrapperCol={{ span: 22 }} style={{ width: '100%' }} label="地址:" name='address' rules={[
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请输入地址',
|
|
|
- },
|
|
|
- ]}>
|
|
|
- <Input disabled={disabled} placeholder="请输入地址" />
|
|
|
+ <Select disabled={disabled || typeDisabled} options={[
|
|
|
+ { value: 1, label: '供应商' },
|
|
|
+ { value: 4, label: '自然人' },
|
|
|
+ ]} placeholder="请选择主体类型" onChange={handleType}>
|
|
|
+ </Select>
|
|
|
</Form.Item>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
- {/* <Row gutter={[48, 24]}>
|
|
|
+ {
|
|
|
+ type === 1 &&
|
|
|
+ <>
|
|
|
+ <Row gutter={[48, 24]}>
|
|
|
+ <Col span={12}>
|
|
|
+ <Form.Item style={{ width: '100%' }} label="名称:" name='name' rules={
|
|
|
+ [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入供应商名称',
|
|
|
+ }]}>
|
|
|
+ <Input disabled={disabled} placeholder="请输入供应商名称" />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={12}>
|
|
|
+ <Form.Item style={{ width: '100%' }} label="税号:" name="tax_code" rules={[
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入税号',
|
|
|
+ },
|
|
|
+ ]}>
|
|
|
+ <Input disabled={disabled} placeholder="请输入税号" />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ <Row gutter={[48, 24]}>
|
|
|
+ <Col span={12}>
|
|
|
+ <Form.Item style={{ width: '100%' }} label="联系人:" name="contact" rules={
|
|
|
+ [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入联系人',
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ }>
|
|
|
+ <Input disabled={disabled} placeholder="请输入联系人" />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={12}>
|
|
|
+ <Form.Item style={{ width: '100%' }} label="联系电话:" name="phone_number" rules={[
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入联系电话',
|
|
|
+ },
|
|
|
+ ]}>
|
|
|
+ <Input disabled={disabled} placeholder="请输入联系电话" />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ <Row gutter={[48, 24]}>
|
|
|
+ <Col span={12}>
|
|
|
+ <Form.Item style={{ width: '100%' }} label="开户银行:" name='bank_account' rules={[
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入开户银行',
|
|
|
+ },
|
|
|
+ ]}>
|
|
|
+ <Input disabled={disabled} placeholder="请输入开户银行" />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={12}>
|
|
|
+ <Form.Item style={{ width: '100%' }} label="银行账号:" name='bank_number' rules={[
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入银行账号',
|
|
|
+ },
|
|
|
+ ]}>
|
|
|
+ <Input disabled={disabled} placeholder="请输入银行账号" />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ <Row>
|
|
|
+ <Col span={24}>
|
|
|
+ <Form.Item labelCol={{ span: 2 }}
|
|
|
+ wrapperCol={{ span: 22 }} style={{ width: '100%' }} label="地址:" name='address' rules={[
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入地址',
|
|
|
+ },
|
|
|
+ ]}>
|
|
|
+ <Input disabled={disabled} placeholder="请输入地址" />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ {/* <Row gutter={[48, 24]}>
|
|
|
<Col span={12}>
|
|
|
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
|
<div style={{
|
|
@@ -229,6 +263,56 @@ function FirmModal(props) {
|
|
|
</div>
|
|
|
</Col>
|
|
|
</Row> */}
|
|
|
+ </>
|
|
|
+ }
|
|
|
+ {
|
|
|
+ type === 4 && <>
|
|
|
+ <Row gutter={[48, 24]}>
|
|
|
+ <Col span={12}>
|
|
|
+ <Form.Item style={{ width: '100%' }} label="姓名:" name='name' rules={
|
|
|
+ [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入姓名',
|
|
|
+ }]}>
|
|
|
+ <Input disabled={disabled} placeholder="请输入姓名" />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={12}>
|
|
|
+ <Form.Item style={{ width: '100%' }} label="证件类型:" name='id_type' rules={
|
|
|
+ [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请选择证件类型',
|
|
|
+ }]}>
|
|
|
+ <Select disabled={disabled} placeholder="请选择证件类型">
|
|
|
+ <Option value={1}>身份证</Option>
|
|
|
+ <Option value={2}>护照</Option>
|
|
|
+ </Select>
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ <Row gutter={[48, 24]}>
|
|
|
+ <Col span={12}>
|
|
|
+ <Form.Item style={{ width: '100%' }} label="证件号:" name="id_card" rules={
|
|
|
+ [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入证件号',
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ }>
|
|
|
+ <Input disabled={disabled} placeholder="请输入证件号" />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={12}>
|
|
|
+ <Form.Item style={{ width: '100%' }} label="银行账号:" name='bank_number'>
|
|
|
+ <Input disabled={disabled} placeholder="请输入银行账号" />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ </>
|
|
|
+ }
|
|
|
</Form>
|
|
|
</div>
|
|
|
</Modal>
|