消息通知更改
This commit is contained in:
parent
67db0b5844
commit
b4099da594
@ -1,4 +1,4 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import './noticeModal.css'
|
||||
import { get, put, del } from '../../util/AjaxUtils'
|
||||
import {
|
||||
@ -9,7 +9,7 @@ import {
|
||||
message,
|
||||
Spin
|
||||
} from 'antd';
|
||||
import type { TableColumnsType} from 'antd';
|
||||
import type { TableColumnsType } from 'antd';
|
||||
import {
|
||||
MailOutlined,
|
||||
MailFilled
|
||||
@ -53,8 +53,8 @@ export default function NoticeModal() {
|
||||
onBefore() {
|
||||
|
||||
},
|
||||
onSuccess(data) {
|
||||
console.log(data);
|
||||
onSuccess() {
|
||||
// console.log(data);
|
||||
getNoticeData()
|
||||
},
|
||||
onFinally() {
|
||||
@ -107,8 +107,8 @@ export default function NoticeModal() {
|
||||
url: '/api/user-msg/listpage-simple/self',
|
||||
config: {
|
||||
params: {
|
||||
// page: page,
|
||||
// rows: 10,
|
||||
page: page,
|
||||
rows: 10,
|
||||
isRead: isRead ? isRead : '',
|
||||
keywords: keywords ? keywords : ''
|
||||
}
|
||||
@ -148,6 +148,7 @@ export default function NoticeModal() {
|
||||
// 点击删除按钮
|
||||
const Delete = () => {
|
||||
// const deleteIds:any = ids.join('/')
|
||||
console.log(selectedRowKeys);
|
||||
del<any>({
|
||||
messageApi,
|
||||
url: `api/user-msg/remove/self/${ids.join('_')}`,
|
||||
@ -177,8 +178,7 @@ export default function NoticeModal() {
|
||||
onBefore() {
|
||||
|
||||
},
|
||||
onSuccess(data) {
|
||||
console.log(data);
|
||||
onSuccess() {
|
||||
getNoticeData()
|
||||
init()
|
||||
},
|
||||
@ -208,16 +208,39 @@ export default function NoticeModal() {
|
||||
}
|
||||
})
|
||||
}
|
||||
const selectedRowKeyRef = useRef<any>({})
|
||||
const selectedRowRef = useRef<any>({})
|
||||
|
||||
// 缓存数组
|
||||
// const [newArray,setNewArray] = useState<any[]>([])
|
||||
// 选择(多选)项目
|
||||
const rowSelection = {
|
||||
selectedRowKeys,
|
||||
onChange: (newselectedRowKeys: React.Key[], selectedRows: DataType[]) => {
|
||||
setSelectedRowKeys(newselectedRowKeys);
|
||||
const selectedOrderIds = selectedRows.map(row => row.userMsgId);
|
||||
selectedRowKeyRef.current[page]=newselectedRowKeys
|
||||
selectedRowRef.current[page]=selectedRows
|
||||
// console.log(11111111, newselectedRowKeys, selectedRowKeyRef.current);
|
||||
|
||||
const arr=[]
|
||||
for (const element in selectedRowKeyRef.current) {
|
||||
// console.log(22222,element);
|
||||
|
||||
arr.push(...selectedRowKeyRef.current[element])
|
||||
}
|
||||
setSelectedRowKeys(arr);
|
||||
|
||||
const arrIds=[]
|
||||
for (const element in selectedRowRef.current) {
|
||||
// console.log(22222,element);
|
||||
|
||||
arrIds.push(...selectedRowRef.current[element])
|
||||
}
|
||||
|
||||
const selectedOrderIds = arrIds.map(row => row.userMsgId);
|
||||
setIds(selectedOrderIds)
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
getNoticeData()
|
||||
@ -282,6 +305,10 @@ export default function NoticeModal() {
|
||||
onChange: (currentPage) => {
|
||||
setPage(currentPage);
|
||||
// init()
|
||||
|
||||
// setSelectedRowKeys()
|
||||
// const upArray = [...selectedRowKeys,...newArray]
|
||||
// setSelectedRowKeys(upArray)
|
||||
},
|
||||
showSizeChanger: false,
|
||||
current: page
|
||||
@ -289,7 +316,7 @@ export default function NoticeModal() {
|
||||
}
|
||||
scroll={{ y: 500 }} bordered rowKey="userMsgId"
|
||||
/>
|
||||
|
||||
|
||||
</Spin>
|
||||
</div>
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user