Merge remote-tracking branch 'origin/main'

main
白封羽 2023-01-06 15:26:01 +08:00
commit a6c7378398
4 changed files with 126 additions and 64 deletions

View File

@ -1,5 +1,5 @@
import React, {useState, useEffect} from 'react';
import {UploadOutlined, UserOutlined, VideoCameraOutlined} from '@ant-design/icons';
import {UploadOutlined, UserOutlined, BellOutlined} from '@ant-design/icons';
import {Layout, Menu, theme, Typography, Button, Dropdown, MenuProps} from 'antd';
import {useAppDispatch, useAppSelector} from "../models/hooks";
import {getStaff, getToken, setStaff, setToken, store} from "../models/store";
@ -84,11 +84,22 @@ function HeaderBar(props: any) {
padding: 0,
background: colorBgContainer,
display: 'flex',
flexDirection: 'row-reverse',
flexDirection: 'row',
justifyContent: "space-between",
alignItems: 'center',
zIndex: 100,
boxShadow: '0px 6px 16px 0px rgba(0, 0, 0, 0.08)'
}}>
<div></div>
<div style={{
height: '100%',
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
}}>
<Button type="text" shape="circle">
<BellOutlined />
</Button>
<Dropdown overlayStyle={{minWidth: '150px'}} menu={{items, onClick}} placement="bottomRight" arrow>
<Button type="text" style={{
marginRight: '12px', height: '100%',
@ -104,6 +115,8 @@ function HeaderBar(props: any) {
</div>
</Button>
</Dropdown>
</div>
</Header>
)
}
@ -129,6 +142,53 @@ function HomeView() {
const location = useLocation()
const dispatch = useAppDispatch()
const [messageCount, setMessageCount] = useState([])
// 新建Sse连接
const createSseConnect = () => {
if (window.EventSource) {
let source = new EventSource('http://localhost:3000/api1/sse/createConnect?clientId=001')
// 监听打开事件
source.addEventListener('open', (e) => {
console.log("打开连接 onopen==>", e)
})
// 监听消息事件
source.addEventListener("message", (e) => {
})
// 监听错误事件
source.addEventListener("error", (e) => {
})
// 关闭连接
source.close = () => {
console.log("source.close")
}
} else {
alert("该浏览器不支持SSE")
}
}
// 获取系统消息
const getSystemMessage = () => {
// 发送网络请求
axiosInstance.post(`http://localhost:3000/api1/sse/broadcast`).then(
response => {
},
error => {
}
)
}
let items = [{
key: "/invoice/mine",
//icon: React.createElement(UserOutlined),
@ -170,8 +230,7 @@ function HomeView() {
const staff: Staff = response.data
dispatch(setStaff(staff))
if (location.pathname === '/')
{
if (location.pathname === '/') {
if (token.staffId === 'manager')
navigate('/reimbursement/approval')
else

View File

@ -98,11 +98,11 @@ function InvoiceDetailModal(props: any) {
return (
<Modal
open={props.open}
title="发票详情"
title={"发票详情"+(props.invoiceDetail?.modified ? '(发票信息经过手动修改)' : '')}
onCancel={handleCancel}
footer={
<div style={{width: '100%', display: "flex", flexDirection: "row", justifyContent: "space-between"}}>
<Text>{props.invoiceDetail?.modified ? '发票信息经过手动修改' : ''}</Text>
<Text>{props.invoiceDetail?.modified ? '' : ''}</Text>
<div>
{props.invoiceDetail?.invoiceState === 0 && <Button danger loading={loading} onClick={withDraw}
>

View File

@ -210,16 +210,15 @@ function InvoiceSearch(props: { isManagement: boolean, handleSearchData: any })
props.handleSearchData(invoiceSearchOption)
}}/>}
</div>
{complexEnabled &&
<div className="complexSearchBar" style={{
margin: '20px',
padding: '20px 20px 0px 20px',
display: "flex",
display: complexEnabled ? "flex" : "none",
backgroundColor: colorBgContainer,
borderRadius: '20px'
}}>
<Form name="complexOption" onValuesChange={onValuesChange} style={{width: '100%'}}>
<Form.Item
name={`invoice-kind`}
label={`发票类型`}
@ -251,9 +250,8 @@ function InvoiceSearch(props: { isManagement: boolean, handleSearchData: any })
<Radio.Button value="2"></Radio.Button>
</Radio.Group>
</Form.Item>
</Form>
</div>}
</div>
</div>
)
}
@ -399,7 +397,12 @@ function InvoiceListView(props: { isManagement: boolean }) {
return (
<div style={{}}>
<InvoiceSearch isManagement={props.isManagement} handleSearchData={handleInvoiceSearchInfo}/>
<div style={{padding: '10px 30px 30px 30px', display: "flex", flexDirection: "column", alignItems: "flex-end"}}>
<div style={{
padding: '10px 30px 30px 30px',
display: "flex",
flexDirection: "column",
alignItems: "flex-end"
}}>
<div style={{display: "flex", flexWrap: "wrap", justifyContent: 'center', width: '100%'}}>
{invoices.map((item: Invoice, index: number) =>
<InvoiceItem showUploader={props.isManagement} onClick={onItemClick} invoice={item}

View File

@ -666,7 +666,7 @@ function StatView() {
trigger: 'item',
formatter: function (params: any) {
let returnStr = '';
if (params.componentSubType == 'lines') {
if (params.componentSubType === 'lines') {
returnStr += params.marker;
returnStr += params.data.fromName + ' → ' + params.data.toName;
returnStr += '' + params.data.value;