|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
import { useEffect, useState } from 'react';
|
|
|
|
|
import { App, Form, Input, Row, Col, Select, Button, InputNumber, Checkbox } from 'antd';
|
|
|
|
|
import { objectMapper, isEmpty, isNotEmpty } from '@/utils/commons';
|
|
|
|
|
import { objectMapper, isEmpty, isNotEmpty, pick } from '@/utils/commons';
|
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
|
import { useWeekdays } from '@/hooks/useDatePresets';
|
|
|
|
|
import DeptSelector from '@/components/DeptSelector';
|
|
|
|
@ -36,8 +36,13 @@ const InfoForm = ({ onSubmit, onReset, onValuesChange, editablePerm, infoEditabl
|
|
|
|
|
const [showSave, setShowSave] = useState(true);
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
form.resetFields();
|
|
|
|
|
|
|
|
|
|
form.setFieldsValue(serverData2Form(editingProduct));
|
|
|
|
|
const _formValue = serverData2Form(editingProduct);
|
|
|
|
|
const readyFormVal = pick(_formValue, ['quotation', 'lgc_details_mapped','city', 'dept', 'display_to_c'])
|
|
|
|
|
// form.setFieldsValue(serverData2Form(editingProduct));
|
|
|
|
|
// ! setFieldsValue 导致赋值错误
|
|
|
|
|
for (const _key in readyFormVal) {
|
|
|
|
|
form.setFieldValue(_key, readyFormVal[_key])
|
|
|
|
|
}
|
|
|
|
|
setPickEditedInfo({ ...pickEditedInfo, product_title: editingProduct?.info?.product_title });
|
|
|
|
|
|
|
|
|
|
setFormEditable(infoEditable || priceEditable);
|
|
|
|
|