Blame view

src/pages/oop/Car/components/CarModal.tsx 24.4 KB
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
1
2
3
4
5
6
7
8
9
10
11
12
13
  import React, { useEffect, useState } from "react";
  import {
    Form,
    Input,
    Modal,
    Select,
    message,
    Radio,
    Upload,
    InputNumber,
    DatePicker,
    Button,
  } from "antd";
3913a49e   赵凤   配置管理
14
  import { PlusOutlined } from "@ant-design/icons";
de72c8e2   莫红玲   车型配置代码
15
  import { saveCarInfoApi, getAllSeriesApi } from "../api";
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
  import { useStore } from "../index";
  import { UploadFile } from "antd/lib/upload/interface";
  import SpecCodeEdilt from "./SpecCodeEdilt";
  import { cars } from "../interface";
  import moment from "moment";
  import * as DATA from '../carData';
  
  const FormItem = Form.Item;
  const { Option } = Select;
  const RadioGroup = Radio.Group;
  
  export default function CarModal() {
    const {
      brands,
      factorys,
      getFactories,
      series,
      getSeries,
      setLoading,
      visible,
      setVisible,
      setConfirmLoading,
      confirmLoading,
      currentItem,
      setCurrentItem,
de72c8e2   莫红玲   车型配置代码
41
42
      getSpecCodeList,
      specCodeList
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
    } = useStore();
    const [form] = Form.useForm();
    //新能源类型选择
    const [energryList, setEnergryList] = useState<any>(DATA.EnergyData);
    //控制隐藏
    const [exhaustHidden, setExhaustHidden] = useState(true); //排量
    const [inhaleTypeHidden, setInhaleTypeHidden] = useState(true); //进气方式
    const [gearboxHidden, setGearboxHidden] = useState(true); //变速箱
    const [envLevelHidden, setEnvLevelHidden] = useState(true); //环境标准
    const [batterySizeHidden, setBatterySizeHidden] = useState(true); //电池容量
    const [evMileageHidden, setEvMileageHidden] = useState(true); //纯电续航
    const [quickChargeHidden, setQuickChargeHidden] = useState(true); //快充
    const [slowChargeHidden, setSlowChargeHidden] = useState(true); //慢充
  
    //自动生成车型名称
    const [carName, setCarName] = useState<string>();
    const [restName, setRestName] = useState<string>();
  
    useEffect(() => {
      form.setFieldsValue({
        name: carName
      });
    }, [carName]);
  
    useEffect(() => {
      if (visible) {
        if (currentItem) {
          form.setFieldsValue({
            ...currentItem,
797337c5   莫红玲   oop配置代码编辑bugfix
72
            year: currentItem.year && moment().year(currentItem.year),
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
73
74
            thumbnail: currentItem.thumbnail
              ? [
de72c8e2   莫红玲   车型配置代码
75
76
77
78
79
80
81
82
                {
                  uid: "-1",
                  name: "缩略图",
                  status: "done",
                  url: currentItem.thumbnail,
                  response: { data: currentItem.thumbnail },
                },
              ]
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
83
84
85
86
              : [],
          });
          getFactories(currentItem.brandId);
          getSeries(currentItem.factoryId);
de72c8e2   莫红玲   车型配置代码
87
          getSpecCodeList(currentItem.seriesId);
9c27d397   莫红玲   车型配置名称编辑优化
88
          setCarName(currentItem.name);
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
89
90
91
92
93
94
95
        }
      }
    }, [visible]);
  
    useEffect(() => {
      if (visible) {
        if (currentItem) {
de72c8e2   莫红玲   车型配置代码
96
          getAllSeriesApi({ factoryId: currentItem.factoryId }).then((res: any) => {
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
97
            const car: any = res.data.filter(
de72c8e2   莫红玲   车型配置代码
98
              (item: any) => item.id === currentItem.seriesId
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
99
100
101
102
103
104
105
106
107
            );
            if (car[0].newEnergy) {
              setEnergryList(DATA.NewEnergyData);
            } else {
              setEnergryList(DATA.OldEnergyData);
            }
          });
        }
      }
de72c8e2   莫红玲   车型配置代码
108
    }, [visible]);
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
109
110
111
  
    useEffect(() => {
      if (visible) {
3913a49e   赵凤   配置管理
112
        if (currentItem) { //编辑
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
          if (currentItem.energyType === 1 || currentItem.energyType === 2) {
            setBatterySizeHidden(true);
            setEvMileageHidden(true);
            setQuickChargeHidden(true);
            setSlowChargeHidden(true);
            setExhaustHidden(false);
            setInhaleTypeHidden(false);
            setGearboxHidden(false);
            setEnvLevelHidden(false);
          } else if (currentItem.energyType === 6) {
            setBatterySizeHidden(false);
            setEvMileageHidden(false);
            setQuickChargeHidden(false);
            setSlowChargeHidden(false);
            setExhaustHidden(true);
            setInhaleTypeHidden(true);
            setGearboxHidden(true);
            setEnvLevelHidden(true);
          } else {
            setExhaustHidden(false);
            setInhaleTypeHidden(false);
            setGearboxHidden(false);
            setEnvLevelHidden(false);
            setBatterySizeHidden(false);
            setEvMileageHidden(false);
            setQuickChargeHidden(false);
            setSlowChargeHidden(false);
          }
3913a49e   赵凤   配置管理
141
        } else { // 新增
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
          setExhaustHidden(false);
          setInhaleTypeHidden(false);
          setGearboxHidden(false);
          setEnvLevelHidden(false);
          setBatterySizeHidden(false);
          setEvMileageHidden(false);
          setQuickChargeHidden(false);
          setSlowChargeHidden(false);
        }
      }
    }, [visible]);
  
    const okHandle = () => {
      form
        .validateFields()
        .then((v: any) => {
          const item = {
            ...v,
            id: currentItem ? currentItem.id : undefined,
98b0e464   莫红玲   Merge remote-trac...
161
            thumbnail: v.thumbnail ? v.thumbnail[0] && v.thumbnail[0].response.data : '',
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
            year: +moment(v.year).format("YYYY"),
            specCodeList: v.specCodeList,
          };
          setConfirmLoading(true);
          saveCarInfoApi(item)
            .then((res: any) => {
              message.success("操作成功!");
              setConfirmLoading(false);
              setVisible(false);
              setLoading(true);
            })
            .catch((error: any) => {
              message.error(error.message);
              setConfirmLoading(false);
            });
        })
        .catch((error) => {
          message.error(error.message);
          setConfirmLoading(false);
        });
    };
  
    const brandSelect = (v: any) => {
      form.setFieldsValue({
        factoryId: undefined,
        seriesId: undefined,
        energyType: undefined,
        ...DATA.resData,
      });
      setCarName("");
      return v;
    };
  
    const factorySelect = (v: any) => {
      form.setFieldsValue({
        seriesId: undefined,
        energyType: undefined,
        ...DATA.resData,
      });
      return v;
    };
  
de72c8e2   莫红玲   车型配置代码
204
    const seriesIdSelect = (v: any) => {
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
205
206
207
208
209
210
211
212
213
214
215
216
217
218
      form.setFieldsValue({
        energyType: undefined,
        ...DATA.resData,
      });
      setCarName("");
      const car: any = series.filter((item) => item.id === v);
      if (car[0].newEnergy) {
        setEnergryList(DATA.NewEnergyData);
      } else {
        setEnergryList(DATA.OldEnergyData);
      }
      return v;
    };
  
de72c8e2   莫红玲   车型配置代码
219
    const specCodeSelect = (v: string, options: any) => {
d8e1c180   莫红玲   进气方式
220
      const spec: OopSpecCode.ListVO[] = specCodeList.filter((item) => item.specCode === v);
de72c8e2   莫红玲   车型配置代码
221
      options.exhaust && form.setFieldsValue({
d8e1c180   莫红玲   进气方式
222
223
        exhaust: spec[0].exhaust,
        inhaleType: spec[0].inhaleType
de72c8e2   莫红玲   车型配置代码
224
225
226
      });
    };
  
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
    const beforeUpload = (file: UploadFile) => {
      const imgTypeArr = ["image/jpg", "image/jpeg", "image/gif", "image/png"];
      const isImg = imgTypeArr.indexOf(file.type) > -1;
      if (!isImg) {
        message.error("请选择png、jpg、gif、jpeg图片!");
      }
      const isLt2M = file.size / 1024 / 1024 < 2;
      if (!isLt2M) {
        message.error("图片大小不能超过 2MB!");
      }
      return isImg && isLt2M;
    };
  
    const onPreView = (file: UploadFile) => {
      const bodyEl = document.body;
      const a = document.createElement("a");
      a.href = file.response.data;
      a.target = "__blank";
      bodyEl.appendChild(a);
      a.click();
      bodyEl.removeChild(a);
    };
  
    //选择能源类型
de72c8e2   莫红玲   车型配置代码
251
    const SelectEnergyType = (value: any) => {
3913a49e   赵凤   配置管理
252
253
      // form.setFieldsValue({ ...DATA.resData });
      // setCarName("");
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
      if (value === 1 || value === 2) {
        setBatterySizeHidden(true);
        setEvMileageHidden(true);
        setQuickChargeHidden(true);
        setSlowChargeHidden(true);
        setExhaustHidden(false);
        setInhaleTypeHidden(false);
        setGearboxHidden(false);
        setEnvLevelHidden(false);
      } else if (value === 6) {
        setBatterySizeHidden(false);
        setEvMileageHidden(false);
        setQuickChargeHidden(false);
        setSlowChargeHidden(false);
        setExhaustHidden(true);
        setInhaleTypeHidden(true);
        setGearboxHidden(true);
        setEnvLevelHidden(true);
      } else {
        setExhaustHidden(false);
        setInhaleTypeHidden(false);
        setGearboxHidden(false);
        setEnvLevelHidden(false);
        setBatterySizeHidden(false);
        setEvMileageHidden(false);
        setQuickChargeHidden(false);
        setSlowChargeHidden(false);
      }
de72c8e2   莫红玲   车型配置代码
282
    };
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
283
284
  
    //点击表单获取所有值并自动生成车型名称
de72c8e2   莫红玲   车型配置代码
285
    const onValuesChange = (changedValues: any, allValues: any) => {
3913a49e   赵凤   配置管理
286
287
      let NAME;
      if (currentItem === undefined) { //新增
de72c8e2   莫红玲   车型配置代码
288
289
290
291
292
293
294
295
296
297
        const caryear: string = allValues.year ? allValues.year.year() + "款" : "";
        const careditionName: string = allValues.editionName ? `${allValues.editionName}` : '';
        const carexhaust: string = allValues.exhaust ? `${allValues.exhaust.toFixed(1)}` : '';
        const carinhaleType: string = allValues.inhaleType ? (allValues.inhaleType === 1 ? "L" : "T") : '';
        const cardriveType: string = allValues.driveType ? `${DATA.DriveType[allValues.driveType]}` : '';
        const cartransmissionType: string = allValues.transmissionType ? `${DATA.TransmissionType[allValues.transmissionType]}` : '';
        const cargearbox: string = allValues.gearbox ? `${allValues.gearbox}` : '';
        const carmodelName: string = allValues.modelName ? allValues.modelName : '';
        const carsuitName: string = allValues.suitName ? `${allValues.suitName}` : '';
        const carseatCount: string = allValues.seatCount ? `${allValues.seatCount}座` : '';
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
298
  
3913a49e   赵凤   配置管理
299
        // const NAME = `${caryear} ${careditionName} ${carexhaust}${carinhaleType} ${cardriveType} ${cartransmissionType}${cargearbox} ${carmodelName} ${carsuitName} ${carseatCount}`;
9c27d397   莫红玲   车型配置名称编辑优化
300
        NAME = `${careditionName} ${carexhaust}${carinhaleType} ${cardriveType} ${cartransmissionType}${cargearbox} ${carmodelName} ${carsuitName} ${carseatCount}`;
3913a49e   赵凤   配置管理
301
302
303
304
305
  
        // let pattern = /\s+/g;
        // const _Name = NAME.replace(pattern, " ");
        // setCarName(_Name);
      } else { //编辑
9c27d397   莫红玲   车型配置名称编辑优化
306
        return;
de72c8e2   莫红玲   车型配置代码
307
308
309
310
311
312
313
314
315
316
        const caryear: string = allValues.year ? allValues.year.year() + "款" : "";
        const careditionName: string = allValues.editionName ? `${allValues.editionName}` : '';
        const carexhaust: string = allValues.exhaust ? `${allValues.exhaust.toFixed(1)}` : '';
        const carinhaleType: string = allValues.inhaleType ? (allValues.inhaleType === 1 ? "L" : "T") : '';
        const cardriveType: string = allValues.driveType ? `${DATA.DriveType[allValues.driveType]}` : '';
        const cartransmissionType: string = allValues.transmissionType ? `${DATA.TransmissionType[allValues.transmissionType]}` : '';
        const cargearbox: string = allValues.gearbox ? `${allValues.gearbox}` : '';
        const carmodelName: string = allValues.modelName ? allValues.modelName : '';
        const carsuitName: string = allValues.suitName ? `${allValues.suitName}` : '';
        const carseatCount: string = allValues.seatCount ? `${allValues.seatCount}座` : '';
9c27d397   莫红玲   车型配置名称编辑优化
317
        NAME = `${careditionName} ${carexhaust}${carinhaleType} ${cardriveType} ${cartransmissionType}${cargearbox} ${carmodelName} ${carsuitName} ${carseatCount}`;
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
318
      }
3913a49e   赵凤   配置管理
319
320
321
      let pattern = /\s+/g;
      const _Name = NAME.replace(pattern, " ");
      setCarName(_Name);
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
    };
  
    //重置车型名称
    const onRest = () => {
      if (currentItem) {
        if (carName === undefined && restName === undefined) {
          form.setFieldsValue({
            name: currentItem?.name,
          });
        } else {
          form.setFieldsValue({
            name: restName,
          });
        }
      } else {
        form.setFieldsValue({
          name: carName,
        });
      }
    };
  
    return (
      <Modal
        getContainer={false}
        width={900}
        title={`${currentItem ? "编辑" : "添加"}车型`}
        visible={visible}
        onOk={okHandle}
        maskClosable={false}
        onCancel={() => setVisible(false)}
        confirmLoading={confirmLoading}
        afterClose={() => {
          form.resetFields();
          setCurrentItem(undefined);
        }}
      >
        <Form
          form={form}
          labelCol={{ span: 8 }}
          wrapperCol={{ span: 15 }}
          onValuesChange={onValuesChange}
        >
          <div
            style={{ display: "flex", flexDirection: "row", flexWrap: "wrap" }}
          >
af1abf66   赵凤   配置管理
367
  
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
            <FormItem
              style={{ width: 400 }}
              name="brandId"
              label="品牌"
              rules={[{ required: true, message: "必填项" }]}
              getValueFromEvent={brandSelect}
            >
              <Select
                allowClear
                showSearch
                optionFilterProp="children"
                style={{ width: "100%" }}
                placeholder="请选择品牌"
                onChange={(val) => getFactories(+val)}
              >
                {brands.map((item: cars.BrandItem) => (
                  <Option key={item.id} value={item.id || 0} title={item.name}>
                    {item.name}
                  </Option>
                ))}
              </Select>
            </FormItem>
            <FormItem
              style={{ width: 400 }}
              name="factoryId"
              label="厂商"
              rules={[{ required: true, message: "必填项" }]}
              getValueFromEvent={factorySelect}
            >
              <Select
                allowClear
                showSearch
                optionFilterProp="children"
                style={{ width: "100%" }}
                placeholder="请选择厂商"
                onChange={(val) => getSeries(+val)}
              >
                {factorys.map((item: cars.FactoryItem) => (
                  <Option key={item.id} value={item.id || 0} title={item.name}>
                    {item.name}
                  </Option>
                ))}
              </Select>
            </FormItem>
            <FormItem
              style={{ width: 400 }}
              name="seriesId"
              label="车系"
              rules={[{ required: true, message: "必填项" }]}
              getValueFromEvent={seriesIdSelect}
            >
              <Select
                allowClear
                showSearch
                optionFilterProp="children"
                style={{ width: "100%" }}
                placeholder="请选择"
de72c8e2   莫红玲   车型配置代码
425
                onChange={(val) => getSpecCodeList(+val)}
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
426
427
428
429
430
431
432
433
              >
                {series.map((item: cars.SeriesItem) => (
                  <Option key={item.id} value={item.id || 0} title={item.name}>
                    {item.name}
                  </Option>
                ))}
              </Select>
            </FormItem>
0e37f7ac   莫红玲   配置管理新增车型分类名称
434
            
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
435
436
            <FormItem
              style={{ width: 400 }}
de72c8e2   莫红玲   车型配置代码
437
              name="specCode"
d2394e39   莫红玲   整车型号配置bugfix
438
              label="整车型号代码"
de72c8e2   莫红玲   车型配置代码
439
              rules={[{ required: true, message: "必填项" }]}
de72c8e2   莫红玲   车型配置代码
440
441
442
443
444
445
446
447
448
449
450
            >
              <Select
                allowClear
                showSearch
                optionFilterProp="children"
                style={{ width: "100%" }}
                placeholder="请选择"
                onChange={specCodeSelect}
              >
                {specCodeList.map((item: OopSpecCode.ListVO) => (
                  <Option key={item.id} value={item.specCode || 0} exhaust={item.exhaust}>
ac849095   莫红玲   oop配置管理搜索调整
451
                    {`[${item.specCode}]${item.specCodeName}`}
de72c8e2   莫红玲   车型配置代码
452
                  </Option>
3913a49e   赵凤   配置管理
453
                ))}
de72c8e2   莫红玲   车型配置代码
454
455
              </Select>
            </FormItem>
de72c8e2   莫红玲   车型配置代码
456
            <FormItem
d2394e39   莫红玲   整车型号配置bugfix
457
458
459
460
461
462
              name="specCodeList"
              label="配置代码"
              style={{ width: 400 }}
            >
              <SpecCodeEdilt />
            </FormItem>
af1abf66   赵凤   配置管理
463
  
d2394e39   莫红玲   整车型号配置bugfix
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
            <FormItem
              name="thumbnail"
              valuePropName="fileList"
              label="缩略图"
              style={{ width: 400 }}
              // rules={[{ required: true }]}
              getValueFromEvent={(e) => {
                if (Array.isArray(e)) {
                  return e.slice(-1);
                }
                if (!e.file.status) return [];
                if (e.file.status == "error") {
                  message.error("缩略图上传出错,请重新上传");
                  return [];
                }
                return e && e.fileList.slice(-1);
              }}
            >
              <Upload
                name="file"
                action="/api/oop/util/file/upload"
                accept="image/*"
                listType="picture-card"
                beforeUpload={beforeUpload}
                onPreview={onPreView}
              >
                <div>
                  <PlusOutlined />
                  <div className="ant-upload-text">上传缩略图</div>
                </div>
              </Upload>
            </FormItem>
            <FormItem
              style={{ width: 400 }}
              name="name"
              label="配置名称"
              rules={[{ required: true, message: "该选项为必填项" }]}
            >
9c27d397   莫红玲   车型配置名称编辑优化
502
              <Input.TextArea autoSize allowClear />
d2394e39   莫红玲   整车型号配置bugfix
503
504
            </FormItem>
            <FormItem
0e37f7ac   莫红玲   配置管理新增车型分类名称
505
506
507
508
509
510
511
512
              name="classifyName"
              label="车型分类名称"
              style={{ width: 400 }}
              rules={[{ required: true, message: "该选项为必填项" }]}
            >
              <Input placeholder="请输入" allowClear />
            </FormItem>
            <FormItem
de72c8e2   莫红玲   车型配置代码
513
              style={{ width: 400 }}
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
              name="energyType"
              label="能源类型"
              rules={[{ required: true }]}
            >
              <Select
                allowClear
                showSearch
                optionFilterProp="children"
                style={{ width: "100%" }}
                placeholder="请选择能源类型"
                onSelect={SelectEnergyType}
              >
                {energryList.map((item: any) => (
                  <Option value={item.value} key={`${item.label}_${item.value}`}>
                    {item.label}
                  </Option>
                ))}
              </Select>
            </FormItem>
            <FormItem
              name="year"
              label="年款"
              rules={[{ required: true }]}
              style={{ width: 400 }}
            >
              <DatePicker style={{ width: "100%" }} picker="year" />
            </FormItem>
            <FormItem
              name="exhaust"
              label="排量"
              rules={[{ required: !exhaustHidden }]}
              style={{ width: 400 }}
              hidden={exhaustHidden}
            >
              <InputNumber
                style={{ width: "100%" }}
                min={0}
                step={0.01}
                precision={1}
                placeholder="请输入排量"
              />
            </FormItem>
            <FormItem
              style={{ width: 400 }}
              name="inhaleType"
              label="进气方式"
              hidden={inhaleTypeHidden}
              rules={[{ required: !inhaleTypeHidden }]}
            >
              <Select
                allowClear
                showSearch
                optionFilterProp="children"
                style={{ width: "100%" }}
                placeholder="请选择进气方式"
              >
                <Option value={1}>自然吸气</Option>
                <Option value={2}>涡轮增压</Option>
                <Option value={3}>机械增压</Option>
              </Select>
            </FormItem>
            <FormItem
              style={{ width: 400 }}
              name="driveType"
              label="驱动类型"
de72c8e2   莫红玲   车型配置代码
579
            //rules={[{ required: true }]}
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
            >
              <Select
                allowClear
                showSearch
                optionFilterProp="children"
                style={{ width: "100%" }}
                placeholder="请选择驱动类型"
              >
                <Option value={1}>两驱</Option>
                <Option value={2}>四驱</Option>
              </Select>
            </FormItem>
            <FormItem
              style={{ width: 400 }}
              name="transmissionType"
              label="变速类型"
de72c8e2   莫红玲   车型配置代码
596
            //rules={[{ required: true }]}
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
            >
              <Select
                allowClear
                showSearch
                optionFilterProp="children"
                style={{ width: "100%" }}
                placeholder="请选择变速类型"
              >
                <Option value={1}>手动</Option>
                <Option value={2}>自动</Option>
              </Select>
            </FormItem>
            <FormItem
              name="gearbox"
              label="变速箱"
              hidden={gearboxHidden}
              //rules={[{ required: true }]}
              style={{ width: 400 }}
            >
              <Select
                allowClear
                showSearch
                optionFilterProp="children"
                style={{ width: "100%" }}
                placeholder="请选择变速箱"
              >
                <Option value="MT">MT</Option>
                <Option value="AT">AT</Option>
                <Option value="CVT">CVT</Option>
                <Option value="DCT">DCT</Option>
                <Option value="DSGW">DSG</Option>
              </Select>
            </FormItem>
            <FormItem name="editionName" label="版本名称" style={{ width: 400 }}>
              <Input placeholder="请输入车型名称" />
            </FormItem>
            <FormItem
              style={{ width: 400 }}
              name="modelName"
              label="型号名称"
              rules={[{ required: true }]}
            >
              <Input placeholder="请输入车型名称" />
            </FormItem>
            <FormItem
              name="suitName"
              label="套装名称"
              //rules={[{ required: true }]}
              style={{ width: 400 }}
            >
              <Input placeholder="请输入车型名称" />
            </FormItem>
            <FormItem
              name="batterySize"
              label="电池容量(kWh)"
              hidden={batterySizeHidden}
              //rules={[{ required: true }]}
              style={{ width: 400 }}
            >
              <InputNumber
                style={{ width: "100%" }}
                placeholder="请输入电池容量"
                min={0}
                precision={2}
              />
            </FormItem>
            <FormItem
              name="evMileage"
              label="纯电续航(km)"
              hidden={evMileageHidden}
              //rules={[{ required: true }]}
              style={{ width: 400 }}
            >
              <InputNumber
                style={{ width: "100%" }}
                min={0}
                precision={2}
                placeholder="请输入纯电续航"
              />
            </FormItem>
            <FormItem
              name="quickCharge"
              label="快充时间(小时)"
              hidden={quickChargeHidden}
              //rules={[{ required: true }]}
              style={{ width: 400 }}
            >
              <InputNumber
                style={{ width: "100%" }}
                min={0}
                precision={2}
                placeholder="请输入快充时间"
              />
            </FormItem>
            <FormItem
              name="slowCharge"
              label="慢充时间(小时)"
              hidden={slowChargeHidden}
              //rules={[{ required: true }]}
              style={{ width: 400 }}
            >
              <InputNumber
                style={{ width: "100%" }}
                min={0}
                precision={2}
                placeholder="请输入慢充时间"
              />
            </FormItem>
            <FormItem
              name="envLevel"
              label="排放标准"
              hidden={envLevelHidden}
              rules={[{ required: !envLevelHidden }]}
              style={{ width: 400 }}
            >
              <Select
                allowClear
                showSearch
                optionFilterProp="children"
                style={{ width: "100%" }}
                placeholder="请选择排放标准"
              >
                <Option value="国I">国I</Option>
                <Option value="国II">国II</Option>
                <Option value="国III">国III</Option>
                <Option value="国IV">国IV</Option>
                <Option value="国V">国V</Option>
                <Option value="国VI">国VI</Option>
              </Select>
            </FormItem>
            <FormItem
              name="seatCount"
              label="座位数"
              //rules={[{ required: true }]}
              style={{ width: 400 }}
            >
              <InputNumber
                style={{ width: "100%" }}
                min={0}
                step={1}
                placeholder="请输入座位数"
              />
            </FormItem>
            <FormItem
              style={{ width: 400 }}
              name="saleStatus"
              label="销售状态"
              rules={[{ required: true }]}
            >
              <RadioGroup>
                <Radio value={1}>在售</Radio>
                <Radio value={0}>停售</Radio>
                <Radio value={2}>预售</Radio>
              </RadioGroup>
            </FormItem>
            <FormItem
              style={{ width: 400 }}
              name="proStatus"
              label="生产状态"
              rules={[{ required: true }]}
            >
              <RadioGroup>
                <Radio value={1}>在产</Radio>
                <Radio value={0}>停产</Radio>
              </RadioGroup>
            </FormItem>
af1abf66   赵凤   配置管理
763
  
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
764
765
          </div>
        </Form>
9c27d397   莫红玲   车型配置名称编辑优化
766
767
768
769
770
771
772
773
774
        {!currentItem && (
          <Button
            type="primary"
            style={{ display: "block", margin: "auto" }}
            onClick={onRest}
          >
            重置名称
          </Button>
        )}
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
775
776
777
      </Modal>
    );
  }