Merge remote-tracking branch 'origin/main'

perf/export-docx
Lei OT 11 months ago
commit d5777eaff1

@ -1,7 +1,7 @@
{
"name": "global-highlights-hub",
"private": true,
"version": "2.0.0-beta.2",
"version": "2.0.0-beta.3",
"type": "module",
"scripts": {
"dev": "vite",

@ -65,6 +65,8 @@
"thisMonth": "This Month",
"lastMonth": "Last Month",
"lastThreeMonth": "Last Three Month",
"firstHalfYear": "First Half Year",
"latterHalfYear": "Latter Half Year",
"thisYear": "This Year"
},
"weekdays": {

@ -65,6 +65,8 @@
"thisMonth": "本月",
"lastMonth": "上月",
"lastThreeMonth": "前三个月",
"firstHalfYear": "上半年",
"latterHalfYear": "下半年",
"thisYear": "今年"
},
"weekdays": {

@ -29,6 +29,14 @@ export const useDatePresets = () => {
label: t("datetime.lastThreeMonth"),
value: [dayjs().subtract(2, "M").startOf("M"), dayjs().endOf("M")],
},
{
label: t("datetime.firstHalfYear"),
value: [dayjs().startOf("y"), dayjs().endOf("y").subtract(6, "M")],
},
{
label: t("datetime.latterHalfYear"),
value: [dayjs().startOf("y").add(6,"M"), dayjs().endOf("y")],
},
{
label: t("datetime.thisYear"),
value: [dayjs().startOf("y"), dayjs().endOf("y")],

@ -77,6 +77,20 @@ const airTicketStore = create((set, get) => ({
// console.log(_result);
// return _result;
// },
async postFlightCost(values) {
const formData = new FormData();
for (const [key, value] of Object.entries(values)) {
formData.append(key, value); //先用原始数据填充一遍,确保复制了全部数据到新表
}
const postUrl = HT_HOST + "/Service_BaseInfoWeb/edit_or_new_flight_cost";
return postForm(postUrl, formData).then(json => {
if (json.errcode == 0) {
return json;
} else {
throw new Error(json.errmsg + ": " + json.errcode);
}
});
},
}));
export default airTicketStore;

@ -3,7 +3,7 @@ import { devtools } from 'zustand/middleware';
import dayjs from 'dayjs'
import { fetchJSON, postForm, postJSON } from '@/utils/request';
import { HT_HOST } from '@/config';
import { groupBy, generateId, isEmpty } from '@/utils/commons';
import { groupBy, generateId, isNotEmpty } from '@/utils/commons';
export const searchAgencyAction = async (param) => {
const { errcode, result } = await fetchJSON(`${HT_HOST}/Service_BaseInfoWeb/products_search`, param);
@ -305,31 +305,39 @@ export const useProductsStore = create(
const { editingProduct, quotationList, agencyProducts } = get()
const productTypeId = editingProduct.info.product_type_id;
const quotationId = quotation.id
const newList = quotationList.filter(q => {
const newQuotationList = quotationList.filter(q => {
return q.key != quotation.key
})
const newProductList = agencyProducts[productTypeId].map(p => {
if (p.info.id == editingProduct.info.id) {
return {
...editingProduct,
quotation: newQuotationList
}
} else {
return p
}
})
set({
agencyProducts: {
...agencyProducts,
[productTypeId]: [{
...editingProduct,
quotation: newList
}]
[productTypeId]: newProductList
},
quotationList: newList
quotationList: newQuotationList
})
if (isEmpty(quotationId)) {
return Promise.resolve(newList)
} else {
let promiseDelete = Promise.resolve(newQuotationList)
if (isNotEmpty(quotationId)) {
const { result, success } = await deleteQuotationAction(quotationId)
if (success) {
return Promise.resolve(result)
} else {
return Promise.reject(result)
if (!success) {
promiseDelete = Promise.reject(result)
}
}
return promiseDelete
},
// side effects

@ -11,7 +11,7 @@ import { usingStorage } from "@/hooks/usingStorage";
const AirticketPlan = props => {
const { coli_sn, gri_sn } = useParams();
const { travelAgencyId, loginToken } = usingStorage();
const [getPlanDetail, planDetail, getGuestList, guestList, loading, postFlightDetail, getFlightCostList] = airTicketStore(state => [
const [getPlanDetail, planDetail, getGuestList, guestList, loading, postFlightDetail, getFlightCostList, postFlightCost] = airTicketStore(state => [
state.getPlanDetail,
state.planDetail,
state.getGuestList,
@ -19,8 +19,9 @@ const AirticketPlan = props => {
state.loading,
state.postFlightDetail,
state.getFlightCostList,
state.postFlightCost,
]);
const reservationUrl = `https://p9axztuwd7x8a7.mycht.cn/Service_BaseInfoWeb/FlightPlanDocx?GRI_SN=${coli_sn}&VEI_SN=${travelAgencyId}`;
const reservationUrl = `https://p9axztuwd7x8a7.mycht.cn/Service_BaseInfoWeb/FlightPlanDocx?GRI_SN=${gri_sn}&VEI_SN=${travelAgencyId}`;
const reservationPreviewUrl = OFFICEWEBVIEWERURL + encodeURIComponent(reservationUrl);
const [form] = Form.useForm();
const { notification } = App.useApp();
@ -115,7 +116,7 @@ const AirticketPlan = props => {
dataIndex: "CostType",
},
{
title: "金额",
title: "手续费/费用",
key: "Cost",
dataIndex: "Cost",
},
@ -123,41 +124,42 @@ const AirticketPlan = props => {
title: "PNR",
key: "PNR",
dataIndex: "PNR",
render: (text, record) => (record.CostType == "出票" ? text : "-"),
},
{
title: "FlightCost",
title: "票号",
key: "FlightCost",
dataIndex: "FlightCost",
render: (text, record) => (record.CostType == "出票" ? text : "-"),
},
{
title: "Discount",
key: "Discount",
dataIndex: "Discount",
},
{
title: "ServiceFee",
key: "ServiceFee",
dataIndex: "ServiceFee",
title: "机票类型",
key: "FlightType",
dataIndex: "FlightType",
render: (text, record) => (record.CostType == "出票" ? text : "-"),
},
{
title: "DateTime",
key: "DateTime",
dataIndex: "DateTime",
title: "机票价格",
key: "FlightCost",
dataIndex: "FlightCost",
render: (text, record) => (record.CostType == "出票" ? text : "-"),
},
{
title: "FlightType",
key: "FlightType",
dataIndex: "FlightType",
title: "折扣",
key: "Discount",
dataIndex: "Discount",
render: (text, record) => (record.CostType == "出票" ? text : "-"),
},
{
title: "Memo",
title: "备注",
key: "Memo",
dataIndex: "Memo",
},
{
title: "编辑",
key: "CLF_SN",
dataIndex: "CLF_SN", //GRI_SN VEI_SN
dataIndex: "CLF_SN",
render: (text, record) => <a onClick={() => showModal(record)}>编辑</a>,
},
];
@ -168,6 +170,7 @@ const AirticketPlan = props => {
<Row>
<Col md={4} lg={4} xxl={4}></Col>
<Col md={16} lg={16} xxl={16}>
<Divider orientation="left">航班信息</Divider>
<Form
name={"ticket_form_" + airInfo.id}
labelCol={{
@ -225,7 +228,7 @@ const AirticketPlan = props => {
</Form.Item>
<Form.Item label="出发">
<Space>
<Form.Item name="FromAirport" noStyle>
<Form.Item name="FromAirportCode" noStyle>
<Input placeholder="机场" />
</Form.Item>
<Form.Item name="FromTerminal" noStyle>
@ -238,7 +241,7 @@ const AirticketPlan = props => {
</Form.Item>
<Form.Item label="抵达">
<Space>
<Form.Item name="ToAirport" noStyle>
<Form.Item name="ToAirportCode" noStyle>
<Input placeholder="机场" />
</Form.Item>
<Form.Item name="ToTerminal" noStyle>
@ -273,7 +276,9 @@ const AirticketPlan = props => {
<Button type="primary" htmlType="submit">
保存机票信息
</Button>
<Button type="dashed">添加出票信息和费用</Button>
<Button type="dashed" onClick={() => showModal(airInfo)}>
添加出票信息或费用
</Button>
</Space>
</Form.Item>
</Form>
@ -304,10 +309,12 @@ const AirticketPlan = props => {
// begin
const [isModalOpen, setIsModalOpen] = useState(false);
const [isTicketType, setisTicketType] = useState(true);
const [ticket_form] = Form.useForm();
const showModal = ticket => {
setIsModalOpen(true);
ticket.CostType == "出票" ? setisTicketType(true) : setisTicketType(false);//
ticket_form.setFieldsValue(ticket);
};
@ -317,6 +324,26 @@ const AirticketPlan = props => {
.then(values => {
//
console.log("Received values of form: ", values);
postFlightCost(values)
.then(() => {
notification.success({
message: `成功`,
description: "保存成功!",
placement: "top",
duration: 4,
icon: <LikeTwoTone />,
});
getPlanDetail(travelAgencyId, gri_sn);
})
.catch(() => {
notification.error({
message: `错误`,
description: "保存失败",
placement: "top",
duration: 4,
icon: <FrownTwoTone />,
});
});
ticket_form.resetFields();
setIsModalOpen(false);
})
@ -331,7 +358,11 @@ const AirticketPlan = props => {
};
const onChangeType = value => {
console.log(value);
if (value == "出票") {
setisTicketType(true);
} else {
setisTicketType(false);
}
};
const TicketModal = () => {
@ -343,71 +374,85 @@ const AirticketPlan = props => {
labelCol={{
span: 5,
}}>
<Form.Item label="费用类型" name="MEI_Name2222">
<Form.Item label="费用类型" name="CostType">
<Select
defaultValue="jack"
style={{
width: 160,
}}
onChange={onChangeType}
options={[
{
value: "jack",
value: "出票",
label: "出票",
},
{
value: "lucy",
value: "改签",
label: "改签",
},
{
value: "Yiminghe",
value: "退票",
label: "退票",
},
{
value: "Yimingh2e",
value: "其它",
label: "其它",
},
]}
/>
</Form.Item>
<Form.Item label="机票类型" name="MEI_Name2222">
<Form.Item label="手续费/费用" name="ServiceFee" rules={[{ required: true }]}>
<Input
prefix="¥"
style={{
width: 160,
}}
/>
</Form.Item>
{isTicketType && (
<>
<Form.Item label="PNR" name="PNR">
<Input />
</Form.Item>
<Form.Item label="票号" name="Cost">
<Input />
</Form.Item>
<Form.Item label="机票类型" name="FlightType">
<Select
style={{
width: 160,
}}
onChange={() => console.log("dsads")}
options={[
{
value: "jack",
value: "成人",
label: "成人",
},
{
value: "lucy",
value: "儿童",
label: "儿童",
},
{
value: "Yiminghe",
value: "婴儿",
label: "婴儿",
},
]}
/>
</Form.Item>
<Form.Item label="票号">
<Input />
</Form.Item>
<Form.Item label="机票价格">
<Input placeholder="含基建和税" prefix="¥" />
</Form.Item>
<Form.Item label="折扣" name="MEI_Name33">
<Input />
</Form.Item>
<Form.Item label="PNR">
<Input />
<Form.Item label="机票价格" name="FlightCost">
<Input
placeholder="含基建和税"
prefix="¥"
style={{
width: 160,
}}
/>
</Form.Item>
<Form.Item label="手续费/费用" name="MEI_Name66" rules={[{ required: true }]}>
<Input prefix="¥" />
<Form.Item label="折扣" name="Discount">
<Input
style={{
width: 160,
}}
/>
</Form.Item>
<Form.Item label="选择客人" name="MEI_Name66">
@ -417,6 +462,10 @@ const AirticketPlan = props => {
}}
onChange={() => console.log("dsads")}
options={[
{
value: "",
label: "",
},
{
value: "jack",
label: "成人",
@ -432,9 +481,23 @@ const AirticketPlan = props => {
]}
/>
</Form.Item>
<Form.Item label="备注">
</>
)}
<Form.Item label="备注" name="Memo">
<Input.TextArea rows={4} />
</Form.Item>
<Form.Item name="CLF_SN" hidden>
<input />{" "}
</Form.Item>
<Form.Item name="GRI_SN" hidden>
<input />
</Form.Item>
<Form.Item name="VEI_SN" hidden>
<input />
</Form.Item>
<Form.Item name="CLC_SN" hidden>
<input />
</Form.Item>
</Form>
</Modal>
</>
@ -452,7 +515,7 @@ const AirticketPlan = props => {
<Space direction="vertical" style={{ width: "100%" }}>
<Row>
<Col md={24} lg={24} xxl={24} style={{ height: "100%" }}>
{/* <iframe id="msdoc-iframe-reservation" title="msdoc-iframe-reservation" src={reservationPreviewUrl} frameBorder="0" style={{ width: "100%", height: "600px" }}></iframe> */}
<iframe id="msdoc-iframe-reservation" title="msdoc-iframe-reservation" src={reservationPreviewUrl} style={{ width: "100%", height: "600px" }}></iframe>
<Button type="link" target="_blank" href={reservationUrl}>
下载
</Button>

Loading…
Cancel
Save