import { history, Link } from 'umi';
import { useRef } from 'react';
import { Button, Modal, message, Popconfirm, Tooltip } from 'antd';
import { PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import ProTable, { TableDropdown } from '@ant-design/pro-table';
export default (props) => {
const dataSource = [
{
id: 9,
key: '1',
name: '胡彦斌',
age: 32,
zz: '西湖区湖底公园1号',
},
];
// 测试内容👆-------------------------
const actionRef = useRef();
const gotoDetail = (id) => {
history.push(`InformationClassification/InformationClassificationEdit`);
};
const handleDelete = (e) => {
deleteNote(e.noteId).then((res) => {
message.success('删除成功');
actionRef.current.reload();
});
};
const handleOK = (record, data) => {
const titleCourse = record.status
? '您确定要禁用该用户吗? 禁用后该用户不能在后台登陆!'
: '您确定要启用该用户吗? 启用后该用户将允许在后台登陆!';
Modal.confirm({
title: titleCourse,
okText: '确认',
cancelText: '取消',
onOk() {
publishNote(record.noteId, record.status ? 'off' : 'on').then((res) => {
message.success('操作成功');
actionRef.current.reload();
});
},
});
};
const actions = () => [
} onClick={() => gotoDetail()}>
新增
,
];
const columns = [
{
title: '分类名',
dataIndex: 'name',
key: 'name',
search: false,
},
{
title: (
<>
创建时间
>
),
// hideInTable: true,
search: false,
key: 'createdAt',
dataIndex: 'createdAt',
valueType: 'date',
// render: (t) => formatterTime(t),
sorter: (a, b) => a.createdAt - b.createdAt, //时间排序
},
{
title: '操作',
valueType: 'option',
key: 'option',
ellipsis: true,
width: 200,
render: (_, record) => [
编辑
,
handleDelete(record)}
okText="确定"
cancelText="取消"
>
删除
,
],
},
];
return (
);
};