From cbf99e271829f266301d4962fa679e892186354a Mon Sep 17 00:00:00 2001 From: YCC Date: Thu, 27 Jun 2024 16:11:39 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=94=B9=E4=B8=BAmodal=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E8=A1=A8=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/Airticket.js | 4 +- src/views/airticket/Plan.jsx | 327 ++++++++++++++++++++++++++--------- 2 files changed, 246 insertions(+), 85 deletions(-) diff --git a/src/stores/Airticket.js b/src/stores/Airticket.js index 6a393b9..e73711a 100644 --- a/src/stores/Airticket.js +++ b/src/stores/Airticket.js @@ -30,8 +30,8 @@ const airTicketStore = create((set, get) => ({ async getPlanDetail(vei_sn, gri_sn) { const { setPlanDetail } = get(); const searchParams = { - vei_sn: 6376, //vei_sn, - gri_sn: 369040, //gri_sn + vei_sn: 4272, //vei_sn, + gri_sn: 372928, //gri_sn }; const { errcode, result } = await fetchJSON(`${HT_HOST}/Service_BaseInfoWeb/GetFlightPlanDetail`, searchParams); const _result = errcode !== 0 ? [] : result; diff --git a/src/views/airticket/Plan.jsx b/src/views/airticket/Plan.jsx index 29ba956..02ed1ee 100644 --- a/src/views/airticket/Plan.jsx +++ b/src/views/airticket/Plan.jsx @@ -1,5 +1,5 @@ import { useState, useEffect } from "react"; -import { Grid, Divider, Layout, Form, Input, Col, Row, Space, Collapse, Table, Button } from "antd"; +import { Grid, Divider, Layout, Modal, Form, Input, Col, Row, Space, Collapse, Table, Button, Select, InputNumber, Typography } from "antd"; import { PhoneOutlined, CustomerServiceOutlined, AudioOutlined, ArrowUpOutlined, ArrowDownOutlined } from "@ant-design/icons"; import { useParams, useHref, useNavigate, NavLink } from "react-router-dom"; import { isEmpty, formatColonTime } from "@/utils/commons"; @@ -15,14 +15,96 @@ const AirticketPlan = props => { const reservationUrl = `https://p9axztuwd7x8a7.mycht.cn/Service_BaseInfoWeb/FlightPlanDocx?GRI_SN=${coli_sn}&VEI_SN=${travelAgencyId}`; const reservationPreviewUrl = OFFICEWEBVIEWERURL + encodeURIComponent(reservationUrl); - console.log(reservationPreviewUrl); + // console.log(reservationPreviewUrl); + + //乘客列表 + 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", + }, + { + title: "操作", + key: "MEI_SN", + dataIndex: "MEI_SN", + render: (_, record) => { + return ( + + showModal(record)}>编辑 | console.log("del")}>删除 + + ); + }, + }, + ]; const Airticket_form = props => { const aitInfo = props.airInfo; return ( <>
{ // onFinish={onFinish} // onFinishFailed={onFinishFailed} autoComplete="off"> - - - - } value={aitInfo.FromCity} /> } value={aitInfo.ToCity} /> - + + @@ -74,18 +153,24 @@ const AirticketPlan = props => { - {/* - - */} + + + + + + + 费用列表 + - -
); }; @@ -102,73 +187,147 @@ const AirticketPlan = props => { : []; }; - 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", - }, - ]; + // 机票信息编辑表单 begin + const [isModalOpen, setIsModalOpen] = useState(false); + const [ticket_form] = Form.useForm(); + + const showModal = ticket => { + setIsModalOpen(true); + ticket_form.setFieldsValue(ticket); + }; + + const handleOk = () => { + ticket_form + .validateFields() + .then(values => { + // 在这里处理表单提交逻辑,例如发送数据到服务器 + console.log("Received values of form: ", values); + ticket_form.resetFields(); + setIsModalOpen(false); + }) + .catch(info => { + console.log("Validate Failed:", info); + }); + }; + + const handleCancel = () => { + ticket_form.resetFields(); + setIsModalOpen(false); + }; + + const onChangeType = value => { + console.log(value); + }; + + const TicketModal = () => { + return ( + <> + +
+ + console.log("dsads")} + options={[ + { + value: "jack", + label: "成人", + }, + { + value: "lucy", + label: "儿童", + }, + { + value: "Yiminghe", + label: "婴儿", + }, + ]} + /> + + + + + + + + + + + + + + + + + + + + + + +
+ + ); + }; + + // 机票信息编辑表单 end useEffect(() => { getPlanDetail(travelAgencyId, coli_sn); @@ -190,7 +349,9 @@ const AirticketPlan = props => { + ); }; + export default AirticketPlan; From e5407d6fa0448bfd77314045cb4bfad27a1266c4 Mon Sep 17 00:00:00 2001 From: YCC Date: Thu, 27 Jun 2024 16:52:51 +0800 Subject: [PATCH 2/8] fix --- src/views/airticket/Plan.jsx | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/views/airticket/Plan.jsx b/src/views/airticket/Plan.jsx index 02ed1ee..ea193fa 100644 --- a/src/views/airticket/Plan.jsx +++ b/src/views/airticket/Plan.jsx @@ -257,7 +257,6 @@ const AirticketPlan = props => { + + + + + + + + + + + + + + + - - - - - - - - - - - - - - From 2e49c01dac0be6ab83883221f752d8069e05d57a Mon Sep 17 00:00:00 2001 From: Jimmy Liow Date: Thu, 11 Jul 2024 16:45:49 +0800 Subject: [PATCH 3/8] =?UTF-8?q?fix:=20=E8=B4=A6=E5=8F=B7=E3=80=81=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E4=BF=9D=E5=AD=98=E5=87=BA=E9=94=99=E4=B8=8D=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E8=A1=A8=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/account/Management.jsx | 3 ++- src/views/account/RoleList.jsx | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/views/account/Management.jsx b/src/views/account/Management.jsx index 7081be3..f495de5 100644 --- a/src/views/account/Management.jsx +++ b/src/views/account/Management.jsx @@ -128,6 +128,7 @@ function Management() { const onAccountFinish = (values) => { saveOrUpdateAccount(values) .then(() => { + setAccountModalOpen(false) handelAccountSearch() }) .catch(ex => { @@ -224,7 +225,7 @@ function Management() { htmlType: 'submit', }} title={t('account:detail')} - open={isAccountModalOpen} onOk={() => setAccountModalOpen(false)} onCancel={() => setAccountModalOpen(false)} + open={isAccountModalOpen} onCancel={() => setAccountModalOpen(false)} destroyOnClose forceRender modalRender={(dom) => ( diff --git a/src/views/account/RoleList.jsx b/src/views/account/RoleList.jsx index 796aafe..5143081 100644 --- a/src/views/account/RoleList.jsx +++ b/src/views/account/RoleList.jsx @@ -132,6 +132,7 @@ function RoleList() { const onRoleFinish = (values) => { saveOrUpdateRole(values) .then(() => { + setRoleModalOpen(false) fetchRoleList() .then(r => { setRoleAllList(r) @@ -148,6 +149,7 @@ function RoleList() { } const onRoleFailed = (error) => { + console.log('Failed:', error) // form.resetFields() } @@ -160,7 +162,7 @@ function RoleList() { htmlType: 'submit', }} title={t('account:detail')} - open={isRoleModalOpen} onOk={() => setRoleModalOpen(false)} onCancel={() => setRoleModalOpen(false)} + open={isRoleModalOpen} onCancel={() => setRoleModalOpen(false)} destroyOnClose forceRender modalRender={(dom) => ( From 96c0e9f5169cd59535534c2045d9661cd7b46f1a Mon Sep 17 00:00:00 2001 From: Jimmy Liow Date: Thu, 11 Jul 2024 16:49:58 +0800 Subject: [PATCH 4/8] 2.0.0-alpha.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ac1a9b2..f2ea881 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "global-highlights-hub", "private": true, - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "type": "module", "scripts": { "dev": "vite", From 31d5db8387f9133e0265c732d178db8825caf3af Mon Sep 17 00:00:00 2001 From: Lei OT Date: Fri, 12 Jul 2024 10:25:49 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E4=BA=A7=E5=93=81=E7=AE=A1=E7=90=86:=20?= =?UTF-8?q?=E5=AE=A2=E6=9C=8D=E9=A6=96=E9=A1=B5,=20=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useProductsSets.js | 2 +- src/views/products/Manage.jsx | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/hooks/useProductsSets.js b/src/hooks/useProductsSets.js index 6f7fbe5..8c3ea2b 100644 --- a/src/hooks/useProductsSets.js +++ b/src/hooks/useProductsSets.js @@ -52,7 +52,7 @@ export const useProductsTypes = (showAll = false) => { { label: t('products:type.UltraService'), value: 'B', key: 'B' }, { label: t('products:type.Car'), value: 'J', key: 'J' }, { label: t('products:type.Guide'), value: 'Q', key: 'Q' }, - { label: t('products:type.Attractions'), value: '7', key: '7' }, + { label: t('products:type.Attractions'), value: '7', key: '7' }, // landscape { label: t('products:type.Meals'), value: 'R', key: 'R' }, { label: t('products:type.Extras'), value: '8', key: '8' }, { label: t('products:type.Package'), value: 'D', key: 'D' }, diff --git a/src/views/products/Manage.jsx b/src/views/products/Manage.jsx index 1aa105c..69dbe57 100644 --- a/src/views/products/Manage.jsx +++ b/src/views/products/Manage.jsx @@ -6,6 +6,7 @@ import dayjs from 'dayjs'; import arraySupport from 'dayjs/plugin/arraySupport'; import { useTranslation } from 'react-i18next'; import useProductsStore, { copyAgencyDataAction } from '@/stores/Products/Index'; +import { useProductsTypes, useProductsAuditStatesMapVal } from '@/hooks/useProductsSets'; import useFormStore from '@/stores/Form'; import { objectMapper } from '@/utils/commons'; import CopyProductsFormModal from './Detail/CopyProducts'; @@ -20,6 +21,8 @@ function Index() { const [searchValues, setSearchValues] = useProductsStore((state) => [state.searchValues, state.setSearchValues]); const formValuesToSub = useFormStore(state => state.formValuesToSub); + const stateMapVal = useProductsAuditStatesMapVal(); + const useYear = formValuesToSub.year; const handleSearchAgency = (formVal = undefined) => { @@ -60,7 +63,12 @@ function Index() { { title: t('products:Vendor'), key: 'vendor', dataIndex: 'travel_agency_name' }, { title: t('products:CreatedBy'), key: 'poster_by', dataIndex: 'poster_name' }, { title: t('products:CreateDate'), key: 'poster_date', dataIndex: 'poster_date' }, - { title: t('products:AuState'), key: 'audit_state', dataIndex: 'audit_state' }, + { title: t('products:AuState'), key: 'audit_state', dataIndex: 'audit_state', + render: (_, r) => { + + const stateCls = ` text-${stateMapVal[`${r.audit_state_id}`]?.color} `; + return {stateMapVal[`${r.audit_state_id}`]?.label}; + }, }, { title: t('products:AuditedBy'), key: 'audited_by', dataIndex: 'audited_by_name' }, { title: t('products:AuditDate'), key: 'audit_date', dataIndex: 'audit_date' }, { From bc6b5cbed15894dfeaabdc0441ae79bc0277ec0a Mon Sep 17 00:00:00 2001 From: Lei OT Date: Mon, 15 Jul 2024 14:17:49 +0800 Subject: [PATCH 6/8] =?UTF-8?q?feat:=20=E4=BE=9B=E5=BA=94=E5=95=86?= =?UTF-8?q?=E9=80=89=E6=8B=A9;=20perf:=20=E4=BA=A7=E5=93=81=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E4=BA=8C=E7=BA=A7=E9=A1=B5=E9=9D=A2=E5=A4=B4=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/BackBtn.jsx | 2 +- src/components/ProductsTypesSelector.jsx | 9 ------- src/components/SearchForm.jsx | 12 +++------ src/components/SecondHeaderWrapper.jsx | 4 +-- src/components/VendorSelector.jsx | 29 ++++++++++++++++++++++ src/views/products/Detail/CopyProducts.jsx | 3 ++- 6 files changed, 37 insertions(+), 22 deletions(-) create mode 100644 src/components/VendorSelector.jsx diff --git a/src/components/BackBtn.jsx b/src/components/BackBtn.jsx index 26068e0..baefd53 100644 --- a/src/components/BackBtn.jsx +++ b/src/components/BackBtn.jsx @@ -9,7 +9,7 @@ const BackBtn = ({to, ...props}) => { const navigate = useNavigate(); return ( <> - {isNotEmpty(to) ? {t('Back')} : } + {isNotEmpty(to) ? {t('Back')} : } ); }; diff --git a/src/components/ProductsTypesSelector.jsx b/src/components/ProductsTypesSelector.jsx index ca61815..6c719fe 100644 --- a/src/components/ProductsTypesSelector.jsx +++ b/src/components/ProductsTypesSelector.jsx @@ -2,15 +2,6 @@ import { Select } from 'antd'; import { useProductsTypes } from '@/hooks/useProductsSets'; import { useTranslation } from 'react-i18next'; -import { fetchJSON } from '@/utils/request'; -import { HT_HOST } from '@/config'; - -//供应商列表 -export const fetchVendorList = async (q) => { - const { errcode, result } = await fetchJSON(`${HT_HOST}/Service_BaseInfoWeb/VendorList`, { q }) - return errcode !== 0 ? [] : result -} - const ProductsTypesSelector = ({...props}) => { const productsTypes = useProductsTypes(); const { t } = useTranslation(); diff --git a/src/components/SearchForm.jsx b/src/components/SearchForm.jsx index ab0be78..89b79b9 100644 --- a/src/components/SearchForm.jsx +++ b/src/components/SearchForm.jsx @@ -9,8 +9,9 @@ import { useTranslation } from 'react-i18next'; import SearchInput from './SearchInput'; import AuditStateSelector from './AuditStateSelector'; import DeptSelector from './DeptSelector'; -import ProductsTypesSelector, { fetchVendorList } from './ProductsTypesSelector'; +import ProductsTypesSelector from './ProductsTypesSelector'; import CitySelector from '@/components/CitySelector'; +import VendorSelector from '@/components/VendorSelector'; const { RangePicker } = DatePicker; @@ -248,14 +249,7 @@ function getFields(props) { 'agency', 99, - + , fieldProps?.agency?.col || 6 ), diff --git a/src/components/SecondHeaderWrapper.jsx b/src/components/SecondHeaderWrapper.jsx index 9a4f7bd..b456bca 100644 --- a/src/components/SecondHeaderWrapper.jsx +++ b/src/components/SecondHeaderWrapper.jsx @@ -3,7 +3,7 @@ import { Layout, Flex, theme, Spin, Divider } from 'antd'; import BackBtn from './BackBtn'; const { Content, Header } = Layout; -const HeaderWrapper = ({ children, header, loading, ...props }) => { +const HeaderWrapper = ({ children, header, loading, backTo, ...props }) => { const navigate = useNavigate(); const { token: { colorBgContainer }, @@ -16,7 +16,7 @@ const HeaderWrapper = ({ children, header, loading, ...props }) => { {/* {header} */}
{header}
- +
diff --git a/src/components/VendorSelector.jsx b/src/components/VendorSelector.jsx new file mode 100644 index 0000000..639db96 --- /dev/null +++ b/src/components/VendorSelector.jsx @@ -0,0 +1,29 @@ +import { createContext, useEffect, useState } from 'react'; +import {} from 'antd'; +import SearchInput from './SearchInput'; +import { fetchJSON } from '@/utils/request'; +import { HT_HOST } from '@/config'; +import { useTranslation } from 'react-i18next'; + +//供应商列表 +export const fetchVendorList = async (q) => { + const { errcode, result } = await fetchJSON(`${HT_HOST}/Service_BaseInfoWeb/VendorList`, { q }); + return errcode !== 0 ? [] : result; +}; + +const VendorSelector = ({ ...props }) => { + const { t } = useTranslation(); + return ( + <> + + + ); +}; +export default VendorSelector; diff --git a/src/views/products/Detail/CopyProducts.jsx b/src/views/products/Detail/CopyProducts.jsx index 6b4d151..14ba6be 100644 --- a/src/views/products/Detail/CopyProducts.jsx +++ b/src/views/products/Detail/CopyProducts.jsx @@ -5,7 +5,8 @@ import { useTranslation } from 'react-i18next'; import SearchInput from '@/components/SearchInput'; import DeptSelector from '@/components/DeptSelector'; -import ProductsTypesSelector, { fetchVendorList } from '@/components/ProductsTypesSelector'; +import ProductsTypesSelector from '@/components/ProductsTypesSelector'; +import { fetchVendorList } from '@/components/VendorSelector'; import dayjs from 'dayjs'; import arraySupport from 'dayjs/plugin/arraySupport'; import { copyAgencyDataAction } from '@/stores/Products/Index'; From 6cf4f81cdf3897bd8377ea201ef2b6824777420f Mon Sep 17 00:00:00 2001 From: Lei OT Date: Mon, 15 Jul 2024 14:19:16 +0800 Subject: [PATCH 7/8] =?UTF-8?q?feat:=20=E4=BA=A7=E5=93=81=E7=AE=A1?= =?UTF-8?q?=E7=90=86:=20=E5=AE=A1=E6=A0=B8:=20=E5=88=87=E6=8D=A2=E5=B9=B4?= =?UTF-8?q?=E4=BB=BD;=20=E5=88=87=E6=8D=A2=E4=BE=9B=E5=BA=94=E5=95=86;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/Products/Index.js | 3 +- src/views/products/Audit.jsx | 82 +++++++++++++++++++++++++---------- src/views/products/Manage.jsx | 1 - tailwind.config.js | 5 +++ 4 files changed, 67 insertions(+), 24 deletions(-) diff --git a/src/stores/Products/Index.js b/src/stores/Products/Index.js index a06850e..3d727be 100644 --- a/src/stores/Products/Index.js +++ b/src/stores/Products/Index.js @@ -30,7 +30,7 @@ export const copyAgencyDataAction = async (postbody) => { }; export const getAgencyProductsAction = async (param) => { - const _param = { ...param, use_year: (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: (param.audit_state || '').replace('all', '') }; const { errcode, result } = await fetchJSON(`${HT_HOST}/Service_BaseInfoWeb/travel_agency_products`, _param); return errcode !== 0 ? { agency: {}, products: [] } : result; }; @@ -39,6 +39,7 @@ export const getAgencyProductsAction = async (param) => { * */ export const addProductExtraAction = async (body) => { + console.log('addProductExtraAction', body); return true; // test: 先不更新到HT const { errcode, result } = await postJSON(`${HT_HOST}/Service_BaseInfoWeb/products_extras_add`, body); return errcode === 0 ? true : false; diff --git a/src/views/products/Audit.jsx b/src/views/products/Audit.jsx index 2228b64..dc35d85 100644 --- a/src/views/products/Audit.jsx +++ b/src/views/products/Audit.jsx @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react'; -import { useParams, Link } from 'react-router-dom'; -import { App, Button, Collapse, Table, Space, Divider } from 'antd'; +import { useParams, Link, Navigate, useNavigate } from 'react-router-dom'; +import { App, Empty, Button, Collapse, Table, Space, Divider, Select } from 'antd'; import { useProductsTypes, useProductsAuditStatesMapVal } from '@/hooks/useProductsSets'; import SecondHeaderWrapper from '@/components/SecondHeaderWrapper'; import { useTranslation } from 'react-i18next'; @@ -10,19 +10,49 @@ 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'; - -const Header = ({ title, agency, refresh, ...props }) => { +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 [activeAgency] = useProductsStore((state) => [state.activeAgency]); + 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(); + refresh(param); } } }) @@ -39,20 +69,33 @@ const Header = ({ title, agency, refresh, ...props }) => {

- {title} + {isPermitted(PERM_PRODUCTS_OFFER_AUDIT) ? ( + + ) : ( + activeAgency.travel_agency_name + )} - {(use_year || '').replace('all', '')} +