From fa0550dfdb324b583fd941c4c16eb2c3ba4cc655 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Mon, 17 Jun 2024 17:00:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=9C=8D=E5=AE=A1=E6=A0=B8=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/locales/en/common.json | 2 ++ public/locales/en/products.json | 2 +- public/locales/zh/common.json | 2 ++ src/components/SearchForm.jsx | 4 ++-- src/components/SecondHeaderWrapper.jsx | 28 ++++++++++++++++++++++ src/hooks/useProductsSets.js | 16 ++++++------- src/main.jsx | 4 ++++ src/stores/Products/Index.js | 13 ++++++++++- src/views/products/Audit.jsx | 32 ++++++++++++++++++++++++++ src/views/products/Detail.jsx | 10 ++++++++ src/views/products/Index.jsx | 26 ++++++++++++++------- 11 files changed, 119 insertions(+), 20 deletions(-) create mode 100644 src/components/SecondHeaderWrapper.jsx create mode 100644 src/views/products/Audit.jsx create mode 100644 src/views/products/Detail.jsx diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 4575ad3..0810454 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -11,6 +11,7 @@ "Close": "Close", "Save": "Save", "Edit": "Edit", + "Audit": "Audit", "Delete": "Delete", "Add": "Add", "View": "View", @@ -19,6 +20,7 @@ "Upload": "Upload", "preview": "Preview", "Total": "Total", + "Action": "Action", "Login": "Login", "Username": "Username", diff --git a/public/locales/en/products.json b/public/locales/en/products.json index 4813a31..2076875 100644 --- a/public/locales/en/products.json +++ b/public/locales/en/products.json @@ -21,6 +21,6 @@ "AuState": "Audit State", "CreatedBy": "Created By", "CreateDate": "Create Date", - "Auditors": "Auditors", + "AuditedBy": "Audited By", "AuditDate": "Audit Date" } diff --git a/public/locales/zh/common.json b/public/locales/zh/common.json index d689719..4ef0694 100644 --- a/public/locales/zh/common.json +++ b/public/locales/zh/common.json @@ -11,6 +11,7 @@ "Close": "关闭", "Save": "保存", "Edit": "编辑", + "Audit": "审核", "Delete": "删除", "Add": "添加", "View": "查看", @@ -19,6 +20,7 @@ "Upload": "上传", "preview": "预览", "Total": "总数", + "Action": "操作", "Login": "登录", "Username": "账号", diff --git a/src/components/SearchForm.jsx b/src/components/SearchForm.jsx index 6ccbeae..97ca443 100644 --- a/src/components/SearchForm.jsx +++ b/src/components/SearchForm.jsx @@ -47,7 +47,7 @@ const SearchForm = ({ initialValue, onSubmit, onReset, ...props }) => { { key: 'endtime', transform: (arrVal) => (arrVal ? arrVal[1].format(SMALL_DATETIME_FORMAT) : '') }, ], 'invoiceStatus': { key: 'invoiceStatus', transform: (value) => value?.value || value?.key || '', default: '' }, - 'auditStatus': { key: 'auditStatus', transform: (value) => value?.value || value?.key || '', default: '' }, + 'auditState': { key: 'auditState', transform: (value) => value?.value || value?.key || '', default: '' }, 'agency': { key: 'agency', transform: (value) => { @@ -225,7 +225,7 @@ function getFields(props) { { value: '0', label: 'New' }, { value: '1', label: 'Pending' }, { value: '2', label: 'Approve' }, - { value: '3', label: 'Rejected' }, + // { value: '3', label: 'Rejected' }, { value: '4', label: 'Published' }, ]} /> diff --git a/src/components/SecondHeaderWrapper.jsx b/src/components/SecondHeaderWrapper.jsx new file mode 100644 index 0000000..2b2ffca --- /dev/null +++ b/src/components/SecondHeaderWrapper.jsx @@ -0,0 +1,28 @@ +import { Outlet, useNavigate } from 'react-router-dom'; +import { Layout, Flex, theme } from 'antd'; +import BackBtn from './BackBtn'; + +const { Content, Header } = Layout; +const HeaderWrapper = ({ children, header, ...props }) => { + const navigate = useNavigate(); + const { + token: { colorBgContainer }, + } = theme.useToken(); + return ( + <> + +
+ + {/* {header} */} +
{header}
+ +
+
+ + {children || } + +
+ + ); +}; +export default HeaderWrapper; diff --git a/src/hooks/useProductsSets.js b/src/hooks/useProductsSets.js index 0834d52..4545d91 100644 --- a/src/hooks/useProductsSets.js +++ b/src/hooks/useProductsSets.js @@ -11,14 +11,14 @@ export const useProductsTypes = () => { useEffect(() => { const newData = [ - { label: t('products:type.Experience'), value: t('products:type.Experience') }, - {label: t("products:type.Car"), value: t("products:type.Car"),}, - {label: t("products:type.Guide"), value: t("products:type.Guide"),}, - {label: t("products:type.Package"), value: t("products:type.Package"),}, - {label: t("products:type.Attractions"), value: t("products:type.Attractions"),}, - {label: t("products:type.Meals"), value: t("products:type.Meals"),}, - {label: t("products:type.Extras"), value: t("products:type.Extras"),}, - {label: t("products:type.Special"), value: t("products:type.Special")}, + { label: t('products:type.Experience'), value: 'Experience', key: 'Experience' }, + { label: t('products:type.Car'), value: 'Car', key: 'Car' }, + { label: t('products:type.Guide'), value: 'Guide', key: 'Guide' }, + { label: t('products:type.Package'), value: 'Package', key: 'Package' }, + { label: t('products:type.Attractions'), value: 'Attractions', key: 'Attractions' }, + { label: t('products:type.Meals'), value: 'Meals', key: 'Meals' }, + { label: t('products:type.Extras'), value: 'Extras', key: 'Extras' }, + { label: t('products:type.Special'), value: 'Special', key: 'Special' }, ]; setTypes(newData); }, [i18n.language]); diff --git a/src/main.jsx b/src/main.jsx index 0f7c4fc..3733462 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -31,6 +31,8 @@ import InvoicePaid from "@/views/invoice/Paid"; import InvoicePaidDetail from "@/views/invoice/PaidDetail"; import Airticket from "@/views/airticket/Index"; import ProductsIndex from '@/views/products/Index'; +import ProductsDetail from '@/views/products/Detail'; +import ProductsAudit from '@/views/products/Audit'; import './i18n'; @@ -67,6 +69,8 @@ const router = createBrowserRouter([ { path: "invoice/paid/detail/:flid",element:}, { path: "airticket",element:}, { path: "products",element:}, + { path: "products/:travel_agency_id/audit",element:}, + { path: "products/:travel_agency_id",element:}, ] }, { diff --git a/src/stores/Products/Index.js b/src/stores/Products/Index.js index 87066a9..872bec9 100644 --- a/src/stores/Products/Index.js +++ b/src/stores/Products/Index.js @@ -6,7 +6,18 @@ import { HT_HOST } from '@/config'; const initialState = { loading: false, - productsList: [], + productsList: [ + { + 'audit_date': '2001-03-03', + 'travel_agency_name': '新油低外', + 'travel_agency_id': '650000200301029585', + 'created_by': '冯丽', + 'create_date': '1989-06-20', + 'lastedit_memo': 'nostrud ad eu', + 'audited_by': '黎静', + 'audit_state': '1', + }, + ], }; export const useProductsStore = create( devtools((set, get) => ({ diff --git a/src/views/products/Audit.jsx b/src/views/products/Audit.jsx new file mode 100644 index 0000000..f4187a2 --- /dev/null +++ b/src/views/products/Audit.jsx @@ -0,0 +1,32 @@ +import { createContext, useContext, useEffect, useState } from 'react'; +import { Button, Table, Tabs } from 'antd'; +import { useProductsTypes } from '@/hooks/useProductsSets'; +import SecondHeaderWrapper from '@/components/SecondHeaderWrapper'; + +const Header = () => { + return ( +
+
+ + +
+ ); +}; + +const TypesTabs = () => { + const productsTypes = useProductsTypes(); + return ( + + ) +} + +const Audit = ({ ...props }) => { + return ( + <> + }> + + + + ); +}; +export default Audit; diff --git a/src/views/products/Detail.jsx b/src/views/products/Detail.jsx new file mode 100644 index 0000000..807e0e9 --- /dev/null +++ b/src/views/products/Detail.jsx @@ -0,0 +1,10 @@ +import { createContext, useContext, useEffect, useState } from 'react'; +import { Table } from 'antd'; + +const Detail = ((props) => { + return ( + <> + + ); +}); +export default Detail; diff --git a/src/views/products/Index.jsx b/src/views/products/Index.jsx index e75ac50..b793b2f 100644 --- a/src/views/products/Index.jsx +++ b/src/views/products/Index.jsx @@ -1,4 +1,5 @@ import { useEffect, useState } from 'react'; +import { Link } from 'react-router-dom'; import { Row, Col, Space, Typography, Table, Button } from 'antd'; import useProductsStore from '@/stores/Products/Index'; import { usingStorage } from '@/hooks/usingStorage'; @@ -10,20 +11,29 @@ import { useProductsTypes } from '@/hooks/useProductsSets'; function Index() { const { t } = useTranslation(); const { userId } = usingStorage(); - const [loading, productsList] = useProductsStore((state) => state.productsList); + const [loading, productsList] = useProductsStore((state) => [state.loading, state.productsList]); const [noticeList, setNoticeList] = useState([]); useEffect(() => {}, []); const showTotal = (total) => `Total ${total} items`; const columns = [ - { title: t('products:Vendor'), key: '', dataIndex: '' }, - { title: t('products:AuState'), key: '', dataIndex: '' }, - { title: t('products:CreatedBy'), key: '', dataIndex: '' }, - { title: t('products:CreateDate'), key: '', dataIndex: '' }, - { title: t('products:Auditors'), key: '', dataIndex: '' }, - { title: t('products:AuditDate'), key: '', dataIndex: '' }, - { title: '', key: 'action', render: () => }, + { title: t('products:Vendor'), key: 'vendor', dataIndex: 'travel_agency_name' }, + { title: t('products:CreatedBy'), key: 'created_by', dataIndex: 'created_by' }, + { title: t('products:CreateDate'), key: 'create_date', dataIndex: 'create_date' }, + { title: t('products:AuState'), key: 'audit_state', dataIndex: 'audit_state' }, + { title: t('products:AuditedBy'), key: 'audited_by', dataIndex: 'audited_by' }, + { title: t('products:AuditDate'), key: 'audit_date', dataIndex: 'audit_date' }, + { + title: '', + key: 'action', + render: (_, r) => ( + + {t('Edit')} + {t('Audit')} + + ), + }, ]; return (