|
@@ -0,0 +1,154 @@
|
|
1
|
+import { Form, Input, Card, InputNumber, Select, message, Button } from 'antd';
|
|
2
|
+import { history } from 'umi';
|
|
3
|
+import ProCard from '@ant-design/pro-card';
|
|
4
|
+import { useState, useEffect } from 'react';
|
|
5
|
+// import { getTagList } from '@/services/tag';
|
|
6
|
+// import { addAttaList, gettaTouristForm, EditaddAttaList } from '@/services/AttaList'
|
|
7
|
+
|
|
8
|
+const { TextArea } = Input;
|
|
9
|
+const { Option } = Select;
|
|
10
|
+const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 14 } };
|
|
11
|
+
|
|
12
|
+const goBack = () => {
|
|
13
|
+ history.goBack();
|
|
14
|
+};
|
|
15
|
+const FormItem = Form.Item;
|
|
16
|
+export default (props) => {
|
|
17
|
+ const { location } = props;
|
|
18
|
+ const { id } = location.query;
|
|
19
|
+ const [form] = Form.useForm();
|
|
20
|
+ const [listForm, setListForm] = useState({});
|
|
21
|
+ const [loading, setLoading] = useState(false);
|
|
22
|
+ const [imageList, setImageList] = useState([]);
|
|
23
|
+
|
|
24
|
+ const Submit = (data) => {
|
|
25
|
+ const typeList = (data.typeList || []).map((x) => {
|
|
26
|
+ return { ...x, targetId: id, targetType: 'tourist' };
|
|
27
|
+ });
|
|
28
|
+ setLoading(true);
|
|
29
|
+
|
|
30
|
+ // if (id) {
|
|
31
|
+ // EditaddAttaList(id, { ...listForm, ...data, imageList, typeList }).then(() => {
|
|
32
|
+ // setLoading(false);
|
|
33
|
+ // message.success('数据更新成功');
|
|
34
|
+ // goBack();
|
|
35
|
+ // })
|
|
36
|
+ // .catch(err => {
|
|
37
|
+ // setLoading(false);
|
|
38
|
+ // message.error(err.message || err);
|
|
39
|
+ // });
|
|
40
|
+ // } else {
|
|
41
|
+ // addAttaList({ ...data, imageList, typeList }).then((res) => {
|
|
42
|
+ // setLoading(false);
|
|
43
|
+ // message.success('数据保存成功');
|
|
44
|
+ // history.replace(`/Attractions/Edit?id=${res.touristId}`)
|
|
45
|
+ // })
|
|
46
|
+ // .catch(err => {
|
|
47
|
+ // setLoading(false);
|
|
48
|
+ // message.error(err.message || err);
|
|
49
|
+ // });
|
|
50
|
+ // }
|
|
51
|
+ };
|
|
52
|
+
|
|
53
|
+ //地址--占位
|
|
54
|
+ const [newLocName, setLocName] = useState('');
|
|
55
|
+ const [newAddress, setAddress] = useState('');
|
|
56
|
+
|
|
57
|
+ const selectTagList = (params) => {
|
|
58
|
+ // return getTagList({
|
|
59
|
+ // }).then((res) => {
|
|
60
|
+ // }).catch((err) => {
|
|
61
|
+ // return {
|
|
62
|
+ // success: false,
|
|
63
|
+ // }
|
|
64
|
+ // })
|
|
65
|
+ };
|
|
66
|
+
|
|
67
|
+ const imageInput = (image) => {
|
|
68
|
+ return {
|
|
69
|
+ uid: image.imageId,
|
|
70
|
+ url: image.url,
|
|
71
|
+ };
|
|
72
|
+ };
|
|
73
|
+
|
|
74
|
+ const imageOutput = (image) => {
|
|
75
|
+ return {
|
|
76
|
+ imageId: image?.raw?.imageId,
|
|
77
|
+ shopId: id,
|
|
78
|
+ url: image.url,
|
|
79
|
+ };
|
|
80
|
+ };
|
|
81
|
+ useEffect(() => {
|
|
82
|
+ selectTagList();
|
|
83
|
+ // if (id) {
|
|
84
|
+ // gettaTouristForm(id).then((res) => {
|
|
85
|
+ // setListForm(res)
|
|
86
|
+ // form.setFieldsValue(res)
|
|
87
|
+ // setImageList(res?.imageList || [])
|
|
88
|
+ // })
|
|
89
|
+ // }
|
|
90
|
+ }, [id]);
|
|
91
|
+
|
|
92
|
+ return (
|
|
93
|
+ <Card>
|
|
94
|
+ <ProCard tabs={{ type: 'card' }}>
|
|
95
|
+ <ProCard.TabPane key={1} tab="合作社编辑">
|
|
96
|
+ <Form {...formItemLayout} onFinish={Submit} form={form}>
|
|
97
|
+ <FormItem
|
|
98
|
+ label="合作社名称"
|
|
99
|
+ name="title"
|
|
100
|
+ rules={[{ required: true, message: '请输入合作社名称16个字符以内' }]}
|
|
101
|
+ >
|
|
102
|
+ <Input
|
|
103
|
+ placeholder="请输入合作社名称16个字符以内"
|
|
104
|
+ maxLength="16"
|
|
105
|
+ style={{ width: '350px' }}
|
|
106
|
+ />
|
|
107
|
+ </FormItem>
|
|
108
|
+ <FormItem
|
|
109
|
+ label="信用代码"
|
|
110
|
+ name="creditCode"
|
|
111
|
+ rules={[{ required: true, message: '请输入' }]}
|
|
112
|
+ >
|
|
113
|
+ <Input placeholder="请输入信用代码" style={{ width: '350px' }} />
|
|
114
|
+ </FormItem>
|
|
115
|
+ <FormItem
|
|
116
|
+ label="联系人"
|
|
117
|
+ name="name"
|
|
118
|
+ rules={[{ required: true, message: '请输入联系人' }]}
|
|
119
|
+ >
|
|
120
|
+ <Input placeholder="请输入联系人" rows={4} style={{ width: '350px' }} />
|
|
121
|
+ </FormItem>
|
|
122
|
+ <FormItem
|
|
123
|
+ label="联系方式"
|
|
124
|
+ name="phone"
|
|
125
|
+ rules={[{ required: true, message: '请输入联系方式' }]}
|
|
126
|
+ >
|
|
127
|
+ <Input placeholder="请输入联系方式" rows={4} style={{ width: '350px' }} />
|
|
128
|
+ </FormItem>
|
|
129
|
+ <FormItem
|
|
130
|
+ label="地址"
|
|
131
|
+ name="address"
|
|
132
|
+ rules={[{ required: true, message: '请输入地址' }]}
|
|
133
|
+ >
|
|
134
|
+ <TextArea placeholder="请输入地址" style={{ width: '350px' }} />
|
|
135
|
+ </FormItem>
|
|
136
|
+ <FormItem label=" " colon={false}>
|
|
137
|
+ <Button type="default" onClick={() => goBack()}>
|
|
138
|
+ 返回
|
|
139
|
+ </Button>
|
|
140
|
+ <Button
|
|
141
|
+ type="primary"
|
|
142
|
+ loading={loading}
|
|
143
|
+ htmlType="submit"
|
|
144
|
+ style={{ marginLeft: '4em' }}
|
|
145
|
+ >
|
|
146
|
+ 保存
|
|
147
|
+ </Button>
|
|
148
|
+ </FormItem>
|
|
149
|
+ </Form>
|
|
150
|
+ </ProCard.TabPane>
|
|
151
|
+ </ProCard>
|
|
152
|
+ </Card>
|
|
153
|
+ );
|
|
154
|
+};
|