tsg-web/src/views/sz/szzf/clyj/form.js

119 lines
3.0 KiB
JavaScript
Raw Normal View History

2024-09-23 18:03:30 +08:00
import React, { useEffect, useState, useMemo, useRef } from 'react';
2024-09-24 14:37:41 +08:00
import { Space, Table, Radio, DatePicker, Form, Select, Button, message, Upload, Input, Row, Col, Switch, Image } from 'antd';
2024-09-23 18:03:30 +08:00
import { DeleteOutlined, FileWordOutlined, FilePdfOutlined, FileZipOutlined, FileExcelOutlined } from '@ant-design/icons';
import { formItemLayout, btnItemLayout } from '../../../../components/crud/FormLayoutProps';
import apiurl from '../../../../service/apiurl';
// import "./index.less"
import moment from 'moment';
2024-09-24 14:37:41 +08:00
const { TextArea } = Input;
2024-09-23 18:03:30 +08:00
2024-09-24 14:37:41 +08:00
const options=[
2024-09-26 17:59:26 +08:00
{label:'禁用',value:0},
{label:'启用',value:1}
2024-09-23 18:03:30 +08:00
]
2024-09-26 17:59:26 +08:00
const ModalForm = ({ mode, record, onEdit, onSave, onCrudSuccess }) => {
2024-09-23 18:03:30 +08:00
const [form] = Form.useForm();
const [fileList, setFileList] = useState([]) //上传文件列表
const [loading, setLoading] = useState(false)
const onfinish = (values) => {
2024-09-26 17:59:26 +08:00
onEdit(apiurl.szzf.clyj.edit, {...record,...values})
2024-09-23 18:03:30 +08:00
}
useEffect(() => {
2024-09-26 17:59:26 +08:00
if(record){
form.setFieldsValue(record)
2024-09-23 18:03:30 +08:00
}
}, [record, mode])
return (
<>
<Form
form={form}
{...formItemLayout}
onFinish={onfinish}
initialValues={record}
>
<Row>
2024-09-24 14:37:41 +08:00
<Col span={24}>
2024-09-23 18:03:30 +08:00
<Form.Item
2024-09-24 14:37:41 +08:00
label="节点"
2024-09-23 18:03:30 +08:00
name="name"
rules={[{ required: true }]}
>
2024-09-24 14:37:41 +08:00
<Input disabled style={{ width: '100%' }} allowClear />
2024-09-23 18:03:30 +08:00
</Form.Item>
</Col>
2024-09-24 14:37:41 +08:00
<Col span={24}>
2024-09-23 18:03:30 +08:00
<Form.Item
2024-09-24 14:37:41 +08:00
label="状态"
2024-09-26 17:59:26 +08:00
name="status"
2024-09-23 18:03:30 +08:00
rules={[{ required: true }]}
>
2024-09-24 14:37:41 +08:00
<Radio.Group options={options}/>
2024-09-23 18:03:30 +08:00
</Form.Item>
</Col>
2024-09-24 14:37:41 +08:00
<Col span={24}>
<Form.Item
label="法律名称"
2024-09-26 17:59:26 +08:00
name="legalName"
2024-09-24 14:37:41 +08:00
rules={[{ required: true }]}
>
<Input style={{ width: '100%' }} allowClear />
2024-09-23 18:03:30 +08:00
</Form.Item>
</Col>
2024-09-24 14:37:41 +08:00
<Col span={24}>
2024-09-23 18:03:30 +08:00
<Form.Item
2024-09-24 14:37:41 +08:00
label="法条内容"
2024-09-26 17:59:26 +08:00
name="legalContent"
2024-09-23 18:03:30 +08:00
>
2024-09-24 14:37:41 +08:00
<Input style={{ width: '100%' }} allowClear />
2024-09-23 18:03:30 +08:00
</Form.Item>
</Col>
2024-09-24 14:37:41 +08:00
<Col span={24}>
2024-09-23 18:03:30 +08:00
<Form.Item
2024-09-24 14:37:41 +08:00
label="违法行为描述"
2024-09-26 17:59:26 +08:00
name="violationDesc"
2024-09-23 18:03:30 +08:00
>
2024-09-24 14:37:41 +08:00
<TextArea rows={4} />
2024-09-23 18:03:30 +08:00
</Form.Item>
</Col>
<Col span={24}>
<Form.Item
2024-09-24 14:37:41 +08:00
label="处罚措施"
2024-09-26 17:59:26 +08:00
name="penalties"
2024-09-23 18:03:30 +08:00
>
2024-09-24 14:37:41 +08:00
<TextArea rows={4} />
2024-09-23 18:03:30 +08:00
</Form.Item>
</Col>
2024-09-24 14:37:41 +08:00
2024-09-23 18:03:30 +08:00
</Row>
2024-09-24 14:37:41 +08:00
2024-09-23 18:03:30 +08:00
{
mode === 'view' ? null : (
<>
<Form.Item {...btnItemLayout}>
<Button type="primary" htmlType="submit">
{mode === 'save' ? '提交' : '修改'}
</Button>
</Form.Item>
</>
)
}
</Form>
2024-09-24 14:37:41 +08:00
2024-09-23 18:03:30 +08:00
</>
);
}
export default ModalForm;