添加机票计划搜索和列表显示
parent
0c91e88674
commit
e2766501ca
@ -0,0 +1,30 @@
|
||||
import { create } from "zustand";
|
||||
import { fetchJSON } from "@/utils/request";
|
||||
import { prepareUrl, isNotEmpty } from "@/utils/commons";
|
||||
import { HT_HOST, DATE_FORMAT } from "@/config";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
const airTicketStore = create((set, get) => ({
|
||||
loading: false,
|
||||
setLoading: loading => set({ loading }),
|
||||
setPlanList: planList => set({ planList }),
|
||||
|
||||
async getPlanList(vei_sn, GRI_Name, PNR, TimeStart, TimeEnd) {
|
||||
const { setLoading, setPlanList } = get();
|
||||
setLoading(true);
|
||||
const searchParams = {
|
||||
vei_sn: 4272, //vei_sn,
|
||||
FlightDate1: TimeStart,
|
||||
FlightDate2: TimeEnd,
|
||||
GRI_Name: GRI_Name,
|
||||
PNR: PNR,
|
||||
};
|
||||
|
||||
const { errcode, result } = await fetchJSON(`${HT_HOST}/Service_BaseInfoWeb/GetFlightPlan`, searchParams);
|
||||
const _result = errcode !== 0 ? [] : result;
|
||||
setPlanList(_result);
|
||||
setLoading(false);
|
||||
},
|
||||
}));
|
||||
|
||||
export default airTicketStore;
|
@ -0,0 +1,105 @@
|
||||
import { useState, useEffect } from "react";
|
||||
import { Grid, Divider, Layout, Spin, Input, Col, Row, Space, List, Table } from "antd";
|
||||
import { PhoneOutlined, CustomerServiceOutlined, AudioOutlined } from "@ant-design/icons";
|
||||
import { useParams, useHref, useNavigate } from "react-router-dom";
|
||||
import { isEmpty } from "@/utils/commons";
|
||||
import dayjs from "dayjs";
|
||||
import SearchForm from "@/components/SearchForm";
|
||||
|
||||
import airTicketStore from "@/stores/Airticket";
|
||||
import useAuthStore from "@/stores/Auth";
|
||||
|
||||
const planListColumns = [
|
||||
{
|
||||
title: "团名",
|
||||
key: "GRI_No",
|
||||
dataIndex: "GRI_No",
|
||||
},
|
||||
{
|
||||
title: "组团人",
|
||||
key: "WL",
|
||||
dataIndex: "WL",
|
||||
},
|
||||
{
|
||||
title: "人数",
|
||||
dataIndex: "PersonNum",
|
||||
key: "PersonNum",
|
||||
},
|
||||
{
|
||||
title: "出发日期",
|
||||
key: "StartDate",
|
||||
dataIndex: "StartDate",
|
||||
},
|
||||
{
|
||||
title: "出发城市",
|
||||
key: "FromCity",
|
||||
dataIndex: "FromCity",
|
||||
},
|
||||
{
|
||||
title: "抵达城市",
|
||||
key: "ToCity",
|
||||
dataIndex: "ToCity",
|
||||
},
|
||||
{
|
||||
title: "航空",
|
||||
key: "FlightNo",
|
||||
dataIndex: "FlightNo",
|
||||
},
|
||||
{
|
||||
title: "起飞时间",
|
||||
key: "FlightTimeStart",
|
||||
dataIndex: "FlightTimeStart",
|
||||
},
|
||||
{
|
||||
title: "落地时间",
|
||||
key: "FlightTimeEnd",
|
||||
dataIndex: "FlightTimeEnd",
|
||||
},
|
||||
{
|
||||
title: "PNR 暂时用FlightInfo",
|
||||
key: "FlightInfo",
|
||||
dataIndex: "FlightInfo",
|
||||
},
|
||||
];
|
||||
|
||||
const Airticket = props => {
|
||||
const href = useHref();
|
||||
const navigate = useNavigate();
|
||||
const { phonenumber } = useParams();
|
||||
const travelAgencyId = useAuthStore(state => state.loginUser.travelAgencyId);
|
||||
const [getPlanList, planList, loading] = airTicketStore(state => [state.getPlanList, state.planList, state.loading]);
|
||||
const [loginUser] = useAuthStore(state => [state.loginUser]);
|
||||
const [phone_number, setPhone_number] = useState(phonenumber);
|
||||
const showTotal = total => `合计 ${total} `;
|
||||
|
||||
useEffect(() => {}, []);
|
||||
|
||||
const oncall = () => {};
|
||||
|
||||
return (
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<SearchForm
|
||||
initialValue={{
|
||||
dates: [dayjs().startOf("M"), dayjs().endOf("M")],
|
||||
}}
|
||||
fieldsConfig={{
|
||||
shows: ["referenceNo", "PNR", "dates"],
|
||||
fieldProps: {
|
||||
referenceNo: { label: "搜索计划" },
|
||||
dates: { label: "出发日期" },
|
||||
},
|
||||
}}
|
||||
onSubmit={(err, formVal, filedsVal) => {
|
||||
getPlanList(travelAgencyId, formVal.referenceNo, formVal.PNR, formVal.startdate, formVal.endtime);
|
||||
}}
|
||||
/>
|
||||
<Row>
|
||||
<Col md={24} lg={24} xxl={24}>
|
||||
<Table bordered={true} rowKey="id" columns={planListColumns} dataSource={planList} loading={loading} pagination={{ defaultPageSize: 20, showTotal: showTotal }} />
|
||||
</Col>
|
||||
<Col md={24} lg={24} xxl={24}></Col>
|
||||
</Row>
|
||||
</Space>
|
||||
);
|
||||
};
|
||||
export default Airticket;
|
Loading…
Reference in New Issue