import { useEffect, useState } from 'react';
import { useSelector } from 'react-redux'
import { Table, Modal, message, Menu, Breadcrumb, Dropdown, Space, Form, Input, Button, Row, Col, Select } from 'antd';
import { DownOutlined, PlusOutlined } from '@ant-design/icons';
import './index.less';
import apiObj from '@api/index';
import utils from '@utils/index'
const { pickCheckedTreeIds } = utils;
const { post, api, xPost } = apiObj;
const { Option } = Select;
function MyMessage() {
useEffect(() => {
//刷新列表
getTableData();
}, []);
const [size, setSize] = useState(15); //每页显示条数
const [total, setTotal] = useState(0); //每页显示条数
const [dataSource, setDataSource] = useState([]); //列表数据
const [visible, setVisible] = useState(false); //弹窗查看
const [confirmLoading, setConfirmLoading] = useState(false);
const [msgDetail, setMsgDetail] = useState({});
//从state中取出状态、类型列表
const staticInfo = useSelector(state => {
return state.staticInfo;
});
const { msgTypeList, msgStatusList } = staticInfo;
//获取表格数据
function getTableData(param = {}) {
post(api.listManagePage, param).then((res) => {
if (res.data.code === 200) {
let data = res.data.data;
setTotal(data.total);
setDataSource(data.records);
}
})
}
//弹窗取消
function handleCancel() {
setVisible(false);
}
//新增子组织弹窗
function showMessage(id) {
getMsgDetail(id);
setVisible(true);
}
function getMsgDetail(id) { //type:1我的通知,0通知管理
xPost(api.getNoticeInfoById, { id: id, type: 1 }).then((res) => {
const { data, code } = res.data;
if (code === 200) {
setMsgDetail(data);
} else {
message.warning(res.data.msg || '获取详情失败')
}
});
}
//每页显示条数切换
function onSizeChange(){
}
//翻页
function onPageChange(){
}
//表格渲染
function RenderTable() {
const columns = [
{ title: '标题', dataIndex: 'title', key: 'title' },
{
title: '类型', width: 150, dataIndex: 'typeName', key:'typeName'
},
{ title: '发送者', dataIndex: 'sender', key: 'sender' },
{ title: '发送时间', width: 240, dataIndex: 'gmtCreate', key: 'gmtCreate' },
{
title: '阅读状态', key: 'statusName', dataIndex:'statusName'
},
{
title: '操作', key: 'operation', render: (row) => {
return (