Merge remote-tracking branch 'origin/main'
commit
e71ca15397
|
@ -30,8 +30,6 @@ export interface Notice {
|
||||||
export interface NoticeData {
|
export interface NoticeData {
|
||||||
|
|
||||||
approvalOpinion?: string;
|
approvalOpinion?: string;
|
||||||
approvalResult?: number;
|
|
||||||
approvalStaff?: Staff;
|
|
||||||
/*
|
/*
|
||||||
const val SUCCESS = 0. toShort()
|
const val SUCCESS = 0. toShort()
|
||||||
const val WAITING_ FOR_ DEPARTMENT _MANAGER_ APPROVAL = 1. toShort()
|
const val WAITING_ FOR_ DEPARTMENT _MANAGER_ APPROVAL = 1. toShort()
|
||||||
|
@ -41,6 +39,9 @@ export interface NoticeData {
|
||||||
const val REJECTED = 5. toShort()
|
const val REJECTED = 5. toShort()
|
||||||
const val TERMINATED = 6. toShort()
|
const val TERMINATED = 6. toShort()
|
||||||
*/
|
*/
|
||||||
|
approvalResult?: number;
|
||||||
|
approvalStaff?: Staff;
|
||||||
|
|
||||||
noticeType: number;
|
noticeType: number;
|
||||||
reimbursement?: Reimbursement;
|
reimbursement?: Reimbursement;
|
||||||
invoice?: Invoice;
|
invoice?: Invoice;
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import {Button, Card, List, Popover, Space, Typography, Divider, Badge, Dropdown, MenuProps} from "antd";
|
import {Button, Card, List, Popover, Space, Typography, Divider, Badge, Dropdown, MenuProps} from "antd";
|
||||||
import {BellOutlined, CloseOutlined} from "@ant-design/icons";
|
import {BellOutlined, CloseOutlined} from "@ant-design/icons";
|
||||||
import React, {useEffect, useState} from "react";
|
import React, {useEffect, useState} from "react";
|
||||||
import {Notice} from "../models/Notice";
|
import {Notice, NoticeResponse} from "../models/Notice";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import 'dayjs/locale/zh-cn'
|
import 'dayjs/locale/zh-cn'
|
||||||
import axiosInstance from "../utils/axiosInstance";
|
import axiosInstance from "../utils/axiosInstance";
|
||||||
import {setToken} from "../models/store";
|
import {setStaff, setToken} from "../models/store";
|
||||||
|
import {Staff} from "../models/Staff";
|
||||||
|
|
||||||
const {Text, Title, Paragraph} = Typography
|
const {Text, Title, Paragraph} = Typography
|
||||||
const relativeTime = require('dayjs/plugin/relativeTime')
|
const relativeTime = require('dayjs/plugin/relativeTime')
|
||||||
|
@ -31,9 +32,62 @@ function MessageList() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getApprovalStep = (approvalResult?: number) => {
|
||||||
|
switch (approvalResult) {
|
||||||
|
case 1:
|
||||||
|
return '部门主管'
|
||||||
|
break
|
||||||
|
case 2:
|
||||||
|
return '财务'
|
||||||
|
break
|
||||||
|
case 3:
|
||||||
|
return '财务主管'
|
||||||
|
break
|
||||||
|
case 4:
|
||||||
|
return '总经理'
|
||||||
|
break
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
|
const getContent = (notice: Notice) => {
|
||||||
|
switch (notice.data.noticeType) {
|
||||||
|
case 0:
|
||||||
|
if (notice.data.approvalResult === 5)
|
||||||
|
return '报销单审批未通过'
|
||||||
|
else
|
||||||
|
return <Paragraph>{
|
||||||
|
notice.data.reimbursement?.reimbursementId + '号报销单(' + notice.data.reimbursement?.reimbursementDepartureName
|
||||||
|
+ (notice.data.reimbursement?.roundTrip ? " ⇌ " : " → ") + notice.data.reimbursement?.reimbursementDestinationName+')'
|
||||||
|
+ getApprovalStep(notice.data.approvalResult)+'『'+notice.data.approvalStaff?.staffName+'』审批通过'
|
||||||
|
}<br/>{'审批意见:'+notice.data.approvalOpinion}</Paragraph>
|
||||||
|
|
||||||
|
break
|
||||||
|
case 1:
|
||||||
|
return '发票被打回'
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const onMessageListOpen = () => {
|
||||||
|
axiosInstance({
|
||||||
|
url: 'common/notice',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
pageNum: 0,
|
||||||
|
pageSize: 10
|
||||||
|
}
|
||||||
|
}).then(response => {
|
||||||
|
console.log(response.data)
|
||||||
|
const data: NoticeResponse = response.data
|
||||||
|
setList(data.records)
|
||||||
|
}).catch(function (error) {
|
||||||
|
console.log(error)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setList([
|
/*setList([
|
||||||
{
|
{
|
||||||
"noticeTargetId": "50",
|
"noticeTargetId": "50",
|
||||||
"noticeTime": "1981-10-04 06:37:59",
|
"noticeTime": "1981-10-04 06:37:59",
|
||||||
|
@ -100,7 +154,7 @@ function MessageList() {
|
||||||
},
|
},
|
||||||
"noticeId": "40"
|
"noticeId": "40"
|
||||||
}
|
}
|
||||||
])
|
])*/
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
|
@ -146,11 +200,11 @@ function MessageList() {
|
||||||
<Divider type="vertical"/>
|
<Divider type="vertical"/>
|
||||||
<Text>{
|
<Text>{
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
dayjs().fromNow()
|
dayjs(item.noticeTime).fromNow()
|
||||||
}</Text>
|
}</Text>
|
||||||
</div>
|
</div>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
<Paragraph>{'Ant Design, a design language for background applications, is refined by Ant UED Team'}</Paragraph>
|
{getContent(item)}
|
||||||
|
|
||||||
</Button>
|
</Button>
|
||||||
<Button style={{
|
<Button style={{
|
||||||
|
@ -161,7 +215,7 @@ function MessageList() {
|
||||||
|
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
} title="我的消息" arrowPointAtCenter>
|
} title="我的消息" arrowPointAtCenter onOpenChange={onMessageListOpen}>
|
||||||
<Button type="text" shape="circle">
|
<Button type="text" shape="circle">
|
||||||
<BellOutlined/>
|
<BellOutlined/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
Loading…
Reference in New Issue