From 769b5aaf23d33f2aa748dda4679b92a479bd9473 Mon Sep 17 00:00:00 2001 From: Joe Date: Sun, 7 Jul 2024 20:11:45 +0800 Subject: [PATCH] up --- .../OperationsDashboard/BusinessDetail.tsx | 73 +++++++- .../OperationsDashboard/ProductDetail.tsx | 101 +++++++---- src/pages/OperationsDashboard/index.tsx | 86 ++++++--- src/services/pop-b2b2c/errorController.ts | 30 ++-- .../pop-b2b2c/pbcUserRecordLogController.ts | 99 +++++++++++ src/services/pop-b2b2c/typings.d.ts | 166 +++++++++++++++++- 6 files changed, 470 insertions(+), 85 deletions(-) diff --git a/src/pages/OperationsDashboard/BusinessDetail.tsx b/src/pages/OperationsDashboard/BusinessDetail.tsx index 8cc824f..ba00058 100644 --- a/src/pages/OperationsDashboard/BusinessDetail.tsx +++ b/src/pages/OperationsDashboard/BusinessDetail.tsx @@ -1,18 +1,20 @@ import Constants from '@/constants'; +import { exportOperationalBusinessDataUsingPost, operationalBusinessDataUsingPost } 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 { Link, useAccess } from '@umijs/max'; +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 operationalBusinessDataUsingPost(params); return { data: msg.data?.records, total: msg.data?.total, @@ -20,12 +22,43 @@ const fetchData = async (params: API.PageVO) => { } as any; }; +const handleExport = async (values?: API.PbcOperationalDashboardDTO) => { + + const hide = message.loading('正在处理', 0); + try { + await exportOperationalBusinessDataUsingPost( + { ...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(); - const access: any = useAccess(); + const [searchParams] = useSearchParams(); + const userId = searchParams.get('userId'); + const userName = searchParams.get('userName'); + const ref = useRef>(); - const columns: ProColumns[] = [ + const columns: ProColumns[] = [ + { + title: '序号', + dataIndex: 'serialNumber', + search: false + }, { title: '商户编号', dataIndex: 'pbcBusinessCode', @@ -34,6 +67,7 @@ const TableList: React.FC<{}> = () => { { title: '商户名称', dataIndex: 'pbcBusinessName', + search: false }, { title: '联系人', @@ -62,7 +96,7 @@ const TableList: React.FC<{}> = () => { search: false, }, { - title: '注册日期', + title: '创建日期', dataIndex: 'pbcCreateAt', width: 150, valueType: 'dateTimeRange', @@ -78,14 +112,21 @@ const TableList: React.FC<{}> = () => { return ( 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 @@ -97,6 +138,20 @@ const TableList: React.FC<{}> = () => { defaultPageSize: 20, showSizeChanger: true, }} + formRef={ref} + toolbar={{ + actions: [ + + ] + }} scroll={{ y: 'calc(100vh - 320px)', }} diff --git a/src/pages/OperationsDashboard/ProductDetail.tsx b/src/pages/OperationsDashboard/ProductDetail.tsx index 0111109..fc75a1e 100644 --- a/src/pages/OperationsDashboard/ProductDetail.tsx +++ b/src/pages/OperationsDashboard/ProductDetail.tsx @@ -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(); + const [searchParams] = useSearchParams(); + const userId = searchParams.get('userId'); + const userName = searchParams.get('userName'); + const ref = useRef>(); - const columns: ProColumns[] = [ - { - 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[] = [ { - 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 ( 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: [ + + ] + }} scroll={{ y: 'calc(100vh - 320px)', }} diff --git a/src/pages/OperationsDashboard/index.tsx b/src/pages/OperationsDashboard/index.tsx index 548151f..cdd3395 100644 --- a/src/pages/OperationsDashboard/index.tsx +++ b/src/pages/OperationsDashboard/index.tsx @@ -1,18 +1,18 @@ import { queryAllRoleUsingPost } from '@/services/pop-b2b2c/pbcRoleController'; -import { - pbcUsersPageUsingPost, -} from '@/services/pop-b2b2c/pbcUsersController'; +import { exportOperationalDashboardUsingPost, operationalDashboardUsingPost } from '@/services/pop-b2b2c/pbcUserRecordLogController'; import { handlePageQuery } from '@/utils/utils'; -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 { Link } 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 operationalDashboardUsingPost(params); return { data: msg.data?.records, total: msg.data?.total, @@ -20,14 +20,43 @@ const fetchData = async (params: API.PageVO) => { } as any; }; +const handleExport = async (values?: API.PbcOperationalDashboardDTO) => { + + const hide = message.loading('正在处理', 0); + try { + await exportOperationalDashboardUsingPost( + { ...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 ref = useRef>(); const actionRef = useRef(); - const columns: ProColumns[] = [ + const columns: ProColumns[] = [ + { + title: '序号', + dataIndex: 'serialNumber', + search: false + }, { title: '人员姓名', - dataIndex: 'pbcUserNickName' + dataIndex: 'pbcUserName' }, { title: '手机号', @@ -53,13 +82,15 @@ const TableList: React.FC<{}> = () => { }, { title: '注册商家数', - dataIndex: 'pbcUserMobile', - search: false + dataIndex: 'registeredMerchantCount', + search: false, + render: (text, record) => {text} }, { title: '上传商品数', - dataIndex: 'pbcUserMobile', - search: false + dataIndex: 'productUploadCount', + search: false, + render: (text, record) => {text} }, ]; return ( @@ -69,23 +100,13 @@ const TableList: React.FC<{}> = () => { breadcrumb: {}, }} > - + columns={columns} actionRef={actionRef} request={(param: any) => { - console.log(param) - let hasUserType = false - if (param.pbcUserType) { - param.pbcUserType = parseInt(param.pbcUserType) - hasUserType = true - } - const queryParam = handlePageQuery(param); - if (!hasUserType && queryParam.filters) { - queryParam.filters.push({ - key: 'pbcUserType'.replace(/([A-Z])/g, '_$1').toLowerCase(), - value: 1, - action: '<=', - }); + const queryParam = { + userName: param.pbcUserName, + roleId: param.pbcUserRole } return fetchData(queryParam); }} @@ -100,6 +121,19 @@ const TableList: React.FC<{}> = () => { defaultPageSize: 20, showSizeChanger: true, }} + formRef={ref} + toolbar={{ + actions: [ + + ] + }} scroll={{ y: 'calc(100vh - 320px)', }} diff --git a/src/services/pop-b2b2c/errorController.ts b/src/services/pop-b2b2c/errorController.ts index 5f0967b..f29cc7f 100644 --- a/src/services/pop-b2b2c/errorController.ts +++ b/src/services/pop-b2b2c/errorController.ts @@ -2,41 +2,41 @@ /* eslint-disable */ import request from '@/utils/request'; -/** errorHtml GET /error */ -export async function errorHtmlUsingGet(options?: { [key: string]: any }) { - return request('/error', { +/** error GET /error */ +export async function errorUsingGet(options?: { [key: string]: any }) { + return request>('/error', { method: 'GET', ...(options || {}), }); } -/** errorHtml PUT /error */ -export async function errorHtmlUsingPut(options?: { [key: string]: any }) { - return request('/error', { +/** error PUT /error */ +export async function errorUsingPut(options?: { [key: string]: any }) { + return request>('/error', { method: 'PUT', ...(options || {}), }); } -/** errorHtml POST /error */ -export async function errorHtmlUsingPost(options?: { [key: string]: any }) { - return request('/error', { +/** error POST /error */ +export async function errorUsingPost(options?: { [key: string]: any }) { + return request>('/error', { method: 'POST', ...(options || {}), }); } -/** errorHtml DELETE /error */ -export async function errorHtmlUsingDelete(options?: { [key: string]: any }) { - return request('/error', { +/** error DELETE /error */ +export async function errorUsingDelete(options?: { [key: string]: any }) { + return request>('/error', { method: 'DELETE', ...(options || {}), }); } -/** errorHtml PATCH /error */ -export async function errorHtmlUsingPatch(options?: { [key: string]: any }) { - return request('/error', { +/** error PATCH /error */ +export async function errorUsingPatch(options?: { [key: string]: any }) { + return request>('/error', { method: 'PATCH', ...(options || {}), }); diff --git a/src/services/pop-b2b2c/pbcUserRecordLogController.ts b/src/services/pop-b2b2c/pbcUserRecordLogController.ts index faa41da..eefc0d5 100644 --- a/src/services/pop-b2b2c/pbcUserRecordLogController.ts +++ b/src/services/pop-b2b2c/pbcUserRecordLogController.ts @@ -32,6 +32,105 @@ export async function detailUsingPost( }); } +/** 导出运营人员的导入商户数据 POST /b2b2c/statical/exportOperationalBusinessData */ +export async function exportOperationalBusinessDataUsingPost( + body: API.PbcOperationalDashboardDTO, + options?: { [key: string]: any }, +) { + return request('/b2b2c/statical/exportOperationalBusinessData', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + }); +} + +/** 导出运营看板所有数据 POST /b2b2c/statical/exportOperationalDashboard */ +export async function exportOperationalDashboardUsingPost( + body: API.PbcOperationalDashboardDTO, + options?: { [key: string]: any }, +) { + return request('/b2b2c/statical/exportOperationalDashboard', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + }); +} + +/** 导出运营人员的导入商品数据 POST /b2b2c/statical/exportOperationalProductData */ +export async function exportOperationalProductDataUsingPost( + body: API.PbcOperationalDashboardDTO, + options?: { [key: string]: any }, +) { + return request('/b2b2c/statical/exportOperationalProductData', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + }); +} + +/** 获取运营人员的导入商户数据 POST /b2b2c/statical/operationalBusinessData */ +export async function operationalBusinessDataUsingPost( + body: API.PbcOperationalDashboardDTO, + options?: { [key: string]: any }, +) { + return request( + '/b2b2c/statical/operationalBusinessData', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + }, + ); +} + +/** 运营看板分页 POST /b2b2c/statical/operationalDashboard */ +export async function operationalDashboardUsingPost( + body: API.PbcOperationalDashboardDTO, + options?: { [key: string]: any }, +) { + return request( + '/b2b2c/statical/operationalDashboard', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + }, + ); +} + +/** 获取运营人员的导入商品数据 POST /b2b2c/statical/operationalProductData */ +export async function operationalProductDataUsingPost( + body: API.PbcOperationalDashboardDTO, + options?: { [key: string]: any }, +) { + return request( + '/b2b2c/statical/operationalProductData', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + }, + ); +} + /** 卖家h5端,今日数据, 返回参数:店铺浏览数:businessIndex, 商品浏览数:productDetail,注册数:userRegister,收藏数:addCollect 卖家h5端,今日数据 POST /b2b2c/statical/overview */ export async function overViewUsingPost(options?: { [key: string]: any }) { return request('/b2b2c/statical/overview', { diff --git a/src/services/pop-b2b2c/typings.d.ts b/src/services/pop-b2b2c/typings.d.ts index 6c33d4e..0221da2 100644 --- a/src/services/pop-b2b2c/typings.d.ts +++ b/src/services/pop-b2b2c/typings.d.ts @@ -60,6 +60,18 @@ declare namespace API { retmsg?: string; }; + type AjaxResultIPagePbcOperationalBusinessDataVO_ = { + data?: IPagePbcOperationalBusinessDataVO_; + retcode?: number; + retmsg?: string; + }; + + type AjaxResultIPagePbcOperationalProductVO_ = { + data?: IPagePbcOperationalProductVO_; + retcode?: number; + retmsg?: string; + }; + type AjaxResultIPagePbcProductVO_ = { data?: IPagePbcProductVO_; retcode?: number; @@ -90,6 +102,12 @@ declare namespace API { retmsg?: string; }; + type AjaxResultIPagePbcUserOperationalDataVO_ = { + data?: IPagePbcUserOperationalDataVO_; + retcode?: number; + retmsg?: string; + }; + type AjaxResultIPagePbcUsers_ = { data?: IPagePbcUsers_; retcode?: number; @@ -526,6 +544,22 @@ declare namespace API { total?: number; }; + type IPagePbcOperationalBusinessDataVO_ = { + current?: number; + pages?: number; + records?: PbcOperationalBusinessDataVO[]; + size?: number; + total?: number; + }; + + type IPagePbcOperationalProductVO_ = { + current?: number; + pages?: number; + records?: PbcOperationalProductVO[]; + size?: number; + total?: number; + }; + type IPagePbcProductVO_ = { current?: number; pages?: number; @@ -566,6 +600,14 @@ declare namespace API { total?: number; }; + type IPagePbcUserOperationalDataVO_ = { + current?: number; + pages?: number; + records?: PbcUserOperationalDataVO[]; + size?: number; + total?: number; + }; + type IPagePbcUsers_ = { current?: number; pages?: number; @@ -1074,7 +1116,7 @@ declare namespace API { /** 来源:微信分享,链接、二维码 */ pbcSourceType?: string; /** 分享人的id */ - shareUserId?: number; + pbcUserId?: number; }; type PbcBusinessPageDTO = { @@ -1391,11 +1433,13 @@ declare namespace API { type PbcDashBoardDTO = { /** 登录前的userid */ anonToken?: string; + /** 商户id */ + businessId?: number; endDate?: string; - /** 登录后的token */ - loginToken?: string; pbcCategoryType?: number; pbcQueryType?: number; + /** 分享人的id */ + pbcUserId?: number; startDate?: string; }; @@ -1416,6 +1460,99 @@ declare namespace API { pbcViewTotalNumber?: number; }; + type PbcOperationalBusinessDataVO = { + /** 商户id */ + businessId?: number; + /** 运营人员姓名 */ + operatorName?: string; + /** 运营人员手机 */ + operatorPhone?: string; + /** 商户对公账户 */ + pbcBusinessAccount?: string; + /** 商户地址 */ + pbcBusinessAddress?: string; + /** 商户区域 */ + pbcBusinessArea?: string; + /** 商户对公账户银行 */ + pbcBusinessBank?: string; + /** 商户城市 */ + pbcBusinessCity?: string; + /** 商户编号, 审核通过后生成 */ + pbcBusinessCode?: string; + /** 商户联系人 */ + pbcBusinessContact?: string; + /** 商户手机号 */ + pbcBusinessContactMobile?: string; + /** 商户联系人身份证 */ + pbcBusinessContactUserNo?: string; + /** 商户等级 */ + pbcBusinessLevel?: string; + /** 商户主营范围 */ + pbcBusinessMainCategory?: string; + /** 商户名称 */ + pbcBusinessName?: string; + /** 商户省份 */ + pbcBusinessProvince?: string; + /** 开业时间 */ + pbcBusinessStartDate?: string; + /** 商户类型 */ + pbcBusinessType?: string; + /** 创建时间 */ + pbcCreateAt?: string; + /** 社会统一信用代码 */ + pbcUnifiedSocialCreditCode?: string; + /** 序号 */ + serialNumber?: number; + }; + + type PbcOperationalDashboardDTO = { + /** 当前页 */ + current?: number; + /** 结束日期 */ + endDate?: string; + /** 条数 */ + pageSize?: number; + /** 角色id */ + roleId?: number; + /** 角色名称 */ + roleName?: string; + /** 开始日期 */ + startDate?: string; + /** 用户表id */ + userId?: number; + /** 用户名称 */ + userName?: string; + }; + + type PbcOperationalProductVO = { + /** 运营人员姓名 */ + operatorName?: string; + /** 运营人员手机 */ + operatorPhone?: string; + /** 商户id */ + pbcBusinessId?: number; + /** 商户名称 */ + pbcBusinessName?: string; + /** 商品细分类id */ + pbcProductCategoryId?: number; + /** 商品细分类 */ + pbcProductCategoryName?: string; + /** 商品编号 */ + pbcProductCode?: string; + /** 商品价格 */ + pbcProductPrice?: string; + /** 货架号 */ + pbcProductShelfNumber?: string; + /** 商品状态 */ + pbcProductState?: string; + /** 商品标题 */ + pbcProductTitle?: string; + /** 商品id */ + productId?: number; + /** 序号 */ + serialNumber?: number; + }; + type PbcProduct = { /** 商户id */ pbcBusinessId?: number; @@ -2129,6 +2266,29 @@ declare namespace API { pbcTitle?: string; }; + type PbcUserOperationalDataVO = { + /** 用户邮箱 */ + pbcUserEmail?: string; + /** 用户id */ + pbcUserId?: number; + /** 用户头像 */ + pbcUserImage?: string; + /** 用户手机号 */ + pbcUserMobile?: string; + /** 用户姓名 */ + pbcUserName?: string; + /** 角色id */ + pbcUserRole?: number; + /** 角色名称 */ + pbcUserRoleName?: string; + /** 上传商品数 */ + productUploadCount?: number; + /** 注册商家数 */ + registeredMerchantCount?: number; + /** 序号 */ + serialNumber?: number; + }; + type PbcUserRegisterDTO = { /** 商户id */ pbcBusinessId?: number;