From af3bdb782c9503eddc9676821c76e95e3083e1cb Mon Sep 17 00:00:00 2001 From: Joe Date: Mon, 7 Jul 2025 16:27:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.ts | 1 - config/routes.ts | 5 + src/access.ts | 25 +++ src/pages/AuditsList/detail.tsx | 1 + src/pages/BusinessList/add.tsx | 1 + src/pages/BusinessList/detail.tsx | 1 + src/pages/Dashboard/index.tsx | 70 ++++---- src/pages/MemberList/index.tsx | 61 +++++-- src/pages/OrderList/detail.tsx | 1 + src/pages/ProductList/add.tsx | 161 ++++++++++++++++-- src/pages/ProductList/detail.tsx | 48 ++++-- src/pages/ProductList/index.tsx | 49 +++--- src/pages/PurchaseAgentList/detail.tsx | 1 + src/pages/RequirementAudits/detail.tsx | 1 + src/pages/SampleList/detail.tsx | 1 + src/pages/TrainingClasses/add.tsx | 1 + src/pages/TrainingClasses/detail.tsx | 1 + .../pop-b2b2c/pbcProductController.ts | 8 + .../pop-b2b2c/pbcProductHotController.ts | 2 +- .../pbcProductLabelConfigController.ts | 18 ++ .../pop-b2b2c/pbcProductLabelHotController.ts | 11 +- src/services/pop-b2b2c/pbcUsersController.ts | 15 ++ src/services/pop-b2b2c/typings.d.ts | 51 +++++- 23 files changed, 427 insertions(+), 107 deletions(-) diff --git a/config/config.ts b/config/config.ts index 782030a..8aa233b 100644 --- a/config/config.ts +++ b/config/config.ts @@ -39,7 +39,6 @@ export default defineConfig({ }, keepalive: [/./], tabsLayout: { - hasDropdown: true, hasFixedHeader: true }, /** diff --git a/config/routes.ts b/config/routes.ts index fb1403f..c1f53fd 100644 --- a/config/routes.ts +++ b/config/routes.ts @@ -116,6 +116,7 @@ export default [ name: '采购员管理', path: '/purchase-agent', icon: 'UserSwitch', + access: 'purchaseAgent', routes: [ { path: '/purchase-agent/list', @@ -141,6 +142,7 @@ export default [ name: '商家管理', path: '/business', icon: 'shop', + access: 'business', routes: [ { path: '/business/list', @@ -172,6 +174,7 @@ export default [ name: '会员管理', path: '/member', icon: 'team', + access: 'member', routes: [ { name: '会员管理', @@ -191,6 +194,7 @@ export default [ name: '商品管理', path: '/product', icon: 'skin', + access: 'product', routes: [ { name: '商品类目管理', @@ -241,6 +245,7 @@ export default [ name: '课程管理', path: '/training-classes', icon: 'book', + access: 'trainingClasses', routes: [ { name: '课程维护', diff --git a/src/access.ts b/src/access.ts index c9ff9a7..f72de5c 100644 --- a/src/access.ts +++ b/src/access.ts @@ -4,9 +4,11 @@ export default function access(initialState: { currentUser?: API.PbcUsersVO | undefined }) { const { currentUser } = initialState || {}; if (currentUser?.currentAuthority) { + console.log(currentUser.pbcUserRole) const params: any = { dashboard: false, dashboardUser: currentUser.pbcUserMobile !== '13052023298', + isBusiness: currentUser.pbcUserRole === 2, dashboardQuery: false, operations: false, operationsQuery: false, @@ -69,11 +71,34 @@ export default function access(initialState: { currentUser?: API.PbcUsersVO | un adBannerQuery: false, adBannerAdd: false, adBannerUpdate: false, + purchaseAgent: false, + purchaseAgentQuery: false, + recommendPurchaseAgentQuery: false, + trainingClasses: false, + trainingClassesQuery: false, + trainingClassesCategoryQuery: false, }; for (let i = 0; i < currentUser?.currentAuthority.length; i++) { const element = currentUser?.currentAuthority[i]; params[element] = true; } + params.product = + params.productCategoryQuery || + params.productLabelQuery || + params.productLabelTypeQuery || + params.productQuery; + params.member = + params.memberQuery || + params.memberGradeQuery; + params.purchaseAgent = + params.purchaseAgentQuery || + params.recommendPurchaseAgentQuery; + params.business = + params.businessQuery || + params.recommendBusinessQuery; + params.trainingClasses = + params.trainingClassesQuery || + params.trainingClassesCategoryQuery; return params; } return {}; diff --git a/src/pages/AuditsList/detail.tsx b/src/pages/AuditsList/detail.tsx index 756e442..205338a 100644 --- a/src/pages/AuditsList/detail.tsx +++ b/src/pages/AuditsList/detail.tsx @@ -35,6 +35,7 @@ const Detail: React.FC = () => { header={{ title: '', }} + footerToolBarProps={{ portalDom: false }} footer={ info.pbcBusinessApprovalResult === 0 ? [ diff --git a/src/pages/BusinessList/add.tsx b/src/pages/BusinessList/add.tsx index a4b42d8..8ee51a1 100644 --- a/src/pages/BusinessList/add.tsx +++ b/src/pages/BusinessList/add.tsx @@ -108,6 +108,7 @@ const Detail: React.FC = () => { header={{ title: '', }} + footerToolBarProps={{ portalDom: false }} footer={[ - } bordered={false}> - { - plot.on('plot:click', (evt: { x: any; y: any; }) => { - const { x, y } = evt; - const tooltipData = plot.chart.getTooltipItems({ x, y }); - let id = "" - if (tooltipData && tooltipData.length > 0) { - id = tooltipData[0].data.pbcBusinessId + + + + { + const param: any = ref.current?.getFieldsValue() + let startDate = param.pbcQueryType === 1 ? dayjs().format('YYYY-MM-DD') : dayjs().date(1).format('YYYY-MM-DD') + let endDate = dayjs().format('YYYY-MM-DD') + if (param.dateRange) { + startDate = dayjs(param.dateRange[0]).format('YYYY-MM-DD') + endDate = dayjs(param.dateRange[1]).format('YYYY-MM-DD') } - history.push(`/business/detail/${id}?isEdit=0`) - }); - }} /> - - + history.push(`/dashboard/business-views?startDate=${startDate}&endDate=${endDate}`) + }}>{'更多>>'} + } bordered={false}> + { + plot.on('plot:click', (evt: { x: any; y: any; }) => { + const { x, y } = evt; + const tooltipData = plot.chart.getTooltipItems({ x, y }); + let id = "" + if (tooltipData && tooltipData.length > 0) { + id = tooltipData[0].data.pbcBusinessId + } + history.push(`/business/detail/${id}?isEdit=0`) + }); + }} /> + + + { @@ -343,8 +353,6 @@ const Welcome: React.FC = () => { }} /> - - { @@ -375,8 +383,6 @@ const Welcome: React.FC = () => { }} /> - - diff --git a/src/pages/MemberList/index.tsx b/src/pages/MemberList/index.tsx index f596d0b..57f2cad 100644 --- a/src/pages/MemberList/index.tsx +++ b/src/pages/MemberList/index.tsx @@ -1,5 +1,6 @@ import Constants from '@/constants'; import { + getUsersPageByBusinessIdUsingPost, pbcUsersPageUsingPost, updateMemberRecordStateUsingGet, } from '@/services/pop-b2b2c/pbcUsersController'; @@ -7,7 +8,7 @@ import { gradeListUsingPost } from '@/services/pop-b2b2c/pbcVipGradeController'; import { handlePageQuery } from '@/utils/utils'; import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components'; import { PageContainer } from '@ant-design/pro-layout'; -import { Access, useAccess } from '@umijs/max'; +import { Access, useAccess, useModel } from '@umijs/max'; import { Button, message, Popconfirm, Switch } from 'antd'; import React, { useRef } from 'react'; @@ -24,6 +25,19 @@ const fetchData = async (params: API.PageVO) => { } as any; }; +/** + * 查询表格 + * @param param0 + */ +const fetchBusinessData = async (params: API.GetBusinessUserPageVO) => { + const msg = await getUsersPageByBusinessIdUsingPost(params); + return { + data: msg.data?.records, + total: msg.data?.total, + success: msg.retcode, + } as any; +}; + const handleUpdateState = async (id: number, state: number) => { const hide = message.loading('正在保存'); if (!id) return false; @@ -48,6 +62,9 @@ const TableList: React.FC<{}> = () => { const actionRef = useRef(); const access: any = useAccess(); + const { initialState } = useModel('@@initialState'); + const { currentUser } = initialState || { currentUser: {} }; + const columns: ProColumns[] = [ { title: '会员类型', @@ -83,6 +100,7 @@ const TableList: React.FC<{}> = () => { { title: '会员等级', dataIndex: 'pbcVipGradeName', + search: false, valueType: 'select', request: async () => { const msg = await gradeListUsingPost(); @@ -159,21 +177,34 @@ const TableList: React.FC<{}> = () => { 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: '<=', - }); + let queryParam + if (access.isBusiness) { + queryParam = { + ...param, + pbcBusinessId: currentUser?.pbcBusinessId, + startDate: param.pbcCreateAt && param.pbcCreateAt.length > 1 ? param.pbcCreateAt[0] : undefined, + endDate: param.pbcCreateAt && param.pbcCreateAt.length > 1 ? param.pbcCreateAt[1] : undefined, + pbcCreateAt: undefined + } + return fetchBusinessData(queryParam); + } else { + let hasUserType = false + if (param.pbcUserType) { + param.pbcUserType = parseInt(param.pbcUserType) + hasUserType = true + } + queryParam = handlePageQuery(param); + if (!hasUserType && queryParam.filters) { + queryParam.filters.push({ + key: 'pbcUserType'.replace(/([A-Z])/g, '_$1').toLowerCase(), + value: 1, + action: '<=', + }); + } + return fetchData(queryParam); } - return fetchData(queryParam); + + }} rowKey="pbcId" size="small" diff --git a/src/pages/OrderList/detail.tsx b/src/pages/OrderList/detail.tsx index af13b1c..858d572 100644 --- a/src/pages/OrderList/detail.tsx +++ b/src/pages/OrderList/detail.tsx @@ -79,6 +79,7 @@ const Detail: React.FC = () => { header={{ title: '', }} + footerToolBarProps={{ portalDom: false }} footer={[ ) : ( - + + + )} @@ -230,6 +236,9 @@ const TableList: React.FC<{}> = () => { startDate: param.pbcCreateAt && param.pbcCreateAt.length > 1 ? param.pbcCreateAt[0] : undefined, endDate: param.pbcCreateAt && param.pbcCreateAt.length > 1 ? param.pbcCreateAt[1] + ' 23:59:59' : undefined } + if (access.isBusiness) { + queryParam.pbcBusinessId = currentUser?.pbcBusinessId + } return fetchData(queryParam); }} rowKey="pbcId" diff --git a/src/pages/PurchaseAgentList/detail.tsx b/src/pages/PurchaseAgentList/detail.tsx index 6b1f40a..9f5fad3 100644 --- a/src/pages/PurchaseAgentList/detail.tsx +++ b/src/pages/PurchaseAgentList/detail.tsx @@ -33,6 +33,7 @@ const Detail: React.FC = () => { header={{ title: '', }} + footerToolBarProps={{ portalDom: false }} footer={ info.pbcReviewStatus === 0 ? [ diff --git a/src/pages/RequirementAudits/detail.tsx b/src/pages/RequirementAudits/detail.tsx index 61fe337..1d83c41 100644 --- a/src/pages/RequirementAudits/detail.tsx +++ b/src/pages/RequirementAudits/detail.tsx @@ -30,6 +30,7 @@ const Detail: React.FC = () => { header={{ title: '', }} + footerToolBarProps={{ portalDom: false }} footer={ info.pbcApprovalStatus === 0 ? [ diff --git a/src/pages/SampleList/detail.tsx b/src/pages/SampleList/detail.tsx index af13b1c..858d572 100644 --- a/src/pages/SampleList/detail.tsx +++ b/src/pages/SampleList/detail.tsx @@ -79,6 +79,7 @@ const Detail: React.FC = () => { header={{ title: '', }} + footerToolBarProps={{ portalDom: false }} footer={[