lisenzhou 2 年之前
父節點
當前提交
f98756161a
共有 3 個文件被更改,包括 343 次插入0 次删除
  1. 322
    0
      src/pages/supportability/index.jsx
  2. 10
    0
      src/routes/routes.jsx
  3. 11
    0
      src/services/supportCapability.js

+ 322
- 0
src/pages/supportability/index.jsx 查看文件

@@ -0,0 +1,322 @@
1
+import React, { useState, useEffect } from "react";
2
+import { Link, useNavigate } from "react-router-dom";
3
+import {
4
+  Button,
5
+  Row,
6
+  Col,
7
+  Form,
8
+  Input,
9
+  InputNumber,
10
+  DatePicker,
11
+  notification,
12
+  Card,
13
+  Checkbox,
14
+} from "antd";
15
+import {
16
+  getSupportCapabilityDetail,
17
+  updateSupportCapability,
18
+  saveSupportCapability,
19
+} from "@/services/supportCapability";
20
+
21
+const { TextArea } = Input;
22
+const { RangePicker } = DatePicker;
23
+
24
+const configList = [
25
+  {
26
+    //12个
27
+    title: "常规膳食保障",
28
+    children: [
29
+      {
30
+        name: "dietDaily",
31
+        label: "单日整体膳食供应能力(人次)",
32
+      },
33
+      {
34
+        name: "dietSingle",
35
+        label: "单次整体膳食供应能力(人)",
36
+      },
37
+      {
38
+        name: "dietStationDaily",
39
+        label: "单日站内膳食供应能力(人次)",
40
+      },
41
+      {
42
+        name: "dietStationSingle",
43
+        label: "单次站内膳食供应能力(人)",
44
+      },
45
+      {
46
+        name: "dietRemoteDaily",
47
+        label: "单日远程膳食供应能力(人次)",
48
+      },
49
+      {
50
+        name: "dietRemoteSingle",
51
+        label: "单次远程膳食供应能力(人)",
52
+      },
53
+      {
54
+        name: "dietSocializationDaily",
55
+        label: "单日社会化膳食供应能力(人次)",
56
+      },
57
+      {
58
+        name: "dietSocializationSingle",
59
+        label: "单次社会化膳食供应能力(人)",
60
+      },
61
+      {
62
+        name: "dietTempDailyNum",
63
+        label: "单日临时制膳点数量(个)",
64
+      },
65
+      {
66
+        name: "dietTempSingleNum",
67
+        label: "单次临时制膳点数量(个)",
68
+      },
69
+      {
70
+        name: "dietTempDaily",
71
+        label: "单日临时制膳点供应能力(人次)",
72
+      },
73
+      {
74
+        name: "dietTempSingle",
75
+        label: "单次临时制膳点供应能力(人)",
76
+      },
77
+    ],
78
+  },
79
+  {
80
+    title: "应急膳食保障",
81
+    children: [
82
+      {
83
+        name: "dietDailyEmergency",
84
+        label: "应急单日整体膳食供应能力(人次)",
85
+        key: 13,
86
+      },
87
+      {
88
+        name: "dietSingleEmergency",
89
+        label: "应急单次整体膳食供应能力(人)",
90
+        key: 14,
91
+      },
92
+      {
93
+        name: "dietStationDailyEmergency",
94
+        label: "应急单日站内膳食供应能力(人次)",
95
+        key: 15,
96
+      },
97
+      {
98
+        name: "dietStationSingleEmergency",
99
+        label: "应急单次站内膳食供应能力(人)",
100
+        key: 16,
101
+      },
102
+      {
103
+        name: "dietRemoteDailyEmergency",
104
+        label: "应急单日远程膳食供应能力(人次)",
105
+        key: 17,
106
+      },
107
+      {
108
+        name: "dietRemoteSingleEmergency",
109
+        label: "应急单次远程膳食供应能力(人)",
110
+        key: 18,
111
+      },
112
+      {
113
+        name: "dietSocializationDailyEmergency",
114
+        label: "应急单日社会化膳食供应能力(人次)",
115
+        key: 19,
116
+      },
117
+      {
118
+        name: "dietSocializationSingleEmergency",
119
+        label: "应急单次社会化膳食供应能力(人)",
120
+        key: 20,
121
+      },
122
+      {
123
+        name: "dietTempDailyNumEmergency",
124
+        label: "应急单日临时制膳点数量(个)",
125
+        key: 21,
126
+      },
127
+      {
128
+        name: "dietTempSingleNumEmergency",
129
+        label: "应急单次临时制膳点数量(个)",
130
+        key: 22,
131
+      },
132
+      {
133
+        name: "dietTempDailyEmergency",
134
+        label: "应急单日临时制膳点供应能力(人次)",
135
+        key: 23,
136
+      },
137
+      {
138
+        name: "dietTempSingleEmergency",
139
+        label: "应急单次临时制膳点供应能力(人)",
140
+        key: 24,
141
+      },
142
+    ],
143
+  },
144
+  {
145
+    title: "常规住宿保障",
146
+    children: [
147
+      {
148
+        name: "stayCapability",
149
+        label: "整体住宿供应能力(人)",
150
+        key: 25,
151
+      },
152
+      {
153
+        name: "stayStation",
154
+        label: "站内住宿供应能力(人)",
155
+        key: 26,
156
+      },
157
+      {
158
+        name: "staySocialization",
159
+        label: "社会化住宿供应能力(人)",
160
+        key: 27,
161
+      },
162
+    ],
163
+  },
164
+  {
165
+    title: "应急住宿保障",
166
+    children: [
167
+      {
168
+        name: "stayCapabilityEmergency",
169
+        label: "应急整体住宿供应能力(人)",
170
+        key: 28,
171
+      },
172
+      {
173
+        name: "stayStationEmergency",
174
+        label: "应急站内住宿供应能力(人)",
175
+        key: 29,
176
+      },
177
+      {
178
+        name: "staySocializationEmergency",
179
+        label: "应急社会化住宿供应能力(人)",
180
+        key: 30,
181
+      },
182
+    ],
183
+  },
184
+  {
185
+    title: "运输送出保障车辆",
186
+    children: [
187
+      {
188
+        name: "cartNum",
189
+        label: "车辆总数(台)",
190
+        key: 31,
191
+      },
192
+      {
193
+        name: "cookingCart",
194
+        label: "野外自行式炊事车(台)",
195
+        key: 32,
196
+      },
197
+      {
198
+        name: "transportVehicle",
199
+        label: "送餐车(台)",
200
+        key: 33,
201
+      },
202
+    ],
203
+  },
204
+  {
205
+    title: "物资保障",
206
+    children: [
207
+      {
208
+        name: "supportCapability",
209
+        label: "物资供应能力(人)",
210
+        key: 34,
211
+      },
212
+    ],
213
+  },
214
+];
215
+
216
+export default (props) => {
217
+  //   const { dataSource, setDataSource } = props;
218
+  //   const id = dataSource ? dataSource.id : undefined;
219
+
220
+  const navigate = useNavigate();
221
+  const [form] = Form.useForm();
222
+  //   const [rangeDate, setRangeDate] = useState([]);
223
+  const [loading, setLoading] = useState(false);
224
+
225
+  const onChange = (dts) => {
226
+    // const [start, end] = dts;
227
+    // setRangeDate(dts);
228
+    // form.setFieldValue('startDate', start ? start.format('YYYY-MM-DD') : undefined);
229
+    // form.setFieldValue('endDate', end ? end.format('YYYY-MM-DD') : undefined);
230
+  };
231
+
232
+  const onFinish = (values) => {
233
+    console.log(values, "---");
234
+    // const notNull = Object.keys(values)
235
+    //   .map((k) => values[k])
236
+    //   .filter(Boolean);
237
+    // if (!notNull || notNull.length < 1) {
238
+    //   notification.warn({ message: "未检索到填写内容" });
239
+    //   return;
240
+    // }
241
+    // const [start, end] = rangeDate;
242
+    // const startDate = start ? start.format("YYYY-MM-DD") : undefined;
243
+    // const endDate = end ? end.format("YYYY-MM-DD") : undefined;
244
+    // const func = id ? updateGuaranteeTask : addGuaranteeTask;
245
+    setLoading(true);
246
+    updateSupportCapability(1, {
247
+      ...values,
248
+      serviceCapability: values.serviceCapability
249
+        ? values.serviceCapability?.join(",")
250
+        : null,
251
+    })
252
+      .then((res) => {
253
+        setLoading(false);
254
+        // setDataSource(res);
255
+        // notification.success({ message: '操作成功' })
256
+      })
257
+      .catch(() => {
258
+        // setLoading(false);
259
+      });
260
+  };
261
+
262
+  useEffect(() => {
263
+    getSupportCapabilityDetail(1).then((res) => {
264
+      console.log(res, "getSupportCapabilityDetail");
265
+      if (res) {
266
+        form.setFieldsValue({
267
+          ...res,
268
+          serviceCapability: res.serviceCapability
269
+            ? res.serviceCapability?.split(",")
270
+            : null,
271
+        });
272
+      }
273
+    });
274
+  }, [form]);
275
+
276
+  return (
277
+    <Card>
278
+      <Form layout="vertical" form={form} onFinish={onFinish}>
279
+        {configList?.map((x, index1) => (
280
+          <div key={index1}>
281
+            <h3 style={{ marginBottom: "1.5em", fontWeight: 700 }}>
282
+              {x.title}
283
+            </h3>
284
+            <Row gutter={48}>
285
+              {x?.children?.map((item, index2) => (
286
+                <Col span={6} key={index2}>
287
+                  <Form.Item label={item.label} name={item.name}>
288
+                    <InputNumber style={{ width: "100%" }} precision={0} />
289
+                  </Form.Item>
290
+                </Col>
291
+              ))}
292
+            </Row>
293
+          </div>
294
+        ))}
295
+        <h3 style={{ marginBottom: "1.5em", fontWeight: 700 }}>服务能力</h3>
296
+        <Form.Item name="serviceCapability">
297
+          <Checkbox.Group
298
+            options={[
299
+              "洗澡",
300
+              "WIFI",
301
+              "电脑",
302
+              "报纸/图书",
303
+              "手机充电",
304
+              "代购",
305
+              "休息",
306
+            ]}
307
+          />
308
+        </Form.Item>
309
+        <Row gutter={48}>
310
+          <Col offset={6} span={12}>
311
+            <Button type="primary" htmlType="submit" loading={loading}>
312
+              提交
313
+            </Button>
314
+            {/* <Button style={{ marginLeft: "48px" }} onClick={() => navigate(-1)}>
315
+              返回
316
+            </Button> */}
317
+          </Col>
318
+        </Row>
319
+      </Form>
320
+    </Card>
321
+  );
322
+};

+ 10
- 0
src/routes/routes.jsx 查看文件

@@ -49,6 +49,7 @@ import FilesList from "@/pages/cms/files/list";
49 49
 import MessageList from "@/pages/message";
50 50
 import MessageDetail from "@/pages/message/detail";
51 51
 import StatisCharts from "@/pages/statis/charts";
52
+import Supportability from "@/pages/supportability";
52 53
 
53 54
 /**
54 55
  * meta 用来扩展自定义数据数据
@@ -130,6 +131,15 @@ export const authRoutes = [
130 131
           permission: 'guaranteeTask.evaluate.list',
131 132
         },
132 133
       },
134
+      {
135
+        path: "supportability",
136
+        element: <Supportability />,
137
+        meta: {
138
+          title: "保障能力",
139
+          permission: 'guaranteeTask.evaluate.list',
140
+        },
141
+      },
142
+      
133 143
     ],
134 144
   },
135 145
   {

+ 11
- 0
src/services/supportCapability.js 查看文件

@@ -0,0 +1,11 @@
1
+import { restful } from "@/utils/request";
2
+
3
+const [
4
+  getSupportCapabilityList,
5
+  getSupportCapabilityDetail,
6
+  saveSupportCapability,
7
+  updateSupportCapability,
8
+  deleteSupportCapability,
9
+] = restful("/supportCapability");
10
+
11
+export { getSupportCapabilityDetail, updateSupportCapability,saveSupportCapability };