You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
2.6 KiB
TypeScript

1 year ago
import Constants from '@/constants';
import { listAdminTreeUsingGet } from '@/services/pop-b2b2c/pbcCategoryController';
import {
pbcUsersPageUsingPost,
} from '@/services/pop-b2b2c/pbcUsersController';
import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components';
import { PageContainer } from '@ant-design/pro-layout';
import React, { useRef } from 'react';
/**
*
* @param param0
*/
const fetchData = async (params: API.PageVO) => {
const msg = await pbcUsersPageUsingPost(params);
return {
data: msg.data?.records,
total: msg.data?.total,
success: msg.retcode,
} as any;
};
// eslint-disable-next-line @typescript-eslint/ban-types
const TableList: React.FC<{}> = () => {
const actionRef = useRef<ActionType>();
const columns: ProColumns<API.PbcProduct>[] = [
{
title: '商品类目',
dataIndex: 'pbcProductCategoryId',
hideInTable: true,
valueType: 'cascader',
fieldProps: {
fieldNames: { label: 'pbcCategoryName', value: 'pbcId', children: 'children' },
},
request: async () => {
const msg = await listAdminTreeUsingGet({ type: 2 });
if (msg.retcode && msg.data) {
return msg.data;
}
return [];
},
},
{
title: '商品大类',
dataIndex: 'pbcProductTopCategoryName',
search: false,
},
{
title: '商品中类',
dataIndex: 'pbcProductParentCategoryName',
search: false,
},
{
title: '商品小类',
dataIndex: 'pbcProductCategoryName',
search: false,
},
{
title: '商品名称',
dataIndex: 'pbcProductTitle',
},
{
title: '价格',
dataIndex: 'pbcProductPrice',
search: false,
},
{
title: '所属商户',
dataIndex: 'pbcBusinessName',
search: false,
},
{
title: '状态',
dataIndex: 'pbcState',
valueType: 'select',
search: false,
valueEnum: Constants.pbcProductState,
},
];
return (
<PageContainer
header={{
title: '',
breadcrumb: {},
}}
>
<ProTable<API.PbcBusiness>
columns={columns}
actionRef={actionRef}
request={fetchData}
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={() => []}
/>
</PageContainer>
);
};
export default TableList;