解决了一些问题
parent
c770c86eaf
commit
586c4fa69e
|
@ -1,5 +1,5 @@
|
||||||
import React, {useState, useEffect} from 'react';
|
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 {Layout, Menu, theme, Typography, Button, Dropdown, MenuProps} from 'antd';
|
||||||
import {useAppDispatch, useAppSelector} from "../models/hooks";
|
import {useAppDispatch, useAppSelector} from "../models/hooks";
|
||||||
import {getStaff, getToken, setStaff, setToken, store} from "../models/store";
|
import {getStaff, getToken, setStaff, setToken, store} from "../models/store";
|
||||||
|
@ -84,11 +84,22 @@ function HeaderBar(props: any) {
|
||||||
padding: 0,
|
padding: 0,
|
||||||
background: colorBgContainer,
|
background: colorBgContainer,
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'row-reverse',
|
flexDirection: 'row',
|
||||||
|
justifyContent: "space-between",
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
zIndex: 100,
|
zIndex: 100,
|
||||||
boxShadow: '0px 6px 16px 0px rgba(0, 0, 0, 0.08)'
|
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>
|
<Dropdown overlayStyle={{minWidth: '150px'}} menu={{items, onClick}} placement="bottomRight" arrow>
|
||||||
<Button type="text" style={{
|
<Button type="text" style={{
|
||||||
marginRight: '12px', height: '100%',
|
marginRight: '12px', height: '100%',
|
||||||
|
@ -104,6 +115,8 @@ function HeaderBar(props: any) {
|
||||||
</div>
|
</div>
|
||||||
</Button>
|
</Button>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
|
</div>
|
||||||
|
|
||||||
</Header>
|
</Header>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -129,6 +142,53 @@ function HomeView() {
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
const dispatch = useAppDispatch()
|
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 = [{
|
let items = [{
|
||||||
key: "/invoice/mine",
|
key: "/invoice/mine",
|
||||||
//icon: React.createElement(UserOutlined),
|
//icon: React.createElement(UserOutlined),
|
||||||
|
@ -170,8 +230,7 @@ function HomeView() {
|
||||||
const staff: Staff = response.data
|
const staff: Staff = response.data
|
||||||
dispatch(setStaff(staff))
|
dispatch(setStaff(staff))
|
||||||
|
|
||||||
if (location.pathname === '/')
|
if (location.pathname === '/') {
|
||||||
{
|
|
||||||
if (token.staffId === 'manager')
|
if (token.staffId === 'manager')
|
||||||
navigate('/reimbursement/approval')
|
navigate('/reimbursement/approval')
|
||||||
else
|
else
|
||||||
|
|
|
@ -98,11 +98,11 @@ function InvoiceDetailModal(props: any) {
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
open={props.open}
|
open={props.open}
|
||||||
title="发票详情"
|
title={"发票详情"+(props.invoiceDetail?.modified ? '(发票信息经过手动修改)' : '')}
|
||||||
onCancel={handleCancel}
|
onCancel={handleCancel}
|
||||||
footer={
|
footer={
|
||||||
<div style={{width: '100%', display: "flex", flexDirection: "row", justifyContent: "space-between"}}>
|
<div style={{width: '100%', display: "flex", flexDirection: "row", justifyContent: "space-between"}}>
|
||||||
<Text>{props.invoiceDetail?.modified ? '发票信息经过手动修改' : ''}</Text>
|
<Text>{props.invoiceDetail?.modified ? '' : ''}</Text>
|
||||||
<div>
|
<div>
|
||||||
{props.invoiceDetail?.invoiceState === 0 && <Button danger loading={loading} onClick={withDraw}
|
{props.invoiceDetail?.invoiceState === 0 && <Button danger loading={loading} onClick={withDraw}
|
||||||
>
|
>
|
||||||
|
|
|
@ -210,16 +210,15 @@ function InvoiceSearch(props: { isManagement: boolean, handleSearchData: any })
|
||||||
props.handleSearchData(invoiceSearchOption)
|
props.handleSearchData(invoiceSearchOption)
|
||||||
}}/>}
|
}}/>}
|
||||||
</div>
|
</div>
|
||||||
{complexEnabled &&
|
|
||||||
<div className="complexSearchBar" style={{
|
<div className="complexSearchBar" style={{
|
||||||
margin: '20px',
|
margin: '20px',
|
||||||
padding: '20px 20px 0px 20px',
|
padding: '20px 20px 0px 20px',
|
||||||
display: "flex",
|
display: complexEnabled ? "flex" : "none",
|
||||||
backgroundColor: colorBgContainer,
|
backgroundColor: colorBgContainer,
|
||||||
borderRadius: '20px'
|
borderRadius: '20px'
|
||||||
}}>
|
}}>
|
||||||
<Form name="complexOption" onValuesChange={onValuesChange} style={{width: '100%'}}>
|
<Form name="complexOption" onValuesChange={onValuesChange} style={{width: '100%'}}>
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name={`invoice-kind`}
|
name={`invoice-kind`}
|
||||||
label={`发票类型`}
|
label={`发票类型`}
|
||||||
|
@ -251,9 +250,8 @@ function InvoiceSearch(props: { isManagement: boolean, handleSearchData: any })
|
||||||
<Radio.Button value="2">已报销</Radio.Button>
|
<Radio.Button value="2">已报销</Radio.Button>
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
</Form>
|
</Form>
|
||||||
</div>}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -399,7 +397,12 @@ function InvoiceListView(props: { isManagement: boolean }) {
|
||||||
return (
|
return (
|
||||||
<div style={{}}>
|
<div style={{}}>
|
||||||
<InvoiceSearch isManagement={props.isManagement} handleSearchData={handleInvoiceSearchInfo}/>
|
<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%'}}>
|
<div style={{display: "flex", flexWrap: "wrap", justifyContent: 'center', width: '100%'}}>
|
||||||
{invoices.map((item: Invoice, index: number) =>
|
{invoices.map((item: Invoice, index: number) =>
|
||||||
<InvoiceItem showUploader={props.isManagement} onClick={onItemClick} invoice={item}
|
<InvoiceItem showUploader={props.isManagement} onClick={onItemClick} invoice={item}
|
||||||
|
|
|
@ -666,7 +666,7 @@ function StatView() {
|
||||||
trigger: 'item',
|
trigger: 'item',
|
||||||
formatter: function (params: any) {
|
formatter: function (params: any) {
|
||||||
let returnStr = '';
|
let returnStr = '';
|
||||||
if (params.componentSubType == 'lines') {
|
if (params.componentSubType === 'lines') {
|
||||||
returnStr += params.marker;
|
returnStr += params.marker;
|
||||||
returnStr += params.data.fromName + ' → ' + params.data.toName;
|
returnStr += params.data.fromName + ' → ' + params.data.toName;
|
||||||
returnStr += ':' + params.data.value;
|
returnStr += ':' + params.data.value;
|
||||||
|
|
Loading…
Reference in New Issue