import React, { useRef, useState } from 'react'; 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 { 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'; /** * 查询表格 * @param param0 */ const fetchData = async (params: API.PageVO) => { const msg = await pbcUserMessagePageUsingPost(params); return { data: msg.data?.records, total: msg.data?.total, success: msg.retcode, } 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(); const access: any = useAccess(); const [currentRow, setCurrentRow] = useState(); const [openDrawer, handleOpenDrawer] = useState(false); const [loading, handleLoading] = useState(false); const columns: ProColumns[] = [ { title: '会员昵称', dataIndex: 'pbcUserNickName', }, { title: '手机号', dataIndex: 'pbcUserMobile', }, { title: '商户名称', dataIndex: 'pbcBusinessName' }, { title: '留言内容', dataIndex: 'pbcMessage', ellipsis: true, search: false }, { title: '留言时间', dataIndex: 'pbcCreateAt', valueType: 'dateTime', search: false }, { title: '回复状态', dataIndex: 'pbcReplyState', valueEnum: Constants.pbcReplyState }, { title: '操作', fixed: 'right', valueType: 'option', render: (text, record) => ( { const success = await handleRemove(record); if (success) actionRef.current?.reload(); }} > ), }, ]; return ( columns={columns} actionRef={actionRef} request={(param: any) => { const queryParam = handlePageQuery(param); if (queryParam.filters) { queryParam.filters.push({ key: 'pbcReplyToId'.replace(/([A-Z])/g, '_$1').toLowerCase(), value: "", action: 'isnull', }) } return fetchData(queryParam); }} rowKey="pbcId" size="small" bordered search={{ labelWidth: 'auto', span: 6 }} pagination={{ defaultPageSize: 20, showSizeChanger: true, }} scroll={{ y: 'calc(100vh - 320px)', }} dateFormatter="string" options={false} toolBarRender={() => []} /> { setCurrentRow({}) handleOpenDrawer(false) }} width={600} closeIcon={null} footer={null} destroyOnClose={true} open={openDrawer} >
} src={currentRow?.pbcUserImage} />
{currentRow?.pbcUserNickName}
{currentRow?.pbcCreateAt}

{currentRow?.pbcMessage}

{currentRow?.pbcMessageImages?.split(',').map(e => )}
{currentRow?.pbcProduct?.pbcProductTitle}
¥{currentRow?.pbcProduct?.pbcProductPrice}
{currentRow?.children?.map(e => (
} src={e.pbcUserImage} />
{e.pbcUserNickName}
{e.pbcCreateAt}

{e.pbcMessage}

{e.pbcMessageImages?.split(',').map(item => )}
))}
); }; export default TableList;