|
|
|
@ -3,9 +3,10 @@ import { PageContainer } from '@ant-design/pro-layout';
|
|
|
|
|
import Constants from '@/constants';
|
|
|
|
|
import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components';
|
|
|
|
|
import { handlePageQuery } from '@/utils/utils';
|
|
|
|
|
import { getMessageDetailUsingGet, pbcUserMessagePageUsingPost } from '@/services/pop-b2b2c/pbcUserMessageController';
|
|
|
|
|
import { Avatar, Button, Col, Drawer, Row, Image, Divider } from 'antd';
|
|
|
|
|
import { deleteUserMessageUsingGet, getMessageDetailUsingGet, pbcUserMessagePageUsingPost } from '@/services/pop-b2b2c/pbcUserMessageController';
|
|
|
|
|
import { Avatar, Button, Col, Drawer, Row, Image, Divider, Space, Popconfirm, message } from 'antd';
|
|
|
|
|
import { UserOutlined } from '@ant-design/icons';
|
|
|
|
|
import { Access, useAccess } from '@umijs/max';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询表格
|
|
|
|
@ -20,9 +21,34 @@ const fetchData = async (params: API.PageVO) => {
|
|
|
|
|
} as any;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除节点
|
|
|
|
|
* @param id
|
|
|
|
|
*/
|
|
|
|
|
const handleRemove = async (fields: API.PbcUserMessage) => {
|
|
|
|
|
const hide = message.loading('正在删除');
|
|
|
|
|
if (!fields.pbcId) return false;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const msg = await deleteUserMessageUsingGet({ id: fields.pbcId });
|
|
|
|
|
hide();
|
|
|
|
|
if (msg.retcode) {
|
|
|
|
|
message.success('删除成功,即将刷新');
|
|
|
|
|
} else {
|
|
|
|
|
message.error(msg.retmsg ?? '删除失败,请重试');
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
} catch (error) {
|
|
|
|
|
hide();
|
|
|
|
|
message.error('删除失败,请重试');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
|
|
|
const TableList: React.FC<{}> = () => {
|
|
|
|
|
const actionRef = useRef<ActionType>();
|
|
|
|
|
const access: any = useAccess();
|
|
|
|
|
|
|
|
|
|
const [currentRow, setCurrentRow] = useState<API.PbcUserMessage>();
|
|
|
|
|
|
|
|
|
@ -65,6 +91,7 @@ const TableList: React.FC<{}> = () => {
|
|
|
|
|
fixed: 'right',
|
|
|
|
|
valueType: 'option',
|
|
|
|
|
render: (text, record) => (
|
|
|
|
|
<Space>
|
|
|
|
|
<Button type="link" loading={loading} onClick={() => {
|
|
|
|
|
if (record.pbcId) {
|
|
|
|
|
handleLoading(true);
|
|
|
|
@ -81,6 +108,20 @@ const TableList: React.FC<{}> = () => {
|
|
|
|
|
}}>
|
|
|
|
|
查看详情
|
|
|
|
|
</Button>
|
|
|
|
|
<Access key="remove" accessible={access.messageDelete}>
|
|
|
|
|
<Popconfirm
|
|
|
|
|
title={`确定需要删除该留言?`}
|
|
|
|
|
onConfirm={async () => {
|
|
|
|
|
const success = await handleRemove(record);
|
|
|
|
|
if (success) actionRef.current?.reload();
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Button size="small" type="link" danger>
|
|
|
|
|
删除
|
|
|
|
|
</Button>
|
|
|
|
|
</Popconfirm>
|
|
|
|
|
</Access>
|
|
|
|
|
</Space>
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
@ -113,7 +154,7 @@ const TableList: React.FC<{}> = () => {
|
|
|
|
|
span: 6
|
|
|
|
|
}}
|
|
|
|
|
pagination={{
|
|
|
|
|
pageSize: 20,
|
|
|
|
|
defaultPageSize: 20,
|
|
|
|
|
showSizeChanger: true,
|
|
|
|
|
}}
|
|
|
|
|
scroll={{
|
|
|
|
|