|
@@ -1,22 +1,24 @@
|
1
|
|
-import { addRegulation, getRegulationById } from '@/services/regulation';
|
|
1
|
+import { addRegulation, getRegulationList } from '@/services/regulation';
|
2
|
2
|
import { PageContainer, ProForm, ProFormTextArea } from '@ant-design/pro-components';
|
3
|
3
|
import { Card, Col, message, Row, Space } from 'antd';
|
4
|
4
|
import { useNavigate, useSearchParams } from 'react-router-dom';
|
5
|
5
|
import { useEffect, useRef, useState } from 'react';
|
|
6
|
+import { queryTable } from '@/utils/request';
|
6
|
7
|
|
7
|
8
|
export default (props) => {
|
|
9
|
+
|
8
|
10
|
const [searchParams, setSearchParams] = useSearchParams();
|
9
|
11
|
const id = searchParams.get('id');
|
|
12
|
+ const [data, setData] = useState({});
|
10
|
13
|
const formRef = useRef();
|
11
|
14
|
const navigate = useNavigate();
|
12
|
15
|
|
13
|
16
|
useEffect(() => {
|
14
|
|
- if (id) {
|
15
|
|
- getRegulationById(id).then((res) => {
|
16
|
|
- formRef.current.setFieldsValue(res);
|
17
|
|
- });
|
18
|
|
- }
|
19
|
|
- }, [id]);
|
|
17
|
+ getRegulationList({ type: `station` }).then((res) => {
|
|
18
|
+ formRef.current.setFieldsValue(res.records[0]);
|
|
19
|
+ console.log('tt', res)
|
|
20
|
+ });
|
|
21
|
+ }, []);
|
20
|
22
|
|
21
|
23
|
const onFinish = async (values) => {
|
22
|
24
|
//添加,修改
|
|
@@ -40,7 +42,7 @@ export default (props) => {
|
40
|
42
|
searchConfig: {
|
41
|
43
|
resetText: '返回',
|
42
|
44
|
},
|
43
|
|
- onReset: () => navigate(-1),
|
|
45
|
+ // onReset: () => navigate(-1),
|
44
|
46
|
render: (props, doms) => {
|
45
|
47
|
return (
|
46
|
48
|
<Row>
|
|
@@ -53,12 +55,14 @@ export default (props) => {
|
53
|
55
|
}}
|
54
|
56
|
>
|
55
|
57
|
<ProFormTextArea
|
56
|
|
- name="detail"
|
57
|
58
|
label="发布内容"
|
58
|
59
|
placeholder="请输入发布内容"
|
59
|
60
|
rules={[{ required: true, message: '请输入发布内容' }]}
|
60
|
61
|
allowClear={false}
|
61
|
62
|
width={750}
|
|
63
|
+ name="detail"
|
|
64
|
+ onFinish={onFinish}
|
|
65
|
+ request={queryTable(getRegulationList)}
|
62
|
66
|
/>
|
63
|
67
|
</ProForm>
|
64
|
68
|
</Card>
|