|
|
|
|
@ -1,18 +1,21 @@
|
|
|
|
|
import Constants from '@/constants';
|
|
|
|
|
import { listAdminTreeUsingGet } from '@/services/pop-b2b2c/pbcCategoryController';
|
|
|
|
|
import { exportOperationalProductDataUsingPost, operationalProductDataUsingPost } from '@/services/pop-b2b2c/pbcUserRecordLogController';
|
|
|
|
|
import {
|
|
|
|
|
pbcUsersPageUsingPost,
|
|
|
|
|
} from '@/services/pop-b2b2c/pbcUsersController';
|
|
|
|
|
import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components';
|
|
|
|
|
import { ActionType, ProColumns, ProFormInstance, ProTable } from '@ant-design/pro-components';
|
|
|
|
|
import { PageContainer } from '@ant-design/pro-layout';
|
|
|
|
|
import { useSearchParams } from '@umijs/max';
|
|
|
|
|
import { Button, message } from 'antd';
|
|
|
|
|
import React, { useRef } from 'react';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询表格
|
|
|
|
|
* @param param0
|
|
|
|
|
*/
|
|
|
|
|
const fetchData = async (params: API.PageVO) => {
|
|
|
|
|
const msg = await pbcUsersPageUsingPost(params);
|
|
|
|
|
const fetchData = async (params: API.PbcOperationalDashboardDTO) => {
|
|
|
|
|
const msg = await operationalProductDataUsingPost(params);
|
|
|
|
|
return {
|
|
|
|
|
data: msg.data?.records,
|
|
|
|
|
total: msg.data?.total,
|
|
|
|
|
@ -20,45 +23,52 @@ const fetchData = async (params: API.PageVO) => {
|
|
|
|
|
} as any;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleExport = async (values?: API.PbcOperationalDashboardDTO) => {
|
|
|
|
|
|
|
|
|
|
const hide = message.loading('正在处理', 0);
|
|
|
|
|
try {
|
|
|
|
|
await exportOperationalProductDataUsingPost(
|
|
|
|
|
{ ...values },
|
|
|
|
|
{
|
|
|
|
|
responseType: 'blob',
|
|
|
|
|
getResponse: true,
|
|
|
|
|
parseResponse: false,
|
|
|
|
|
data: { ...values, fileName: '导出' },
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
hide();
|
|
|
|
|
return false;
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
hide();
|
|
|
|
|
message.error('处理失败,请重试');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
|
|
|
const TableList: React.FC<{}> = () => {
|
|
|
|
|
const actionRef = useRef<ActionType>();
|
|
|
|
|
const [searchParams] = useSearchParams();
|
|
|
|
|
const userId = searchParams.get('userId');
|
|
|
|
|
const userName = searchParams.get('userName');
|
|
|
|
|
const ref = useRef<ProFormInstance<API.PbcOperationalProductVO>>();
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
},
|
|
|
|
|
const columns: ProColumns<API.PbcOperationalProductVO>[] = [
|
|
|
|
|
{
|
|
|
|
|
title: '商品中类',
|
|
|
|
|
dataIndex: 'pbcProductParentCategoryName',
|
|
|
|
|
search: false,
|
|
|
|
|
title: '序号',
|
|
|
|
|
dataIndex: 'serialNumber',
|
|
|
|
|
search: false
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '商品小类',
|
|
|
|
|
title: '商品分类',
|
|
|
|
|
dataIndex: 'pbcProductCategoryName',
|
|
|
|
|
search: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '商品名称',
|
|
|
|
|
dataIndex: 'pbcProductTitle',
|
|
|
|
|
search: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '价格',
|
|
|
|
|
@ -70,9 +80,15 @@ const TableList: React.FC<{}> = () => {
|
|
|
|
|
dataIndex: 'pbcBusinessName',
|
|
|
|
|
search: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '创建日期',
|
|
|
|
|
dataIndex: 'pbcCreateAt',
|
|
|
|
|
hideInTable: true,
|
|
|
|
|
valueType: 'dateTimeRange'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '状态',
|
|
|
|
|
dataIndex: 'pbcState',
|
|
|
|
|
dataIndex: 'pbcProductState',
|
|
|
|
|
valueType: 'select',
|
|
|
|
|
search: false,
|
|
|
|
|
valueEnum: Constants.pbcProductState,
|
|
|
|
|
@ -81,14 +97,21 @@ const TableList: React.FC<{}> = () => {
|
|
|
|
|
return (
|
|
|
|
|
<PageContainer
|
|
|
|
|
header={{
|
|
|
|
|
title: '',
|
|
|
|
|
title: userName || '',
|
|
|
|
|
breadcrumb: {},
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<ProTable<API.PbcBusiness>
|
|
|
|
|
columns={columns}
|
|
|
|
|
actionRef={actionRef}
|
|
|
|
|
request={fetchData}
|
|
|
|
|
request={(param: any) => {
|
|
|
|
|
const queryParam = {
|
|
|
|
|
userId: userId ? parseInt(userId) : undefined,
|
|
|
|
|
startDate: param.pbcCreateAt && param.pbcCreateAt.length > 1 ? param.pbcCreateAt[0] : undefined,
|
|
|
|
|
endDate: param.pbcCreateAt && param.pbcCreateAt.length > 1 ? param.pbcCreateAt[1] : undefined
|
|
|
|
|
}
|
|
|
|
|
return fetchData(queryParam);
|
|
|
|
|
}}
|
|
|
|
|
rowKey="pbcId"
|
|
|
|
|
size="small"
|
|
|
|
|
bordered
|
|
|
|
|
@ -100,6 +123,20 @@ const TableList: React.FC<{}> = () => {
|
|
|
|
|
defaultPageSize: 20,
|
|
|
|
|
showSizeChanger: true,
|
|
|
|
|
}}
|
|
|
|
|
formRef={ref}
|
|
|
|
|
toolbar={{
|
|
|
|
|
actions: [
|
|
|
|
|
<Button type="primary" onClick={() => {
|
|
|
|
|
const values: any = ref.current?.getFieldsValue();
|
|
|
|
|
const queryParam = {
|
|
|
|
|
userId: userId ? parseInt(userId) : undefined,
|
|
|
|
|
startDate: values?.pbcCreateAt && values?.pbcCreateAt.length > 1 ? values?.pbcCreateAt[0] : undefined,
|
|
|
|
|
endDate: values?.pbcCreateAt && values?.pbcCreateAt.length > 1 ? values?.pbcCreateAt[1] : undefined
|
|
|
|
|
}
|
|
|
|
|
handleExport(queryParam)
|
|
|
|
|
}}>导出</Button>
|
|
|
|
|
]
|
|
|
|
|
}}
|
|
|
|
|
scroll={{
|
|
|
|
|
y: 'calc(100vh - 320px)',
|
|
|
|
|
}}
|
|
|
|
|
|