From fe7a7a82f649d050fb9ccdd22f72171c5f22f580 Mon Sep 17 00:00:00 2001 From: ylj20011123 Date: Fri, 19 Sep 2025 09:15:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=88=E5=BA=A6=E8=90=A5=E6=94=B6=E5=88=86?= =?UTF-8?q?=E6=9E=90=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes.ts | 5 + package.json | 2 +- .../monthlyRevenueAnalysis/index.tsx | 385 ++++++++++++++++++ .../revenueQOQReport/service.ts | 23 ++ src/utils/format.ts | 2 +- src/versionEnv.ts | 6 +- 6 files changed, 418 insertions(+), 5 deletions(-) create mode 100644 src/pages/reports/BusinessAnalysis/monthlyRevenueAnalysis/index.tsx diff --git a/config/routes.ts b/config/routes.ts index 310ba0c..47f01de 100644 --- a/config/routes.ts +++ b/config/routes.ts @@ -1631,6 +1631,11 @@ export default [ name: 'business/revenueQOQReport', component: './reports/BusinessAnalysis/revenueQOQReport', }, + { + path: 'business/monthlyRevenueAnalysis', + name: 'business/monthlyRevenueAnalysis', + component: './reports/BusinessAnalysis/monthlyRevenueAnalysis', + }, { path: 'region/business/revenueQOQReport', name: 'region/business/revenueQOQReport', diff --git a/package.json b/package.json index df7570f..2b9e042 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ant-design-pro", - "version": "4.5.57", + "version": "4.5.58", "private": true, "description": "An out-of-box UI solution for enterprise applications", "scripts": { diff --git a/src/pages/reports/BusinessAnalysis/monthlyRevenueAnalysis/index.tsx b/src/pages/reports/BusinessAnalysis/monthlyRevenueAnalysis/index.tsx new file mode 100644 index 0000000..5dc5fa0 --- /dev/null +++ b/src/pages/reports/BusinessAnalysis/monthlyRevenueAnalysis/index.tsx @@ -0,0 +1,385 @@ +import { connect } from "umi"; +import type { CurrentUser } from "umi"; +import type { ConnectState } from "@/models/connect"; +import React, { Children, useRef, useState } from "react"; +import ProCard from "@ant-design/pro-card"; +import { MenuFoldOutlined } from "@ant-design/icons"; +import type { FormInstance } from "antd"; +import { Button, message, Space, Spin, Tree } from "antd"; +import useRequest from "@ahooksjs/use-request"; +import { getServerpartTree } from "@/services/options"; +import type { ActionType } from "@ant-design/pro-table"; +import ProTable from "@ant-design/pro-table"; +import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSelectTree"; +import PageTitleBox from "@/components/PageTitleBox"; +import { exportXlsxFromProColumnsExcelJS } from "@/utils/exportExcelFun"; +import { ValueType } from "exceljs"; +import moment from 'moment' +import { handleGetBusinessItemSummary } from "../revenueQOQReport/service"; + + +const monthlyRevenueAnalysis: React.FC<{ currentUser: CurrentUser }> = (props) => { + const { currentUser } = props + const downloadBtnRef = useRef() + const actionRef = useRef(); + const formRef = useRef(); + const [reqDetailList, setReqDetailList] = useState(); // 合计项数据源 + const [printOut, setPrintOut] = useState(); // 打印数据的内容 + const [collapsible, setCollapsible] = useState(false) + const [treeView, setTreeView] = useState() + const [printIndex, setPrintIndex] = useState(new Date().getTime()) + + + // 树相关的属性和方法 + const [selectedId, setSelectedId] = useState() + // 导出的加载效果 + const [showLoading, setShowLoading] = useState(false) + // 是否显示打印的表格 + const [showExportTable, setShowExportTable] = useState(false) + // 查询的条件 + const [searchParams, setSearchParams] = useState() + // 表格表头 显示的时间 + const [tableTitle, setTableTitle] = useState({ + thisMonthStart: "", + thisMonthEnd: "", + thisYearStart: "", + thisYearEnd: "", + thisYear: "", + lastYear: "" + }) + + const columns: any = [ + { + title: '统计口径', + dataIndex: "DataType", + hideInTable: true, + valueType: 'select', + fieldProps: { + options: [ + { label: "全部", value: 3 }, + { label: "业态", value: 1 }, + { label: "中心", value: 2 }, + ] + }, + initialValue: 3 + }, + { + title: '统计月份', + dataIndex: 'searchMonth', + valueType: "date", + hideInTable: true, + initialValue: moment(), + fieldProps: { + picker: "month", + format: 'YYYY-MM', + } + }, + { + title:
类别
, + width: 120, + dataIndex: "Item_Name", + hideInSearch: true, + ellipsis: true, + }, + { + title:
项目
, + width: 120, + dataIndex: "Serverpart_Name", + hideInSearch: true, + ellipsis: true, + }, + { + title: `本月${tableTitle?.thisMonthStart && tableTitle?.thisMonthEnd ? `(${tableTitle?.thisMonthStart}-${tableTitle?.thisMonthEnd})` : ""}`, + dataIndex: "RevenueAmount", + hideInSearch: true, + align: 'center', + children: [ + { + title:
{`${tableTitle?.lastYear}年`}
, + dataIndex: "RevenueAmountFirst", + hideInSearch: true, + ellipsis: true, + children: [ + { + title:
总额
, + width: 120, + dataIndex: ["RevenueAmount", "curData"], + hideInSearch: true, + align: 'right', + valueType: 'digit', + ellipsis: true, + }, + ] + }, + + + { + title:
{`${tableTitle?.thisYear}年`}
, + dataIndex: "RevenueAmountSecond", + hideInSearch: true, + ellipsis: true, + children: [ + { + title:
总额
, + width: 120, + dataIndex: ["RevenueAmount", "compareData"], + hideInSearch: true, + ellipsis: true, + align: 'right', + valueType: 'digit', + }, + { + title:
增长
, + width: 120, + dataIndex: ["RevenueAmount", "increaseData"], + hideInSearch: true, + ellipsis: true, + align: 'right', + valueType: 'digit', + }, + { + title:
增幅
, + width: 120, + dataIndex: "RevenueAmount.increaseRate", + hideInSearch: true, + ellipsis: true, + align: 'right', + valueType: 'digit', + render: (_, record) => { + return record?.RevenueAmount?.increaseRate ? `${record?.RevenueAmount?.increaseRate}%` : "-" + } + }, + ] + }, + ] + }, + + { + title: `年度累计${tableTitle?.thisYearStart && tableTitle?.thisYearEnd ? `(${tableTitle?.thisYearStart}-${tableTitle?.thisYearEnd})` : ""}`, + dataIndex: "ACCRevenueAmount", + hideInSearch: true, + align: 'center', + children: [ + { + title:
{`${tableTitle?.lastYear}年`}
, + dataIndex: "ACCRevenueAmountFirst", + hideInSearch: true, + ellipsis: true, + children: [ + { + title:
总额
, + width: 120, + dataIndex: ["ACCRevenueAmount", "curData"], + hideInSearch: true, + ellipsis: true, + align: 'right', + valueType: 'digit', + }, + ] + }, + { + title:
{`${tableTitle?.thisYear}年`}
, + dataIndex: "ACCRevenueAmountSecond", + hideInSearch: true, + ellipsis: true, + children: [ + { + title:
总额
, + width: 120, + dataIndex: ["ACCRevenueAmount", "compareData"], + hideInSearch: true, + ellipsis: true, + align: 'right', + valueType: 'digit', + }, + { + title:
增长
, + width: 120, + dataIndex: ["ACCRevenueAmount", "increaseData"], + hideInSearch: true, + ellipsis: true, + align: 'right', + valueType: 'digit', + }, + { + title:
增幅
, + width: 120, + dataIndex: "ACCRevenueAmount.increaseRate", + hideInSearch: true, + ellipsis: true, + align: 'right', + valueType: 'digit', + render: (_, record) => { + return record?.ACCRevenueAmount?.increaseRate ? `${record?.ACCRevenueAmount?.increaseRate}%` : "-" + } + }, + ] + }, + ] + } + ] + + + return ( +
{ + // 打印报表 + if (!reqDetailList || reqDetailList.length === 0) return; + setPrintOut(el); + }} > + + { + showLoading ? +
+
+ + 数据导出中... +
+
: '' + } + +
+ +
+ } // 列表表头 + search={{ span: 6 }} + request={async (params) => { + if (!selectedId) { + return + } + console.log('paramsparamsparamsparams', params); + console.log('currentUsercurrentUsercurrentUser', currentUser); + const req: any = { + DataType: params?.DataType || 3, + ProvinceCode: currentUser?.ProvinceCode, + ServerpartId: selectedId, + StartDate: params?.searchMonth ? moment(params?.searchMonth).startOf('M').format('YYYY-MM-DD') : "", + EndDate: params?.searchMonth ? new Date(moment().subtract(1, 'd').format('YYYY-MM-DD')).getTime() < new Date(moment(params?.searchMonth).endOf('M').format('YYYY-MM-DD')).getTime() ? moment().subtract(1, 'd').format('YYYY-MM-DD') : moment(params?.searchMonth).endOf('M').format('YYYY-MM-DD') : "", + } + setSearchParams(params) + const data = await handleGetBusinessItemSummary(req) + if (params?.searchMonth) { + setTableTitle( + { + thisMonthStart: moment(params?.searchMonth).startOf('M').format('MM.DD'), + thisMonthEnd: new Date(moment().subtract(1, 'd').format('YYYY-MM-DD')).getTime() < new Date(moment(params?.searchMonth).endOf('M').format('YYYY-MM-DD')).getTime() ? moment().subtract(1, 'd').format('MM.DD') : moment(params?.searchMonth).endOf('M').format('MM.DD'), + thisYearStart: moment(params?.searchMonth).startOf('y').format('MM.DD'), + thisYearEnd: new Date(moment().subtract(1, 'd').format('YYYY-MM-DD')).getTime() < new Date(moment(params?.searchMonth).endOf('M').format('YYYY-MM-DD')).getTime() ? moment().subtract(1, 'd').format('MM.DD') : moment(params?.searchMonth).endOf('M').format('MM.DD'), + thisYear: moment(params?.searchMonth).format('YYYY'), + lastYear: moment(params?.searchMonth).subtract(1, 'y').format('YYYY') + } + ) + } + console.log('data', data); + if (data && data.length > 0) { + let list: any = JSON.parse(JSON.stringify(data)) + list.forEach((item: any) => { + // 处理百分号 + item.RevenueAmount.increaseRate = item.RevenueAmount?.increaseRate ? item.RevenueAmount?.increaseRate + '%' : "" + item.ACCRevenueAmount.increaseRate = item.ACCRevenueAmount?.increaseRate ? item.ACCRevenueAmount?.increaseRate + '%' : "" + + // 处理数字的千分号 + item.RevenueAmount.curData = item.RevenueAmount.curData.toLocaleString() || 0 + item.RevenueAmount.compareData = item.RevenueAmount.compareData.toLocaleString() || 0 + item.RevenueAmount.increaseData = item.RevenueAmount.increaseData.toLocaleString() || 0 + item.ACCRevenueAmount.curData = item.ACCRevenueAmount.curData.toLocaleString() || 0 + item.ACCRevenueAmount.compareData = item.ACCRevenueAmount.compareData.toLocaleString() || 0 + item.ACCRevenueAmount.increaseData = item.ACCRevenueAmount.increaseData.toLocaleString() || 0 + if (item.children && item.children.length > 0) { + item.children.forEach((subItem: any) => { + // 处理百分号 + subItem.RevenueAmount.increaseRate = subItem.RevenueAmount?.increaseRate ? subItem.RevenueAmount?.increaseRate + '%' : "" + subItem.ACCRevenueAmount.increaseRate = subItem.ACCRevenueAmount?.increaseRate ? subItem.ACCRevenueAmount?.increaseRate + '%' : "" + + // 处理数字的千分号 + subItem.RevenueAmount.curData = subItem.RevenueAmount.curData.toLocaleString() || 0 + subItem.RevenueAmount.compareData = subItem.RevenueAmount.compareData.toLocaleString() || 0 + subItem.RevenueAmount.increaseData = subItem.RevenueAmount.increaseData.toLocaleString() || 0 + subItem.ACCRevenueAmount.curData = subItem.ACCRevenueAmount.curData.toLocaleString() || 0 + subItem.ACCRevenueAmount.compareData = subItem.ACCRevenueAmount.compareData.toLocaleString() || 0 + subItem.ACCRevenueAmount.increaseData = subItem.ACCRevenueAmount.increaseData.toLocaleString() || 0 + }) + } + }) + setReqDetailList(list) + return { data, success: true } + } + setReqDetailList([]) + return { data: [], success: true } + + }} + toolbar={{ + actions: [ + // + // + // , + + ] + }} + /> +
+
+
+ ) +} + +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser +}))(monthlyRevenueAnalysis); diff --git a/src/pages/reports/BusinessAnalysis/revenueQOQReport/service.ts b/src/pages/reports/BusinessAnalysis/revenueQOQReport/service.ts index f3504e4..cc2eb1e 100644 --- a/src/pages/reports/BusinessAnalysis/revenueQOQReport/service.ts +++ b/src/pages/reports/BusinessAnalysis/revenueQOQReport/service.ts @@ -67,3 +67,26 @@ export async function handleGetRevenueYOYQOQByDate(params: any) { const treeTable = wrapTreeNode(data.Result_Data.List); return treeTable } + + +// 获取安徽驿达月度营收分析 +export async function handleGetBusinessItemSummary(params: any) { + const data = await request('/Revenue/GetBusinessItemSummary', { + method: 'GET', + params + }) + + if (data.Result_Code !== 100) { + return { + data: [], + otherData: '', + current: 1, + pageSize: 20, + total: 0, + success: true, + }; + } + + const treeTable = wrapTreeNode(data.Result_Data.List); + return treeTable +} diff --git a/src/utils/format.ts b/src/utils/format.ts index e56055f..fd8ed4a 100644 --- a/src/utils/format.ts +++ b/src/utils/format.ts @@ -667,7 +667,7 @@ export const handleSetPublicLog = (obj: any) => { BUSINESSMAN_NAME: currentUser.BusinessManName, SOURCE_PLATFORM: '驿商云平台', USER_LOGINIP: basicInfo.ip, - USER_LOGINPLACE: `${basicInfo.country}${basicInfo.prov}${basicInfo.city}${basicInfo.district}`, + USER_LOGINPLACE: `${basicInfo.country || ""}${basicInfo.prov || ""}${basicInfo.city || ""}${basicInfo.district || ""}`, BROWSER_VERSION: browserVersion, OPERATING_SYSTEM: systemBasin } diff --git a/src/versionEnv.ts b/src/versionEnv.ts index 6f349a1..f48e350 100644 --- a/src/versionEnv.ts +++ b/src/versionEnv.ts @@ -1,4 +1,4 @@ // 由 scripts/writeVersion.js 自动生成 -export const VERSION = "4.5.57"; -export const GIT_HASH = "8f8b347"; -export const BUILD_TIME = "2025-09-18T01:29:44.333Z"; +export const VERSION = "4.5.58"; +export const GIT_HASH = "f7e3cc6"; +export const BUILD_TIME = "2025-09-18T14:27:48.181Z";