diff --git a/public/locales/en/products.json b/public/locales/en/products.json
index 6ae1f9f..e5e841c 100644
--- a/public/locales/en/products.json
+++ b/public/locales/en/products.json
@@ -116,6 +116,7 @@
"Weekdays": "Weekdays"
},
+ "sureSubmitAudit": "确认提交所有产品审核? 提交后,所有产品将进入待审核流程. ",
"FormTooltip": {
"Type": "Product Type",
"Title": "Title",
diff --git a/public/locales/zh/products.json b/public/locales/zh/products.json
index 50d586c..37cfb4f 100644
--- a/public/locales/zh/products.json
+++ b/public/locales/zh/products.json
@@ -105,6 +105,7 @@
"Operation": "Operation"
},
+ "sureSubmitAudit": "确认提交所有产品审核? 提交后,所有产品将进入待审核流程. ",
"FormTooltip": {
"Type": "Product Type",
"Title": "Title",
diff --git a/src/views/products/Detail/Header.jsx b/src/views/products/Detail/Header.jsx
index 84d7bb0..493a207 100644
--- a/src/views/products/Detail/Header.jsx
+++ b/src/views/products/Detail/Header.jsx
@@ -181,10 +181,10 @@ const Header = ({ refresh, newActionable, ...props }) => {
)}
- {activeAgencyState === 0 && (
+ {/* {activeAgencyState === 0 && ( */}
<>
-
+
>
- )}
+ {/* )} */}
);
};
diff --git a/src/views/products/Detail/ProductInfo.jsx b/src/views/products/Detail/ProductInfo.jsx
index 4065ef5..c6fe6eb 100644
--- a/src/views/products/Detail/ProductInfo.jsx
+++ b/src/views/products/Detail/ProductInfo.jsx
@@ -22,18 +22,25 @@ const ProductInfo = ({ ...props }) => {
const [activeAgency, editingProduct, setEditingProduct] = useProductsStore((state) => [state.activeAgency, state.editingProduct, state.setEditingProduct]);
const [extrasVisible, setExtrasVisible] = useState(false);
- const [editable, setEditable] = useState(false);
+ const [editablePerm, setEditablePerm] = useState(false);
+ const [infoEditable, setInfoEditable] = useState(false);
+ const [priceEditable, setPriceEditable] = useState(false);
const topPerm = isPermitted(PERM_PRODUCTS_MANAGEMENT); // 高级权限
useEffect(() => {
const hasHT = (editingProduct?.info?.htid || 0) > 0;
// const hasAuditPer = isPermitted(PERM_PRODUCTS_OFFER_AUDIT);
const hasEditPer = isPermitted(PERM_PRODUCTS_OFFER_PUT);
- setEditable(topPerm || (!hasHT && hasEditPer));
+
+ setEditablePerm(topPerm || hasEditPer);
// setEditable(topPerm || (hasAuditPer ? true : (!hasHT && hasEditPer)));
// setEditable(true); // debug: 0
// console.log('editable', hasAuditPer, (notAudit && hasEditPer));
+ setInfoEditable(topPerm || (!hasHT && hasEditPer));
+
+ const _priceEditable = [-1, 3].includes(activeAgency?.audit_state_id);
+ setPriceEditable(topPerm || (_priceEditable && hasEditPer));
- const showExtras = topPerm && !isEmpty(editingProduct) && hasHT;
+ const showExtras = topPerm && hasHT; // !isEmpty(editingProduct) &&
setExtrasVisible(showExtras);
return () => {};
}, [activeAgency, editingProduct]);
@@ -42,18 +49,19 @@ const ProductInfo = ({ ...props }) => {
values.travel_agency_id = activeAgency.travel_agency_id;
const copyNewProduct = structuredClone(newProductRecord);
const poster = {
- ...(topPerm ? {} : {'audit_state': '-1',}), // 高级权限: 不变更状态值
+ ...(topPerm ? {} : { 'audit_state': -1 }), // 高级权限: 不变更状态值
// "create_date": dayjs().format('YYYY-MM-DD HH:mm:ss'),
// "created_by": userId,
'travel_agency_id': activeAgency.travel_agency_id,
// "travel_agency_name": "",
// "lastedit_changed": "",
};
- /** lgc_details */
const copyFields = pick(editingProduct.info, ['product_type_id']); // 'title',
const readyToSubInfo = { ...copyNewProduct.info, ...editingProduct.info, ...values.info, ...copyFields, type: copyFields.product_type_id, ...poster };
+ readyToSubInfo.dept = Number(readyToSubInfo.dept);
// console.log('onSave', editingProduct.info, readyToSubInfo);
- const prevLgcDetailsMapped = editingProduct.lgc_details.reduce((r, c) => ({ ...r, [c.lgc]: { ...c, description: c.descriptions } }), {}); // todo: description字段不一致
+ /** lgc_details */
+ const prevLgcDetailsMapped = editingProduct.lgc_details.reduce((r, c) => ({ ...r, [c.lgc]: { ...c, description: c.descriptions } }), {});
const mergedLgc = { ...prevLgcDetailsMapped, ...values.lgc_details_mapped };
// console.log(values);
@@ -64,15 +72,15 @@ const ProductInfo = ({ ...props }) => {
travel_agency_id: activeAgency.travel_agency_id,
info: readyToSubInfo,
lgc_details: Object.values(mergedLgc),
- quotation: values.quotation, // || editingProduct.quotation, // 没改动, 就用原来的
- }).catch(ex => {
+ quotation: values.quotation.map((q) => ({ ...q, unit: Number(q.unit || q.unit_id), unit_id: Number(q.unit_id) })), // || editingProduct.quotation, // 没改动, 就用原来的
+ }).catch((ex) => {
setLoading(false);
notification.error({
message: 'Notification',
description: ex.message,
placement: 'top',
duration: 4,
- })
+ });
});
setLoading(false);
success ? message.success(t('Success')) : message.error(t('Failed'));
@@ -90,10 +98,14 @@ const ProductInfo = ({ ...props }) => {
]}
/>
-
{t('products:EditComponents.info')}
-
-
- {extrasVisible && }
+ {isEmpty(editingProduct) ? null : (
+ <>
+ {t('products:EditComponents.info')}
+
+
+ {extrasVisible && }
+ >
+ )}
>
);
};
diff --git a/src/views/products/Detail/ProductInfoForm.jsx b/src/views/products/Detail/ProductInfoForm.jsx
index a35c483..b3305b6 100644
--- a/src/views/products/Detail/ProductInfoForm.jsx
+++ b/src/views/products/Detail/ProductInfoForm.jsx
@@ -11,7 +11,7 @@ import ProductInfoLgc from './ProductInfoLgc';
import ProductInfoQuotation from './ProductInfoQuotation';
import { useHTLanguageSetsMapVal } from '@/hooks/useHTLanguageSets';
-const InfoForm = ({ onSubmit, onReset, onValuesChange, editable: _editable, showSubmit, confirmText, formName, ...props }) => {
+const InfoForm = ({ onSubmit, onReset, onValuesChange, editablePerm, infoEditable, priceEditable, showSubmit, confirmText, formName, ...props }) => {
const { notification } = App.useApp();
const { t } = useTranslation('products');
const HTLanguageSetsMapVal = useHTLanguageSetsMapVal();
@@ -29,7 +29,9 @@ const InfoForm = ({ onSubmit, onReset, onValuesChange, editable: _editable, show
const filedsets = useProductsTypesFieldsets(editingProduct?.info?.product_type_id);
const shows = filedsets[0];
- const [editable, setEditable] = useState(true);
+ // const [editable, setEditable] = useState(true);
+ const [formEditable, setFormEditable] = useState(true);
+ const [showSave, setShowSave] = useState(true);
useEffect(() => {
form.resetFields();
form.setFieldValue('city', editingProduct?.info?.city_id ? { value: editingProduct?.info?.city_id, label: editingProduct?.info?.city_name } : undefined);
@@ -38,10 +40,13 @@ const InfoForm = ({ onSubmit, onReset, onValuesChange, editable: _editable, show
form.setFieldValue('lgc_details_mapped', lgc_details_mapped);
form.setFieldValue('quotation', editingProduct?.quotation);
- const editable0 = isEmpty(editingProduct) ? false : _editable; // 空对象未操作
- setEditable(editable0);
+ setFormEditable(infoEditable || priceEditable);
+
+ const editable0 = isEmpty(editingProduct) ? false : editablePerm; // 空对象未操作
+ setShowSave(infoEditable || priceEditable);
+ // setEditable(editable0);
return () => {};
- }, [editingProduct?.info?.id, _editable]);
+ }, [editingProduct?.info?.id, editablePerm, infoEditable, priceEditable]);
const onFinish = (values) => {
console.log('Received values of form, origin form value: \n', values);
@@ -84,7 +89,7 @@ const InfoForm = ({ onSubmit, onReset, onValuesChange, editable: _editable, show
<>