营业执照上传开发
Some checks failed
Node CI / build (14.x, macOS-latest) (push) Has been cancelled
Node CI / build (14.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (14.x, windows-latest) (push) Has been cancelled
Node CI / build (16.x, macOS-latest) (push) Has been cancelled
Node CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (16.x, windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
coverage CI / build (push) Has been cancelled
Node pnpm CI / build (16.x, macOS-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, windows-latest) (push) Has been cancelled
Some checks failed
Node CI / build (14.x, macOS-latest) (push) Has been cancelled
Node CI / build (14.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (14.x, windows-latest) (push) Has been cancelled
Node CI / build (16.x, macOS-latest) (push) Has been cancelled
Node CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (16.x, windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
coverage CI / build (push) Has been cancelled
Node pnpm CI / build (16.x, macOS-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, windows-latest) (push) Has been cancelled
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Modal, Form, Input, DatePicker, Upload, Button, message } from 'antd';
|
||||
import { Modal, Form, Input, DatePicker, Upload, Button, message, Row, Col, Select } from 'antd';
|
||||
import { UploadOutlined, DeleteOutlined } from '@ant-design/icons';
|
||||
import type { UploadFile } from 'antd/es/upload/interface';
|
||||
import dayjs from 'dayjs';
|
||||
import { uploadPolicyFile } from '@/services/cms/policyInfo';
|
||||
import { getDictValueEnum } from '@/services/system/dict';
|
||||
import type { DictValueEnumObj } from '@/components/DictTag';
|
||||
|
||||
const { TextArea } = Input;
|
||||
|
||||
@@ -18,6 +20,13 @@ const EditModal: React.FC<EditModalProps> = ({ open, values, onCancel, onSubmit
|
||||
const [form] = Form.useForm();
|
||||
const [fileList, setFileList] = useState<UploadFile[]>([]);
|
||||
const [uploading, setUploading] = useState(false);
|
||||
const [userTypeEnum, setUserTypeEnum] = useState<DictValueEnumObj>({});
|
||||
|
||||
useEffect(() => {
|
||||
getDictValueEnum('user_type', false, true).then((data) => {
|
||||
setUserTypeEnum(data);
|
||||
});
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
@@ -25,6 +34,9 @@ const EditModal: React.FC<EditModalProps> = ({ open, values, onCancel, onSubmit
|
||||
form.setFieldsValue({
|
||||
...values,
|
||||
publishTime: values.publishTime ? dayjs(values.publishTime) : undefined,
|
||||
policyTag: values.policyTag
|
||||
? String(values.policyTag).split(',').filter(Boolean)
|
||||
: undefined,
|
||||
});
|
||||
// 如果有已上传的文件,显示在列表中
|
||||
if (values.fileUrl && values.fileName) {
|
||||
@@ -81,88 +93,131 @@ const EditModal: React.FC<EditModalProps> = ({ open, values, onCancel, onSubmit
|
||||
|
||||
const handleOk = async () => {
|
||||
const formValues = await form.validateFields();
|
||||
const { policyTag, publishTime, ...rest } = formValues;
|
||||
onSubmit({
|
||||
...formValues,
|
||||
...rest,
|
||||
id: values?.id,
|
||||
publishTime: formValues.publishTime?.format('YYYY-MM-DD'),
|
||||
publishTime: publishTime?.format('YYYY-MM-DD'),
|
||||
policyTag: Array.isArray(policyTag) ? policyTag.join(',') : policyTag,
|
||||
});
|
||||
};
|
||||
|
||||
const userTypeOptions = Object.values(userTypeEnum).map((item) => ({
|
||||
label: item.label,
|
||||
value: item.value,
|
||||
}));
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title={values ? '编辑政策' : '新增政策'}
|
||||
open={open}
|
||||
onCancel={onCancel}
|
||||
onOk={handleOk}
|
||||
width={700}
|
||||
width={900}
|
||||
destroyOnClose
|
||||
>
|
||||
<Form form={form} layout="vertical">
|
||||
<Form.Item name="zcmc" label="政策名称" rules={[{ required: true, message: '请输入政策名称' }]}>
|
||||
<Input placeholder="请输入政策名称" />
|
||||
</Form.Item>
|
||||
<Form.Item name="zclx" label="政策类型">
|
||||
<Input placeholder="请输入政策类型" />
|
||||
</Form.Item>
|
||||
<Form.Item name="zcLevel" label="政策级别">
|
||||
<Input placeholder="请输入政策级别" />
|
||||
</Form.Item>
|
||||
<Form.Item name="sourceUnit" label="发文单位">
|
||||
<Input placeholder="请输入发文单位" />
|
||||
</Form.Item>
|
||||
<Form.Item name="acceptUnit" label="受理单位">
|
||||
<Input placeholder="请输入受理单位" />
|
||||
</Form.Item>
|
||||
<Form.Item name="publishTime" label="发文时间">
|
||||
<DatePicker style={{ width: '100%' }} />
|
||||
</Form.Item>
|
||||
<Form.Item name="zcContent" label="政策内容">
|
||||
<TextArea rows={4} placeholder="请输入政策内容" />
|
||||
</Form.Item>
|
||||
<Form.Item name="subsidyStandard" label="补贴标准">
|
||||
<TextArea rows={2} placeholder="请输入补贴标准" />
|
||||
</Form.Item>
|
||||
<Form.Item name="handleChannel" label="经办渠道">
|
||||
<Input placeholder="请输入经办渠道" />
|
||||
</Form.Item>
|
||||
<Form.Item name="applyCondition" label="申报条件">
|
||||
<TextArea rows={2} placeholder="请输入申报条件" />
|
||||
</Form.Item>
|
||||
<Form.Item label="政策文件">
|
||||
{fileList.length > 0 ? (
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||
<a href={fileList[0].url} target="_blank" rel="noopener noreferrer">
|
||||
{fileList[0].name}
|
||||
</a>
|
||||
<Button
|
||||
type="text"
|
||||
danger
|
||||
size="small"
|
||||
icon={<DeleteOutlined />}
|
||||
onClick={handleRemoveFile}
|
||||
<Row gutter={16}>
|
||||
<Col span={12}>
|
||||
<Form.Item name="zcmc" label="政策名称" rules={[{ required: true, message: '请输入政策名称' }]}>
|
||||
<Input placeholder="请输入政策名称" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Form.Item name="zclx" label="政策类型">
|
||||
<Input placeholder="请输入政策类型" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Form.Item name="zcLevel" label="政策级别">
|
||||
<Input placeholder="请输入政策级别" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Form.Item name="policyTag" label="人员类型">
|
||||
<Select
|
||||
mode="multiple"
|
||||
allowClear
|
||||
placeholder="请选择人员类型"
|
||||
options={userTypeOptions}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<Upload
|
||||
beforeUpload={handleUpload}
|
||||
showUploadList={false}
|
||||
maxCount={1}
|
||||
>
|
||||
<Button icon={<UploadOutlined />} loading={uploading}>
|
||||
上传文件
|
||||
</Button>
|
||||
</Upload>
|
||||
)}
|
||||
</Form.Item>
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Form.Item name="sourceUnit" label="发文单位">
|
||||
<Input placeholder="请输入发文单位" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Form.Item name="acceptUnit" label="受理单位">
|
||||
<Input placeholder="请输入受理单位" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Form.Item name="publishTime" label="发文时间">
|
||||
<DatePicker style={{ width: '100%' }} />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Form.Item name="handleChannel" label="经办渠道">
|
||||
<Input placeholder="请输入经办渠道" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={24}>
|
||||
<Form.Item name="zcContent" label="政策内容">
|
||||
<TextArea rows={4} placeholder="请输入政策内容" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={24}>
|
||||
<Form.Item name="subsidyStandard" label="补贴标准">
|
||||
<TextArea rows={2} placeholder="请输入补贴标准" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={24}>
|
||||
<Form.Item name="applyCondition" label="申报条件">
|
||||
<TextArea rows={2} placeholder="请输入申报条件" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={24}>
|
||||
<Form.Item label="政策文件">
|
||||
{fileList.length > 0 ? (
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||
<a href={fileList[0].url} target="_blank" rel="noopener noreferrer">
|
||||
{fileList[0].name}
|
||||
</a>
|
||||
<Button
|
||||
type="text"
|
||||
danger
|
||||
size="small"
|
||||
icon={<DeleteOutlined />}
|
||||
onClick={handleRemoveFile}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<Upload
|
||||
beforeUpload={handleUpload}
|
||||
showUploadList={false}
|
||||
maxCount={1}
|
||||
>
|
||||
<Button icon={<UploadOutlined />} loading={uploading}>
|
||||
上传文件
|
||||
</Button>
|
||||
</Upload>
|
||||
)}
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={24}>
|
||||
<Form.Item name="remark" label="备注">
|
||||
<TextArea rows={2} placeholder="请输入备注" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
</Row>
|
||||
<Form.Item name="fileUrl" hidden>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item name="fileName" hidden>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item name="remark" label="备注">
|
||||
<TextArea rows={2} placeholder="请输入备注" />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user