Merge branch 'main' of github.com:hainatravel/GHHub

perf/export-docx
YCC 1 year ago
commit 606c54a4f9

@ -44,6 +44,7 @@ http://202.103.68.111:5173/feedback/330948
---
```mermaid
---
title: GHHub 开发管理 - 机票和价格管理
@ -51,6 +52,7 @@ title: GHHub 开发管理 - 机票和价格管理
gitGraph TB:
commit
commit
branch release
branch feature/i18n
checkout main
commit id: "release" tag: "1.0.5.31"
@ -65,16 +67,19 @@ gitGraph TB:
checkout main
commit
commit
commit id: "账户体系"
checkout feature/price_manager
commit
commit id: "完成价格"
checkout main
commit tag: "1.1.0" id: "完成机票"
branch pre-release
merge feature/price_manager id: "合并机票+价格" type:HIGHLIGHT
commit
commit
checkout main
merge pre-release id: "合并发布" tag: "1.2.0"
merge feature/price_manager id: "合并价格" type:HIGHLIGHT
commit
commit
commit tag: "2.0.0" id: "完成机票"
commit
commit
commit id: "pre-release" tag: "pre-release" type:HIGHLIGHT
commit
```

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

@ -15,7 +15,7 @@ import VendorSelector from '@/components/VendorSelector';
const { RangePicker } = DatePicker;
const SearchForm = ({ initialValue, onSubmit, onReset, confirmText, formName, formLayout, loading, ...props }) => {
const SearchForm = ({ initialValue, onSubmit, onReset, onMounted, confirmText, formName, formLayout, loading, ...props }) => {
const { t } = useTranslation();
const presets = useDatePresets();
const [formValues, setFormValues] = useFormStore((state) => [state.formValues, state.setFormValues]);
@ -89,8 +89,14 @@ const SearchForm = ({ initialValue, onSubmit, onReset, confirmText, formName, fo
};
useEffect(() => {
const dest = formValuesMapper(formValues);
setFormValues(readValues);
const dest = formValuesMapper(readValues);
setFormValuesToSub(dest);
if (typeof onMounted === 'function') {
onMounted(dest)
}
return () => {};
}, []);

@ -64,6 +64,8 @@ const useAuthStore = create((set, get) => ({
const { startTokenInterval, loadUserPermission } = get()
const { setStorage, loginToken } = usingStorage()
// Dev 模式使用 localStorage会有 token 失效情况,需要手动删除
// Prod 环境没有该问题
const userJson = await fetchUserDetail(loginToken)
appendRequestParams('token', loginToken)
@ -142,9 +144,9 @@ const useAuthStore = create((set, get) => ({
async function checkTokenTimeout() {
// TODOToken 失效后要跳转到登录页面
const { LastReqDate } = await fetchLastRequet()
const lastReqDate = new Date(LastReqDate)
const lastReqDateTime = new Date(LastReqDate).getTime()
const now = new Date()
const diffTime = now.getTime() - lastReqDate.getTime()
const diffTime = now.getTime() - lastReqDateTime
const diffHours = diffTime/1000/60/60
if (diffHours > 1) {
logout()

@ -30,7 +30,7 @@ export const copyAgencyDataAction = async (postbody) => {
};
export const getAgencyProductsAction = async (param) => {
const _param = { ...param, use_year: String(param.use_year || '').replace('all', ''), audit_state: (param.audit_state || '').replace('all', '') };
const _param = { ...param, use_year: String(param.use_year || '').replace('all', ''), audit_state: String(param.audit_state || '').replace('all', '') };
const { errcode, result } = await fetchJSON(`${HT_HOST}/Service_BaseInfoWeb/travel_agency_products`, _param);
return errcode !== 0 ? { agency: {}, products: [] } : result;
};
@ -95,13 +95,18 @@ export const postProductsAuditAction = async (auditState, infoRow) => {
// return errcode !== 0 ? {} : result;
};
export const postProductsSave = async (products) => {
const { errcode, result } = await postJSON(`${HT_HOST}/Service_BaseInfoWeb/agency_product_save`, products);
return { errcode, result };
}
const initialState = {
loading: false,
searchValues: {},
agencyList: [],
activeAgency: {},
agencyProducts: {},
editingProduct: {},
searchValues: {}, // 客服首页: 搜索条件
agencyList: [], // 客服首页: 搜索结果
activeAgency: {}, // 审核/编辑 页: 当前的供应商
agencyProducts: {}, // 审核/编辑 页: 供应商产品列表
editingProduct: {}, // 编辑页: 当前编辑的产品
};
export const useProductsStore = create(
devtools((set, get) => ({
@ -130,7 +135,9 @@ export const useProductsStore = create(
getAgencyProducts: async (param) => {
const { setLoading, setActiveAgency, setAgencyProducts } = get();
setLoading(true);
setAgencyProducts({});
const res = await getAgencyProductsAction(param);
const productsData = groupBy(res.products, (row) => row.info.product_type_id);
setAgencyProducts(productsData);
setActiveAgency(res.agency);

@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';
import { useParams, Link, Navigate, useNavigate } from 'react-router-dom';
import { App, Empty, Button, Collapse, Table, Space, Divider, Select } from 'antd';
import { useParams, Link } from 'react-router-dom';
import { App, Empty, Button, Collapse, Table, Space } from 'antd';
import { useProductsTypes, useProductsAuditStatesMapVal } from '@/hooks/useProductsSets';
import SecondHeaderWrapper from '@/components/SecondHeaderWrapper';
import { useTranslation } from 'react-i18next';
@ -8,112 +8,8 @@ import useProductsStore, { postProductsQuoteAuditAction, } from '@/stores/Produc
import { cloneDeep, isEmpty } from '@/utils/commons';
import useAuthStore from '@/stores/Auth';
import RequireAuth from '@/components/RequireAuth';
// import PrintContractPDF from './PrintContractPDF';
import { PERM_PRODUCTS_OFFER_AUDIT, PERM_PRODUCTS_OFFER_PUT } from '@/config';
import dayjs from 'dayjs';
import VendorSelector from '@/components/VendorSelector';
const Header = ({ refresh, ...props }) => {
const { travel_agency_id, use_year, audit_state } = useParams();
const { t } = useTranslation();
const isPermitted = useAuthStore(state => state.isPermitted);
const [activeAgency, setActiveAgency] = useProductsStore((state) => [state.activeAgency, state.setActiveAgency]);
const { message, notification } = App.useApp();
const navigate = useNavigate();
const yearOptions = [];
const currentYear = dayjs().year();
const baseYear = Number(use_year === 'all' ? currentYear : use_year);
for (let i = baseYear - 3; i <= baseYear + 3; i++) {
yearOptions.push({ label: i, value: i, });
}
const [param, setParam] = useState({ pick_year: baseYear, pick_agency: travel_agency_id, });
const [pickYear, setPickYear] = useState(baseYear);
useEffect(() => {
refresh(param);
navigate(`/products/${activeAgency.travel_agency_id}/${pickYear}/${audit_state}/audit`);
return () => {};
}, [param]);
const handleYearChange = (value) => {
setPickYear(value);
setParam((pre) => ({ ...pre, ...{ pick_year: value } }));
};
const handleAgencyChange = ({ label, value }) => {
setActiveAgency({ travel_agency_id: value, travel_agency_name: label });
setParam((pre) => ({ ...pre, ...{ pick_agency: value } }));
};
const handleAuditItem = (state, row) => {
postProductsQuoteAuditAction(state, { id: row.id, travel_agency_id: activeAgency.travel_agency_id })
.then((json) => {
if (json.errcode === 0) {
message.success(json.errmsg);
if (typeof refresh === 'function') {
refresh(param);
}
}
})
.catch((ex) => {
notification.error({
message: 'Notification',
description: ex.message,
placement: 'top',
duration: 4,
});
});
};
return (
<div className='flex justify-end items-center gap-4 h-full'>
<div className='grow'>
<h2 className='m-0 leading-tight'>
{isPermitted(PERM_PRODUCTS_OFFER_AUDIT) ? (
<VendorSelector
value={{ label: activeAgency.travel_agency_name, value: activeAgency.travel_agency_id }}
onChange={handleAgencyChange}
mode={null}
className='w-72'
size='large'
variant={'borderless'}
/>
) : (
activeAgency.travel_agency_name
)}
<Divider type={'vertical'} />
<Select options={yearOptions} variant={'borderless'} className='w-24' size='large' value={pickYear} onChange={handleYearChange} />
{/* <Divider type={'vertical'} />
{(use_year || '').replace('all', '')} */}
</h2>
</div>
{/* <Button size='small'>{t('Copy')}</Button> */}
{/* <Button size='small'>{t('Import')}</Button> */}
<RequireAuth subject={PERM_PRODUCTS_OFFER_PUT}>
<Link className='px-2' to={`/products/${activeAgency.travel_agency_id}/${pickYear}/${audit_state}/edit`}>
{t('Edit')}
</Link>
</RequireAuth>
<RequireAuth subject={PERM_PRODUCTS_OFFER_AUDIT}>
<Button size='small' type={'primary'} onClick={() => handleAuditItem('2', activeAgency)}>
{t('products:auditStateAction.Published')}
</Button>
</RequireAuth>
{/* <Button size='small' type={'primary'} ghost onClick={() => handleAuditItem('2', agency)}>
{t('products:auditStateAction.Approved')}
</Button> */}
<RequireAuth subject={PERM_PRODUCTS_OFFER_AUDIT}>
<Button size='small' type={'primary'} danger ghost onClick={() => handleAuditItem('3', activeAgency)}>
{t('products:auditStateAction.Rejected')}
</Button>
</RequireAuth>
{/* todo: export, 审核完成之后才能导出 */}
<Button size='small'>{t('Print')} PDF</Button>
{/* <PrintContractPDF /> */}
</div>
);
};
import Header from './Detail/Header';
const PriceTable = ({ productType, dataSource, refresh }) => {
const { t } = useTranslation('products');
const { travel_agency_id, use_year, audit_state } = useParams();
@ -266,15 +162,16 @@ const Audit = ({ ...props }) => {
const { travel_agency_id, use_year, audit_state } = useParams();
const [loading, activeAgency, getAgencyProducts] = useProductsStore((state) => [state.loading, state.activeAgency, state.getAgencyProducts]);
const handleGetAgencyProducts = ({pick_year, pick_agency}={}) => {
const handleGetAgencyProducts = ({pick_year, pick_agency, pick_state}={}) => {
const year = pick_year || use_year;
const agency = pick_agency || travel_agency_id;
getAgencyProducts({ travel_agency_id: agency, use_year: year, audit_state });
const state = pick_state ?? audit_state;
getAgencyProducts({ travel_agency_id: agency, use_year: year, audit_state: state });
};
return (
<>
<SecondHeaderWrapper header={<Header title={activeAgency.travel_agency_name} refresh={handleGetAgencyProducts} />} loading={loading} backTo={`/products`}>
<SecondHeaderWrapper loading={loading} backTo={`/products`} header={<Header title={activeAgency.travel_agency_name} refresh={handleGetAgencyProducts} />}>
{/* <PrintContractPDF /> */}
<TypesPanels refresh={handleGetAgencyProducts} />

File diff suppressed because it is too large Load Diff

@ -3,10 +3,9 @@ import { App, Form, Modal, DatePicker, Divider, Switch } from 'antd';
import { isEmpty, objectMapper } from '@/utils/commons';
import { useTranslation } from 'react-i18next';
import SearchInput from '@/components/SearchInput';
import DeptSelector from '@/components/DeptSelector';
import ProductsTypesSelector from '@/components/ProductsTypesSelector';
import { fetchVendorList } from '@/components/VendorSelector';
import VendorSelector from '@/components/VendorSelector';
import dayjs from 'dayjs';
import arraySupport from 'dayjs/plugin/arraySupport';
import { copyAgencyDataAction } from '@/stores/Products/Index';
@ -31,13 +30,7 @@ export const CopyProductsForm = ({ action, initialValues, onFormInstanceReady, s
return (
<Form layout='horizontal' form={form} name='form_in_modal' initialValues={initialValues} onValuesChange={onValuesChange} >
{action === '#' && <Form.Item name='agency' label={`${t('products:CopyFormMsg.target')}${t('products:Vendor')}`} rules={[{ required: true, message: t('products:CopyFormMsg.requiredVendor') }]}>
<SearchInput
placeholder={t('products:Vendor')}
mode={null}
maxTagCount={0}
fetchOptions={fetchVendorList}
map={{ travel_agency_name: 'label', travel_agency_id: 'value' }}
/>
<VendorSelector mode={null} placeholder={t('products:Vendor')} />
</Form.Item>}
<Form.Item name={`products_types`} label={t('products:ProductType')} >
<ProductsTypesSelector maxTagCount={1} mode={'multiple'} placeholder={t('All')} />

@ -0,0 +1,137 @@
import { useEffect, useState } from 'react';
import { useParams, Link, useNavigate } from 'react-router-dom';
import { App, Button, Divider, Select } from 'antd';
import { useProductsAuditStatesMapVal } from '@/hooks/useProductsSets';
import { useTranslation } from 'react-i18next';
import useProductsStore, { postProductsQuoteAuditAction, } from '@/stores/Products/Index';
import { isEmpty } from '@/utils/commons';
import useAuthStore from '@/stores/Auth';
import RequireAuth from '@/components/RequireAuth';
// import PrintContractPDF from './PrintContractPDF';
import { PERM_PRODUCTS_OFFER_AUDIT, PERM_PRODUCTS_OFFER_PUT } from '@/config';
import dayjs from 'dayjs';
import VendorSelector from '@/components/VendorSelector';
import AuditStateSelector from '@/components/AuditStateSelector';
const Header = ({ refresh, ...props }) => {
const { travel_agency_id, use_year, audit_state } = useParams();
const { t } = useTranslation();
const isPermitted = useAuthStore(state => state.isPermitted);
const [activeAgency, setActiveAgency] = useProductsStore((state) => [state.activeAgency, state.setActiveAgency]);
const stateMapVal = useProductsAuditStatesMapVal();
const { message, notification } = App.useApp();
const navigate = useNavigate();
const yearOptions = [];
const currentYear = dayjs().year();
const baseYear = Number(use_year === 'all' ? currentYear : use_year);
for (let i = baseYear - 3; i <= baseYear + 3; i++) {
yearOptions.push({ label: i, value: i, });
}
const [param, setParam] = useState({ pick_year: baseYear, pick_agency: travel_agency_id, });
const [pickYear, setPickYear] = useState(baseYear);
const [pickAgency, setPickAgency] = useState({value: activeAgency.travel_agency_id, label: activeAgency.travel_agency_name });
const [pickAuditState, setPickAuditState] = useState();
useEffect(() => {
refresh(param);
return () => {};
}, [param]);
const emptyPickState = { value: '', label: t('products:State') };
useEffect(() => {
const baseState = audit_state === 'all' ? emptyPickState : stateMapVal[`${audit_state}`];
if (isEmpty(pickAuditState)) {
setPickAuditState(baseState);
}
return () => {};
}, [audit_state, stateMapVal])
const handleYearChange = (value) => {
setPickYear(value);
setParam((pre) => ({ ...pre, ...{ pick_year: value } }));
};
const handleAuditStateChange = (labelValue) => {
const { value } = labelValue || emptyPickState;
setPickAuditState(labelValue || emptyPickState);
setParam((pre) => ({ ...pre, ...{ pick_state: value } }));
};
const handleAgencyChange = ({ label, value }) => {
setPickAgency({ label, value });
setActiveAgency({ travel_agency_id: value, travel_agency_name: label });
setParam((pre) => ({ ...pre, ...{ pick_agency: value } }));
};
const handleAuditItem = (state, row) => {
postProductsQuoteAuditAction(state, { id: row.id, travel_agency_id: activeAgency.travel_agency_id })
.then((json) => {
if (json.errcode === 0) {
message.success(json.errmsg);
if (typeof refresh === 'function') {
refresh(param);
}
}
})
.catch((ex) => {
notification.error({
message: 'Notification',
description: ex.message,
placement: 'top',
duration: 4,
});
});
};
return (
<div className='flex justify-end items-center gap-4 h-full'>
<div className='grow'>
<h2 className='m-0 leading-tight'>
{isPermitted(PERM_PRODUCTS_OFFER_AUDIT) ? (
<VendorSelector
value={{label: activeAgency.travel_agency_name, value: activeAgency.travel_agency_id}}
onChange={handleAgencyChange}
allowClear={false}
mode={null}
className='w-72'
size='large'
variant={'borderless'}
/>
) : (
activeAgency.travel_agency_name
)}
<Divider type={'vertical'} />
<Select options={yearOptions} variant={'borderless'} className='w-24' size='large' value={pickYear} onChange={handleYearChange} />
<Divider type={'vertical'} />
<AuditStateSelector variant={'borderless'} className='w-32' size='large' value={pickAuditState} onChange={handleAuditStateChange} />
{/* <Divider type={'vertical'} />
{(use_year || '').replace('all', '')} */}
</h2>
</div>
{/* <Button size='small'>{t('Copy')}</Button> */}
{/* <Button size='small'>{t('Import')}</Button> */}
<RequireAuth subject={PERM_PRODUCTS_OFFER_PUT}>
<Link className='px-2' to={`/products/${activeAgency.travel_agency_id}/${pickYear}/${audit_state}/edit`}>
{t('Edit')}
</Link>
</RequireAuth>
<RequireAuth subject={PERM_PRODUCTS_OFFER_AUDIT}>
<Button size='small' type={'primary'} onClick={() => handleAuditItem('2', activeAgency)}>
{t('products:auditStateAction.Published')}
</Button>
</RequireAuth>
{/* <Button size='small' type={'primary'} ghost onClick={() => handleAuditItem('2', agency)}>
{t('products:auditStateAction.Approved')}
</Button> */}
<RequireAuth subject={PERM_PRODUCTS_OFFER_AUDIT}>
<Button size='small' type={'primary'} danger ghost onClick={() => handleAuditItem('3', activeAgency)}>
{t('products:auditStateAction.Rejected')}
</Button>
</RequireAuth>
{/* todo: export, 审核完成之后才能导出 */}
<Button size='small'>{t('Print')} PDF</Button>
{/* <PrintContractPDF /> */}
</div>
);
};
export default Header;

@ -0,0 +1,81 @@
import { useEffect, useState } from 'react';
import { useParams, Link, useNavigate } from 'react-router-dom';
import { App, Button, Divider, Select } from 'antd';
import { useProductsAuditStatesMapVal } from '@/hooks/useProductsSets';
import { useTranslation } from 'react-i18next';
import useProductsStore, { postProductsQuoteAuditAction, } from '@/stores/Products/Index';
import { isEmpty } from '@/utils/commons';
import useAuthStore from '@/stores/Auth';
import RequireAuth from '@/components/RequireAuth';
// import PrintContractPDF from './PrintContractPDF';
import { PERM_PRODUCTS_OFFER_AUDIT, PERM_PRODUCTS_OFFER_PUT } from '@/config';
import dayjs from 'dayjs';
import AuditStateSelector from '@/components/AuditStateSelector';
const YearSelector = ({ refresh,onStateChange }) => {
const { travel_agency_id, use_year, audit_state } = useParams();
const { t } = useTranslation();
const stateMapVal = useProductsAuditStatesMapVal();
const navigate = useNavigate();
const yearOptions = [];
const currentYear = dayjs().year();
const baseYear = Number(use_year === 'all' ? currentYear : use_year);
for (let i = baseYear - 3; i <= baseYear + 3; i++) {
yearOptions.push({ label: i, value: i, });
}
const [param, setParam] = useState({ pick_year: baseYear, pick_agency: travel_agency_id, });
const [pickYear, setPickYear] = useState(baseYear);
const [pickAuditState, setPickAuditState] = useState();
useEffect(() => {
refresh(param);
return () => {};
}, [param]);
const emptyPickState = { value: '', label: t('products:State') };
useEffect(() => {
const baseState = audit_state === 'all' ? emptyPickState : stateMapVal[`${audit_state}`];
if (isEmpty(pickAuditState)) {
setPickAuditState(baseState);
}
return () => {};
}, [audit_state, stateMapVal])
const handleYearChange = (value) => {
setPickYear(value);
setParam((pre) => ({ ...pre, ...{ pick_year: value } }));
};
const handleAuditStateChange = (labelValue) => {
const { value } = labelValue || emptyPickState;
setPickAuditState(labelValue || emptyPickState);
setParam((pre) => ({ ...pre, ...{ pick_state: value } }));
};
const addproducts = () => {
onStateChange('addProducts');
};
const submitreview = () => {
onStateChange('submitReview');
}
return (
<div className='flex justify-end items-center gap-4 h-full'>
<div className='grow'>
<h2 className='m-0 leading-tight'>
<Divider type={'vertical'} />
<Select options={yearOptions} variant={'borderless'} className='w-24' size='large' value={pickYear} onChange={handleYearChange} />
<Divider type={'vertical'} />
<AuditStateSelector variant={'borderless'} className='w-32' size='large' value={pickAuditState} onChange={handleAuditStateChange} />
</h2>
</div>
<Button size='small' type={'primary'} onClick={addproducts}>
增加产品
</Button>
<Button size='small' type={'primary'} onClick={submitreview}>
提交审核
</Button>
</div>
);
};
export default YearSelector;

@ -82,11 +82,12 @@ function Index() {
render: (_, r) => (
<Space size={'large'}>
<Link to={`/products/${r.travel_agency_id}/${searchValues.use_year || 'all'}/${searchValues.audit_state || 'all'}/edit`}>{t('Edit')}</Link>
{r.audit_state_id >= 0 ? (
<Link to={`/products/${r.travel_agency_id}/${searchValues.use_year || 'all'}/${searchValues.audit_state || 'all'}/audit`}>{t('Audit')}</Link>
{/* {r.audit_state_id >= 0 ? (
<Link to={`/products/${r.travel_agency_id}/${searchValues.use_year || 'all'}/${searchValues.audit_state || 'all'}/audit`}>{t('Audit')}</Link>
) : (
<span className='text-muted'>{t('Audit')}</span>
)}
)} */}
<Button type='link' size={'small'} onClick={() => openCopyModal(r, '#')}>
{t('Copy') + '-' + t('products:#')}
</Button>

@ -42,7 +42,7 @@ function Detail() {
},
];
function detailTextRender(text, confirm) {
function detailTextRender(_, confirm) {
const formattedText = confirm.PCI_ConfirmText;//.replace(/\;/g, '\n\n');
return (
<div className='whitespace-pre-line'>
@ -51,19 +51,21 @@ function Detail() {
);
}
function attachmentRender(text, confirm) {
function attachmentRender(_, confirm) {
return (
<>
{confirm.attachmentList.map(attch => {
return (
<Tag bordered={false} icon={<FileOutlined />}><a href={attch.file_url} target='_blank'>{attch.file_name}</a></Tag>
<Tag key={attch.file_name} bordered={false} icon={<FileOutlined />}>
<a href={attch.file_url} target='_blank' rel='noreferrer'>{attch.file_name}</a>
</Tag>
)}
)}
</>
);
}
function confirmRender(text, confirm) {
function confirmRender(_, confirm) {
return (
<Button type='link' onClick={() => showConfirmModal(confirm)}>{t('Confirm')}</Button>
);
@ -128,7 +130,7 @@ function Detail() {
.finally(() => {
setDataLoading(false);
});
}, [reservationId]);
}, [reservationId, getReservationDetail, notification]);
return (
<>

@ -1,4 +1,4 @@
import { NavLink, useLocation } from 'react-router-dom'
import { NavLink } from 'react-router-dom'
import { useState, useEffect } from 'react'
import { Row, Col, Space, Button, Table, Typography, Modal, App, Select } from 'antd'
import dayjs from 'dayjs'
@ -90,13 +90,11 @@ function Newest() {
)
}
const location = useLocation()
const [isModalOpen, setIsModalOpen] = useState(false)
const [dataLoading, setDataLoading] = useState(false)
const [guideSelectOptions, setGuideSelectOptions] = useState([])
const formValuesToSub = useFormStore((state) => state.formValuesToSub)
const [fetchAllGuideList, fetchReservationList, reservationList, reservationPage, cityList, selectReservation, getCityListByReservationId, setupCityGuide, updateReservationGuide] =
useReservationStore((state) =>
[state.fetchAllGuideList, state.fetchReservationList, state.reservationList, state.reservationPage, state.cityList, state.selectReservation, state.getCityListByReservationId, state.setupCityGuide, state.updateReservationGuide])
@ -104,13 +102,9 @@ function Newest() {
const { notification } = App.useApp()
useEffect (() => {
if (location.search !== '?back') {
//
onSearchClick(1, 1)
}
fetchAllGuideList()
.then((guideList) => {
const selectOptions = guideList.map((data, index) => {
const selectOptions = guideList.map((data) => {
return {
value: data.guideId,
label: data.guideName
@ -118,7 +112,7 @@ function Newest() {
})
setGuideSelectOptions(selectOptions)
})
}, [])
}, [fetchAllGuideList])
const showCityGuideModal = (reservation) => {
setDataLoading(true)
@ -137,6 +131,7 @@ function Newest() {
setDataLoading(false);
})
}
const handleOk = () => {
updateReservationGuide()
.finally(() => {
@ -144,15 +139,18 @@ function Newest() {
setDataLoading(false);
})
}
const handleCancel = () => {
setIsModalOpen(false);
setDataLoading(false);
}
//
const onSearchClick = (current=1, status=null) => {
const searchReservation = (submitValues, current=1) => {
setDataLoading(true)
fetchReservationList(formValuesToSub, current)
console.info('onSearchClick')
console.info(submitValues)
fetchReservationList(submitValues, current)
.catch(ex => {
notification.error({
message: `Notification`,
@ -208,20 +206,11 @@ function Newest() {
dates: { label: t('group:ArrivalDate') },
},
}}
onSubmit={(err, formVal, filedsVal) => {
setDataLoading(true)
fetchReservationList(formVal)
.catch(ex => {
notification.error({
message: 'Notification',
description: ex.message,
placement: 'top',
duration: 4,
})
})
.finally(() => {
setDataLoading(false)
})
onMounted={(initialValue) => {
searchReservation(initialValue)
}}
onSubmit={() => {
searchReservation(formValuesToSub)
}}
/>
<Title level={3}></Title>
@ -238,7 +227,9 @@ function Newest() {
total: reservationPage.total,
simple: true
}}
onChange={(pagination) => {onSearchClick(pagination.current)}}
onChange={(pagination) => {
searchReservation(formValuesToSub, pagination.current)
}}
columns={reservationListColumns} dataSource={reservationList}
/>
</Col>

Loading…
Cancel
Save