版本更新

This commit is contained in:
lyp 2025-03-28 09:44:48 +08:00
parent abebaf54e7
commit 458ae8efaf
22 changed files with 1230 additions and 451 deletions

View File

@ -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<any>({
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 (
// <div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '100vh' }}>
// <p>正在加载,请稍候...</p>
// </div>
// );
// }
if (isTokenFetched) {
return (
<div>
<Provider store={store}>
<GlobalContext.Provider value={globalData}>
<GlobalDispatchContext.Provider value={dispatch}>
<Head />
<Body />
{/* <Foot/> */}
</GlobalDispatchContext.Provider>
</GlobalContext.Provider>
</Provider>
</div>
);
}
return (
<div>
<Provider store={store}>
<GlobalContext.Provider value={globalData}>
<GlobalDispatchContext.Provider value={dispatch}>
<Head />
<Body />
{/* <Foot/> */}
</GlobalDispatchContext.Provider>
</GlobalContext.Provider>
</Provider>
</div>
);
};
export default App;

View File

@ -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) {
<div style={{ display: authorName ? 'block' : 'none' }}>
{authorName}/{authorType == 'PERSONAL' ? '自然人' : '企业-组织'}/{authorIdCardType == 'ID_CARD' ? '身份证' : '营业执照'}/{authorIdCard}
</div>
<Button style={{ display: authorName ? 'block' : 'none', height: 30, marginLeft: 10 }} onClick={() => {
{/* <Button style={{ display: authorName ? 'block' : 'none', height: 30, marginLeft: 10 }} onClick={() => {
// lyp
setauthorName('');
setauthorIdCardType('');
@ -527,8 +527,11 @@ export default function BelongPeople(props: propsInfo) {
setauthorProvinceCity('');
setAuthorId('');
setSelectedRowKeys([]);
}}></Button>
setauthorCrcAccount(0);
setauthorCrcAccountPassword('');
setauthorCrcAccountUsername('');
}}></Button> */}
</div>
</>) : (<>
<div style={{ display: 'flex', alignItems: 'center' }}>
@ -544,9 +547,11 @@ export default function BelongPeople(props: propsInfo) {
authorType: '',
authorIdCardType: '',
authorIdCard: '',
authorCrcAccount: '',
authorCrcAccount: 0,
authorId: '',
authorProvinceCity: ''
authorProvinceCity: '',
authorCrcAccountPassword: '',
authorCrcAccountUsername: '',
})
}}></Button>
@ -874,13 +879,17 @@ export default function BelongPeople(props: propsInfo) {
<div style={{ display: props.isShow ? 'block' : 'none' }}>
<div className="belongPeopleModal-btn" style={{ display: 'flex', justifyContent: 'flex-end' }} >
<Button onClick={() => {
props.closeModal()
}}></Button>
<Button style={{
marginLeft: 20
}} type="primary"
onClick={() => {
if ( !authorName) {
messageApi.error('请选择所属者')
return
}
if (props.belongPeopleInfo.authorId && !authorId) {
props.closeModal()
return
@ -893,7 +902,9 @@ export default function BelongPeople(props: propsInfo) {
authorCrcAccount,
authorId,
authorProvinceCity
authorProvinceCity,
authorCrcAccountPassword,
authorCrcAccountUsername,
})
props.setValue(authorName)
props.closeModal()
@ -989,7 +1000,11 @@ export default function BelongPeople(props: propsInfo) {
<Col span={12}>
<div className='blongNameInt blongSmallNamel promptBox'>
{/* <div className='blongTitle blongsmallTitle '>姓名或公司名称:</div> */}
<div className='blongTitle blongsmallTitle '>{belongShow == 'PERSONAL' ? '姓名' : '公司名称'}</div>
<div className='blongTitle blongsmallTitle '>{belongShow == 'PERSONAL' ? '姓名' : '公司名称'}
<span style={{
color: 'red'
}}>*</span>
</div>
<Form.Item<BelongPeopleType>
// label="姓名或公司名称"
@ -1008,7 +1023,7 @@ export default function BelongPeople(props: propsInfo) {
</div>
</Col>
<Col span={12}>
{/* <Col span={12}>
<div className='blongNameInt blongSmallNameR'>
<div className='blongTitle blongsmallTitle '>{belongShow == 'PERSONAL' ? '英文名' : '公司英文缩写'}</div>
@ -1031,8 +1046,30 @@ export default function BelongPeople(props: propsInfo) {
</Form.Item>
</div>
</Col>
</Col> */}
<Col span={12}>
<div className='blongNameInt blongSmallNameR'>
<div className='blongTitle blongsmallTitle '>{belongShow == 'PERSONAL' ? '身份证号' : '统一社会信用代码'}
<span style={{
color: 'red',
}}>*</span>
</div>
<Form.Item<BelongPeopleType>
// label="证件号"
name="authorIdCard"
rules={[{ required: true, message: '请输入证件号' }]}
>
<Input placeholder="请输入证件号"
style={{ height: '44px', width: '360px', fontSize: '15px', marginTop: '22px' }}
disabled={belongTitle == '查看所属者' ? true : false}
/>
</Form.Item>
<div className='prompt' style={{left:180}}>(:如有多个著作人{belongShow == 'PERSONAL' ? '身份证号' : '统一社会信用代码'})</div>
</div>
</Col>
</Row>
<Row gutter={15}>
@ -1061,7 +1098,7 @@ export default function BelongPeople(props: propsInfo) {
<Col span={12}>
{/* <Col span={12}>
<div className='blongNameInt blongSmallNamel'>
<div className='blongTitle blongsmallTitle '>{belongShow == 'PERSONAL' ? '身份证号' : '统一社会信用代码'}</div>
@ -1078,7 +1115,7 @@ export default function BelongPeople(props: propsInfo) {
</Form.Item>
</div>
</Col>
</Col> */}
</Row></>}
<Row gutter={15}>

View File

@ -472,6 +472,7 @@ export default function ContactPeople(props: any) {
<Modal
destroyOnClose
okText="确认"
centered
// cancelText="取消"
cancelText={contactTitle === '查看联系人' ? '返回' : '取消'}
open={isContantOpen}
@ -511,7 +512,9 @@ export default function ContactPeople(props: any) {
autoComplete="off"
>
<div className='blongNameInt'>
<div className='blongTitle ' style={{ width: 65, marginRight: '15px' }}>: </div>
<div className='blongTitle ' style={{ width: 65, marginRight: '15px' }}><span style={{
color: 'red',
}}>*</span> : </div>
<Form.Item<ContactType>
@ -526,7 +529,9 @@ export default function ContactPeople(props: any) {
</Form.Item>
</div>
<div className='blongNameInt'>
<div className='blongTitle ' style={{ width: 65, marginRight: '15px' }}>: </div>
<div className='blongTitle ' style={{ width: 65, marginRight: '15px' }}><span style={{
color: 'red',
}}>*</span> : </div>
<Form.Item<ContactType>
name="phone"

View File

@ -91,7 +91,7 @@ export default function ContractModal(props: any) {
>
<div className='refunModal-item'>
<div className='refunModal-title'>
<span className='refunModal-red'>*</span>
<span className='refunModal-red'>*</span>
</div>
<div className='refunInput'>
@ -123,11 +123,11 @@ export default function ContractModal(props: any) {
<Form.Item
name="phone"
rules={[
{required: true, message: '请输入联系电话!'},
{
pattern: /^1[3456789]\d{9}$/,
message: '请输入正确的手机号码',
},
{required: true, message: '请输入联系电话!'},
// {
// pattern: /^1[3456789]\d{9}$/,
// message: '请输入正确的手机号码',
// },
]}
>
<Input

View File

@ -3,7 +3,7 @@ export default function ContractText(props: any) {
const height = window.innerHeight - 200;
return (
<div className='contract' style={{ height: height, overflow: 'auto', padding: '20px 90px' }}>
<div className='contractTitle contractTextCenter contractTextBold'>AI秒著引擎平台用户服务协议</div>
<div className='contractTitle contractTextCenter contractTextBold'>AI喵著网用户服务协议</div>
<div className='contractNum contractText'></div>
<div className='contractBox'>
<div><span className='contractLine'>{props.name}</span></div>
@ -12,18 +12,18 @@ export default function ContractText(props: any) {
</div>
<div className='contractBox'>
<div><span className='contractLine'>西AI秒著引擎平台</span></div>
<div><span className='contractLine'>西西909B6号楼9层0910室</span></div>
<div><span className='contractLine'>AI喵著网</span></div>
<div><span className='contractLine'>131</span></div>
<div><span className='contractLine'>400-086-1633</span></div>
</div>
<div className='contractBox'>
<div className='contractText'>AI秒著引擎平台在线服务</div>
<div className='contractText'>AI喵著网在线服务</div>
</div>
<div className='contractBox'>
<div className='contractTitleTwo contractTextBold'></div>
<div className='contractText'>1.1 AI秒著引擎平台https://www.aimzhu.com/所下单的相关业务甲方在AI秒著引擎平台上注册账户,其注册的下单账号为:***********。</div>
<div className='contractText'>1.2 AI秒著引擎平台提供相关服务AI秒著引擎平台具体下单选择的服务类型为准</div>
<div className='contractText'>1.1 AI喵著网https://www.aimzhu.com/所下单的相关业务甲方在AI喵著网上注册账户,其注册的下单账号为:***********。</div>
<div className='contractText'>1.2 AI喵著网提供相关服务AI喵著网具体下单选择的服务类型为准</div>
<table border={1} style={{ borderCollapse: 'collapse', width: '100%' ,marginTop:10}}>
<tbody>
@ -97,7 +97,7 @@ export default function ContractText(props: any) {
<div className='contractTitleTwo contractTextBold'></div>
<div className='contractText'>2.1 线</div>
<div className='contractText'>2.2 https://www.aimzhu.com/上付款页面进行。付款后甲方可在线登记发票信息登记后3个工作日内乙方开具数电发票通过平台发送给甲方注册的账号甲方可自行下载。</div>
<div className='contractText'>2.3AI秒著引擎平台下单时显示价格为准</div>
<div className='contractText'>2.3AI喵著网下单时显示价格为准</div>
</div>
<div className='contractBox'>
@ -128,9 +128,9 @@ export default function ContractText(props: any) {
<div className='contractBox'>
<div className='contractTitleTwo contractTextBold'></div>
<div className='contractText'>5.1 AI秒著引擎平台上注册账户所提供的相关信息均真实</div>
<div className='contractText'>5.1 AI喵著网上注册账户所提供的相关信息均真实</div>
<div className='contractText'>5.2 </div>
<div className='contractText'>5.3 使AI秒著引擎平台搭建的可运行系统用于合法的目的和用途</div>
<div className='contractText'>5.3 使AI喵著网搭建的可运行系统用于合法的目的和用途</div>
</div>
<div className='contractBox'>
@ -146,7 +146,7 @@ export default function ContractText(props: any) {
<div className='contractText'>7.1 </div>
<div className='contractText'>7.2 IDC机房等</div>
<div className='contractText'>7.3 </div>
<div className='contractText'>7.4 AI秒著引擎平台</div>
<div className='contractText'>7.4 AI喵著网</div>
<div className='contractText'>7.5 </div>
</div>
@ -158,7 +158,7 @@ export default function ContractText(props: any) {
<div className='contractBox'>
<div className='contractTitleTwo contractTextBold'></div>
<div className='contractText'>9.1 AI秒著引擎平台https://www.aimzhu.com/UserAgreement.html的约定为准。</div>
<div className='contractText'>9.1 AI喵著网https://www.aimzhu.com/UserAgreement.html的约定为准。</div>
<div className='contractText' >9.2 </div>
<div className='contractText'>9.32.1使</div>
<div className='contractText'>9.4 </div>
@ -176,7 +176,7 @@ export default function ContractText(props: any) {
<div className='contractText'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div>
</div>
<div className='contractBox'>
<div className='contractText' >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span className='contractLine'>西</span></div>
<div className='contractText' >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span className='contractLine'></span></div>
<div className='contractText signBox'>
<div></div>
<div className='sign'></div>

View File

@ -1,4 +1,4 @@
import {Button, Divider, Flex, Form, Input, Modal, Radio, Space} from "antd";
import {Button,Flex, Form, Input, Modal, Radio, Space} from "antd";
import {useEffect, useState} from "react";
import {listDictionary, IDictionary, get, put} from "../../util/AjaxUtils.ts";
import useMessage from "antd/es/message/useMessage";
@ -26,6 +26,7 @@ type EditProps = {
invoiceId: string;
handleOk: () => void;
handleCancel: () => void;
// invdataArray: any[];
}
export default function InvoiceEdit(props: EditProps) {
@ -63,6 +64,7 @@ export default function InvoiceEdit(props: EditProps) {
setOrderAmount((data.invoiceAmount / 100).toFixed(2));
}
})
}, []);
return (
@ -76,6 +78,7 @@ export default function InvoiceEdit(props: EditProps) {
onFinish={(values) => {
modal.confirm({
title: '提示',
centered: true,
content: '确定提交吗?',
okText: '确定',
cancelText: '取消',
@ -98,7 +101,7 @@ export default function InvoiceEdit(props: EditProps) {
});
}}
>
<Divider orientation="left" plain></Divider>
{/* <Divider orientation="left" plain></Divider>
<table className="pay-table">
<colgroup>
<col width="120"/>
@ -288,7 +291,226 @@ export default function InvoiceEdit(props: EditProps) {
</td>
</tr>
</tbody>
</table>
</table> */}
<div className="payBox">
<div>
<div className="payTitle"></div>
<div style={{
marginTop: '10px',
}}>
<Button type="link"
onClick={() => {
setIsInvoiceInfoListOpen(true);
}}></Button>
</div>
<div className="payRow">
<div className="payRowL">
<div className="payName"><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="invoiceTitle"
rules={[{ required: true, message: '请输入公司名称' }]}
>
<Input style={{
width: '300px'
}} placeholder="请输入公司名称" />
</Form.Item>
</div>
<div className="payRowR">
<div className="payName"><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="invoiceNo"
rules={[{ required: true, message: '请输入纳税人识别号' }]}
>
<Input
style={{
width: '300px'
}}
placeholder="请输入纳税人识别号" />
</Form.Item>
</div>
</div>
<div className="payRow">
<div className="payRowL">
<div className="payName"><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="invoiceAddress"
rules={[{ required: true, message: '请输入公司地址' }]}
>
<Input
style={{
width: '300px'
}}
placeholder="请输入公司地址" />
</Form.Item>
</div>
<div className="payRowR">
<div className="payName"><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="invoicePhone"
rules={[{ required: true, message: '请输入联系电话' }]}
>
<Input
style={{
width: '300px'
}}
placeholder="请输入联系电话" />
</Form.Item>
</div>
</div>
<div className="payRow">
<div className="payRowL">
<div className="payName"><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="invoiceAccount"
rules={[{ required: true, message: '请输入开户行' }]}
>
<Input
style={{
width: '300px'
}}
placeholder="请输入开户行" />
</Form.Item>
</div>
<div className="payRowR">
<div className="payName"><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="invoiceBank"
rules={[{ required: true, message: '请输入开户行账号' }]}
>
<Input
style={{
width: '300px'
}}
placeholder="请输入开户行账号" />
</Form.Item>
</div>
</div>
<div className="payRow" >
<div className="payRowL">
<div className="payName"><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="content"
rules={[{ required: true, message: '请选择开票内容' }]}
>
<Radio.Group>
<div style={{
width: '300px',
}}>
{contentArray.map(item => <Radio value={item.dataName}
key={item.dataId}>{item.dataName}</Radio>)}
</div>
</Radio.Group>
</Form.Item>
</div>
<div className="payRowR">
<div className="payName"><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="rate"
rules={[{ required: true, message: '请选择开票税率' }]}
>
<Radio.Group>
<div style={{
width: '300px',
}}>
{rateArray.map(item => <Radio value={item.dataName}
key={item.dataId}>{item.dataName}</Radio>)}
</div>
</Radio.Group>
</Form.Item>
</div>
</div>
<div className="payRow" style={{
}}>
<div className="payRowL">
<div className="payName"><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="type"
rules={[{ required: true, message: '请选择发票类型' }]}
>
<Radio.Group>
<div style={{
width: '300px',
}}>
{typeArray.map(item => <Radio value={item.dataName}
key={item.dataId}>{item.dataName}</Radio>)}
</div>
</Radio.Group>
</Form.Item>
</div>
<div className="payRowR">
<div className="payName"><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="isSaveInvoiceInfo"
>
<Radio.Group>
<div style={{
width: '300px',
}}>
<Radio value={0}></Radio>
<Radio value={1}></Radio>
</div>
</Radio.Group>
</Form.Item>
</div>
</div>
</div>
<div>
<div className="payTitle"></div>
<div style={{
marginTop: '10px',
}}>
<div style={{
display: 'flex',
}}>
<div className="payName" style={{
marginTop: '2px',
}}><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="orderIds"
rules={[{ required: true, message: '请选择开票金额' }]}
>
<div>
<span></span>
<span style={{ fontSize: '20px', fontWeight: 'bold' }}>{orderAmount}</span>
<Button type="link" size="small" onClick={() => {
setIsInvoiceOrderListOpen(true);
}}></Button>
</div>
</Form.Item>
</div>
<div style={{
display: 'flex',
}}>
<div className="payName" style={{
marginTop: '2px',
}}></div>
<Form.Item
name="invoiceNote"
>
<Input.TextArea placeholder="请输入开票备注"
style={{ resize: 'none',
width: '820px',
height: '100px',
}}
/>
</Form.Item>
</div>
</div>
</div>
</div>
<Form.Item style={{marginBottom: '0'}}>
<Flex justify="center" style={{marginTop: '15px'}}>
<Space>
@ -306,6 +528,7 @@ export default function InvoiceEdit(props: EditProps) {
title="开票信息"
width={1000}
footer={false}
destroyOnClose
onCancel={() => setIsInvoiceInfoListOpen(false)}
>
<InvoiceInfoList

View File

@ -1,8 +1,12 @@
import {Button, Dropdown, Flex, MenuProps, Modal, Popconfirm, Space, Table, TableProps, Tag} from "antd";
import {PlusOutlined} from "@ant-design/icons";
import {useEffect, useRef, useState} from "react";
import {get, put} from "../../util/AjaxUtils.ts";
import {IListPage} from "../../interfaces/listpage/IListPage.ts";
import { Button, Dropdown, Flex, MenuProps, Modal, Popconfirm, Space, Table, TableProps, Tag } from "antd";
import { PlusOutlined } from "@ant-design/icons";
import {
useEffect,
// useRef,
useState
} from "react";
import { get, put } from "../../util/AjaxUtils.ts";
import { IListPage } from "../../interfaces/listpage/IListPage.ts";
import useMessage from "antd/es/message/useMessage";
import InvoiceSave from "./InvoiceSave.tsx";
import InvoiceEdit from "./InvoiceEdit.tsx";
@ -44,8 +48,9 @@ export default function InvoiceList() {
const [isSaveModalOpen, setIsSaveModalOpen] = useState(false);
const [isEditModalOpen, setIsEditModalOpen] = useState(false);
const [isShowModalOpen, setIsShowModalOpen] = useState(false);
const invoiceId = useRef('');
// const invoiceId = useRef('');
const [invoiceId, setInvoiceId] = useState('');
// const [invdataArray,setInvDataArray] = useState<any[]>([]);
const columns: TableProps<DataType>['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 <Tag color="magenta"></Tag>
}
if(value === InvoiceStatusEnum.COMPLETE) {
if (value === InvoiceStatusEnum.COMPLETE) {
return <Tag color="green"></Tag>
}
if(value === InvoiceStatusEnum.FAILED) {
if (value === InvoiceStatusEnum.FAILED) {
return <Tag color="red"></Tag>
}
if(value === InvoiceStatusEnum.CANCEL) {
if (value === InvoiceStatusEnum.CANCEL) {
return <Tag color="cyan"></Tag>
}
}
@ -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 <Flex justify="center">
<Space>
<Button type="link" style={{
color: 'var(--color-dark)',
padding: '0'
}} onClick={() => {
invoiceId.current = record.invoiceId;
// invoiceId.current = record.invoiceId;
// console.log(record.invoiceId);
setInvoiceId(record.invoiceId);
setIsShowModalOpen(true);
}}></Button>
<Popconfirm
@ -172,15 +179,17 @@ export default function InvoiceList() {
</Space>
</Flex>
}
if(record.invoiceStatus === InvoiceStatusEnum.CANCEL) {
if (record.invoiceStatus === InvoiceStatusEnum.CANCEL) {
return <Button type="link" style={{
padding: '0'
}} onClick={() => {
invoiceId.current = record.invoiceId;
// invoiceId.current = record.invoiceId;
console.log(record.invoiceId);
setInvoiceId(record.invoiceId);
setIsEditModalOpen(true);
}}></Button>
}
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() {
<>
<div className="invoice-list-container">
<div className="mod-list">
<div className="table-btn-group" style={{marginBottom: '15px'}}>
<div className="table-btn-group" style={{ marginBottom: '15px' }}>
<Button value="small" onClick={() => {
setIsSaveModalOpen(true);
}}><PlusOutlined/> </Button>
}}><PlusOutlined /> </Button>
</div>
<Table columns={columns} dataSource={dataArray} pagination={
{
pageSize: 20,
total: total,
onChange: (currentPage) => {
setPage(currentPage);
setPage(currentPage);
},
}
} scroll={{y: 500}} bordered key="dataTable" rowKey="invoiceId"/>
} scroll={{ y: 500 }} bordered key="dataTable" rowKey="invoiceId" />
</div>
</div>
<Modal open={isSaveModalOpen}
title="申请开票"
footer={false}
onCancel={() => setIsSaveModalOpen(false)}
centered
title="申请开票"
footer={false}
onCancel={() => setIsSaveModalOpen(false)}
width={1000}
destroyOnClose
>
<InvoiceSave
handleOk={() => {
@ -258,12 +271,16 @@ export default function InvoiceList() {
/>
</Modal>
<Modal open={isEditModalOpen}
title="修改开票信息"
footer={false}
onCancel={() => setIsEditModalOpen(false)}
centered
width={1000}
title="修改开票信息"
footer={false}
onCancel={() => setIsEditModalOpen(false)}
destroyOnClose
>
<InvoiceEdit
invoiceId={invoiceId.current}
invoiceId={invoiceId}
// invdataArray={invdataArray}
handleOk={() => {
getData();
setIsEditModalOpen(false);
@ -274,12 +291,15 @@ export default function InvoiceList() {
/>
</Modal>
<Modal open={isShowModalOpen}
title="查看开票信息"
footer={false}
onCancel={() => setIsShowModalOpen(false)}
destroyOnClose
title="查看开票信息"
footer={false}
onCancel={() => setIsShowModalOpen(false)}
centered
>
{/* {invoiceId.current} */}
<InvoiceShow
invoiceId={invoiceId.current}
invoiceId={invoiceId}
/>
</Modal>
{messageContext}

View File

@ -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;
}

View File

@ -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}
<Form
name="basic"
initialValues={{isSaveInvoiceInfo: 0}}
initialValues={{ isSaveInvoiceInfo: 0 }}
form={form}
onFinish={(values) => {
modal.confirm({
title: '提示',
content: '确定提交吗?',
okText: '确定',
cancelText: '取消',
centered: true,
okButtonProps: {
style: {
backgroundColor: 'val(--color-primary)'
@ -85,199 +87,419 @@ export default function InvoiceSave(props: SaveProps) {
});
}}
>
<Divider orientation="left" plain></Divider>
{/* <Divider orientation="left" plain></Divider>
<table className="pay-table">
<colgroup>
<col width="120"/>
<col/>
<col width="120" />
<col />
</colgroup>
<tbody>
<tr>
<td colSpan={2}>
<Button type="link" onClick={() => {
setIsInvoiceInfoListOpen(true);
}}></Button>
</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="invoiceTitle"
style={{marginBottom: '0'}}
rules={[{required: true, message: '请输入公司名称'}]}
>
<Input placeholder="请输入公司名称"/>
</Form.Item>
</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="invoiceNo"
style={{marginBottom: '0'}}
rules={[{required: true, message: '请输入纳税人识别号'}]}
>
<Input placeholder="请输入纳税人识别号"/>
</Form.Item>
</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="invoiceAddress"
style={{marginBottom: '0'}}
rules={[{required: true, message: '请输入公司地址'}]}
>
<Input placeholder="请输入公司地址"/>
</Form.Item>
</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="invoicePhone"
style={{marginBottom: '0'}}
rules={[{required: true, message: '请输入联系电话'}]}
>
<Input placeholder="请输入联系电话"/>
</Form.Item>
</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="invoiceAccount"
style={{marginBottom: '0'}}
rules={[{required: true, message: '请输入开户行'}]}
>
<Input placeholder="请输入开户行"/>
</Form.Item>
</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="invoiceBank"
style={{marginBottom: '0'}}
rules={[{required: true, message: '请输入开户行账号'}]}
>
<Input placeholder="请输入开户行账号"/>
</Form.Item>
</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="content"
style={{marginBottom: '0'}}
rules={[{required: true, message: '请选择开票内容'}]}
>
<Radio.Group>
<Space direction="vertical">
{contentArray.map(item => <Radio value={item.dataName}
key={item.dataId}>{item.dataName}</Radio>)}
</Space>
</Radio.Group>
</Form.Item>
</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="rate"
style={{marginBottom: '0'}}
rules={[{required: true, message: '请选择开票税率'}]}
>
<Radio.Group>
{rateArray.map(item => <Radio value={item.dataName}
key={item.dataId}>{item.dataName}</Radio>)}
</Radio.Group>
</Form.Item>
</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="type"
style={{marginBottom: '0'}}
rules={[{required: true, message: '请选择发票类型'}]}
>
<Radio.Group>
<Space direction="vertical">
{typeArray.map(item => <Radio value={item.dataName}
key={item.dataId}>{item.dataName}</Radio>)}
</Space>
</Radio.Group>
</Form.Item>
</td>
</tr>
<tr>
<td colSpan={2}>
<Button type="link" onClick={() => {
setIsInvoiceInfoListOpen(true);
}}></Button>
</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="invoiceTitle"
style={{ marginBottom: '0' }}
rules={[{ required: true, message: '请输入公司名称' }]}
>
<Input placeholder="请输入公司名称" />
</Form.Item>
</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="invoiceNo"
style={{ marginBottom: '0' }}
rules={[{ required: true, message: '请输入纳税人识别号' }]}
>
<Input placeholder="请输入纳税人识别号" />
</Form.Item>
</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="invoiceAddress"
style={{ marginBottom: '0' }}
rules={[{ required: true, message: '请输入公司地址' }]}
>
<Input placeholder="请输入公司地址" />
</Form.Item>
</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="invoicePhone"
style={{ marginBottom: '0' }}
rules={[{ required: true, message: '请输入联系电话' }]}
>
<Input placeholder="请输入联系电话" />
</Form.Item>
</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="invoiceAccount"
style={{ marginBottom: '0' }}
rules={[{ required: true, message: '请输入开户行' }]}
>
<Input placeholder="请输入开户行" />
</Form.Item>
</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="invoiceBank"
style={{ marginBottom: '0' }}
rules={[{ required: true, message: '请输入开户行账号' }]}
>
<Input placeholder="请输入开户行账号" />
</Form.Item>
</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="content"
style={{ marginBottom: '0' }}
rules={[{ required: true, message: '请选择开票内容' }]}
>
<Radio.Group>
<Space direction="vertical">
{contentArray.map(item => <Radio value={item.dataName}
key={item.dataId}>{item.dataName}</Radio>)}
</Space>
</Radio.Group>
</Form.Item>
</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="rate"
style={{ marginBottom: '0' }}
rules={[{ required: true, message: '请选择开票税率' }]}
>
<Radio.Group>
{rateArray.map(item => <Radio value={item.dataName}
key={item.dataId}>{item.dataName}</Radio>)}
</Radio.Group>
</Form.Item>
</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="type"
style={{ marginBottom: '0' }}
rules={[{ required: true, message: '请选择发票类型' }]}
>
<Radio.Group>
<Space direction="vertical">
{typeArray.map(item => <Radio value={item.dataName}
key={item.dataId}>{item.dataName}</Radio>)}
</Space>
</Radio.Group>
</Form.Item>
</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="isSaveInvoiceInfo"
style={{marginBottom: '0'}}
>
<Radio.Group>
<Radio value={0}></Radio>
<Radio value={1}></Radio>
</Radio.Group>
</Form.Item>
</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="isSaveInvoiceInfo"
style={{ marginBottom: '0' }}
>
<Radio.Group>
<Radio value={0}></Radio>
<Radio value={1}></Radio>
</Radio.Group>
</Form.Item>
</td>
</tr>
</tbody>
</table>
<Divider orientation="left" plain></Divider>
<table className="pay-table">
<colgroup>
<col width="120"/>
<col/>
<col width="120" />
<col />
</colgroup>
<tbody>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="orderIds"
style={{marginBottom: '0'}}
rules={[{required: true, message: '请选择开票金额'}]}
>
<div>
<span></span>
<span style={{fontSize: '20px', fontWeight: 'bold'}}>{orderAmount}</span>
<Button type="link" size="small" onClick={() => {
setIsInvoiceOrderListOpen(true);
}}></Button>
</div>
</Form.Item>
</td>
</tr>
<tr>
<td className="table-label"></td>
<td>
<Form.Item
name="invoiceNote"
style={{marginBottom: '0'}}
>
<Input.TextArea placeholder="请输入开票备注" rows={4}/>
</Form.Item>
</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<Form.Item
name="orderIds"
style={{ marginBottom: '0' }}
rules={[{ required: true, message: '请选择开票金额' }]}
>
<div>
<span></span>
<span style={{ fontSize: '20px', fontWeight: 'bold' }}>{orderAmount}</span>
<Button type="link" size="small" onClick={() => {
setIsInvoiceOrderListOpen(true);
}}></Button>
</div>
</Form.Item>
</td>
</tr>
<tr>
<td className="table-label"></td>
<td>
<Form.Item
name="invoiceNote"
style={{ marginBottom: '0' }}
>
<Input.TextArea placeholder="请输入开票备注" rows={4} />
</Form.Item>
</td>
</tr>
</tbody>
</table>
<Form.Item style={{marginBottom: '0'}}>
<Flex justify="center" style={{marginTop: '15px'}}>
</table> */}
<div className="payBox">
<div>
<div className="payTitle"></div>
<div style={{
marginTop: '10px',
}}>
<Button type="link"
onClick={() => {
setIsInvoiceInfoListOpen(true);
}}></Button>
</div>
<div className="payRow">
<div className="payRowL">
<div className="payName"><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="invoiceTitle"
rules={[{ required: true, message: '请输入公司名称' }]}
>
<Input style={{
width: '300px'
}} placeholder="请输入公司名称" />
</Form.Item>
</div>
<div className="payRowR">
<div className="payName"><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="invoiceNo"
rules={[{ required: true, message: '请输入纳税人识别号' }]}
>
<Input
style={{
width: '300px'
}}
placeholder="请输入纳税人识别号" />
</Form.Item>
</div>
</div>
<div className="payRow">
<div className="payRowL">
<div className="payName"><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="invoiceAddress"
rules={[{ required: true, message: '请输入公司地址' }]}
>
<Input
style={{
width: '300px'
}}
placeholder="请输入公司地址" />
</Form.Item>
</div>
<div className="payRowR">
<div className="payName"><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="invoicePhone"
rules={[{ required: true, message: '请输入联系电话' }]}
>
<Input
style={{
width: '300px'
}}
placeholder="请输入联系电话" />
</Form.Item>
</div>
</div>
<div className="payRow">
<div className="payRowL">
<div className="payName"><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="invoiceAccount"
rules={[{ required: true, message: '请输入开户行' }]}
>
<Input
style={{
width: '300px'
}}
placeholder="请输入开户行" />
</Form.Item>
</div>
<div className="payRowR">
<div className="payName"><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="invoiceBank"
rules={[{ required: true, message: '请输入开户行账号' }]}
>
<Input
style={{
width: '300px'
}}
placeholder="请输入开户行账号" />
</Form.Item>
</div>
</div>
<div className="payRow" >
<div className="payRowL">
<div className="payName"><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="content"
rules={[{ required: true, message: '请选择开票内容' }]}
>
<Radio.Group>
<div style={{
width: '300px',
}}>
{contentArray.map(item => <Radio value={item.dataName}
key={item.dataId}>{item.dataName}</Radio>)}
</div>
</Radio.Group>
</Form.Item>
</div>
<div className="payRowR">
<div className="payName"><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="rate"
rules={[{ required: true, message: '请选择开票税率' }]}
>
<Radio.Group>
<div style={{
width: '300px',
}}>
{rateArray.map(item => <Radio value={item.dataName}
key={item.dataId}>{item.dataName}</Radio>)}
</div>
</Radio.Group>
</Form.Item>
</div>
</div>
<div className="payRow" style={{
}}>
<div className="payRowL">
<div className="payName"><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="type"
rules={[{ required: true, message: '请选择发票类型' }]}
>
<Radio.Group>
<div style={{
width: '300px',
}}>
{typeArray.map(item => <Radio value={item.dataName}
key={item.dataId}>{item.dataName}</Radio>)}
</div>
</Radio.Group>
</Form.Item>
</div>
<div className="payRowR">
<div className="payName"><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="isSaveInvoiceInfo"
>
<Radio.Group>
<div style={{
width: '300px',
}}>
<Radio value={0}></Radio>
<Radio value={1}></Radio>
</div>
</Radio.Group>
</Form.Item>
</div>
</div>
</div>
<div>
<div className="payTitle"></div>
<div style={{
marginTop: '10px',
}}>
<div style={{
display: 'flex',
}}>
<div className="payName" style={{
marginTop: '2px',
}}><span style={{ color: 'red' }}>*</span></div>
<Form.Item
name="orderIds"
rules={[{ required: true, message: '请选择开票金额' }]}
>
<div>
<span></span>
<span style={{ fontSize: '20px', fontWeight: 'bold' }}>{orderAmount}</span>
<Button type="link" size="small" onClick={() => {
setIsInvoiceOrderListOpen(true);
}}></Button>
</div>
</Form.Item>
</div>
<div style={{
display: 'flex',
}}>
<div className="payName" style={{
marginTop: '2px',
}}></div>
<Form.Item
name="invoiceNote"
>
<Input.TextArea placeholder="请输入开票备注"
style={{
resize: 'none',
width: '820px',
height: '100px',
}}
/>
</Form.Item>
</div>
</div>
</div>
</div>
<Form.Item style={{ marginBottom: '0' }}>
<Flex justify="center" style={{ marginTop: '15px' }}>
<Space>
<Button type="primary" htmlType="submit" style={{
backgroundColor: 'var(--color-primary)'
@ -290,12 +512,14 @@ export default function InvoiceSave(props: SaveProps) {
</Form.Item>
</Form>
<Modal open={isInvoiceInfoListOpen}
title="开票信息"
width={1000}
footer={false}
onCancel={() => {
setIsInvoiceInfoListOpen(false);
}}
destroyOnClose
centered
title="开票信息"
width={1000}
footer={false}
onCancel={() => {
setIsInvoiceInfoListOpen(false);
}}
>
<InvoiceInfoList
handleOk={(selectedInvoice) => {
@ -315,10 +539,10 @@ export default function InvoiceSave(props: SaveProps) {
/>
</Modal>
<Modal open={isInvoiceOrderListOpen}
title="开票订单"
width={1000}
footer={false}
onCancel={() => setIsInvoiceOrderListOpen(false)}
title="开票订单"
width={1000}
footer={false}
onCancel={() => setIsInvoiceOrderListOpen(false)}
>
<InvoiceOrderList
handleOk={(selectedOrders) => {

View File

@ -1,6 +1,6 @@
import {Button, Divider, Modal} from "antd";
import {useEffect, useState} from "react";
import {get} from "../../util/AjaxUtils.ts";
import { Button, Divider, Modal } from "antd";
import { useEffect, useState } from "react";
import { get } from "../../util/AjaxUtils.ts";
import useMessage from "antd/es/message/useMessage";
import InvoiceInfoSelectedList from "./order/InvoiceOrderSelectedList.tsx"
@ -31,19 +31,22 @@ export default function InvoiceShow(props: ShowProps) {
const [orderAmount, setOrderAmount] = useState('0');
useEffect(() => {
if (!props.invoiceId) {
return;
}
get<DataType>({
messageApi,
url: `/api/invoice/get/${props.invoiceId}`,
onSuccess({data}) {
onSuccess({ data }) {
setInvoiceData({
...data
});
setOrderAmount((data.invoiceAmount / 100).toFixed(2));
}
})
}, []);
return (
@ -52,80 +55,81 @@ export default function InvoiceShow(props: ShowProps) {
<Divider orientation="left" plain></Divider>
<table className="pay-table">
<colgroup>
<col width="120"/>
<col/>
<col width="120" />
<col />
</colgroup>
<tbody>
<tr>
<td className="table-label"> *</td>
<td>{invoiceData?.invoiceTitle}</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>{invoiceData?.invoiceNo}</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>{invoiceData?.invoiceAddress}</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>{invoiceData?.invoicePhone}</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>{invoiceData?.invoiceAccount}</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>{invoiceData?.invoiceBank}</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>{invoiceData?.content}</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>{invoiceData?.rate}</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>{invoiceData?.type}</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>{invoiceData?.invoiceTitle}</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>{invoiceData?.invoiceNo}</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>{invoiceData?.invoiceAddress}</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>{invoiceData?.invoicePhone}</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>{invoiceData?.invoiceAccount}</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>{invoiceData?.invoiceBank}</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>{invoiceData?.content}</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>{invoiceData?.rate}</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>{invoiceData?.type}</td>
</tr>
</tbody>
</table>
<Divider orientation="left" plain></Divider>
<table className="pay-table">
<colgroup>
<col width="120"/>
<col/>
<col width="120" />
<col />
</colgroup>
<tbody>
<tr>
<td className="table-label"> *</td>
<td>
<div>
<span></span>
<span style={{fontSize: '20px', fontWeight: 'bold'}}>{orderAmount}</span>
<Button type="link" size="small" onClick={() => {
setIsInvoiceOrderListOpen(true);
}}></Button>
</div>
</td>
</tr>
<tr>
<td className="table-label"></td>
<td>{invoiceData?.invoiceNote}</td>
</tr>
<tr>
<td className="table-label"> *</td>
<td>
<div>
<span></span>
<span style={{ fontSize: '20px', fontWeight: 'bold' }}>{orderAmount}</span>
<Button type="link" size="small" onClick={() => {
setIsInvoiceOrderListOpen(true);
}}></Button>
</div>
</td>
</tr>
<tr>
<td className="table-label"></td>
<td>{invoiceData?.invoiceNote}</td>
</tr>
</tbody>
</table>
<Modal open={isInvoiceOrderListOpen}
title="开票订单"
width={1000}
footer={false}
onCancel={() => setIsInvoiceOrderListOpen(false)}
centered
title="开票订单"
width={1000}
footer={false}
onCancel={() => setIsInvoiceOrderListOpen(false)}
>
<InvoiceInfoSelectedList invoiceId={props.invoiceId}/>
<InvoiceInfoSelectedList invoiceId={props.invoiceId} />
</Modal>
</>
);

View File

@ -1,22 +1,23 @@
import {Table, TableProps, Tooltip} from "antd";
import {Table, TableProps,
Tooltip} from "antd";
import useMessage from "antd/es/message/useMessage";
import {useEffect, useState} from "react";
import {get} from "../../../util/AjaxUtils.ts";
import {IListPage} from "../../../interfaces/listpage/IListPage.ts";
type DetailDataType = {
productType: string;
quantity: number;
unitPrice: number;
notes: string;
productDescription: string;
}
// type DetailDataType = {
// productType: string;
// quantity: number;
// unitPrice: number;
// notes: string;
// productDescription: string;
// }
type DataType = {
orderId: string;
orderNo: string;
totalAmount: number;
detail: DetailDataType;
orderDetails: any;
orderStatus: string;
gmtCreate: string;
}
@ -71,60 +72,60 @@ export default function InvoiceInfoSelectedList(props: ListProps) {
},
{
title: '产品类型',
dataIndex: 'detail.productType',
dataIndex: 'orderDetails.0.productType',
align: 'center',
width: 100,
render: (_value, record) => {
if(record.detail.productType === 'PROJ') {
if(record.orderDetails[0].productType === 'PROJ') {
return '项目创建'
}
if(record.detail.productType === 'AGENT') {
if(record.orderDetails[0].productType === 'AGENT') {
return '项目代理'
}
return record.detail.productType
return record.orderDetails[0].productType
}
},
{
title: '数量',
dataIndex: 'detail.quantity',
dataIndex: 'orderDetails.0.quantity',
align: 'center',
width: 100,
render: (_value, record) => {
return record.detail.quantity
return record.orderDetails[0].quantity
}
},
{
title: '单价',
dataIndex: 'detail.unitPrice',
dataIndex: 'orderDetails.0.unitPrice',
align: 'center',
width: 100,
render: (_value, record) => {
return (record.detail.unitPrice / 100).toFixed(2)
return (record.orderDetails[0].unitPrice / 100).toFixed(2)
}
},
{
title: '订单备注',
dataIndex: 'detail.notes',
dataIndex: 'orderDetails.0.notes',
align: 'center',
width: 120,
render: (_value, record) => {
return record.detail.notes
return record.orderDetails[0].notes
}
},
{
title: '描述',
dataIndex: 'detail.productDescription',
dataIndex: 'orderDetails.0.productDescription',
align: 'center',
width: 200,
ellipsis: {
showTitle: false,
},
render: (_value, record) => {
return <Tooltip placement="top" title={record.detail.productDescription}>{record.detail.productDescription}</Tooltip>
return <Tooltip placement="top" title={record.orderDetails[0].productDescription}>{record.orderDetails[0].productDescription}</Tooltip>
}
},
]
// const columns = []
useEffect(() => {
get<IListPage<DataType>>({
messageApi,

View File

@ -254,7 +254,7 @@ export default function UserEdit(props: IUserEditProps) {
<Input placeholder="请输入名称" />
</Form.Item>
</Col>
<Col span={12}>
{/* <Col span={12}>
<Form.Item label="公司英文名"
name="userInfoNameEn"
rules={[
@ -267,7 +267,7 @@ export default function UserEdit(props: IUserEditProps) {
>
<Input placeholder="请输入公司英文名" />
</Form.Item>
</Col>
</Col> */}
</Row>
<Row gutter={15}>
<Col span={12}>

View File

@ -20,6 +20,7 @@ export function reloadUser(messageApi: MessageInstance, globalDispatchContext: D
messageApi,
url: '/api/user-info/get-user-self',
onSuccess({data}) {
globalDispatchContext({
type: GlobalDataActionType.REFRESH_SELF,
user: {
@ -30,6 +31,15 @@ export function reloadUser(messageApi: MessageInstance, globalDispatchContext: D
hasUserInfo: data.hasUserInfo,
}
})
// localStorage.setItem('token', data.accessToken);
// 获取内存中的token
// const currentToken = sessionStorage.getItem('token');
// // 检查内存中的token与获取的token是否一致
// if (currentToken!== data.accessToken) {
// sessionStorage.setItem('token', data.accessToken);
// }
// console.log('用户信息',data);
resolve(data);
}
})

View File

@ -108,6 +108,7 @@ import {
// post,
getUseUrl
} from "../../util/AjaxUtils.ts";
import { getLoginflag } from '../../request/api'
import { GlobalContext, GlobalDispatchContext, reloadUser } from "../../context/GlobalContext.ts";
import UserEdit from "../../components/user/UserEdit.tsx";
import PasswordChange from "../../components/password/PasswordChange.tsx";
@ -844,12 +845,33 @@ export default function Head() {
}
})
}
useEffect(() => {
getUnRead()
// 五分钟刷新一次用户信息
setInterval(reloadUserInterval, 5 * 60 * 1000);
getMyPackNum()
}, [])
}, [])
const loginFlag = async() => {
// await getLoginflag(globalContext.user.userId)
await getLoginflag(globalContext.user.userId);
sessionStorage.setItem('isLoggedIn', 'true');
}
useEffect(() => {
if (globalContext.user.userId) {
const islogin = sessionStorage.getItem('isLoggedIn');
if (!islogin ) {
loginFlag()
}
// loginFlag()
}
// loginFlag()
}, [globalContext.user.userId])
const items: MenuProps['items'] = [
{
@ -968,7 +990,8 @@ export default function Head() {
),
onClick: () => {
reMenuActive()
// 清除缓存
sessionStorage.clear()
window.location.href = '/copyright/logout'
}
},
@ -1066,31 +1089,31 @@ export default function Head() {
<div style={{
display: 'flex',
alignItems: 'center',
justifyContent:'center',
justifyContent: 'center',
cursor: 'pointer',
}}
onClick={() => {
setPackageModal(true)
setPackPage(1);
getPickList(1, '')
}}
onClick={() => {
setPackageModal(true)
setPackPage(1);
getPickList(1, '')
}}
>
<img src={pack} width={19} height={19} alt="" />
<div style={{
fontSize:14,
marginLeft:5
fontSize: 14,
marginLeft: 5
}}></div>
</div>
<div style={{
display: 'flex',
alignItems: 'center',
marginTop:5
marginTop: 5
}}>
<div>
<span style={{
fontSize: 12,
color: '#FF9F08',
}}> </span>
<span
style={{
@ -1099,31 +1122,31 @@ export default function Head() {
fontWeight: 700,
}}
>{packNum.ALL}</span>
<span style={{
<span style={{
fontSize: 12,
color: '#FF9F08',
}}> </span>
</div>
<div style={{
marginLeft:15
marginLeft: 15
}}>
<span style={{
fontSize: 12,
color: '#FF9F08',
}}> </span>
<span
style={{
fontSize: 16,
color: '#FF9F08',
fontWeight: 700,
}}
style={{
fontSize: 16,
color: '#FF9F08',
fontWeight: 700,
}}
>{packNum.MATERIAL}</span>
<span style={{
fontSize: 12,
color: '#FF9F08',
}}> </span>
</div>
</div>

4
src/request/api.ts Normal file
View File

@ -0,0 +1,4 @@
import request from './request'
// 获取登录标志
export const getLoginflag = (userId:string) => request.get(`/operator-plugin/app/contentcensusrelease/log?requestUrl=网页USER${userId}`)

27
src/request/request.ts Normal file
View File

@ -0,0 +1,27 @@
import axios from "axios";
const baseURL = 'https://www.aimzhu.com';
const request = axios.create({
baseURL: baseURL,
timeout: 5000,
});
request.interceptors.request.use(
(config) => {
// 有token带token
const token = sessionStorage.getItem('token')
config.headers = config.headers || {}
config.headers['Auth'] = token ? `Bearer ${token}` : '';
return config;
},
(err) => Promise.reject(err)
);
request.interceptors.response.use(
(res) => {
return res.data;
},
(err) => Promise.reject(err)
);
export default request

View File

@ -311,6 +311,10 @@ export default function ProjCreate() {
id: ProjChargeType.FREE,
price: freeInfo.price,
handleClick: (_title, additional) => {
if(freeCount <= 0){
messageApi.warning('免费试用次数已用完')
return
}
nav(`/proj-new/${ProjChargeType.FREE}?${additional.pkg ? 'pkg=true' : 'pkg='}&${additional.videoDemo ? 'videoDemo=true' : 'videoDemo='}`)
}
}

View File

@ -44,7 +44,7 @@ interface DataType {
packageOrderId: string;
}
import { useDispatch } from 'react-redux'
import { useDispatch,useSelector } from 'react-redux'
export default function ProjNew() {
const dispath = useDispatch()
// 更新redux的套餐包信息
@ -69,6 +69,10 @@ export default function ProjNew() {
}
})
}
const redxuState: any = useSelector(state => state)
// const [packageType, setPackageType] = useState('')
const packNum = redxuState.packNum
const [packselectShow, setPackselectShow] = useState(false)
const [debounceTimer, setDebounceTimer] = useState<any>(null);
// 创建一个 ref 来引用推荐列表容器
const recommendListRef = useRef<HTMLDivElement>(null);
@ -196,9 +200,11 @@ export default function ProjNew() {
authorType: '',
authorIdCardType: '',
authorIdCard: '',
authorCrcAccount: '',
authorCrcAccount: 0,
authorId: '',
authorProvinceCity: ''
authorProvinceCity: '',
authorCrcAccountPassword: '',
authorCrcAccountUsername: ''
})
const [concatPeopleInfo, setConcatPeopleInfo] = useState({
applyConcatId: '',
@ -380,6 +386,15 @@ export default function ProjNew() {
// setPage(1)
// }
// },[projInfo.packageInfoId])
useEffect(() => {
if(packNum.ALL > 0 && pathParams.projChargeType == 'ALL'){
setPackselectShow(true)
}
if(packNum.MATERIAL > 0 && pathParams.projChargeType == 'MATERIAL'){
setPackselectShow(true)
}
}, [packNum]);
useEffect(() => {
get({
messageApi: messageApi,
@ -638,7 +653,7 @@ export default function ProjNew() {
</Form.Item>
<div style={{
display:belongPeopleInfo.authorId? 'none' : 'unset',
display: belongPeopleInfo.authorId ? 'none' : 'unset',
position: 'absolute', right: 20,
// fontSize: 16,
color: " #1F79FF", cursor: 'pointer',
@ -649,7 +664,7 @@ export default function ProjNew() {
setBelongModal(true)
}}></div>
<div style={{
display:belongPeopleInfo.authorId? 'unset' : 'none',
display: belongPeopleInfo.authorId ? 'unset' : 'none',
position: 'absolute', right: 0,
// fontSize: 16,
@ -665,9 +680,11 @@ export default function ProjNew() {
authorType: '',
authorIdCardType: '',
authorIdCard: '',
authorCrcAccount: '',
authorCrcAccount: 0,
authorId: '',
authorProvinceCity: ''
authorProvinceCity: '',
authorCrcAccountUsername: '',
authorCrcAccountPassword: '',
})
}}></div>
</div>
@ -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
/>
</Form.Item>
<div style={{
position: 'absolute',
// left: 165,
left: 158,
top: 40,
// display: showTip ? 'unset' : 'none',
color: 'red',
fontSize: 18,
fontWeight: 'bold',
}}></div>
<div
style={{
display: selectPack ? 'none' : 'unset', position: 'absolute', right: 23,
// fontSize: 16,
color: packList.length ? '#1F79FF' : '#676767', cursor: 'pointer',
// color: packList.length ? '#1F79FF' : '#676767', cursor: 'pointer',
color: packselectShow ? '#1F79FF' : '#676767', cursor: 'pointer',
// background:'pink',
width: 290,
textAlign: 'right',
@ -852,7 +883,7 @@ export default function ProjNew() {
onClick={() => {
if (packList.length > 0) {
setPackModal(true)
// setPage(1)
setPage(1)
setSelectedRowKeys([])
getPickList(1)
// #1F79FF
@ -861,9 +892,13 @@ export default function ProjNew() {
}
}}></div>
<div style={{ display: selectPack ? 'unset' : 'none', position: 'absolute', right: 23, fontSize: 16, color: '#1F79FF', cursor: 'pointer' }} onClick={() => {
<div style={{ display: selectPack ? 'unset' : 'none', position: 'absolute', right: 23, color: '#1F79FF', cursor: 'pointer' }} onClick={() => {
// setPackageInfoId('')
setPackageOrderId('')
setNowpackageOrderId('')
setNowPackageName ('')
form.setFieldsValue({
packageName: ''
})
@ -1013,7 +1048,7 @@ export default function ProjNew() {
// background:'pink',
lineHeight: '40px'
}}> :
}}>
<span
style={{
color: 'red',
@ -1091,6 +1126,8 @@ export default function ProjNew() {
// dayjs(formInfo.getFieldValue('projDevCompleteDate')).format(dateFormat),
projDevCompleteDate: projInfo.projDevCompleteDate ? dayjs(projInfo.projDevCompleteDate).format(dateFormat) : '',
authorCrcAccount: belongPeopleInfo.authorCrcAccount,
authorCrcAccountPassword: belongPeopleInfo.authorCrcAccountPassword,
authorCrcAccountUsername: belongPeopleInfo.authorCrcAccountUsername,
authorId: belongPeopleInfo.authorId,
authorIdCard: belongPeopleInfo.authorIdCard,
authorIdCardType: belongPeopleInfo.authorIdCardType,
@ -1104,7 +1141,6 @@ export default function ProjNew() {
applyContactId: concatPeopleInfo.applyConcatId,
applyContactName: concatPeopleInfo.applyContactName,
applyContactPhone: concatPeopleInfo.applyContactPhone,
couponId: couponId ? couponId : '',
// packageInfoId: packageInfoId ? packageInfoId : ''
packageOrderId: packageOrderId ? packageOrderId : '',
@ -1309,6 +1345,10 @@ export default function ProjNew() {
}}
type="primary"
onClick={() => {
if (!nowPackageName) {
messageApi.error('请选择套餐包')
return
}
// setPickSelectNo(nowPickSelectNo)
// setShowPrice(0)
setSelectPack(true)
@ -1427,9 +1467,25 @@ export default function ProjNew() {
</div>
</div>
<div style={{
textAlign: 'right',
// textAlign: 'right',
marginTop: 10,
// background: '#F3F3F3',
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
}}>
<div style={{
fontSize: 16,
fontWeight: 'bold',
}}>
<div><span style={{
color: 'red',
}}> </span> </div>
<div style={{
color:'#1677ff',
}}></div>
</div>
<Button type="primary"
style={{
width: 100,

View File

@ -142,34 +142,34 @@ export default function ProjEditStep2(props: any) {
// setauthorCrcAccountUsername(selectedRows[0].crcAccountUsername)
// setAuthorId(selectedRows[0].projOwnerId)
// }
// 判断是否是清空选中状态
const isClearingSelection = selectedRowKeys.length === 0;
if (isClearingSelection) {
setauthorName('');
setauthorIdCardType('');
setauthorIdCard('');
setauthorType('');
setauthorNameEn('');
setauthorProvinceCity('');
setauthorCrcAccount(0);
setauthorCrcAccountPassword('');
setauthorCrcAccountUsername('');
setAuthorId('');
} else {
// 正常选中时,更新相关状态
setSelectedRowKeys(selectedRowKeys);
const firstSelectedRow = selectedRows[0];
setauthorName(firstSelectedRow.name);
setauthorIdCardType(firstSelectedRow.idCardType);
setauthorIdCard(firstSelectedRow.idCardNo);
setauthorType(firstSelectedRow.type);
setauthorNameEn(firstSelectedRow.nameEn);
setauthorProvinceCity(firstSelectedRow.provinceCity);
setauthorCrcAccount(firstSelectedRow.isCrcAccount);
setauthorCrcAccountPassword(firstSelectedRow.crcAccountPassword);
setauthorCrcAccountUsername(firstSelectedRow.crcAccountUsername);
setAuthorId(firstSelectedRow.projOwnerId);
}
// 判断是否是清空选中状态
const isClearingSelection = selectedRowKeys.length === 0;
if (isClearingSelection) {
setauthorName('');
setauthorIdCardType('');
setauthorIdCard('');
setauthorType('');
setauthorNameEn('');
setauthorProvinceCity('');
setauthorCrcAccount(0);
setauthorCrcAccountPassword('');
setauthorCrcAccountUsername('');
setAuthorId('');
} else {
// 正常选中时,更新相关状态
setSelectedRowKeys(selectedRowKeys);
const firstSelectedRow = selectedRows[0];
setauthorName(firstSelectedRow.name);
setauthorIdCardType(firstSelectedRow.idCardType);
setauthorIdCard(firstSelectedRow.idCardNo);
setauthorType(firstSelectedRow.type);
setauthorNameEn(firstSelectedRow.nameEn);
setauthorProvinceCity(firstSelectedRow.provinceCity);
setauthorCrcAccount(firstSelectedRow.isCrcAccount);
setauthorCrcAccountPassword(firstSelectedRow.crcAccountPassword);
setauthorCrcAccountUsername(firstSelectedRow.crcAccountUsername);
setAuthorId(firstSelectedRow.projOwnerId);
}
// setClom(String(selectedRowKeys))
// setbelongselectedKeys(selectedRowKeys)
@ -770,13 +770,13 @@ export default function ProjEditStep2(props: any) {
/>
</div> */}
</div>
<div className='showInfo' style={{alignItems:'center'}}>
<div className='showInfo' style={{ alignItems: 'center' }}>
<div style={{ marginRight: '22px' }}>:</div>
<div style={{ display: authorName == '' ? 'block' : 'none' }}></div>
<div style={{ display: authorName == '' ? 'none' : 'block' }}>
{authorName}/{authorType == 'PERSONAL' ? '自然人' : '企业-组织'}/{authorIdCardType == 'ID_CARD' ? '身份证' : '营业执照'}/{authorIdCard}
</div>
<Button style={{ display: authorName == '' ? 'none' : 'block',height:30,marginLeft:10 }} onClick={()=>{
<Button style={{ display: authorName == '' ? 'none' : 'block', height: 30, marginLeft: 10 }} onClick={() => {
// lyp
setauthorName('');
setauthorIdCardType('');
@ -1355,7 +1355,11 @@ export default function ProjEditStep2(props: any) {
<Col span={12}>
<div className='blongNameInt blongSmallNamel promptBox'>
{/* <div className='blongTitle blongsmallTitle '>姓名或公司名称:</div> */}
<div className='blongTitle blongsmallTitle '>{belongShow == 'PERSONAL' ? '姓名' : '公司名称'}</div>
<div className='blongTitle blongsmallTitle '>{belongShow == 'PERSONAL' ? '姓名' : '公司名称'}
<span style={{
color: 'red',
}}>*</span>
</div>
<Form.Item<BelongPeopleType>
// label="姓名或公司名称"
@ -1373,7 +1377,7 @@ export default function ProjEditStep2(props: any) {
</div>
</Col>
<Col span={12}>
{/* <Col span={12}>
<div className='blongNameInt blongSmallNameR'>
<div className='blongTitle blongsmallTitle '>{belongShow == 'PERSONAL' ? '英文名' : '公司英文缩写'}</div>
@ -1397,6 +1401,29 @@ export default function ProjEditStep2(props: any) {
</Form.Item>
</div>
</Col> */}
<Col span={12}>
<div className='blongNameInt blongSmallNameR'>
<div className='blongTitle blongsmallTitle '>{belongShow == 'PERSONAL' ? '身份证号' : '统一社会信用代码'}
<span style={{
color: 'red',
}}>*</span>
</div>
<Form.Item<BelongPeopleType>
// label="证件号"
name="authorIdCard"
rules={[{ required: true, message: '请输入证件号' }]}
>
<Input placeholder="请输入证件号"
style={{ height: '44px', width: '360px', fontSize: '15px', marginTop: '22px' }}
disabled={belongTitle == '查看所属者' ? true : false}
/>
</Form.Item>
<div className='prompt' style={{left:180}}>(:如有多个著作人{belongShow == 'PERSONAL' ? '身份证号' : '统一社会信用代码'})</div>
</div>
</Col>
@ -1423,11 +1450,12 @@ export default function ProjEditStep2(props: any) {
/>
</Form.Item>
</div>
<Col span={12}>
{/* <Col span={12}>
<div className='blongNameInt blongSmallNamel'>
<div className='blongTitle blongsmallTitle '>{belongShow == 'PERSONAL' ? '身份证号' : '统一社会信用代码'}</div>
@ -1444,7 +1472,7 @@ export default function ProjEditStep2(props: any) {
</Form.Item>
</div>
</Col>
</Col> */}
</Row></>}
<Row gutter={15}>
@ -1654,6 +1682,7 @@ export default function ProjEditStep2(props: any) {
<Modal
destroyOnClose
okText="确认"
centered
// cancelText="取消"
cancelText={contactTitle === '查看联系人' ? '返回' : '取消'}
open={isContantOpen}
@ -1693,7 +1722,9 @@ export default function ProjEditStep2(props: any) {
autoComplete="off"
>
<div className='blongNameInt'>
<div className='blongTitle ' style={{ width: 65, marginRight: '15px' }}>: </div>
<div className='blongTitle ' style={{ width: 65, marginRight: '15px' }}><span style={{
color: 'red',
}}>*</span> : </div>
<Form.Item<ContactType>
@ -1708,7 +1739,9 @@ export default function ProjEditStep2(props: any) {
</Form.Item>
</div>
<div className='blongNameInt'>
<div className='blongTitle ' style={{ width: 65, marginRight: '15px' }}>: </div>
<div className='blongTitle ' style={{ width: 65, marginRight: '15px' }}><span style={{
color: 'red',
}}>*</span> : </div>
<Form.Item<ContactType>
name="phone"

View File

@ -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() {
<div className='projNameInt'>
<div style={{ display: 'flex' }}>
<div className='projTitle '> :</div>
<div className='projTitle '> :</div>
<Form.Item<FieldType>
// label="项目简称"
name="projSubName"
name="projName"
rules={[{ required: false, message: '请输入项目简称' }]}
>
<Input
style={{ height: '50px', width: '411px', fontSize: '16px' }}
placeholder="请输入项目简称" />
// placeholder="请输入项目简称"
/>
</Form.Item>
</div>
<div style={{ display: 'flex' }}>

View File

@ -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: <LoadingPage />,
// },
{
path: '/',
element: <Index />,

View File

@ -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<T> = {
messageApi: MessageInstance;
@ -26,6 +28,7 @@ type Req<T> = {
config?: AxiosRequestConfig;
onBefore?(): void;
onSuccess(data: AxiosResponse<T>): 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<T>(req: Req<T>) {
}).finally(() => {
req.onFinally?.();
})
}
}