解决页面刷新表单重置问题

添加记录改为同步
dev/2025b
Ycc 4 days ago
parent 2b01fc01ea
commit 6077c6b5ed

@ -45,6 +45,8 @@ const trainTicketStore = create((set, get) => ({
}, },
async postFlightDetail(CLF_SN, GRI_SN, VEI_SN, original_values, info_object) { async postFlightDetail(CLF_SN, GRI_SN, VEI_SN, original_values, info_object) {
console.log(original_values);
const formData = new FormData(); const formData = new FormData();
formData.append("CLF_SN", CLF_SN ? CLF_SN : ""); formData.append("CLF_SN", CLF_SN ? CLF_SN : "");
formData.append("GRI_SN", GRI_SN); formData.append("GRI_SN", GRI_SN);

@ -145,13 +145,13 @@ const AirticketPlan = props => {
}, },
]; ];
const Airticket_form = props => { const Airticket_form = airInfo => {
const airInfo = props.airInfo; // const airInfo = props.airInfo;
const [airinfo_form] = Form.useForm(); // const [airinfo_form] = Form.useForm();
return ( return (
<> <>
<Form <Form
form={airinfo_form} // form={airinfo_form}
name={"ticket_form_" + airInfo.id} name={"ticket_form_" + airInfo.id}
labelCol={{ labelCol={{
span: 6, span: 6,
@ -277,6 +277,39 @@ const AirticketPlan = props => {
</Space> </Space>
</Col> </Col>
</Row> </Row>
</Form>
<Form
labelCol={{
span: 6,
}}
wrapperCol={{
span: 16,
}}
initialValues={{ ...airInfo }}
onFinish={values => {
ticketIssuedNotifications(userId, airInfo.CLF_SN, airInfo.OPI_SN, values.FlightMemo_messages)
.then(() => {
notification.success({
message: `成功`,
description: "提醒信息已发出!",
placement: "top",
duration: 4,
icon: <LikeTwoTone />,
});
//airinfo_form.setFieldValue('FlightMemo_messages','')
})
.catch(() => {
notification.error({
message: `错误`,
description: "提醒失败",
placement: "top",
duration: 4,
icon: <FrownTwoTone />,
});
});
}}
autoComplete="off">
<Divider orientation="left"></Divider> <Divider orientation="left"></Divider>
<Row gutter={16}> <Row gutter={16}>
<Col md={24} lg={20} xxl={20}> <Col md={24} lg={20} xxl={20}>
@ -284,34 +317,11 @@ const AirticketPlan = props => {
<Input placeholder="没有提醒请留空,信息会抄送给上下站地接" /> <Input placeholder="没有提醒请留空,信息会抄送给上下站地接" />
</Form.Item> </Form.Item>
<Form.Item label="已发提醒" name="FlightMemo"> <Form.Item label="已发提醒" name="FlightMemo">
<Input.TextArea rows={4} readOnly disabled /> <Input.TextArea rows={4} readOnly disabled />
</Form.Item> </Form.Item>
</Col> </Col>
<Col md={24} lg={4} xxl={4}> <Col md={24} lg={4} xxl={4}>
<Button <Button type="primary" htmlType="submit">
type="primary"
onClick={() => {
ticketIssuedNotifications(userId,airInfo.CLF_SN, airInfo.OPI_SN,airinfo_form.getFieldValue('FlightMemo_messages'))
.then(() => {
notification.success({
message: `成功`,
description: "提醒信息已发出!",
placement: "top",
duration: 4,
icon: <LikeTwoTone />,
});
airinfo_form.setFieldValue('FlightMemo_messages','')
})
.catch(() => {
notification.error({
message: `错误`,
description: "提醒失败",
placement: "top",
duration: 4,
icon: <FrownTwoTone />,
});
});
}}>
3. 通知顾问 3. 通知顾问
</Button> </Button>
</Col> </Col>
@ -342,7 +352,7 @@ const AirticketPlan = props => {
</Button> </Button>
</Popconfirm> </Popconfirm>
), ),
children: <Airticket_form airInfo={item} />, children: Airticket_form(item),
}; };
}) })
: []; : [];
@ -518,8 +528,8 @@ const AirticketPlan = props => {
<Popconfirm <Popconfirm
title="请确认要增加航班记录" title="请确认要增加航班记录"
description="" description=""
onConfirm={() => { onConfirm={async () => {
postFlightDetail("", gri_sn, travelAgencyId, { FlightNo: "新的记录", FlightStatus: 1 }, []); // await postFlightDetail("", gri_sn, travelAgencyId, { FlightNo: "新的记录", FlightStatus: 1 }, []); //
getPlanDetail(travelAgencyId, gri_sn); // getPlanDetail(travelAgencyId, gri_sn); //
}} }}
okText="是" okText="是"

@ -129,7 +129,7 @@ const Trainticket = props => {
<Row gutter={16}> <Row gutter={16}>
<Col md={24} lg={24} xxl={24}> <Col md={24} lg={24} xxl={24}>
<Table bordered={true} rowKey="id" columns={planListColumns} dataSource={planList} loading={loading} pagination={{ defaultPageSize: 20, showTotal: showTotal }} /> <Table bordered={true} rowKey={record => `${record.id}-${record.GRI_SN}`} columns={planListColumns} dataSource={planList} loading={loading} pagination={{ defaultPageSize: 20, showTotal: showTotal }} />
<TableExportBtn btnTxt="导出计划" label={`出票计划`} {...{ columns: planListColumns, dataSource: planList }} /> <TableExportBtn btnTxt="导出计划" label={`出票计划`} {...{ columns: planListColumns, dataSource: planList }} />
</Col> </Col>
<Col md={24} lg={24} xxl={24}></Col> <Col md={24} lg={24} xxl={24}></Col>

@ -46,7 +46,7 @@ const TrainticketPlan = props => {
]); ]);
const reservationUrl = `https://p9axztuwd7x8a7.mycht.cn/Service_BaseInfoWeb/FlightPlanDocx?GRI_SN=${gri_sn}&VEI_SN=${travelAgencyId}&token=${loginToken}`; const reservationUrl = `https://p9axztuwd7x8a7.mycht.cn/Service_BaseInfoWeb/FlightPlanDocx?GRI_SN=${gri_sn}&VEI_SN=${travelAgencyId}&token=${loginToken}`;
const reservationPreviewUrl = OFFICEWEBVIEWERURL + encodeURIComponent(reservationUrl); const reservationPreviewUrl = OFFICEWEBVIEWERURL + encodeURIComponent(reservationUrl);
const [form] = Form.useForm(); // const [form] = Form.useForm();
const { notification } = App.useApp(); const { notification } = App.useApp();
// //
@ -74,7 +74,7 @@ const TrainticketPlan = props => {
city, // city, //
] = record.split("|"); ] = record.split("|");
return { return {
value: name + "-" + pinyin, value: name + "(" + pinyin + ")",
label: name, label: name,
}; };
}); });
@ -155,13 +155,10 @@ const TrainticketPlan = props => {
}, },
]; ];
const Trainticket_form = props => { const Trainticket_form = trainInfo => {
const trainInfo = props.airInfo;
const [traininfo_form] = Form.useForm();
return ( return (
<> <>
<Form <Form
form={traininfo_form}
name={"ticket_form_" + trainInfo.id} name={"ticket_form_" + trainInfo.id}
labelCol={{ labelCol={{
span: 6, span: 6,
@ -273,7 +270,40 @@ const TrainticketPlan = props => {
</Space> </Space>
</Col> </Col>
</Row> </Row>
<Divider orientation="left"></Divider> </Form>
<Form
labelCol={{
span: 6,
}}
wrapperCol={{
span: 16,
}}
initialValues={{ ...trainInfo }}
onFinish={values => {
ticketIssuedNotifications(userId, trainInfo.CLF_SN, trainInfo.OPI_SN, values.FlightMemo_messages)
.then(() => {
notification.success({
message: `成功`,
description: "提醒信息已发出!",
placement: "top",
duration: 4,
icon: <LikeTwoTone />,
});
//todo: values.FlightMemo_messages = "";
})
.catch(() => {
notification.error({
message: `错误`,
description: "提醒失败",
placement: "top",
duration: 4,
icon: <FrownTwoTone />,
});
});
}}
autoComplete="off">
<Divider orientation="left">出票完成通知</Divider>
<Row gutter={16}> <Row gutter={16}>
<Col md={24} lg={20} xxl={20}> <Col md={24} lg={20} xxl={20}>
<Form.Item label="上下站提醒信息" name="FlightMemo_messages"> <Form.Item label="上下站提醒信息" name="FlightMemo_messages">
@ -284,30 +314,7 @@ const TrainticketPlan = props => {
</Form.Item> </Form.Item>
</Col> </Col>
<Col md={24} lg={4} xxl={4}> <Col md={24} lg={4} xxl={4}>
<Button <Button type="primary" htmlType="submit">
type="primary"
onClick={() => {
ticketIssuedNotifications(userId, trainInfo.CLF_SN, trainInfo.OPI_SN, traininfo_form.getFieldValue("FlightMemo_messages"))
.then(() => {
notification.success({
message: `成功`,
description: "提醒信息已发出!",
placement: "top",
duration: 4,
icon: <LikeTwoTone />,
});
traininfo_form.setFieldValue("FlightMemo_messages", "");
})
.catch(() => {
notification.error({
message: `错误`,
description: "提醒失败",
placement: "top",
duration: 4,
icon: <FrownTwoTone />,
});
});
}}>
3. 通知顾问 3. 通知顾问
</Button> </Button>
</Col> </Col>
@ -338,7 +345,7 @@ const TrainticketPlan = props => {
</Button> </Button>
</Popconfirm> </Popconfirm>
), ),
children: <Trainticket_form airInfo={item} />, children: Trainticket_form(item),
}; };
}) })
: []; : [];
@ -516,8 +523,9 @@ const TrainticketPlan = props => {
<Popconfirm <Popconfirm
title="请确认要增加车票记录" title="请确认要增加车票记录"
description="" description=""
onConfirm={() => { onConfirm={async () => {
postFlightDetail("", gri_sn, travelAgencyId, { FlightNo: "新的记录", FlightStatus: 1, ServiceType: 2 }, []); // const startDate = planDetail && planDetail.length > 0 && planDetail[planDetail.length - 1].StartDate ? planDetail[planDetail.length - 1].StartDate : "";
await postFlightDetail("", gri_sn, travelAgencyId, { FlightNo: "新的记录", FlightStatus: 1, ServiceType: 2 }, { StartDate: startDate }); //
getPlanDetail(travelAgencyId, gri_sn); // getPlanDetail(travelAgencyId, gri_sn); //
}} }}
okText="是" okText="是"
@ -529,11 +537,12 @@ const TrainticketPlan = props => {
</p> </p>
</Col> </Col>
</Row> </Row>
<Row> <Row>
<Divider orientation="left">计划变更</Divider> <Divider orientation="left">计划变更</Divider>
<Col md={24} lg={12} xxl={12}> <Col md={24} lg={12} xxl={12}>
<Space direction="vertical" style={{ width: "90%" }}> <Space direction="vertical" style={{ width: "90%" }}>
<Input.TextArea rows={16} readOnly value={veiPlanChangeTxt && veiPlanChangeTxt.ChangeText} /> <Input.TextArea rows={16} value={veiPlanChangeTxt && veiPlanChangeTxt.ChangeText} />
<Button <Button
type="primary" type="primary"
onClick={() => { onClick={() => {
@ -560,7 +569,6 @@ const TrainticketPlan = props => {
</Form.Item> </Form.Item>
</Form> </Form>
</Modal> </Modal>
<Modal <Modal
title="费用信息" title="费用信息"
open={isModalOpen} open={isModalOpen}

Loading…
Cancel
Save