diff --git a/src/stores/Products/Index.js b/src/stores/Products/Index.js
index 01bffe7..06771d6 100644
--- a/src/stores/Products/Index.js
+++ b/src/stores/Products/Index.js
@@ -180,9 +180,8 @@ export const useProductsStore = create(
saveOrUpdateQuotation: (formValues) => {
const { quotationList } = get()
- console.info('formValues: ', formValues)
const prevList = quotationList.filter(q => q.id === formValues.id)
- console.info(prevList)
+
if (prevList.length > 0) {
formValues.use_dates_start = formValues.use_dates[0].format('YYYY-MM-DD')
@@ -199,6 +198,10 @@ export const useProductsStore = create(
console.log(`${key}: ${prevValue} - ${value} (${hasChanged})`)
}
}
+
+ set((state) => ({
+ quotationList: [...state.quotationList, ...[formValues]]
+ }))
},
// side effects
diff --git a/src/views/products/Detail/ProductInfoForm.jsx b/src/views/products/Detail/ProductInfoForm.jsx
index ffa79be..7e5e545 100644
--- a/src/views/products/Detail/ProductInfoForm.jsx
+++ b/src/views/products/Detail/ProductInfoForm.jsx
@@ -134,8 +134,10 @@ const InfoForm = ({ onSubmit, onReset, onValuesChange, editable: _editable, show
)}
+
+
+
-
>
);
};
@@ -380,6 +382,13 @@ const formValuesMapper = (values) => {
},
},
],
+ 'quotation_mapped': {
+ key: 'quotation',
+ transform: (value) => {
+ console.info(value)
+ return value.quotationList
+ },
+ },
};
let dest = {};
const { city, ...omittedValue } = values;
diff --git a/src/views/products/Detail/ProductInfoQuotation.jsx b/src/views/products/Detail/ProductInfoQuotation.jsx
index ac65f23..960e775 100644
--- a/src/views/products/Detail/ProductInfoQuotation.jsx
+++ b/src/views/products/Detail/ProductInfoQuotation.jsx
@@ -236,6 +236,9 @@ const defaultDefinitionValue = {
const ProductInfoQuotation = ({ editable, ...props }) => {
+
+ const { id, value = {}, onChange } = props
+
const { t } = useTranslation()
const [isQuotationModalOpen, setQuotationModalOpen] = useState(false)
@@ -243,14 +246,18 @@ const ProductInfoQuotation = ({ editable, ...props }) => {
const [quotationForm] = Form.useForm()
const [batchSetupForm] = Form.useForm()
+ // console.info('value: ', value)
+
const datePresets = useDatePresets()
- const [newEmptyQuotation, appendQuotationList, quotationList, saveOrUpdateQuotation] =
- useProductsStore((state) => [state.newEmptyQuotation, state.appendQuotationList, state.quotationList, state.saveOrUpdateQuotation])
+ const [quotationList, newEmptyQuotation, appendQuotationList, saveOrUpdateQuotation] =
+ useProductsStore((state) => [state.quotationList, state.newEmptyQuotation, state.appendQuotationList, state.saveOrUpdateQuotation])
- useEffect(() => {
- console.info('quotationList: ', quotationList)
- }, [quotationList])
+ const triggerChange = (changedValue) => {
+ onChange?.({
+ quotationList
+ })
+ }
const onQuotationSeleted = async (quotation) => {
// 把 start, end 转换为 RangePicker 数组格式
@@ -267,6 +274,7 @@ const ProductInfoQuotation = ({ editable, ...props }) => {
const onQuotationFinish = (values) => {
saveOrUpdateQuotation(values)
+ triggerChange(quotationList)
setQuotationModalOpen(false)
// .then(() => {
// setQuotationModalOpen(false)