|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
import React, { useState, useEffect } from 'react';
|
|
|
|
|
import { useState, useEffect } from 'react';
|
|
|
|
|
import { message, Divider, Empty, Flex } from 'antd';
|
|
|
|
|
import { useNavigate } from 'react-router-dom';
|
|
|
|
|
import Extras from './Detail/Extras';
|
|
|
|
@ -9,7 +9,7 @@ import { useParams } from 'react-router-dom';
|
|
|
|
|
import useProductsStore from '@/stores/Products/Index';
|
|
|
|
|
import dayjs from 'dayjs';
|
|
|
|
|
import { HT_HOST } from '@/config';
|
|
|
|
|
import { postJSON, postForm } from '@/utils/request';
|
|
|
|
|
import { postForm } from '@/utils/request';
|
|
|
|
|
import { PERM_PRODUCTS_OFFER_AUDIT, PERM_PRODUCTS_OFFER_PUT } from '@/config';
|
|
|
|
|
import { usingStorage } from '@/hooks/usingStorage';
|
|
|
|
|
import ProductsTree from './Detail/ProductsTree';
|
|
|
|
@ -20,18 +20,12 @@ import NewProductModal from './Detail/NewProductModal';
|
|
|
|
|
function Detail() {
|
|
|
|
|
// const { t } = useTranslation();
|
|
|
|
|
const navigate = useNavigate();
|
|
|
|
|
const [quotation, setQuotation] = useState(null);
|
|
|
|
|
const [lgc_details, setLgc_details] = useState(null);
|
|
|
|
|
// const [languageLabel, setLanguageLabel] = useState(null);
|
|
|
|
|
const { travel_agency_id, audit_state, use_year } = useParams();
|
|
|
|
|
// const HTLanguageSets = useHTLanguageSets();
|
|
|
|
|
// const { Search } = Input;
|
|
|
|
|
const [addProductVisible, setAddProductVisible] = useState(false);
|
|
|
|
|
const [editingProduct, setEditingProduct] = useProductsStore((state) => [state.editingProduct, state.setEditingProduct]);
|
|
|
|
|
const [agencyProducts, setAgencyProducts, loading] = useProductsStore((state) => [state.agencyProducts, state.setAgencyProducts, state.loading]);
|
|
|
|
|
const [editingProduct, ] = useProductsStore((state) => [state.editingProduct]);
|
|
|
|
|
const [agencyProducts, loading] = useProductsStore((state) => [state.agencyProducts, state.loading]);
|
|
|
|
|
const [getAgencyProducts, activeAgency] = useProductsStore((state) => [state.getAgencyProducts, state.activeAgency]);
|
|
|
|
|
const [switchParams, setSwitchParams] = useProductsStore((state) => [state.switchParams, state.setSwitchParams]);
|
|
|
|
|
const [info, setInfo] = useState();
|
|
|
|
|
const [setSwitchParams] = useProductsStore((state) => [state.setSwitchParams]);
|
|
|
|
|
const yearOptions = [];
|
|
|
|
|
const currentYear = dayjs().year();
|
|
|
|
|
const baseYear = Number(use_year === 'all' ? currentYear : use_year);
|
|
|
|
@ -113,79 +107,79 @@ function Detail() {
|
|
|
|
|
}, [activeAgency, editingProduct]);
|
|
|
|
|
|
|
|
|
|
//保存产品
|
|
|
|
|
const onSave = async (values) => {
|
|
|
|
|
let tempInfo;
|
|
|
|
|
if (info.id === '') {
|
|
|
|
|
tempInfo = {
|
|
|
|
|
...info,
|
|
|
|
|
...values.info,
|
|
|
|
|
city_name: values.info.city_name.label,
|
|
|
|
|
audit_state: '-1',
|
|
|
|
|
};
|
|
|
|
|
delete tempInfo.product_type_name;
|
|
|
|
|
delete tempInfo.dept_name;
|
|
|
|
|
// const onSave = async (values) => {
|
|
|
|
|
// let tempInfo;
|
|
|
|
|
// if (info.id === '') {
|
|
|
|
|
// tempInfo = {
|
|
|
|
|
// ...info,
|
|
|
|
|
// ...values.info,
|
|
|
|
|
// city_name: values.info.city_name.label,
|
|
|
|
|
// audit_state: '-1',
|
|
|
|
|
// };
|
|
|
|
|
// delete tempInfo.product_type_name;
|
|
|
|
|
// delete tempInfo.dept_name;
|
|
|
|
|
|
|
|
|
|
let tempQuotation = quotation.map((element) => {
|
|
|
|
|
const updateData = {
|
|
|
|
|
...element,
|
|
|
|
|
audit_state: '-1',
|
|
|
|
|
};
|
|
|
|
|
delete updateData.tempKey;
|
|
|
|
|
return updateData;
|
|
|
|
|
});
|
|
|
|
|
let tempLgc_details = [{ ...lgc_details }];
|
|
|
|
|
const tempData = {
|
|
|
|
|
travel_agency_id,
|
|
|
|
|
info: tempInfo,
|
|
|
|
|
quotation: tempQuotation,
|
|
|
|
|
lgc_details: Object.values(lgc_details),
|
|
|
|
|
};
|
|
|
|
|
console.log('tempData', tempData);
|
|
|
|
|
// let tempQuotation = quotation.map((element) => {
|
|
|
|
|
// const updateData = {
|
|
|
|
|
// ...element,
|
|
|
|
|
// audit_state: '-1',
|
|
|
|
|
// };
|
|
|
|
|
// delete updateData.tempKey;
|
|
|
|
|
// return updateData;
|
|
|
|
|
// });
|
|
|
|
|
// let tempLgc_details = [{ ...lgc_details }];
|
|
|
|
|
// const tempData = {
|
|
|
|
|
// travel_agency_id,
|
|
|
|
|
// info: tempInfo,
|
|
|
|
|
// quotation: tempQuotation,
|
|
|
|
|
// lgc_details: Object.values(lgc_details),
|
|
|
|
|
// };
|
|
|
|
|
// console.log('tempData', tempData);
|
|
|
|
|
|
|
|
|
|
// const { errcode, result } = await postJSON(`${HT_HOST}/Service_BaseInfoWeb/agency_product_save`, tempData);
|
|
|
|
|
// console.log('result', result);
|
|
|
|
|
// if (errcode === 0) {
|
|
|
|
|
// message.success('保存成功');
|
|
|
|
|
// } else {
|
|
|
|
|
// message.error(`保存失败: ${result}`);
|
|
|
|
|
// }
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
const { errcode, result } = await postJSON(`${HT_HOST}/Service_BaseInfoWeb/agency_product_save`, tempData);
|
|
|
|
|
console.log('result', result);
|
|
|
|
|
if (errcode === 0) {
|
|
|
|
|
message.success('保存成功');
|
|
|
|
|
} else {
|
|
|
|
|
message.error(`保存失败: ${result}`);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// tempInfo = {
|
|
|
|
|
// ...info,
|
|
|
|
|
// ...values.info,
|
|
|
|
|
// audit_state: '-1',
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
tempInfo = {
|
|
|
|
|
...info,
|
|
|
|
|
...values.info,
|
|
|
|
|
audit_state: '-1',
|
|
|
|
|
};
|
|
|
|
|
// console.log('tempInfo', tempInfo);
|
|
|
|
|
|
|
|
|
|
console.log('tempInfo', tempInfo);
|
|
|
|
|
// let tempQuotation = quotation.map((element) => {
|
|
|
|
|
// const updateData = {
|
|
|
|
|
// ...element,
|
|
|
|
|
// audit_state: '-1',
|
|
|
|
|
// };
|
|
|
|
|
// return updateData;
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
let tempQuotation = quotation.map((element) => {
|
|
|
|
|
const updateData = {
|
|
|
|
|
...element,
|
|
|
|
|
audit_state: '-1',
|
|
|
|
|
};
|
|
|
|
|
return updateData;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const tempData = {
|
|
|
|
|
travel_agency_id,
|
|
|
|
|
info: tempInfo,
|
|
|
|
|
quotation: tempQuotation,
|
|
|
|
|
lgc_details: Object.values(lgc_details),
|
|
|
|
|
};
|
|
|
|
|
// const tempData = {
|
|
|
|
|
// travel_agency_id,
|
|
|
|
|
// info: tempInfo,
|
|
|
|
|
// quotation: tempQuotation,
|
|
|
|
|
// lgc_details: Object.values(lgc_details),
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
console.log('tempData', tempData);
|
|
|
|
|
// const { errcode, result } = await postProductsSave(tempData);
|
|
|
|
|
const { errcode, result } = await postJSON(`${HT_HOST}/Service_BaseInfoWeb/agency_product_save`, tempData);
|
|
|
|
|
if (errcode === 0) {
|
|
|
|
|
message.success('保存成功');
|
|
|
|
|
} else {
|
|
|
|
|
message.error(`保存失败: ${result}`);
|
|
|
|
|
}
|
|
|
|
|
// console.log('tempData', tempData);
|
|
|
|
|
// // const { errcode, result } = await postProductsSave(tempData);
|
|
|
|
|
// const { errcode, result } = await postJSON(`${HT_HOST}/Service_BaseInfoWeb/agency_product_save`, tempData);
|
|
|
|
|
// if (errcode === 0) {
|
|
|
|
|
// message.success('保存成功');
|
|
|
|
|
// } else {
|
|
|
|
|
// message.error(`保存失败: ${result}`);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
};
|
|
|
|
|
// return;
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
//提交审核方法
|
|
|
|
|
const submitReview = async () => {
|
|
|
|
|