From 0ac3163e799801b7fdb36b2fa178651df9f7e577 Mon Sep 17 00:00:00 2001 From: WenC <450292408@qq.com> Date: Tue, 2 Apr 2024 18:45:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=91=E7=A5=A8=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 3 +- src/components/card/CardProj.tsx | 36 +-- src/components/invoice/InvoiceList.tsx | 194 ++++++++++++++++ src/components/invoice/InvoiceSave.tsx | 207 ++++++++++++++++++ src/components/list/ListProj.tsx | 12 +- src/components/menu/MenuTree.tsx | 18 +- src/components/menu/MenuTreeWithTopButton.tsx | 2 +- .../password/PasswordChange.tsx | 0 src/{route => components}/payment/Payment.tsx | 67 +++--- src/{route => components}/payment/payment.css | 0 src/components/recharge/RechargeHead.tsx | 34 ++- src/{route => components}/user/UserEdit.tsx | 0 src/context/GlobalContext.ts | 27 ++- src/context/IndexListContext.ts | 7 +- src/layout/head/Head.tsx | 62 +++--- src/route/index/Index.tsx | 14 +- src/route/proj/ProjNew.tsx | 7 +- src/route/router.tsx | 3 +- 18 files changed, 592 insertions(+), 101 deletions(-) create mode 100644 src/components/invoice/InvoiceList.tsx create mode 100644 src/components/invoice/InvoiceSave.tsx rename src/{route => components}/password/PasswordChange.tsx (100%) rename src/{route => components}/payment/Payment.tsx (89%) rename src/{route => components}/payment/payment.css (100%) rename src/{route => components}/user/UserEdit.tsx (100%) diff --git a/src/App.tsx b/src/App.tsx index ea818e8..34f5b5e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -6,11 +6,12 @@ import { GlobalData, GlobalDataAction, GlobalDataActionType, - GlobalDispatchContext + GlobalDispatchContext, } from "./context/GlobalContext.ts"; import {Reducer, useReducer} from "react"; const App: React.FC = () => { + const globalDataReducer = (state: GlobalData, action: GlobalDataAction) => { if (action.type == GlobalDataActionType.REFRESH_SELF) { if(action.user) { diff --git a/src/components/card/CardProj.tsx b/src/components/card/CardProj.tsx index d1cff45..2b2a6bc 100644 --- a/src/components/card/CardProj.tsx +++ b/src/components/card/CardProj.tsx @@ -3,7 +3,7 @@ import { CheckOutlined, ClockCircleOutlined, CloseCircleOutlined, - CreditCardOutlined, + CreditCardOutlined, DeleteOutlined, DownloadOutlined, DownOutlined, EditOutlined, EyeOutlined, @@ -24,10 +24,10 @@ export default function CardProj(props: { item: IProj }) { const nav = useNavigate(); const data = props.item; const [messageApi, messageContext] = useMessage(); + const [projCategoryId, setProjCategoryId] = useState(data.projCategoryId); const [projCategoryName, setProjCategoryName] = useState(data.projCategoryName); const indexListContext = useContext(IndexListContext); - /** * 生成状态 */ @@ -110,7 +110,6 @@ export default function CardProj(props: { item: IProj }) { return ( <> - {messageContext}
@@ -181,26 +180,32 @@ export default function CardProj(props: { item: IProj }) { url: `/api/proj/update-category/${data.projId}/${e.key}`, onSuccess() { messageApi.success('修改成功'); + setProjCategoryId(e.key); setProjCategoryName(span.innerText); } }); } }}> - { - put({ - messageApi, - url: `/api/proj/cancel-category/${data.projId}`, - onSuccess() { - messageApi.success('取消成功'); - setProjCategoryName(''); - } - }); - }}> - {projCategoryName ? projCategoryName : '无目录'} + + {projCategoryId ? projCategoryName : '无目录'} - + { + projCategoryId ? ( + { + put({ + messageApi, + url: `/api/proj/cancel-category/${data.projId}`, + onSuccess() { + messageApi.success('取消成功'); + setProjCategoryId(''); + setProjCategoryName(''); + } + }); + }}/> + ) : <> + }
@@ -217,6 +222,7 @@ export default function CardProj(props: { item: IProj }) { + {messageContext} ) } \ No newline at end of file diff --git a/src/components/invoice/InvoiceList.tsx b/src/components/invoice/InvoiceList.tsx new file mode 100644 index 0000000..4b13bc6 --- /dev/null +++ b/src/components/invoice/InvoiceList.tsx @@ -0,0 +1,194 @@ +import {Button, Dropdown, MenuProps, Modal, Table, TableProps, Tag} from "antd"; +import {PlusOutlined} from "@ant-design/icons"; +import {useEffect, useState} from "react"; +import {get} from "../../util/AjaxUtils.ts"; +import {IListPage} from "../../interfaces/listpage/IListPage.ts"; +import useMessage from "antd/es/message/useMessage"; +import InvoiceSave from "./InvoiceSave.tsx"; + +enum InvoiceStatusEnum { + PENDING = 'PENDING', + COMPLETE = 'COMPLETE', + FAILED = 'FAILED', + CANCEL = 'CANCEL', +} + +type DataType = { + examineOpinion: string; + examineUserId: string; + examineUserUsername: string; + gmtCreate: string; + gmtExamine: string; + invoiceAccount: string; + invoiceAddress: string; + invoiceAmount: number; + invoiceBank: string; + invoiceFileList: string[]; + invoiceFiles: string; + invoiceId: string; + invoiceNo: string; + invoiceNote: string; + invoicePhone: string; + invoiceStatus: InvoiceStatusEnum; + invoiceTitle: string; + orderIds: string[]; +} + +export default function InvoiceList() { + const [messageApi, messageContext] = useMessage(); + const [page, setPage] = useState(1); + const [total, setTotal] = useState(0); + const [dataArray, setDataArray] = useState([]); + + const columns: TableProps['columns'] = [ + { + title: '名称', + dataIndex: 'invoiceTitle', + align: 'center', + width: 180 + }, + { + title: '纳税人识别号', + dataIndex: 'invoiceNo', + align: 'center', + width: 180 + }, + { + title: '地址', + dataIndex: 'invoiceAddress', + align: 'center', + width: 180 + }, + { + title: '电话', + dataIndex: 'invoicePhone', + align: 'center', + width: 180 + }, + { + title: '开户行', + dataIndex: 'invoiceBank', + align: 'center', + width: 180 + }, + { + title: '开户行账号', + dataIndex: 'invoiceAccount', + align: 'center', + width: 180 + }, + { + title: '金额', + dataIndex: 'invoiceAmount', + align: 'center', + width: 160, + render: (value) => { + return (value / 100).toFixed(2) + } + }, + { + title: '备注', + dataIndex: 'invoiceNote', + align: 'center', + width: 180 + }, + { + title: '创建时间', + dataIndex: 'gmtCreate', + align: 'center', + width: 180 + }, + { + title: '状态', + dataIndex: 'invoiceStatus', + align: 'center', + width: 100, + fixed: 'right', + render: (value) => { + if(value === InvoiceStatusEnum.PENDING) { + return 待审核 + } + if(value === InvoiceStatusEnum.COMPLETE) { + return 已开票 + } + if(value === InvoiceStatusEnum.FAILED) { + return 失败 + } + if(value === InvoiceStatusEnum.CANCEL) { + return 已取消 + } + } + }, + { + title: '操作', + dataIndex: 'operate', + align: 'center', + width: 120, + fixed: 'right', + render: (value, record) => { + if(record.invoiceStatus == InvoiceStatusEnum.COMPLETE) { + const items: MenuProps['items'] = []; + record.invoiceFileList.forEach((item, index) => { + items.push({ + key: index, + label: ( + 下载发票{index + 1} + ) + }); + }) + return ( + + + + ) + } + } + }, + ] + + useEffect(() => { + get>({ + messageApi, + url: '/api/invoice/listpage/self', + config: { + params: { + page: page, + rows: 20 + } + }, + onSuccess({data}) { + setPage(data.page); + setTotal(data.total); + setDataArray(data.rows); + } + }) + }, [page]); + + return ( + <> +
+
+
+ +
+ { + setPage(currentPage); + } + } + } scroll={{y: 500}} bordered key="dataTable" rowKey="invoiceId"/> + + + + + + {messageContext} + + ) +} \ No newline at end of file diff --git a/src/components/invoice/InvoiceSave.tsx b/src/components/invoice/InvoiceSave.tsx new file mode 100644 index 0000000..d7aff6f --- /dev/null +++ b/src/components/invoice/InvoiceSave.tsx @@ -0,0 +1,207 @@ +import {Button, Divider, Form, Input, Radio, Space} from "antd"; +import {useState} from "react"; + +type FormFieldType = { + invoiceTitle: string; + invoiceNo: number; + invoiceAddress: string; + invoicePhone: string; + invoiceAccount: string; + invoiceBank: string; + content: string; + rate: string; + type: string; +} + +export default function InvoiceSave() { + const [form] = Form.useForm(); + const [isSaveInvoiceInfo, setIsSaveInvoiceInfo] = useState(0); + + return ( + <> +
+ 开票信息 +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
公司名称 * + + + +
纳税人识别号 * + + + +
公司地址 * + + + +
联系电话 * + + + +
开户行 * + + + +
开户行账号 * + + + +
开票内容 * + + + + A + B + C + D + + + +
开票税率 * + + + A + B + C + D + + +
发票类型 * + + + A + B + C + D + + +
保存开票信息 * + { + setIsSaveInvoiceInfo(e.target.value) + }}> + + + +
+ 开票内容 + + + + + + + + + + + + + + + +
开票金额 * +
+ + 300 + +
+
开票备注 + + + +
+ + + ); +} \ No newline at end of file diff --git a/src/components/list/ListProj.tsx b/src/components/list/ListProj.tsx index 2113aab..1ec3fba 100644 --- a/src/components/list/ListProj.tsx +++ b/src/components/list/ListProj.tsx @@ -68,8 +68,8 @@ export default function ListProj() {
) } - return projs.map((item, index) => { - return ; + return projs.map((item) => { + return ; }); } @@ -77,9 +77,11 @@ export default function ListProj() { } useEffect(() => { - reqData(page); - renderCategory(); - }, [indexListContext.status, indexListContext.categorys, indexListContext.category, keywords, page]) + if (indexListContext.categorys) { + reqData(page); + renderCategory(); + } + }, [indexListContext.status, indexListContext.categoryChangeCount, indexListContext.category, keywords, page]) const renderStatus = () => { if (indexListContext.status == 'ALL') { diff --git a/src/components/menu/MenuTree.tsx b/src/components/menu/MenuTree.tsx index d1b0813..e871b20 100644 --- a/src/components/menu/MenuTree.tsx +++ b/src/components/menu/MenuTree.tsx @@ -25,10 +25,12 @@ export default function MenuTree(props: IMenuTree) { if (item.isEdit) { return ( <> - { + { + e.stopPropagation(); props.handleEditSaveClick(item); }}/> - { + { + e.stopPropagation(); props.handleEditCancelClick(item); }}/> @@ -36,13 +38,16 @@ export default function MenuTree(props: IMenuTree) { } return ( <> - { + { + e.stopPropagation(); props.handleEditClick(item); }}/> - { + { + e.stopPropagation(); props.handleAddClick(item); }}/> - { + { + e.stopPropagation(); props.handleRemoveClick(item, index, parent); }}/> @@ -85,7 +90,8 @@ export default function MenuTree(props: IMenuTree) { const lis = children.map((item, index) => { const renderChildrenMenu = renderMenu(item.children, item); return ( -
  • { +
  • { + e.stopPropagation(); props.handleClick(item); }}>
    diff --git a/src/components/menu/MenuTreeWithTopButton.tsx b/src/components/menu/MenuTreeWithTopButton.tsx index 6c93843..8680338 100644 --- a/src/components/menu/MenuTreeWithTopButton.tsx +++ b/src/components/menu/MenuTreeWithTopButton.tsx @@ -194,7 +194,7 @@ export default function MenuTreeWithTopButton() { ...menuTreeArray ]) indexListDispatchContext({ - type: IndexListDataType.CATEGORY, + type: IndexListDataType.CATEGORY_DELETE, value: menus2Dropdowns(menuTreeArray) }) } diff --git a/src/route/password/PasswordChange.tsx b/src/components/password/PasswordChange.tsx similarity index 100% rename from src/route/password/PasswordChange.tsx rename to src/components/password/PasswordChange.tsx diff --git a/src/route/payment/Payment.tsx b/src/components/payment/Payment.tsx similarity index 89% rename from src/route/payment/Payment.tsx rename to src/components/payment/Payment.tsx index 6802afc..edaedd1 100644 --- a/src/route/payment/Payment.tsx +++ b/src/components/payment/Payment.tsx @@ -10,16 +10,16 @@ import { message, Radio, Spin, - Upload, UploadFile, UploadProps + Upload, UploadProps } from "antd"; import { ReloadOutlined } from '@ant-design/icons' -import {useEffect, useState} from "react"; +import {useEffect, useRef, useState} from "react"; import locale from 'antd/locale/zh_CN'; import dayjs from 'dayjs'; import 'dayjs/locale/zh-cn'; -import {DevUserId, downloadUrl, get, post, uploadImageUrl} from "../../util/AjaxUtils.ts"; +import {DevUserId, get, post, uploadImageUrl} from "../../util/AjaxUtils.ts"; import {UploadOutlined} from "@ant-design/icons"; import useMessage from "antd/es/message/useMessage"; import {errorImage} from "../../util/CommonUtil.ts"; @@ -70,7 +70,7 @@ export default function Payment(props: IPaymentProps) { const [isRechargeMoneyEdit, setIsRechargeMoneyEdit] = useState(false); const [isLoading, setIsLoading] = useState(false); const [rechargeVoucherArray, setRechargeVoucherArray] = useState([]); - const [thirdParty, setThirdParty] = useState(''); + const [thirdParty, setThirdParty] = useState(); const [accountRechargeId, setAccountRechargeId] = useState(''); const [thirdPartyPayUrl, setThirdPartyPayUrl] = useState(''); const [paySystemBank, setPaySystemBank] = useState({ @@ -83,14 +83,18 @@ export default function Payment(props: IPaymentProps) { const [countdownTime, setCountdownTime] = useState(''); const [isCountdownTimeout, setIsCountdownTimeout] = useState(false); const moneyRange: number[] = [0.01, 2000]; - let countdownInterval: number = -1; + const countdownIntervalRef = useRef(); + const [refreshQrCodeCount, setRefreshQrCodeCount] = useState(0); /** * 倒计时 */ const countdown = () => { - if (countdownInterval > -1) { - clearInterval(countdownInterval); + if (countdownIntervalRef.current) { + clearInterval(countdownIntervalRef.current); + } + if (thirdParty == ThirdPartyEnum.DGZZ) { + return; } const Time = new Date().getTime(); // 设定计时器的时间为60秒 @@ -108,11 +112,11 @@ export default function Payment(props: IPaymentProps) { if (distance <= 0) { setCountdownTime('已失效'); setIsCountdownTimeout(true); - clearInterval(countdownInterval); + clearInterval(countdownIntervalRef.current); } } // 每秒更新一次计时器 - countdownInterval = setInterval(() => { + countdownIntervalRef.current = setInterval(() => { updateCountdown(); }, 1000); } @@ -131,10 +135,7 @@ export default function Payment(props: IPaymentProps) { onSuccess({data}) { setAccountRechargeId(data.accountRechargeId); setThirdPartyPayUrl(data.thirdPartyPayUrl); - clearInterval(countdownInterval); - if (thirdParty != ThirdPartyEnum.DGZZ) { - countdown(); - } + countdown(); }, onFinally() { setIsLoading(false); @@ -153,14 +154,16 @@ export default function Payment(props: IPaymentProps) { } useEffect(() => { - form.setFieldsValue({ - thirdParty: ThirdPartyEnum.DGZZ, - rechargeMoney: 300 - }) - setThirdParty(ThirdPartyEnum.DGZZ); - getPaySystemBank(); + if (!thirdParty) { + getPaySystemBank(); + form.setFieldsValue({ + thirdParty: ThirdPartyEnum.DGZZ, + rechargeMoney: 300 + }) + setThirdParty(ThirdPartyEnum.DGZZ) + } getPay(); - }, []); + }, [thirdParty, isRechargeMoneyEdit, refreshQrCodeCount]); const renderMoney = () => { @@ -178,7 +181,6 @@ export default function Payment(props: IPaymentProps) { messageApi.error(`金额最大为${moneyRange[1]}`) } setIsRechargeMoneyEdit(false); - getPay(); }}>确定
    ) @@ -277,6 +279,18 @@ export default function Payment(props: IPaymentProps) { + + 银行账号 * + + + + + + 打款时间 * @@ -286,9 +300,10 @@ export default function Payment(props: IPaymentProps) { rules={[{required: true, message: '请选择打款时间'}]} > - { - form.setFieldValue('rechargeFinalTime', dateString); - }}/> + { + form.setFieldValue('rechargeFinalTime', dateString); + }}/> @@ -351,7 +366,7 @@ export default function Payment(props: IPaymentProps) { { isCountdownTimeout ? (
    { - getPay() + setRefreshQrCodeCount(refreshQrCodeCount + 1); }}> 点击刷新 @@ -372,7 +387,6 @@ export default function Payment(props: IPaymentProps) { initialValues={{remember: true}} form={form} onFinish={() => { - post({ messageApi, url: `/api/pay/pay-account-recharge/${accountRechargeId}`, @@ -406,7 +420,6 @@ export default function Payment(props: IPaymentProps) { { form.setFieldValue('thirdParty', e.target.value); setThirdParty(e.target.value); - getPay(); }} defaultValue="a"> 微信 支付宝 diff --git a/src/route/payment/payment.css b/src/components/payment/payment.css similarity index 100% rename from src/route/payment/payment.css rename to src/components/payment/payment.css diff --git a/src/components/recharge/RechargeHead.tsx b/src/components/recharge/RechargeHead.tsx index b7eecbd..ec1fcd2 100644 --- a/src/components/recharge/RechargeHead.tsx +++ b/src/components/recharge/RechargeHead.tsx @@ -1,14 +1,36 @@ import './recharge-head.css'; +import Payment from "../payment/Payment.tsx"; +import {Modal} from "antd"; +import {useState} from "react"; export default function RechargeHead() { - const handleRecharge = () => { - console.log('充值'); - } + const [isPaymentModalOpen, setIsPaymentModalOpen] = useState(false); return ( -
    - 充值 -
    + <> +
    + { + setIsPaymentModalOpen(true); + }}>充值 +
    + { + setIsPaymentModalOpen(false); + }} + footer={false} + > + { + setIsPaymentModalOpen(false); + }} + handleCancel={() => { + setIsPaymentModalOpen(false); + }} + /> + + + ) } \ No newline at end of file diff --git a/src/route/user/UserEdit.tsx b/src/components/user/UserEdit.tsx similarity index 100% rename from src/route/user/UserEdit.tsx rename to src/components/user/UserEdit.tsx diff --git a/src/context/GlobalContext.ts b/src/context/GlobalContext.ts index 27ec494..20e76a7 100644 --- a/src/context/GlobalContext.ts +++ b/src/context/GlobalContext.ts @@ -1,4 +1,6 @@ import {createContext, Dispatch} from "react"; +import {get} from "../util/AjaxUtils.ts"; +import {MessageInstance} from "antd/es/message/interface"; export enum GlobalDataActionType { REFRESH_SELF @@ -11,6 +13,28 @@ export interface User { hasUserInfo: boolean; } + +export function reloadUser(messageApi: MessageInstance, globalDispatchContext: Dispatch) { + return new Promise(resolve => { + get({ + messageApi, + url: '/api/user-info/get-user-self', + onSuccess({data}) { + globalDispatchContext({ + type: GlobalDataActionType.REFRESH_SELF, + user: { + balance: (Math.floor(data.accountMoney) / 100).toFixed(2), + nickname: data.nickname, + username: data.username, + hasUserInfo: data.hasUserInfo, + } + }) + resolve(data); + } + }) + }) +} + export interface GlobalData { user: User; } @@ -28,4 +52,5 @@ export const GlobalContext = createContext({ hasUserInfo: false } }); -export const GlobalDispatchContext = createContext>(() => {}); +export const GlobalDispatchContext = createContext>(() => { +}); diff --git a/src/context/IndexListContext.ts b/src/context/IndexListContext.ts index 69b46bc..c3fbcbe 100644 --- a/src/context/IndexListContext.ts +++ b/src/context/IndexListContext.ts @@ -5,7 +5,8 @@ export enum IndexListDataType { PROJ, AGENT, CATEGORY, - CATEGORY_CHANGE + CATEGORY_CHANGE, + CATEGORY_DELETE } export interface ListData { @@ -13,6 +14,7 @@ export interface ListData { status?: string; category?: string; categorys?: MenuProps['items']; + categoryChangeCount: number; } export interface ListAction { @@ -22,7 +24,8 @@ export interface ListAction { export const IndexListContext = createContext({ - type: IndexListDataType.PROJ + type: IndexListDataType.PROJ, + categoryChangeCount: 0 }) export const IndexListDispatchContext = createContext>(() => { diff --git a/src/layout/head/Head.tsx b/src/layout/head/Head.tsx index 497b893..64b424d 100644 --- a/src/layout/head/Head.tsx +++ b/src/layout/head/Head.tsx @@ -2,14 +2,14 @@ import './head.css' import BalanceHead from '../../components/balance/BalanceHead.tsx'; import RechargeHead from '../../components/recharge/RechargeHead.tsx'; import {Divider, Dropdown, MenuProps, message, Modal, Space, Spin} from "antd"; -import {DownOutlined, UserOutlined, KeyOutlined, LogoutOutlined} from "@ant-design/icons"; +import {DownOutlined, UserOutlined, KeyOutlined, LogoutOutlined, AccountBookOutlined} from "@ant-design/icons"; import {useContext, useEffect, useState} from "react"; -import {get, put} from "../../util/AjaxUtils.ts"; -import {GlobalContext, GlobalDataActionType, GlobalDispatchContext} from "../../context/GlobalContext.ts"; -import UserEdit from "../../route/user/UserEdit.tsx"; -import PasswordChange from "../../route/password/PasswordChange.tsx"; +import {put} from "../../util/AjaxUtils.ts"; +import {GlobalContext, GlobalDispatchContext, reloadUser} from "../../context/GlobalContext.ts"; +import UserEdit from "../../components/user/UserEdit.tsx"; +import PasswordChange from "../../components/password/PasswordChange.tsx"; import headRightBg from '../../assets/head-right-bg.png'; -import Payment from "../../route/payment/Payment.tsx"; +import InvoiceList from "../../components/invoice/InvoiceList.tsx"; export default function Head() { @@ -22,24 +22,11 @@ export default function Head() { const [isPasswordModalOpen, setIsPasswordModalOpen] = useState(false); useEffect(() => { - get({ - messageApi, - url: '/api/user-info/get-user-self', - onSuccess({data}) { - globalDispatchContext({ - type: GlobalDataActionType.REFRESH_SELF, - user: { - balance: (Math.floor(data.accountMoney) / 100).toFixed(2), - nickname: data.nickname, - username: data.username, - hasUserInfo: data.hasUserInfo, - } - }) - if(!data.hasUserInfo) { - setIsSelfModalOpen(true); - } + reloadUser(messageApi, globalDispatchContext).then((data) => { + if (!data.hasUserInfo) { + setIsSelfModalOpen(true); } - }) + }); }, [globalContext.user]); const items: MenuProps['items'] = [ @@ -47,7 +34,7 @@ export default function Head() { key: 'userinfo', label: (
    - + 个人信息
    ), @@ -59,7 +46,7 @@ export default function Head() { key: 'changePass', label: (
    - + 修改密码
    ), @@ -67,11 +54,23 @@ export default function Head() { setIsPasswordModalOpen(true); } }, + { + key: 'invoice', + label: ( +
    + + 发票管理 +
    + ), + onClick: () => { + // nav('/invoice-list'); + } + }, { key: 'logout', label: (
    - + 退出系统
    ), @@ -108,12 +107,12 @@ export default function Head() { title="个人信息" footer={false} onCancel={() => { - if(!globalContext.user.hasUserInfo) { + if (!globalContext.user.hasUserInfo) { messageApi.info('请完善个人信息'); return; } setIsSelfModalOpen(false) - }} > + }}> { modal.confirm({ title: '提示', @@ -150,7 +149,7 @@ export default function Head() { footer={false} onCancel={() => { setIsPasswordModalOpen(false) - }} > + }}> { modal.confirm({ title: '提示', @@ -183,10 +182,11 @@ export default function Head() { }}/> - + {contextHolder} diff --git a/src/route/index/Index.tsx b/src/route/index/Index.tsx index 9aca207..afdc7b6 100644 --- a/src/route/index/Index.tsx +++ b/src/route/index/Index.tsx @@ -6,7 +6,7 @@ import MenuWithTopButton from "../../components/menu/MenuWithTopButton.tsx"; import MenuTreeWithTopButton from "../../components/menu/MenuTreeWithTopButton.tsx"; import ListProj from "../../components/list/ListProj.tsx"; import ListProjAgent from "../../components/list/ListProjAgent.tsx"; -import {Breadcrumb, MenuProps} from 'antd'; +import {Breadcrumb, Button, MenuProps} from 'antd'; import { IndexListContext, IndexListDataType, @@ -28,8 +28,14 @@ export default function Index() { state.status = action.value as string; } else if (action.type == IndexListDataType.CATEGORY) { state.categorys = action.value as MenuProps['items']; + state.categoryChangeCount++; } else if (action.type == IndexListDataType.CATEGORY_CHANGE) { - state.category = action.value as string + state.category = action.value as string; + state.categoryChangeCount++; + } else if (action.type == IndexListDataType.CATEGORY_DELETE) { + state.categorys = action.value as MenuProps['items']; + state.category = ''; + state.categoryChangeCount++; } return { ...state @@ -37,7 +43,8 @@ export default function Index() { } const [listData, dispatch] = useReducer>(listReducer, { - type: IndexListDataType.PROJ + type: IndexListDataType.PROJ, + categoryChangeCount: 0 }); const [projMenu, setProjMenu] = useState({ @@ -126,6 +133,7 @@ export default function Index() { list={agentMenu.list} handleListItem={agentMenu.handleListItem} /> +
    { diff --git a/src/route/proj/ProjNew.tsx b/src/route/proj/ProjNew.tsx index 9a5e03d..2b35175 100644 --- a/src/route/proj/ProjNew.tsx +++ b/src/route/proj/ProjNew.tsx @@ -1,9 +1,10 @@ import './proj-new.css'; import {Link, useNavigate, useParams, useSearchParams} from "react-router-dom"; import {Breadcrumb, Button, Flex, Form, Input, message, Modal, Spin} from "antd"; -import {useEffect, useState} from "react"; +import {useContext, useEffect, useState} from "react"; import {get, post} from "../../util/AjaxUtils.ts"; import {IProjCharge, ProjAdditionalType, ProjChargeType} from "../../interfaces/proj/IProj.ts"; +import {GlobalDispatchContext, reloadUser} from "../../context/GlobalContext.ts"; const {TextArea} = Input; @@ -13,6 +14,7 @@ type ProjInfo = { }; export default function ProjNew() { + const globalDispatchContext = useContext(GlobalDispatchContext); const nav = useNavigate(); const pathParams = useParams(); const [queryParams] = useSearchParams(); @@ -156,6 +158,9 @@ export default function ProjNew() { onSuccess({data}) { setIsEditModalOpen(true); setCreateProjId(data.data); + reloadUser(messageApi, globalDispatchContext).then(() => { + messageApi.success('扣款成功'); + }); }, onFinally() { setLoading(false); diff --git a/src/route/router.tsx b/src/route/router.tsx index 3629a69..5109970 100644 --- a/src/route/router.tsx +++ b/src/route/router.tsx @@ -145,6 +145,5 @@ export const router = createHashRouter([ { path: '/agent-result/:orderId', element: - } -// ], {basename: import.meta.env.BASE_URL}) + }, ]) \ No newline at end of file