From 458ae8efaf1248cfd599d594619b7cf7e85b57d0 Mon Sep 17 00:00:00 2001 From: lyp Date: Fri, 28 Mar 2025 09:44:48 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 73 ++- src/components/BelongPeople/BelongPeople.tsx | 73 ++- .../ContactPeople/ContactPeople.tsx | 9 +- .../ContractModal/ContractModal.tsx | 12 +- src/components/ContractText/ContractText.tsx | 24 +- src/components/invoice/InvoiceEdit.tsx | 229 ++++++- src/components/invoice/InvoiceList.tsx | 84 ++- src/components/invoice/InvoiceSave.css | 40 ++ src/components/invoice/InvoiceSave.tsx | 612 ++++++++++++------ src/components/invoice/InvoiceShow.tsx | 134 ++-- .../order/InvoiceOrderSelectedList.tsx | 45 +- src/components/user/UserEdit.tsx | 4 +- src/context/GlobalContext.ts | 10 + src/layout/head/Head.tsx | 67 +- src/request/api.ts | 4 + src/request/request.ts | 27 + src/route/proj/ProjCreate.tsx | 4 + src/route/proj/ProjNew.tsx | 84 ++- src/route/proj/edit/ProjEditStep2.tsx | 105 +-- src/route/proj/edit/ProjEditStep2Show.tsx | 9 +- src/route/router.tsx | 8 +- src/util/AjaxUtils.ts | 24 +- 22 files changed, 1230 insertions(+), 451 deletions(-) create mode 100644 src/components/invoice/InvoiceSave.css create mode 100644 src/request/api.ts create mode 100644 src/request/request.ts diff --git a/src/App.tsx b/src/App.tsx index 525b911..68150cf 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,3 +1,4 @@ + // 引入Provider import { Provider } from 'react-redux'; // 引入仓库 @@ -12,10 +13,14 @@ import { GlobalDataActionType, GlobalDispatchContext, } from "./context/GlobalContext.ts"; -import React, { Reducer, useReducer } from "react"; +import React, { Reducer, useReducer, useState, useEffect } from "react"; +import { + message +} from 'antd'; +import { get } from "./util/AjaxUtils.ts"; const App: React.FC = () => { - + const [isTokenFetched, setIsTokenFetched] = useState(false); const globalDataReducer = (state: GlobalData, action: GlobalDataAction) => { if (action.type == GlobalDataActionType.REFRESH_SELF) { if (action.user) { @@ -39,20 +44,58 @@ const App: React.FC = () => { hasUserInfo: false } }); + const [messageApi] = message.useMessage(); + // const nav = useNavigate(); + useEffect(() => { + + get({ + messageApi, + url: '/api/user-info/get-user-self', + onSuccess({ data }: any) { + // const currentToken = sessionStorage.getItem('token'); + sessionStorage.setItem('token', data.accessToken); + const token = sessionStorage.getItem('token'); + if (token) { + // 若 token 存在,设置 isTokenFetched 为 true + setIsTokenFetched(true); + } + } + }) + + }, []); + // const token = sessionStorage.getItem('token'); + // useEffect(() => { + // if (token) { + // setIsTokenFetched(true) + // } + + + // }, [token]); + // 如果 token 还未获取,显示加载页面 + // if (!isTokenFetched) { + // return ( + //
+ //

正在加载,请稍候...

+ //
+ // ); + // } + if (isTokenFetched) { + return ( +
+ + + + + + + {/* */} + + + +
+ ); + } - return ( -
- - - - - - {/* */} - - - -
- ); }; export default App; \ No newline at end of file diff --git a/src/components/BelongPeople/BelongPeople.tsx b/src/components/BelongPeople/BelongPeople.tsx index 8a1b55b..b739a47 100644 --- a/src/components/BelongPeople/BelongPeople.tsx +++ b/src/components/BelongPeople/BelongPeople.tsx @@ -89,8 +89,8 @@ export default function BelongPeople(props: propsInfo) { const [authorType, setauthorType] = useState('') //所属人类型 const [authorProvinceCity, setauthorProvinceCity] = useState('') //所属人省市 const [authorCrcAccount, setauthorCrcAccount] = useState(0) //是否给账号 0 给 1 不给 - // const [authorCrcAccountPassword, setauthorCrcAccountPassword] = useState('') //密码 - // const [authorCrcAccountUsername, setauthorCrcAccountUsername] = useState('') //账号 + const [authorCrcAccountPassword, setauthorCrcAccountPassword] = useState('') //密码 + const [authorCrcAccountUsername, setauthorCrcAccountUsername] = useState('') //账号 // // 从基本信息中获取到的两个表格默认选择的id 所属者id 联系人id const [authorId, setAuthorId] = useState('') //所属人id // 设置所属者more你选中的行 @@ -146,8 +146,8 @@ export default function BelongPeople(props: propsInfo) { // setauthorNameEn(''); setauthorProvinceCity(''); setauthorCrcAccount(0); - // setauthorCrcAccountPassword(''); - // setauthorCrcAccountUsername(''); + setauthorCrcAccountPassword(''); + setauthorCrcAccountUsername(''); setAuthorId(''); } else { // 正常选中时,更新相关状态 @@ -160,8 +160,8 @@ export default function BelongPeople(props: propsInfo) { // setauthorNameEn(firstSelectedRow.nameEn); setauthorProvinceCity(firstSelectedRow.provinceCity); setauthorCrcAccount(firstSelectedRow.isCrcAccount); - // setauthorCrcAccountPassword(firstSelectedRow.crcAccountPassword); - // setauthorCrcAccountUsername(firstSelectedRow.crcAccountUsername); + setauthorCrcAccountPassword(firstSelectedRow.crcAccountPassword); + setauthorCrcAccountUsername(firstSelectedRow.crcAccountUsername); setAuthorId(firstSelectedRow.projOwnerId); } @@ -518,7 +518,7 @@ export default function BelongPeople(props: propsInfo) {
{authorName}/{authorType == 'PERSONAL' ? '自然人' : '企业-组织'}/{authorIdCardType == 'ID_CARD' ? '身份证' : '营业执照'}/{authorIdCard}
- + setauthorCrcAccount(0); + setauthorCrcAccountPassword(''); + setauthorCrcAccountUsername(''); + + }}>取消 */} ) : (<>
@@ -544,9 +547,11 @@ export default function BelongPeople(props: propsInfo) { authorType: '', authorIdCardType: '', authorIdCard: '', - authorCrcAccount: '', + authorCrcAccount: 0, authorId: '', - authorProvinceCity: '' + authorProvinceCity: '', + authorCrcAccountPassword: '', + authorCrcAccountUsername: '', }) }}>取消 @@ -874,13 +879,17 @@ export default function BelongPeople(props: propsInfo) {
+
+
+
+
公司名称*
+ + + +
+
+
纳税人识别号*
+ + + +
+ +
+
+
+
公司地址*
+ + + +
+
+
联系电话*
+ + + +
+ + +
+
+
+
开户行*
+ + + +
+
+
开户行账号*
+ + + +
+ + + +
+
+
+
开票内容*
+ + +
+ {contentArray.map(item => {item.dataName})} +
+
+
+
+
+
开票税率*
+ + +
+ {rateArray.map(item => {item.dataName})} +
+
+
+
+ + + +
+
+
+
发票类型*
+ + +
+ {typeArray.map(item => {item.dataName})} +
+
+
+
+
+
保存开票信息*
+ + +
+ + +
+
+
+
+ + + +
+
+
+
开票内容
+
+
+
开票金额*
+ +
+ + {orderAmount} + +
+
+
+
+
开票备注
+ + + +
+
+
+
@@ -306,6 +528,7 @@ export default function InvoiceEdit(props: EditProps) { title="开票信息" width={1000} footer={false} + destroyOnClose onCancel={() => setIsInvoiceInfoListOpen(false)} > ([]); const columns: TableProps['columns'] = [ { title: '名称', @@ -111,16 +116,16 @@ export default function InvoiceList() { width: 100, fixed: 'right', render: (value) => { - if(value === InvoiceStatusEnum.PENDING) { + if (value === InvoiceStatusEnum.PENDING) { return 待审核 } - if(value === InvoiceStatusEnum.COMPLETE) { + if (value === InvoiceStatusEnum.COMPLETE) { return 已开票 } - if(value === InvoiceStatusEnum.FAILED) { + if (value === InvoiceStatusEnum.FAILED) { return 失败 } - if(value === InvoiceStatusEnum.CANCEL) { + if (value === InvoiceStatusEnum.CANCEL) { return 已取消 } } @@ -132,14 +137,16 @@ export default function InvoiceList() { width: 120, fixed: 'right', render: (_value, record) => { - if(record.invoiceStatus === InvoiceStatusEnum.PENDING) { + if (record.invoiceStatus === InvoiceStatusEnum.PENDING) { return } - if(record.invoiceStatus === InvoiceStatusEnum.CANCEL) { + if (record.invoiceStatus === InvoiceStatusEnum.CANCEL) { return } - if(record.invoiceStatus == InvoiceStatusEnum.COMPLETE) { + if (record.invoiceStatus == InvoiceStatusEnum.COMPLETE) { const items: MenuProps['items'] = []; record.invoiceFileList.forEach((item, index) => { items.push({ @@ -210,7 +219,7 @@ export default function InvoiceList() { rows: 20 } }, - onSuccess({data}) { + onSuccess({ data }) { setPage(data.page); setTotal(data.total); setDataArray(data.rows); @@ -226,26 +235,30 @@ export default function InvoiceList() { <>
-
+
+ }}> 新增
{ - setPage(currentPage); + setPage(currentPage); }, } - } scroll={{y: 500}} bordered key="dataTable" rowKey="invoiceId"/> + } scroll={{ y: 500 }} bordered key="dataTable" rowKey="invoiceId" /> setIsSaveModalOpen(false)} + centered + title="申请开票" + footer={false} + onCancel={() => setIsSaveModalOpen(false)} + width={1000} + destroyOnClose + > { @@ -258,12 +271,16 @@ export default function InvoiceList() { /> setIsEditModalOpen(false)} + centered + width={1000} + title="修改开票信息" + footer={false} + onCancel={() => setIsEditModalOpen(false)} + destroyOnClose > { getData(); setIsEditModalOpen(false); @@ -274,12 +291,15 @@ export default function InvoiceList() { /> setIsShowModalOpen(false)} + destroyOnClose + title="查看开票信息" + footer={false} + onCancel={() => setIsShowModalOpen(false)} + centered > + {/* {invoiceId.current} */} {messageContext} diff --git a/src/components/invoice/InvoiceSave.css b/src/components/invoice/InvoiceSave.css new file mode 100644 index 0000000..f4054c6 --- /dev/null +++ b/src/components/invoice/InvoiceSave.css @@ -0,0 +1,40 @@ +.payBox { + border: 1px solid #e4e4e4; +} + +.payTitle { + /* width: 100%; */ + padding: 5px 10px; + background-color: #e4e4e4; + font-size: 14px; + font-weight: 700; +} + +.payRow { + padding: 0px 15px; + margin-top: 10px; + display: flex; + justify-content: space-between; + margin-top: 0; +} + +.payRowL { + display: flex; + /* align-items: center; */ + /* background-color: skyblue; */ + +} + +.payRowR { + display: flex; + /* align-items: center; */ +} +.payName{ + /* background-color: skyblue; */ + width: 95px; + font-size: 14px; + margin-right: 10px; + height: 30px; + line-height: 30px; + text-align: right; +} diff --git a/src/components/invoice/InvoiceSave.tsx b/src/components/invoice/InvoiceSave.tsx index f2ed40d..849106e 100644 --- a/src/components/invoice/InvoiceSave.tsx +++ b/src/components/invoice/InvoiceSave.tsx @@ -1,11 +1,11 @@ -import {Button, Divider, Flex, Form, Input, Modal, Radio, Space} from "antd"; -import {useEffect, useState} from "react"; -import {listDictionary, IDictionary, post} from "../../util/AjaxUtils.ts"; +import { Button, Flex, Form, Input, Modal, Radio, Space } from "antd"; +import { useEffect, useState } from "react"; +import { listDictionary, IDictionary, post } from "../../util/AjaxUtils.ts"; import useMessage from "antd/es/message/useMessage"; import InvoiceInfoList from "./info/InvoiceInfoList.tsx"; import InvoiceOrderList from "./order/InvoiceOrderList.tsx"; import useModal from "antd/es/modal/useModal"; - +import './InvoiceSave.css' type FormFieldType = { invoiceTitle: string; invoiceNo: string; @@ -58,14 +58,16 @@ export default function InvoiceSave(props: SaveProps) { {modalContext} { modal.confirm({ title: '提示', content: '确定提交吗?', okText: '确定', cancelText: '取消', + centered: true, okButtonProps: { style: { backgroundColor: 'val(--color-primary)' @@ -85,199 +87,419 @@ export default function InvoiceSave(props: SaveProps) { }); }} > - 开票信息 + {/* 开票信息
- - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + +
- -
公司名称 * - - - -
纳税人识别号 * - - - -
公司地址 * - - - -
联系电话 * - - - -
开户行 * - - - -
开户行账号 * - - - -
开票内容 * - - - - {contentArray.map(item => {item.dataName})} - - - -
开票税率 * - - - {rateArray.map(item => {item.dataName})} - - -
发票类型 * - - - - {typeArray.map(item => {item.dataName})} - - - -
+ +
公司名称 * + + + +
纳税人识别号 * + + + +
公司地址 * + + + +
联系电话 * + + + +
开户行 * + + + +
开户行账号 * + + + +
开票内容 * + + + + {contentArray.map(item => {item.dataName})} + + + +
开票税率 * + + + {rateArray.map(item => {item.dataName})} + + +
发票类型 * + + + + {typeArray.map(item => {item.dataName})} + + + +
保存开票信息 * - - - - - - -
保存开票信息 * + + + + + + +
开票内容 - - + + - - - - - - - - + + + + + + + + -
开票金额 * - -
- - {orderAmount} - -
-
-
开票备注 - - - -
开票金额 * + +
+ + {orderAmount} + +
+
+
开票备注 + + + +
- - + */} +
+
+
开票信息
+
+ +
+
+
+
公司名称*
+ + + +
+
+
纳税人识别号*
+ + + +
+ +
+
+
+
公司地址*
+ + + +
+
+
联系电话*
+ + + +
+ + +
+
+
+
开户行*
+ + + +
+
+
开户行账号*
+ + + +
+ + + +
+
+
+
开票内容*
+ + +
+ {contentArray.map(item => {item.dataName})} +
+
+
+
+
+
开票税率*
+ + +
+ {rateArray.map(item => {item.dataName})} +
+
+
+
+ + + +
+
+
+
发票类型*
+ + +
+ {typeArray.map(item => {item.dataName})} +
+
+
+
+
+
保存开票信息*
+ + +
+ + +
+
+
+
+ + + +
+
+
+
开票内容
+
+
+
开票金额*
+ +
+ + {orderAmount} + +
+
+
+
+
开票备注
+ + + +
+
+
+
+ +
@@ -835,16 +852,30 @@ export default function ProjNew() { // background: '#eeeeee', // fontSize: 16, width: '310px', height: '42px', color: '#3B3B3B' - }} placeholder={packList.length > 0 ? '请选择套餐包' : '暂无套餐包'} + }} + // placeholder={packList.length > 0 ? '请选择套餐包' : '暂无套餐包'} + placeholder={packselectShow ? '请选择套餐包' : '暂无套餐包'} disabled /> +
注:已购买套餐包的请选择套餐包支付
{ if (packList.length > 0) { setPackModal(true) - // setPage(1) + setPage(1) setSelectedRowKeys([]) getPickList(1) // #1F79FF @@ -861,9 +892,13 @@ export default function ProjNew() { } }}>选择
-
{ +
{ // setPackageInfoId('') setPackageOrderId('') + setNowpackageOrderId('') + setNowPackageName ('') + + form.setFieldsValue({ packageName: '' }) @@ -1013,7 +1048,7 @@ export default function ProjNew() { // background:'pink', lineHeight: '40px' - }}>金额 : + }}>金额 : { + if (!nowPackageName) { + messageApi.error('请选择套餐包') + return + } // setPickSelectNo(nowPickSelectNo) // setShowPrice(0) setSelectPack(true) @@ -1427,9 +1467,25 @@ export default function ProjNew() {
+
+
提问方式 : 建筑 行业方面的软件系统
+
请按以上方式提问,将“建筑”两字替换
+
*/}
-
+
当前所属者:
请选择所属者
{authorName}/{authorType == 'PERSONAL' ? '自然人' : '企业-组织'}/{authorIdCardType == 'ID_CARD' ? '身份证' : '营业执照'}/{authorIdCard}
-
- + {/*
{belongShow == 'PERSONAL' ? '身份证号' : '统一社会信用代码'}
@@ -1444,7 +1472,7 @@ export default function ProjEditStep2(props: any) {
- + */} } @@ -1654,6 +1682,7 @@ export default function ProjEditStep2(props: any) {
-
姓名:
+
姓名* :
@@ -1708,7 +1739,9 @@ export default function ProjEditStep2(props: any) {
-
电话:
+
电话* :
name="phone" diff --git a/src/route/proj/edit/ProjEditStep2Show.tsx b/src/route/proj/edit/ProjEditStep2Show.tsx index 051523a..78a6ae1 100644 --- a/src/route/proj/edit/ProjEditStep2Show.tsx +++ b/src/route/proj/edit/ProjEditStep2Show.tsx @@ -21,6 +21,7 @@ type FieldType = { projDevCompleteDate: Dayjs; companyName: string; companyNameEn: string; + projName: string; }; // 所属人信息类型 type BelongPeopleType = { @@ -259,6 +260,7 @@ export default function ProjEditStep2() { setAuthorId(data.authorId) setApplyConcatId(data.applyContactId) formInfo.setFieldsValue({ + projName: data.projName, projSubName: data.projSubName, projVersion: data.projVersion, projDevCompleteDate: data.projDevCompleteDate ? dayjs(data.projDevCompleteDate, 'YYYY-MM-DD') : '', @@ -519,17 +521,18 @@ export default function ProjEditStep2() {
-
项目简称:
+
项目全称:
// label="项目简称" - name="projSubName" + name="projName" rules={[{ required: false, message: '请输入项目简称' }]} > + // placeholder="请输入项目简称" + />
diff --git a/src/route/router.tsx b/src/route/router.tsx index 74e92cd..2012c67 100644 --- a/src/route/router.tsx +++ b/src/route/router.tsx @@ -39,7 +39,7 @@ import AgentSelect from "./agent/AgentSelect.tsx"; import AgentAgreement from "./agent/AgentAgreement.tsx"; import AgentCorrection from "./agent/AgentCorrection.tsx"; import AgentResult from "./agent/AgentResult.tsx"; - +// import LoadingPage from './LoadingPage/LoadingPage.tsx' export const router = createHashRouter( // [ // { @@ -188,7 +188,11 @@ export const router = createHashRouter( // }, // ] [ - + // { + // path: '/loading', + // element: , + // }, + { path: '/', element: , diff --git a/src/util/AjaxUtils.ts b/src/util/AjaxUtils.ts index 7e705b5..7860a5d 100644 --- a/src/util/AjaxUtils.ts +++ b/src/util/AjaxUtils.ts @@ -14,10 +14,12 @@ axios.defaults.baseURL = 'http://192.168.0.15:7025/copyright'; export const WebSocketBaseUrl: string = 'ws://192.168.0.15:7025/copyright'; // export const WebSocketBaseUrl: string = 'ws://192.168.0.103:7025/copyright'; // export const WebSocketBaseUrl: string = '/copyright'; + export const DevUserId: string = '80d3365e-0597-4988-979e-18ef1c3ec671'; // 18634604067 // export const DevUserId: string = 'eb9a82a6-6ed3-4ba0-90e6-d836cefff915'; // 15042810561 密码123456 // export const DevUserId: string = 'c2438eb8-2685-49a9-bf02-5111a5192d96'; // 18647109157 // export const DevUserId: string = ''; +// export const DevUserId = localStorage.getItem('userId')? localStorage.getItem('userId') : ''; type Req = { messageApi: MessageInstance; @@ -26,6 +28,7 @@ type Req = { config?: AxiosRequestConfig; onBefore?(): void; onSuccess(data: AxiosResponse): void; + specialFlag?: string; // 添加特殊标识参数 onFinally?(): void; // onError?: (error: any) => void; // 添加 onError 属性 } @@ -41,8 +44,18 @@ axios.interceptors.request.use(config => { if (config.method === 'get') { config.data = { unused: 0 } // 这个是关键点,解决get 请求添加不上content_type } - config.headers['X-USER-ID'] = DevUserId; - config.headers['X-SOURCE'] = 'page'; + const token = sessionStorage.getItem('token')? sessionStorage.getItem('token') : ''; + if (token) { + // 如果有token,不添加 X-USER-ID 和 X-SOURCE + config.headers['Auth'] = `Bearer ${token}`; + } else { + config.headers['X-USER-ID'] = DevUserId; + config.headers['X-SOURCE'] = 'page'; + // config.headers['Auth'] = ''; + } + // config.headers['X-USER-ID'] = DevUserId; + // config.headers['X-SOURCE'] = 'page'; + // config.headers['Auth'] =token? `Bearer ${token}`:''; return config }); @@ -184,4 +197,9 @@ export function del(req: Req) { }).finally(() => { req.onFinally?.(); }) -} \ No newline at end of file +} + + + + +