机票计划显示

perf/export-docx
YCC 1 year ago
parent aa501c7f3a
commit e3dc13bc6c

@ -8,6 +8,8 @@ const airTicketStore = create((set, get) => ({
loading: false, loading: false,
setLoading: loading => set({ loading }), setLoading: loading => set({ loading }),
setPlanList: planList => set({ planList }), setPlanList: planList => set({ planList }),
setPlanDetail: planDetail => set({ planDetail }),
setGuestList: guestList => set({ guestList }),
async getPlanList(vei_sn, GRI_Name, TimeStart, TimeEnd) { async getPlanList(vei_sn, GRI_Name, TimeStart, TimeEnd) {
const { setLoading, setPlanList } = get(); const { setLoading, setPlanList } = get();
@ -24,6 +26,27 @@ const airTicketStore = create((set, get) => ({
setPlanList(_result); setPlanList(_result);
setLoading(false); setLoading(false);
}, },
async getPlanDetail(vei_sn, gri_sn) {
const { setPlanDetail } = get();
const searchParams = {
vei_sn: 6376, //vei_sn,
gri_sn: 369040, //gri_sn
};
const { errcode, result } = await fetchJSON(`${HT_HOST}/Service_BaseInfoWeb/GetFlightPlanDetail`, searchParams);
const _result = errcode !== 0 ? [] : result;
setPlanDetail(_result);
},
async getGuestList(coli_sn) {
const { setGuestList } = get();
const searchParams = {
COLI_SN: 1097829, //coli_sn,
};
const { errcode, result } = await fetchJSON(`${HT_HOST}/Service_BaseInfoWeb/GetFlightGuestInfo`, searchParams);
const _result = errcode !== 0 ? [] : result;
setGuestList(_result);
},
})); }));
export default airTicketStore; export default airTicketStore;

@ -129,7 +129,7 @@ export function escape2Html(str) {
var output = temp.innerText || temp.textContent; var output = temp.innerText || temp.textContent;
temp = null; temp = null;
return output; return output;
} }
export function formatPrice(price) { export function formatPrice(price) {
return Math.ceil(price).toLocaleString(); return Math.ceil(price).toLocaleString();
@ -139,7 +139,6 @@ export function formatPercent(number) {
return Math.round(number * 100) + "%"; return Math.round(number * 100) + "%";
} }
/** /**
* ! 不支持计算 Set Map * ! 不支持计算 Set Map
* @param {*} val * @param {*} val
@ -148,23 +147,23 @@ export function formatPercent(number) {
* false if: 'false', 'undefined' * false if: 'false', 'undefined'
*/ */
export function isEmpty(val) { export function isEmpty(val) {
// return val === undefined || val === null || val === ""; // return val === undefined || val === null || val === "";
return [Object, Array].includes((val || {}).constructor) && !Object.entries(val || {}).length; return [Object, Array].includes((val || {}).constructor) && !Object.entries(val || {}).length;
} }
/** /**
* 数组排序 * 数组排序
*/ */
export const sortBy = (key) => { export const sortBy = key => {
return (a, b) => (a[key] > b[key] ? 1 : b[key] > a[key] ? -1 : 0); return (a, b) => (a[key] > b[key] ? 1 : b[key] > a[key] ? -1 : 0);
}; };
/** /**
* Object排序keys * Object排序keys
*/ */
export const sortKeys = (obj) => export const sortKeys = obj =>
Object.keys(obj) Object.keys(obj)
.sort() .sort()
.reduce((a, k2) => ({ ...a, [k2]: obj[k2] }), {}); .reduce((a, k2) => ({ ...a, [k2]: obj[k2] }), {});
/** /**
* 数组排序, 给定排序数组 * 数组排序, 给定排序数组
@ -174,41 +173,41 @@ export const sortKeys = (obj) =>
* @returns * @returns
*/ */
export const sortArrayByOrder = (items, keyName, keyOrder) => { export const sortArrayByOrder = (items, keyName, keyOrder) => {
return items.sort((a, b) => { return items.sort((a, b) => {
return keyOrder.indexOf(a[keyName]) - keyOrder.indexOf(b[keyName]); return keyOrder.indexOf(a[keyName]) - keyOrder.indexOf(b[keyName]);
}); });
}; };
/** /**
* 合并Object, 递归地 * 合并Object, 递归地
*/ */
export function merge(...objects) { export function merge(...objects) {
const isDeep = objects.some((obj) => obj !== null && typeof obj === 'object'); const isDeep = objects.some(obj => obj !== null && typeof obj === "object");
const result = objects[0] || (isDeep ? {} : objects[0]); const result = objects[0] || (isDeep ? {} : objects[0]);
for (let i = 1; i < objects.length; i++) { for (let i = 1; i < objects.length; i++) {
const obj = objects[i]; const obj = objects[i];
if (!obj) continue; if (!obj) continue;
Object.keys(obj).forEach((key) => { Object.keys(obj).forEach(key => {
const val = obj[key]; const val = obj[key];
if (isDeep) { if (isDeep) {
if (Array.isArray(val)) { if (Array.isArray(val)) {
result[key] = [].concat(Array.isArray(result[key]) ? result[key] : [result[key]], val); result[key] = [].concat(Array.isArray(result[key]) ? result[key] : [result[key]], val);
} else if (typeof val === 'object') { } else if (typeof val === "object") {
result[key] = merge(result[key], val); result[key] = merge(result[key], val);
} else { } else {
result[key] = val; result[key] = val;
} }
} else { } else {
result[key] = typeof val === 'boolean' ? val : result[key]; result[key] = typeof val === "boolean" ? val : result[key];
} }
}); });
} }
return result; return result;
} }
/** /**
@ -217,16 +216,16 @@ export function merge(...objects) {
* @see https://www.lodashjs.com/docs/lodash.groupBy#_groupbycollection-iteratee_identity * @see https://www.lodashjs.com/docs/lodash.groupBy#_groupbycollection-iteratee_identity
*/ */
export function groupBy(array = [], callback) { export function groupBy(array = [], callback) {
return array.reduce((groups, item) => { return array.reduce((groups, item) => {
const key = typeof callback === 'function' ? callback(item) : item[callback]; const key = typeof callback === "function" ? callback(item) : item[callback];
if (!groups[key]) { if (!groups[key]) {
groups[key] = []; groups[key] = [];
} }
groups[key].push(item); groups[key].push(item);
return groups; return groups;
}, {}); }, {});
} }
/** /**
@ -235,12 +234,12 @@ export function groupBy(array = [], callback) {
* @param {array} keys * @param {array} keys
*/ */
export function pick(object, keys) { export function pick(object, keys) {
return keys.reduce((obj, key) => { return keys.reduce((obj, key) => {
if (object && Object.prototype.hasOwnProperty.call(object, key)) { if (object && Object.prototype.hasOwnProperty.call(object, key)) {
obj[key] = object[key]; obj[key] = object[key];
} }
return obj; return obj;
}, {}); }, {});
} }
/** /**
@ -250,44 +249,44 @@ export function pick(object, keys) {
* @returns * @returns
*/ */
export function omit(object, keysToOmit) { export function omit(object, keysToOmit) {
return Object.fromEntries(Object.entries(object).filter(([key]) => !keysToOmit.includes(key))); return Object.fromEntries(Object.entries(object).filter(([key]) => !keysToOmit.includes(key)));
} }
/** /**
* 深拷贝 * 深拷贝
*/ */
export function cloneDeep(value) { export function cloneDeep(value) {
// return structuredClone(value); // return structuredClone(value);
if (typeof value !== 'object' || value === null) { if (typeof value !== "object" || value === null) {
return value; return value;
} }
const result = Array.isArray(value) ? [] : {}; const result = Array.isArray(value) ? [] : {};
for (const key in value) { for (const key in value) {
if (Object.prototype.hasOwnProperty.call(value, key)) { if (Object.prototype.hasOwnProperty.call(value, key)) {
result[key] = cloneDeep(value[key]); result[key] = cloneDeep(value[key]);
} }
} }
return result; return result;
} }
/** /**
* 向零四舍五入, 固定精度设置 * 向零四舍五入, 固定精度设置
*/ */
function curriedFix(precision = 0) { function curriedFix(precision = 0) {
return function (number) { return function (number) {
// Shift number by precision places // Shift number by precision places
const shift = Math.pow(10, precision); const shift = Math.pow(10, precision);
const shiftedNumber = number * shift; const shiftedNumber = number * shift;
// Round to nearest integer // Round to nearest integer
const roundedNumber = Math.round(shiftedNumber); const roundedNumber = Math.round(shiftedNumber);
// Shift back decimal place // Shift back decimal place
return roundedNumber / shift; return roundedNumber / shift;
}; };
} }
/** /**
* 向零四舍五入, 保留2位小数 * 向零四舍五入, 保留2位小数
@ -313,106 +312,106 @@ export const fixToInt = curriedFix(0);
* *
*/ */
export function objectMapper(input, keyMap) { export function objectMapper(input, keyMap) {
// Loop through array mapping // Loop through array mapping
if (Array.isArray(input)) { if (Array.isArray(input)) {
return input.map((obj) => objectMapper(obj, keyMap)); return input.map(obj => objectMapper(obj, keyMap));
} }
if (typeof input === 'object') { if (typeof input === "object") {
const mappedObj = {}; const mappedObj = {};
Object.keys(input).forEach((key) => { Object.keys(input).forEach(key => {
// Keep original keys not in keyMap // Keep original keys not in keyMap
if (!keyMap[key]) { if (!keyMap[key]) {
mappedObj[key] = input[key]; mappedObj[key] = input[key];
} }
// Handle array of maps // Handle array of maps
if (Array.isArray(keyMap[key])) { if (Array.isArray(keyMap[key])) {
keyMap[key].forEach((map) => { keyMap[key].forEach(map => {
let value = input[key]; let value = input[key];
if (map.transform) value = map.transform(value); if (map.transform) value = map.transform(value);
mappedObj[map.key] = value; mappedObj[map.key] = value;
}); });
// Handle single map // Handle single map
} else { } else {
const map = keyMap[key]; const map = keyMap[key];
if (map) { if (map) {
let value = input[key]; let value = input[key];
if (map.transform) value = map.transform(value); if (map.transform) value = map.transform(value);
mappedObj[map.key || map] = value; mappedObj[map.key || map] = value;
} }
} }
}); });
return mappedObj; return mappedObj;
} }
return input; return input;
} }
/** /**
* 创建一个对应于对象路径的值数组 * 创建一个对应于对象路径的值数组
*/ */
export function at(obj, path) { export function at(obj, path) {
let result; let result;
if (Array.isArray(obj)) { if (Array.isArray(obj)) {
// array case // array case
const indexes = path.split('.').map((i) => parseInt(i)); const indexes = path.split(".").map(i => parseInt(i));
result = []; result = [];
for (let i = 0; i < indexes.length; i++) { for (let i = 0; i < indexes.length; i++) {
result.push(obj[indexes[i]]); result.push(obj[indexes[i]]);
} }
} else { } else {
// object case // object case
const indexes = path.split('.').map((i) => i); const indexes = path.split(".").map(i => i);
result = [obj]; result = [obj];
for (let i = 0; i < indexes.length; i++) { for (let i = 0; i < indexes.length; i++) {
result = [result[0][indexes[i]]]; result = [result[0][indexes[i]]];
} }
} }
return result; return result;
} }
/** /**
* 删除 null/undefined * 删除 null/undefined
*/ */
export function flush(collection) { export function flush(collection) {
let result, len, i; let result, len, i;
if (!collection) { if (!collection) {
return undefined; return undefined;
} }
if (Array.isArray(collection)) { if (Array.isArray(collection)) {
result = []; result = [];
len = collection.length; len = collection.length;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
const elem = collection[i]; const elem = collection[i];
if (elem != null) { if (elem != null) {
result.push(elem); result.push(elem);
} }
} }
return result; return result;
} }
if (typeof collection === 'object') { if (typeof collection === "object") {
result = {}; result = {};
const keys = Object.keys(collection); const keys = Object.keys(collection);
len = keys.length; len = keys.length;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
const key = keys[i]; const key = keys[i];
const value = collection[key]; const value = collection[key];
if (value != null) { if (value != null) {
result[key] = value; result[key] = value;
} }
} }
return result; return result;
} }
return undefined; return undefined;
} }
/** /**
* 千分位 格式化数字 * 千分位 格式化数字
*/ */
export const numberFormatter = (number) => { export const numberFormatter = number => {
return new Intl.NumberFormat().format(number); return new Intl.NumberFormat().format(number);
}; };
/** /**
@ -422,193 +421,195 @@ export const numberFormatter = (number) => {
* getNestedValue(obj, keyArr); // Returns: 'c' * getNestedValue(obj, keyArr); // Returns: 'c'
*/ */
export const getNestedValue = (obj, keyArr) => { export const getNestedValue = (obj, keyArr) => {
return keyArr.reduce((acc, curr) => { return keyArr.reduce((acc, curr) => {
return acc && Object.prototype.hasOwnProperty.call(acc, curr) ? acc[curr] : undefined; return acc && Object.prototype.hasOwnProperty.call(acc, curr) ? acc[curr] : undefined;
// return acc && acc[curr]; // return acc && acc[curr];
}, obj); }, obj);
}; };
/** /**
* 计算笛卡尔积 * 计算笛卡尔积
*/ */
export const cartesianProductArray = (arr, sep = '_', index = 0, prefix = '') => { export const cartesianProductArray = (arr, sep = "_", index = 0, prefix = "") => {
let result = []; let result = [];
if (index === arr.length) { if (index === arr.length) {
return [prefix]; return [prefix];
} }
arr[index].forEach((item) => { arr[index].forEach(item => {
result = result.concat(cartesianProductArray(arr, sep, index + 1, prefix ? `${prefix}${sep}${item}` : `${item}`)); result = result.concat(cartesianProductArray(arr, sep, index + 1, prefix ? `${prefix}${sep}${item}` : `${item}`));
}); });
return result; return result;
}; };
export const stringToColour = (str) => { export const stringToColour = str => {
var hash = 0 var hash = 0;
for (let i = 0; i < str.length; i++) { for (let i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash) hash = str.charCodeAt(i) + ((hash << 5) - hash);
} }
var colour = '#' var colour = "#";
for (let i = 0; i < 3; i++) { for (let i = 0; i < 3; i++) {
var value = (hash >> (i * 8)) & 0xff var value = (hash >> (i * 8)) & 0xff;
value = (value % 150) + 50 value = (value % 150) + 50;
colour += ('00' + value.toString(16)).substr(-2) colour += ("00" + value.toString(16)).substr(-2);
} }
return colour return colour;
} };
export const debounce = (func, wait, immediate) => { export const debounce = (func, wait, immediate) => {
var timeout; var timeout;
return function () { return function () {
var context = this, var context = this,
args = arguments; args = arguments;
clearTimeout(timeout); clearTimeout(timeout);
if (immediate && !timeout) func.apply(context, args); if (immediate && !timeout) func.apply(context, args);
timeout = setTimeout(function () { timeout = setTimeout(function () {
timeout = null; timeout = null;
if (!immediate) func.apply(context, args); if (!immediate) func.apply(context, args);
}, wait); }, wait);
}; };
} };
export const removeFormattingChars = (str) => { export const removeFormattingChars = str => {
const regex = /[\r\n\t\v\f]/g; const regex = /[\r\n\t\v\f]/g;
str = str.replace(regex, ' '); str = str.replace(regex, " ");
// Replace more than four consecutive spaces with a single space // Replace more than four consecutive spaces with a single space
str = str.replace(/\s{4,}/g, ' '); str = str.replace(/\s{4,}/g, " ");
return str; return str;
} };
export const olog = (text, ...args) => { export const olog = (text, ...args) => {
console.log( console.log(`%c ${text} `, "background:#fb923c ; padding: 1px; border-radius: 3px; color: #fff", ...args);
`%c ${text} `,
'background:#fb923c ; padding: 1px; border-radius: 3px; color: #fff',...args
);
}; };
export const sanitizeFilename = (str) => { export const sanitizeFilename = str => {
// Remove whitespace and replace with hyphens // Remove whitespace and replace with hyphens
str = str.replace(/\s+/g, '-'); str = str.replace(/\s+/g, "-");
// Remove invalid characters and replace with hyphens // Remove invalid characters and replace with hyphens
str = str.replace(/[^a-zA-Z0-9.-]/g, '-'); str = str.replace(/[^a-zA-Z0-9.-]/g, "-");
// Replace consecutive hyphens with a single hyphen // Replace consecutive hyphens with a single hyphen
str = str.replace(/-+/g, '-'); str = str.replace(/-+/g, "-");
// Trim leading and trailing hyphens // Trim leading and trailing hyphens
str = str.replace(/^-+|-+$/g, ''); str = str.replace(/^-+|-+$/g, "");
return str; return str;
} };
export const formatBytes = (bytes, decimals = 2) => { export const formatBytes = (bytes, decimals = 2) => {
if (bytes === 0) return ''; if (bytes === 0) return "";
const k = 1024; const k = 1024;
const dm = decimals < 0 ? 0 : decimals; const dm = decimals < 0 ? 0 : decimals;
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
const i = Math.floor(Math.log(bytes) / Math.log(k)); const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
}; };
export const calcCacheSizes = async () => { export const calcCacheSizes = async () => {
try { try {
let swCacheSize = 0; let swCacheSize = 0;
let diskCacheSize = 0; let diskCacheSize = 0;
let indexedDBSize = 0; let indexedDBSize = 0;
// 1. Get the service worker cache size // 1. Get the service worker cache size
if ('caches' in window) { if ("caches" in window) {
const cacheNames = await caches.keys(); const cacheNames = await caches.keys();
for (const name of cacheNames) { for (const name of cacheNames) {
const cache = await caches.open(name); const cache = await caches.open(name);
const requests = await cache.keys(); const requests = await cache.keys();
for (const request of requests) { for (const request of requests) {
const response = await cache.match(request); const response = await cache.match(request);
swCacheSize += Number(response.headers.get('Content-Length')) || 0; swCacheSize += Number(response.headers.get("Content-Length")) || 0;
} }
} }
} }
// 2. Get the disk cache size // 2. Get the disk cache size
// const diskCacheName = 'disk-cache'; // const diskCacheName = 'disk-cache';
// const diskCache = await caches.open(diskCacheName); // const diskCache = await caches.open(diskCacheName);
// const diskCacheKeys = await diskCache.keys(); // const diskCacheKeys = await diskCache.keys();
// for (const request of diskCacheKeys) { // for (const request of diskCacheKeys) {
// const response = await diskCache.match(request); // const response = await diskCache.match(request);
// diskCacheSize += Number(response.headers.get('Content-Length')) || 0; // diskCacheSize += Number(response.headers.get('Content-Length')) || 0;
// } // }
// 3. Get the IndexedDB cache size // 3. Get the IndexedDB cache size
// const indexedDBNames = await window.indexedDB.databases(); // const indexedDBNames = await window.indexedDB.databases();
// for (const dbName of indexedDBNames) { // for (const dbName of indexedDBNames) {
// const db = await window.indexedDB.open(dbName.name); // const db = await window.indexedDB.open(dbName.name);
// const objectStoreNames = db.objectStoreNames; // const objectStoreNames = db.objectStoreNames;
// if (objectStoreNames !== undefined) { // if (objectStoreNames !== undefined) {
// const objectStores = Array.from(objectStoreNames).map((storeName) => db.transaction([storeName], 'readonly').objectStore(storeName)); // const objectStores = Array.from(objectStoreNames).map((storeName) => db.transaction([storeName], 'readonly').objectStore(storeName));
// for (const objectStore of objectStores) { // for (const objectStore of objectStores) {
// const request = objectStore.count(); // const request = objectStore.count();
// request.onsuccess = () => { // request.onsuccess = () => {
// indexedDBSize += request.result; // indexedDBSize += request.result;
// }; // };
// } // }
// } // }
// } // }
return { swCacheSize, diskCacheSize, indexedDBSize, totalSize: Number(swCacheSize) + Number(diskCacheSize) + indexedDBSize }; return { swCacheSize, diskCacheSize, indexedDBSize, totalSize: Number(swCacheSize) + Number(diskCacheSize) + indexedDBSize };
} catch (error) { } catch (error) {
console.error('Error getting cache sizes:', error); console.error("Error getting cache sizes:", error);
} }
}; };
export const clearAllCaches = async (cb) => { export const clearAllCaches = async cb => {
try { try {
// 1. Clear the service worker cache // 1. Clear the service worker cache
if ('caches' in window) { if ("caches" in window) {
// if (navigator.serviceWorker) { // if (navigator.serviceWorker) {
const cacheNames = await caches.keys(); const cacheNames = await caches.keys();
await Promise.all(cacheNames.map((name) => caches.delete(name))); await Promise.all(cacheNames.map(name => caches.delete(name)));
} }
// 2. Clear the disk cache (HTTP cache) // 2. Clear the disk cache (HTTP cache)
// const diskCacheName = 'disk-cache'; // const diskCacheName = 'disk-cache';
// await window.caches.delete(diskCacheName); // await window.caches.delete(diskCacheName);
// const diskCache = await window.caches.open(diskCacheName); // const diskCache = await window.caches.open(diskCacheName);
// const diskCacheKeys = await diskCache.keys(); // const diskCacheKeys = await diskCache.keys();
// await Promise.all(diskCacheKeys.map((request) => diskCache.delete(request))); // await Promise.all(diskCacheKeys.map((request) => diskCache.delete(request)));
// 3. Clear the IndexedDB cache // 3. Clear the IndexedDB cache
const indexedDBNames = await window.indexedDB.databases(); const indexedDBNames = await window.indexedDB.databases();
await Promise.all(indexedDBNames.map((dbName) => window.indexedDB.deleteDatabase(dbName.name))); await Promise.all(indexedDBNames.map(dbName => window.indexedDB.deleteDatabase(dbName.name)));
// Unregister the service worker // Unregister the service worker
const registration = await navigator.serviceWorker.getRegistration(); const registration = await navigator.serviceWorker.getRegistration();
if (registration) { if (registration) {
await registration.unregister(); await registration.unregister();
console.log('Service worker unregistered'); console.log("Service worker unregistered");
} else { } else {
console.log('No service worker registered'); console.log("No service worker registered");
} }
if (typeof cb === 'function' ) { if (typeof cb === "function") {
cb(); cb();
} }
} catch (error) {
} catch (error) { console.error("Error clearing caches or unregistering service worker:", error);
console.error('Error clearing caches or unregistering service worker:', error); }
}
}; };
export const loadScript = (src) => { export const loadScript = src => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const script = document.createElement('script'); const script = document.createElement("script");
script.type = 'text/javascript'; script.type = "text/javascript";
script.onload = resolve; script.onload = resolve;
script.onerror = reject; script.onerror = reject;
script.crossOrigin = 'anonymous'; script.crossOrigin = "anonymous";
script.src = src; script.src = src;
if (document.head.append) { if (document.head.append) {
document.head.append(script); document.head.append(script);
} else { } else {
document.getElementsByTagName('head')[0].appendChild(script); document.getElementsByTagName("head")[0].appendChild(script);
} }
}); });
}; };
//格式化为冒号时间2010转为20:10
export const formatColonTime = text => {
const hours = text.substring(0, 2);
const minutes = text.substring(2);
return `${hours}:${minutes}`;
};

@ -2,7 +2,7 @@ import { useState, useEffect } from "react";
import { Grid, Divider, Layout, Spin, Input, Col, Row, Space, List, Table } from "antd"; import { Grid, Divider, Layout, Spin, Input, Col, Row, Space, List, Table } from "antd";
import { PhoneOutlined, CustomerServiceOutlined, AudioOutlined } from "@ant-design/icons"; import { PhoneOutlined, CustomerServiceOutlined, AudioOutlined } from "@ant-design/icons";
import { useParams, useHref, useNavigate, NavLink } from "react-router-dom"; import { useParams, useHref, useNavigate, NavLink } from "react-router-dom";
import { isEmpty } from "@/utils/commons"; import { isEmpty, formatColonTime } from "@/utils/commons";
import dayjs from "dayjs"; import dayjs from "dayjs";
import SearchForm from "@/components/SearchForm"; import SearchForm from "@/components/SearchForm";
@ -54,21 +54,19 @@ const planListColumns = [
title: "起飞时间", title: "起飞时间",
key: "FlightTimeStart", key: "FlightTimeStart",
dataIndex: "FlightTimeStart", dataIndex: "FlightTimeStart",
render: text => { render: text => formatColonTime(text),
const hours = text.substring(0, 2);
const minutes = text.substring(2);
return `${hours}:${minutes}`;
},
}, },
{ {
title: "落地时间", title: "落地时间",
key: "FlightTimeEnd", key: "FlightTimeEnd",
dataIndex: "FlightTimeEnd", dataIndex: "FlightTimeEnd",
render: text => { render: text => formatColonTime(text),
const hours = text.substring(0, 2); },
const minutes = text.substring(2); {
return `${hours}:${minutes}`; title: "是否出票",
}, key: "COLD_PlanVEI_SN",
dataIndex: "COLD_PlanVEI_SN",
render: (text, record) => "否",
}, },
{ {
title: "操作", title: "操作",
@ -82,7 +80,7 @@ const Airticket = props => {
const href = useHref(); const href = useHref();
const navigate = useNavigate(); const navigate = useNavigate();
const { phonenumber } = useParams(); const { phonenumber } = useParams();
const {travelAgencyId, } = usingStorage(); const { travelAgencyId } = usingStorage();
const [getPlanList, planList, loading] = airTicketStore(state => [state.getPlanList, state.planList, state.loading]); const [getPlanList, planList, loading] = airTicketStore(state => [state.getPlanList, state.planList, state.loading]);
const [phone_number, setPhone_number] = useState(phonenumber); const [phone_number, setPhone_number] = useState(phonenumber);
const showTotal = total => `合计 ${total} `; const showTotal = total => `合计 ${total} `;

@ -1,40 +1,194 @@
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import { Grid, Divider, Layout, Spin, Input, Col, Row, Space, List, Table, Button } from "antd"; import { Grid, Divider, Layout, Form, Input, Col, Row, Space, Collapse, Table, Button } from "antd";
import { PhoneOutlined, CustomerServiceOutlined, AudioOutlined } from "@ant-design/icons"; import { PhoneOutlined, CustomerServiceOutlined, AudioOutlined, ArrowUpOutlined, ArrowDownOutlined } from "@ant-design/icons";
import { useParams, useHref, useNavigate, NavLink } from "react-router-dom"; import { useParams, useHref, useNavigate, NavLink } from "react-router-dom";
import { isEmpty } from "@/utils/commons"; import { isEmpty, formatColonTime } from "@/utils/commons";
import dayjs from "dayjs"; import { OFFICEWEBVIEWERURL } from "@/config";
import { HT_HOST, OFFICEWEBVIEWERURL } from "@/config";
import airTicketStore from "@/stores/Airticket"; import airTicketStore from "@/stores/Airticket";
import useAuthStore from "@/stores/Auth"; import { usingStorage } from "@/hooks/usingStorage";
const AirticketPlan = props => { const AirticketPlan = props => {
const href = useHref();
const navigate = useNavigate();
const { coli_sn } = useParams(); const { coli_sn } = useParams();
const [travelAgencyId, loginToken] = useAuthStore( const { travelAgencyId, loginToken } = usingStorage();
state => state.loginUser.travelAgencyId, const [getPlanDetail, planDetail, getGuestList, guestList, loading] = airTicketStore(state => [state.getPlanDetail, state.planDetail, state.getGuestList, state.guestList, state.loading]);
state => state.loginUser.loginToken const reservationUrl = `https://p9axztuwd7x8a7.mycht.cn/Service_BaseInfoWeb/FlightPlanDocx?GRI_SN=${coli_sn}&VEI_SN=${travelAgencyId}`;
); const reservationPreviewUrl = OFFICEWEBVIEWERURL + encodeURIComponent(reservationUrl);
const [getPlanList, planList, loading] = airTicketStore(state => [state.getPlanList, state.planList, state.loading]);
const [loginUser] = useAuthStore(state => [state.loginUser]);
const reservationUrl = `https://p9axztuwd7x8a7.mycht.cn/service-fileServer/DownloadPlanDoc?GRI_SN=${coli_sn}&VEI_SN=${travelAgencyId}&token=${loginToken}&FileType=1`; console.log(reservationPreviewUrl);
const reservationPreviewUrl = OFFICEWEBVIEWERURL + encodeURIComponent(reservationUrl); const Airticket_form = props => {
const aitInfo = props.airInfo;
return (
<>
<Form
name="basic"
labelCol={{
span: 8,
}}
wrapperCol={{
span: 16,
}}
style={{
maxWidth: 600,
}}
initialValues={{
remember: true,
}}
// onFinish={onFinish}
// onFinishFailed={onFinishFailed}
autoComplete="off">
<Form.Item label="日期" name="username" rules={[{ required: true }]}>
<Input value={aitInfo.StartDate} />
</Form.Item>
<Form.Item label="城市" name="password" rules={[{ required: true }]}>
<Space.Compact>
<Input placeholder="出发" prefix={<ArrowUpOutlined />} value={aitInfo.FromCity} />
<Input placeholder="抵达" prefix={<ArrowDownOutlined />} value={aitInfo.ToCity} />
</Space.Compact>
</Form.Item>
<Form.Item label="航班" name="password" rules={[{ required: true }]}>
<Space.Compact>
<Input placeholder="航空公司" />
<Input placeholder="航班号" value={aitInfo.FlightNo} />
</Space.Compact>
</Form.Item>
<Form.Item label="出发" name="password" rules={[{ required: true }]}>
<Space.Compact>
<Input placeholder="机场" />
<Input placeholder="航站楼" />
<Input placeholder="出发时间" value={formatColonTime(aitInfo.FlightTimeStart)} />
</Space.Compact>
</Form.Item>
<Form.Item label="抵达" name="password" rules={[{ required: true }]}>
<Space.Compact>
<Input placeholder="机场" />
<Input placeholder="航站楼" />
<Input placeholder="抵达时间" value={formatColonTime(aitInfo.FlightTimeEnd)} />
</Space.Compact>
</Form.Item>
<Form.Item label="仓位和行李" name="password">
<Space.Compact>
<Input placeholder="仓位" />
<Input placeholder="行李" />
</Space.Compact>
</Form.Item>
{/* <Form.Item
wrapperCol={{
offset: 8,
span: 16,
}}>
<Button type="primary" htmlType="submit">
Submit
</Button>
</Form.Item> */}
</Form>
<Divider />
<Table bordered={true} rowKey="id" columns={guestListColumns} dataSource={guestList} loading={loading} pagination={false} />
</>
);
};
useEffect(() => {}, []); const detail_items = () => {
return planDetail
? planDetail.map(item => {
return {
key: item.id,
label: `${item.StartDate} 计划: ${item.FlightInfo}`,
children: <Airticket_form airInfo={item} />,
};
})
: [];
};
const guestListColumns = [
{
title: "姓名",
key: "MEI_Name",
dataIndex: "MEI_Name",
},
{
title: "证件类型",
key: "MEI_PassportType",
dataIndex: "MEI_PassportType",
},
{
title: "证件号",
key: "MEI_PassportNo",
dataIndex: "MEI_PassportNo",
},
{
title: "证件有效期",
key: "MEI_PassportValidDate",
dataIndex: "MEI_PassportValidDate",
},
{
title: "性别",
key: "MEI_Gender",
dataIndex: "MEI_Gender",
},
{
title: "年龄",
key: "MEI_age",
dataIndex: "MEI_age",
},
{
title: "国籍",
key: "MEI_Country",
dataIndex: "MEI_Country",
},
{
title: "票号",
key: "MEI_SN",
dataIndex: "MEI_SN",
},
{
title: "PNR",
key: "MEI_SN",
dataIndex: "MEI_SN",
},
{
title: "机票费用RMB含基建和税",
key: "MEI_SN",
dataIndex: "MEI_SN",
},
{
title: "折扣",
key: "MEI_SN",
dataIndex: "MEI_SN",
},
{
title: "手续费",
key: "MEI_SN",
dataIndex: "MEI_SN",
},
{
title: "机票类型(成人/儿童/婴儿)",
key: "MEI_SN",
dataIndex: "MEI_SN",
},
];
useEffect(() => {
getPlanDetail(travelAgencyId, coli_sn);
getGuestList(travelAgencyId, coli_sn);
console.log(detail_items());
}, []);
return ( return (
<Space direction="vertical" style={{ width: "100%" }}> <Space direction="vertical" style={{ width: "100%" }}>
<Row> <Row>
<Col md={24} lg={24} xxl={24} style={{ height: "100%" }}> <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} frameBorder="0" style={{ width: "100%", height: "600px" }}></iframe> */}
<Button type="link" target="_blank" href={reservationUrl}> <Button type="link" target="_blank" href={reservationUrl}>
下载 下载
</Button> </Button>
</Col> </Col>
<Divider orientation="left">出票信息</Divider>
<Col md={24} lg={24} xxl={24}>
<Collapse items={detail_items()} />
</Col>
</Row> </Row>
</Space> </Space>
); );

Loading…
Cancel
Save