Please enter the commit message for your changes. Lines starting

with '#' will be ignored, and an empty message aborts the commit.

On branch develop
Your branch is up to date with 'goflyapp/develop'.

Changes to be committed:
	modified:   zlt-business/file-center/src/main/resources/bootstrap.yml
	new file:   zlt-business/order-center/src/main/java/com/central/order/controller/DashboardController.java
	new file:   zlt-business/order-center/src/main/java/com/central/order/mapper/DashboardMapper.java
	new file:   zlt-business/order-center/src/main/java/com/central/order/model/vo/ChartStatistics.java
	new file:   zlt-business/order-center/src/main/java/com/central/order/model/vo/DashboardStatisticsVO.java
	new file:   zlt-business/order-center/src/main/java/com/central/order/model/vo/DeviceStatistics.java
	new file:   zlt-business/order-center/src/main/java/com/central/order/model/vo/DistributionDataVO.java
	new file:   zlt-business/order-center/src/main/java/com/central/order/model/vo/IncomeDataVO.java
	new file:   zlt-business/order-center/src/main/java/com/central/order/model/vo/IncomeStatistics.java
	new file:   zlt-business/order-center/src/main/java/com/central/order/model/vo/OrderStatistics.java
	new file:   zlt-business/order-center/src/main/java/com/central/order/model/vo/TourismRankingVO.java
	new file:   zlt-business/order-center/src/main/java/com/central/order/model/vo/TrendDataVO.java
	new file:   zlt-business/order-center/src/main/java/com/central/order/model/vo/WaylineStatistics.java
	new file:   zlt-business/order-center/src/main/java/com/central/order/service/IDashboardService.java
	new file:   zlt-business/order-center/src/main/java/com/central/order/service/impl/DashboardServiceImpl.java
	modified:   zlt-business/user-center/src/main/resources/bootstrap.yml
	modified:   zlt-uaa/src/main/resources/bootstrap.yml
	modified:   zlt-web/react-web/src/main/frontend/config/proxy.ts
	modified:   zlt-web/react-web/src/main/frontend/nginx.conf
	modified:   zlt-web/react-web/src/main/frontend/src/pages/Welcome.less
	modified:   zlt-web/react-web/src/main/frontend/src/pages/Welcome.tsx
	modified:   zlt-web/react-web/src/main/frontend/src/pages/orders/HomeCarousel/index.less
	modified:   zlt-web/react-web/src/main/frontend/src/pages/orders/HomeCarousel/index.tsx
	modified:   zlt-web/react-web/src/main/frontend/src/pages/orders/Qrcode/components/UpdateForm.tsx
	modified:   zlt-web/react-web/src/main/frontend/src/pages/orders/Qrcode/index.less
	modified:   zlt-web/react-web/src/main/frontend/src/pages/orders/Qrcode/index.tsx
	modified:   zlt-web/react-web/src/main/frontend/src/services/orders/api.ts
	modified:   zlt-web/react-web/src/main/frontend/src/services/orders/typings.d.ts
	modified:   zlt-web/react-web/src/main/frontend/src/services/welcome/api.ts
	modified:   zlt-web/react-web/src/main/frontend/src/services/welcome/typings.d.ts
This commit is contained in:
2025-04-14 14:27:19 +08:00
parent 4f39cbed1d
commit 981699d9d0
30 changed files with 1148 additions and 241 deletions
@@ -9,43 +9,43 @@
export default {
dev: {
'/api-uaa/': {
// target: 'http://119.45.169.13:9900',
target: 'http://127.0.0.1:9900',
target: 'http://119.45.169.13:9900',
// target: 'http://127.0.0.1:9900',
changeOrigin: true,
},
'/api-user/': {
target: 'http://127.0.0.1:9900',
// target: 'http://119.45.169.13:9900',
target: 'http://119.45.169.13:9900',
// target: 'http://127.0.0.1:9900',
changeOrigin: true,
},
'/api-log/': {
target: 'http://127.0.0.1:9900',
// target: 'http://119.45.169.13:9900',
target: 'http://119.45.169.13:9900',
// target: 'http://127.0.0.1:9900',
changeOrigin: true,
},
'/api-search/': {
target: 'http://127.0.0.1:9900',
// target: 'http://119.45.169.13:9900',
target: 'http://119.45.169.13:9900',
// target: 'http://127.0.0.1:9900',
changeOrigin: true,
},
'/api-generator/': {
target: 'http://127.0.0.1:9900',
// target: 'http://119.45.169.13:9900',
target: 'http://119.45.169.13:9900',
// target: 'http://127.0.0.1:9900',
changeOrigin: true,
},
'/api-file/': {
target: 'http://127.0.0.1:9900',
// target: 'http://119.45.169.13:9900',
target: 'http://119.45.169.13:9900',
// target: 'http://127.0.0.1:9900',
changeOrigin: true,
},
'/api-order/': {
target: 'http://127.0.0.1:9900',
// target: 'http://119.45.169.13:9900',
target: 'http://119.45.169.13:9900',
// target: 'http://127.0.0.1:9900',
changeOrigin: true,
},
'/api-device/': {
target: 'http://127.0.0.1:9900',
// target: 'http://119.45.169.13:9900',
target: 'http://119.45.169.13:9900',
// target: 'http://127.0.0.1:9900',
changeOrigin: true,
},
},
+10 -2
View File
@@ -10,7 +10,7 @@ server {
gzip_vary on;
gzip_proxied any;
root /usr/share/nginx/html;
root /usr/share/nginx/html/react-web;
index index.html;
# 支持 history 路由
@@ -19,7 +19,7 @@ server {
# 添加必要的跨域和缓存控制头
add_header Access-Control-Allow-Origin *;
add_header Cache-Control no-cache;
add_header Cache-Control "no-cache, no-store, must-revalidate";
# 添加安全相关头
add_header X-Frame-Options SAMEORIGIN;
@@ -68,4 +68,12 @@ server {
return 204;
}
}
# API 代理配置
location /api-order/ {
proxy_pass http://119.45.169.13:9900/api-order/; # 替换为您的后端API地址
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
@@ -1,10 +1,140 @@
@import (reference) '~antd/es/style/themes/index';
@import '~antd/es/style/themes/default.less';
.stat {
margin-top: @margin-md;
padding: @padding-md;
background-color: @white;
.container {
:global {
.ant-card {
border-radius: 8px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
transition: all 0.3s;
&:hover {
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.09);
}
}
}
}
.statCard {
height: 180px;
.statHeader {
display: flex;
align-items: center;
margin-bottom: 16px;
span {
margin-left: 8px;
font-size: 16px;
font-weight: 500;
}
}
.subStats {
margin-top: 16px;
display: flex;
justify-content: space-between;
align-items: flex-end;
:global {
.ant-statistic {
flex: 1;
}
.ant-progress {
width: 100px;
margin-left: 16px;
}
}
}
}
// 图标样式
.iconOrders {
font-size: 24px;
color: #1890ff;
}
.iconIncome {
font-size: 24px;
color: #52c41a;
}
.iconWayline {
font-size: 24px;
color: #722ed1;
}
.iconDevice {
font-size: 24px;
color: #faad14;
}
.trend {
font-size: 14px;
margin-left: 8px;
color: #52c41a;
}
.chartsRow {
margin-top: 16px;
}
.businessRow {
margin-top: 16px;
}
.rankList {
.rankItem {
display: flex;
align-items: center;
padding: 12px 0;
border-bottom: 1px solid #f0f0f0;
&:last-child {
border-bottom: none;
}
.rankNum {
width: 20px;
height: 20px;
line-height: 20px;
text-align: center;
background: #fafafa;
border-radius: 10px;
margin-right: 16px;
font-size: 12px;
color: #8c8c8c;
&.topThree {
color: #fff;
&:nth-child(1) { background: #f5222d; }
&:nth-child(2) { background: #fa8c16; }
&:nth-child(3) { background: #faad14; }
}
}
.rankName {
flex: 1;
color: rgba(0, 0, 0, 0.85);
}
.rankValue {
color: rgba(0, 0, 0, 0.45);
}
}
}
// 响应式调整
@media screen and (max-width: 768px) {
.statCard {
height: auto;
margin-bottom: 16px;
}
.chartsRow, .businessRow {
margin-top: 8px;
}
}
.pie {
@@ -111,3 +241,39 @@
}
}
}
.statisticIcon {
color: #1890ff;
font-size: 20px;
}
.statisticGroup {
margin-top: 24px;
}
.chartRow {
margin-top: 24px;
.ant-card {
height: 100%;
}
}
.tourismCard {
margin-top: 24px;
}
// 响应式调整
@media screen and (max-width: 768px) {
.statisticGroup {
margin-top: 16px;
}
.chartRow {
margin-top: 16px;
}
.tourismCard {
margin-top: 16px;
}
}
@@ -1,73 +1,64 @@
import { PageContainer, StatisticCard } from '@ant-design/pro-components';
import { Card, Tag, Space, Tabs, Col, Row, Skeleton, Empty } from 'antd';
import RcResizeObserver from 'rc-resize-observer';
import React, { useState, useEffect, useMemo } from 'react';
import { statistic } from '@/services/welcome/api';
import { Area, Pie } from '@ant-design/plots';
import { PageContainer } from '@ant-design/pro-components';
import { Card, Row, Col, Statistic, Progress, Typography } from 'antd';
import React, { useState, useEffect } from 'react';
import { dashboard } from '@/services/orders/api';
import { Area, Column, Pie } from '@ant-design/plots';
import {
ShoppingCartOutlined,
RocketOutlined,
MobileOutlined,
UserOutlined,
EyeOutlined,
TeamOutlined,
LineChartOutlined,
BarChartOutlined,
RiseOutlined,
PayCircleOutlined,
} from '@ant-design/icons';
import styles from './Welcome.less';
const { Divider } = StatisticCard;
const { Title } = Typography;
interface Statistics {
totalOrders: number;
todayOrders: number;
orderGrowth: number;
completionRate: number;
totalAmount: number;
todayAmount: number;
targetCompletion: number;
totalWaylines: number;
activeWaylines: number;
waylineUsage: number;
totalDevices: number;
onlineDevices: number;
deviceOnlineRate: number;
orderTrend: Array<{
date: string;
type: string;
value: number;
}>;
deviceDistribution: Array<{
type: string;
value: number;
}>;
incomeData: Array<{
type: string;
value: number;
}>;
tourismRanking: Array<{
id: string;
name: string;
value: number;
}>;
}
const Welcome: React.FC = () => {
const [responsive, setResponsive] = useState<boolean>(false);
const [loading, setLoading] = useState<boolean>(true);
const [statistics, setStatistics] = useState<WELCOME.Statistic>({});
const [weeks, setWeeks] = useState<WELCOME.AreaData[]>([]);
const [days, setDays] = useState<WELCOME.AreaData[]>([]);
const mapWeek = (result: WELCOME.Statistic) => {
const { statWeek_items, statWeek_pv, statWeek_uv } = result;
if (statWeek_items && statWeek_pv && statWeek_uv) {
const weekData = [
...statWeek_pv.map((pv, index) => ({
type: '访问量(PV)',
date: statWeek_items[index],
value: pv,
})),
...statWeek_uv.map((uv, index) => ({
type: '独立用户(UV)',
date: statWeek_items[index],
value: uv,
})),
];
setWeeks(weekData);
}
};
const mapDay = (result: WELCOME.Statistic) => {
const { statDate_items, statDate_pv, statDate_uv } = result;
if (statDate_items && statDate_pv && statDate_uv) {
const dayData = [
...statDate_pv.map((pv, index) => ({
type: '访问量(PV)',
date: statDate_items[index],
value: pv,
})),
...statDate_uv.map((uv, index) => ({
type: '独立用户(UV)',
date: statDate_items[index],
value: uv,
})),
];
setDays(dayData);
}
};
const [statistics, setStatistics] = useState<any>({});
const fetchData = async () => {
try {
setLoading(true);
const result = await statistic();
if (result) {
setStatistics(result);
mapWeek(result);
mapDay(result);
const result = await dashboard();
if (result.resp_code === 0) {
setStatistics(result.data);
}
} catch (error) {
console.error('获取统计数据失败:', error);
@@ -78,166 +69,191 @@ const Welcome: React.FC = () => {
useEffect(() => {
fetchData();
// 每5分钟刷新一次数据
const timer = setInterval(fetchData, 5 * 60 * 1000);
return () => clearInterval(timer);
}, []);
const areaConfig = useMemo(() => ({
smooth: true,
height: 260,
animation: true,
legend: {
layout: 'horizontal',
position: 'top',
},
// 更新数据访问方式
const orderStats = statistics.orderStats || {};
const incomeStats = statistics.incomeStats || {};
const waylineStats = statistics.waylineStats || {};
const deviceStats = statistics.deviceStats || {};
const chartStats = statistics.chartStats || {};
// 订单趋势配置
const orderTrendConfig = {
data: chartStats.orderTrend || [],
xField: 'date',
yField: 'value',
seriesField: 'type',
color: ['#1890ff', '#52c41a'],
smooth: true,
animation: true,
legend: {
position: 'top',
},
areaStyle: {
fillOpacity: 0.6,
},
tooltip: {
shared: true,
showCrosshairs: true,
},
}), []);
};
const pieConfig = useMemo(() => ({
height: 280,
// 设备分布配置
const deviceDistConfig = {
data: chartStats.deviceDistribution || [],
angleField: 'value',
colorField: 'name',
appendPadding: 10,
radius: 0.75,
animation: true,
colorField: 'type',
radius: 0.8,
label: {
type: 'spider',
labelHeight: 28,
content: '{name}\n{percentage}',
type: 'outer',
content: '{name} {percentage}',
},
legend: {
layout: 'horizontal',
position: 'bottom',
};
// 收入统计配置
const incomeConfig = {
data: chartStats.incomeData || [],
xField: 'type',
yField: 'value',
label: {
position: 'middle',
style: {
fill: '#FFFFFF',
opacity: 0.6,
},
},
interactions: [
{ type: 'element-selected' },
{ type: 'element-active' },
],
}), []);
};
return (
<PageContainer
subTitle="前后端分离的微服务架构"
tags={
<Space>
<Tag color="blue">简单</Tag>
<Tag color="green">高效</Tag>
<Tag color="purple">可扩展</Tag>
</Space>
}
>
<RcResizeObserver
key="resize-observer"
onResize={(offset) => setResponsive(offset.width < 596)}
>
<Skeleton loading={loading} active>
<StatisticCard.Group direction={responsive ? 'column' : 'row'}>
<StatisticCard
statistic={{
title: '在线人数',
value: statistics.currHour_uv,
icon: <UserOutlined />,
description: <Tag color="#434343">实时</Tag>,
}}
<PageContainer className={styles.container}>
{/* 核心指标 */}
<Row gutter={[16, 16]}>
<Col xs={24} sm={12} md={6}>
<Card className={styles.statCard} loading={loading}>
<div className={styles.statHeader}>
<ShoppingCartOutlined className={styles.iconOrders} />
<span>订单总览</span>
</div>
<Statistic
title="总订单数"
value={orderStats.totalOrders || 0}
suffix={
<span className={styles.trend}>
<RiseOutlined /> {orderStats.orderGrowth || 0}%
</span>
}
/>
<Divider type={responsive ? 'horizontal' : 'vertical'} />
<StatisticCard
statistic={{
title: '今日PV',
value: statistics.currDate_pv,
icon: <EyeOutlined />,
description: <Tag color="#52c41a">今日</Tag>,
}}
/>
<Divider type={responsive ? 'horizontal' : 'vertical'} />
<StatisticCard
statistic={{
title: '今日UV',
value: statistics.currDate_uv,
icon: <TeamOutlined />,
description: <Tag color="#52c41a">今日</Tag>,
}}
/>
<Divider type={responsive ? 'horizontal' : 'vertical'} />
<StatisticCard
statistic={{
title: '本周访问',
value: statistics.currWeek_pv,
icon: <LineChartOutlined />,
description: <Tag color="#1890ff">本周</Tag>,
}}
/>
<Divider type={responsive ? 'horizontal' : 'vertical'} />
<StatisticCard
statistic={{
title: '本月访问',
value: statistics.currMonth_pv,
icon: <BarChartOutlined />,
description: <Tag color="#faad14">本月</Tag>,
}}
/>
</StatisticCard.Group>
</Skeleton>
<div className={styles.subStats}>
<Statistic title="今日订单" value={orderStats.todayOrders || 0} />
<Statistic
title="完成率"
value={orderStats.completionRate || 0}
suffix="%"
/>
</div>
</Card>
</Col>
<Card className={styles.chartCard}>
<Tabs defaultActiveKey="1">
<Tabs.TabPane tab="周流量趋势" key="1">
{weeks.length > 0 ? (
<Area {...areaConfig} data={weeks} />
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
)}
</Tabs.TabPane>
<Tabs.TabPane tab="日流量趋势" key="2">
{days.length > 0 ? (
<Area {...areaConfig} data={days} />
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
)}
</Tabs.TabPane>
</Tabs>
</Card>
<Col xs={24} sm={12} md={6}>
<Card className={styles.statCard} loading={loading}>
<div className={styles.statHeader}>
<PayCircleOutlined className={styles.iconIncome} />
<span>收入统计</span>
</div>
<Statistic
title="总收入"
value={(incomeStats.totalAmount || 0) / 100}
precision={2}
prefix="¥"
/>
<div className={styles.subStats}>
<Statistic
title="今日收入"
value={(incomeStats.todayAmount || 0) / 100}
precision={2}
prefix="¥"
/>
<Progress
percent={incomeStats.targetCompletion || 0}
size="small"
status="active"
/>
</div>
</Card>
</Col>
<Row gutter={16} className={styles.pieRow}>
<Col xs={24} sm={24} md={12}>
<Card
title="浏览器分布"
bordered={false}
className={styles.pieCard}
>
{statistics.browser_datas?.length ? (
<Pie {...pieConfig} data={statistics.browser_datas} />
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
)}
</Card>
</Col>
<Col xs={24} sm={24} md={12}>
<Card
title="操作系统分布"
bordered={false}
className={styles.pieCard}
>
{statistics.operatingSystem_datas?.length ? (
<Pie {...pieConfig} data={statistics.operatingSystem_datas} />
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
)}
</Card>
</Col>
</Row>
</RcResizeObserver>
<Col xs={24} sm={12} md={6}>
<Card className={styles.statCard} loading={loading}>
<div className={styles.statHeader}>
<RocketOutlined className={styles.iconWayline} />
<span>航线概况</span>
</div>
<Statistic title="航线总数" value={waylineStats.totalWaylines || 0} />
<div className={styles.subStats}>
<Statistic title="活跃航线" value={waylineStats.activeWaylines || 0} />
<Progress
percent={waylineStats.waylineUsage || 0}
size="small"
status="active"
/>
</div>
</Card>
</Col>
<Col xs={24} sm={12} md={6}>
<Card className={styles.statCard} loading={loading}>
<div className={styles.statHeader}>
<MobileOutlined className={styles.iconDevice} />
<span>设备状态</span>
</div>
<Statistic title="设备总数" value={deviceStats.totalDevices || 0} />
<div className={styles.subStats}>
<Statistic title="在线设备" value={deviceStats.onlineDevices || 0} />
<Progress
percent={deviceStats.deviceOnlineRate || 0}
size="small"
status="active"
/>
</div>
</Card>
</Col>
</Row>
{/* 图表展示 */}
<Row gutter={[16, 16]} className={styles.chartsRow}>
<Col xs={24} md={16}>
<Card title="订单趋势" loading={loading}>
<Area {...orderTrendConfig} height={300} />
</Card>
</Col>
<Col xs={24} md={8}>
<Card title="设备分布" loading={loading}>
<Pie {...deviceDistConfig} height={300} />
</Card>
</Col>
</Row>
{/* 业务数据 */}
<Row gutter={[16, 16]} className={styles.businessRow}>
<Col xs={24} md={12}>
<Card title="收入构成" loading={loading}>
<Column {...incomeConfig} height={250} />
</Card>
</Col>
<Col xs={24} md={12}>
<Card title="景区排行" loading={loading}>
<div className={styles.rankList}>
{(statistics.tourismRanking || []).map((item: any, index: number) => (
<div key={item.id} className={styles.rankItem}>
<span className={`${styles.rankNum} ${index < 3 ? styles.topThree : ''}`}>
{index + 1}
</span>
<span className={styles.rankName}>{item.name}</span>
<span className={styles.rankValue}>{item.value}</span>
</div>
))}
</div>
</Card>
</Col>
</Row>
</PageContainer>
);
};
@@ -1 +1,24 @@
@import (reference) '~antd/es/style/themes/index';
// 添加查询栏样式
.query-filter {
padding: 24px 24px 0;
background-color: #fff;
border-radius: 2px;
:global {
.ant-form-item {
margin-bottom: 24px;
}
.ant-select,
.ant-input {
width: 100%;
}
}
}
// 调整表格上边距
.ant-pro-table {
margin-top: 16px;
}
@@ -201,24 +201,38 @@ const TableList: React.FC = () => {
defaultCollapsed={false}
split
span={6}
onFinish={setSearchParams}
className="query-filter"
onFinish={async (values) => {
setSearchParams(values);
actionRef.current?.reload();
}}
style={{ marginBottom: 16 }}
>
<ProFormText
name="title"
label="标题"
placeholder="请输入标题关键字"
fieldProps={{
allowClear: true,
}}
/>
<ProFormSelect
name="type"
label="类型"
placeholder="请选择类型"
options={TYPE_OPTIONS}
fieldProps={{
allowClear: true,
}}
/>
<ProFormSelect
name="status"
label="状态"
placeholder="请选择状态"
options={STATUS_OPTIONS}
fieldProps={{
allowClear: true,
}}
/>
</QueryFilter>
@@ -44,6 +44,13 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
initialValues={values}
>
<ProForm.Group>
<ProFormText
width="md"
name="name"
label="名称"
placeholder="请输入二维码名称"
rules={[{ required: true, message: '请输入名称' }]}
/>
<ProFormSelect
width="md"
name="waylineId"
@@ -1 +1,22 @@
@import (reference) '~antd/es/style/themes/index';
.ant-pro-table {
.ant-table-wrapper {
overflow-x: auto;
}
.ant-table-cell {
white-space: nowrap;
word-break: keep-all;
}
.ant-image {
display: flex;
align-items: center;
justify-content: center;
}
}
.query-filter {
margin-bottom: 16px;
}
@@ -197,6 +197,7 @@ const TableList: React.FC = () => {
dataIndex: 'index',
valueType: 'indexBorder',
width: 48,
fixed: 'left',
},
{
title: 'ID',
@@ -207,11 +208,18 @@ const TableList: React.FC = () => {
title: 'CodeID',
dataIndex: 'codeId',
width: 120,
ellipsis: true,
},
{
title: '名称',
dataIndex: 'name',
width: 120,
ellipsis: true,
},
{
title: '景区名称',
dataIndex: 'tourismId',
width: 160,
width: 140,
ellipsis: true,
render: (_, entity) => {
const tourism = tourismOptions.find(item => item.value === entity.tourismId);
@@ -221,7 +229,7 @@ const TableList: React.FC = () => {
{
title: '航线名称',
dataIndex: 'waylineId',
width: 160,
width: 140,
ellipsis: true,
render: (waylineId) => {
const wayline = waylineOptions.find(item => item.value === waylineId);
@@ -235,7 +243,8 @@ const TableList: React.FC = () => {
render: (viewUrl) => viewUrl ? (
<Image
src={viewUrl}
width={100}
width={80}
height={80}
style={{ objectFit: 'cover' }}
/>
) : '-',
@@ -255,19 +264,21 @@ const TableList: React.FC = () => {
{
title: '状态',
dataIndex: 'status',
width: 100,
width: 80,
render: (status) => renderStatus(status),
},
{
title: '创建时间',
dataIndex: 'createTime',
valueType: 'dateTime',
width: 180,
width: 160,
ellipsis: true,
},
{
title: '操作',
key: 'action',
width: 120,
fixed: 'right',
render: (_, record) => (
<Space>
<Link
@@ -334,9 +345,11 @@ const TableList: React.FC = () => {
request={qrcode}
search={false}
params={params}
scroll={{ x: 1500 }}
pagination={{
showSizeChanger: true,
showQuickJumper: true,
defaultPageSize: 10,
}}
toolBarRender={() => [
<Button
@@ -347,6 +360,10 @@ const TableList: React.FC = () => {
<PlusOutlined /> 新增二维码
</Button>,
]}
style={{
width: '100%',
overflow: 'auto',
}}
/>
<ModalForm
title="添加二维码"
@@ -362,6 +379,13 @@ const TableList: React.FC = () => {
onFinish={async (values) => handleTableAction('add', undefined, values)}
>
<ProForm.Group>
<ProFormText
width="md"
name="name"
label="名称"
placeholder="请输入二维码名称"
rules={[{ required: true, message: '请输入名称' }]}
/>
<ProFormSelect
width="md"
name="waylineId"
@@ -172,3 +172,10 @@ export async function getOrderDetail(orderNo: string) {
});
}
/** 获取首页统计数据 GET /api-order/dashboard/statistics */
export async function dashboard() {
return request('/api-order/dashboard/statistics', {
method: 'GET',
});
}
@@ -93,6 +93,51 @@ declare namespace ORDERS {
tenantId?: string;
updateTime?: string;
}
// 添加 Dashboard 相关类型
interface DashboardStatistics {
orderStats: {
totalOrders: number;
todayOrders: number;
orderGrowth: number;
completionRate: number;
};
incomeStats: {
totalAmount: number;
todayAmount: number;
targetCompletion: number;
};
waylineStats: {
totalWaylines: number;
activeWaylines: number;
waylineUsage: number;
};
deviceStats: {
totalDevices: number;
onlineDevices: number;
deviceOnlineRate: number;
};
chartStats: {
orderTrend: Array<{
date: string;
type: string;
value: number;
}>;
deviceDistribution: Array<{
type: string;
value: number;
}>;
incomeData: Array<{
type: string;
value: number;
}>;
};
tourismRanking: Array<{
id: string;
name: string;
value: number;
}>;
}
}
declare namespace API {
@@ -1,9 +1,10 @@
// @ts-ignore
/* eslint-disable */
import { request } from 'umi';
import { request } from '@/utils/request';
export async function statistic() {
return request<WELCOME.Statistic>('/api-log/requestStat', {
/** 获取首页统计数据 GET /api-order/dashboard */
export async function getDashboardStatistics() {
return request('/api-order/dashboard', {
method: 'GET',
});
}
@@ -31,4 +31,54 @@ declare namespace WELCOME {
date: Date;
value: number;
};
interface DashboardStatistics {
orderStats: {
totalOrders: number;
todayOrders: number;
orderGrowth: number;
completionRate: number;
};
incomeStats: {
totalAmount: number;
todayAmount: number;
targetCompletion: number;
};
waylineStats: {
totalWaylines: number;
activeWaylines: number;
waylineUsage: number;
};
deviceStats: {
totalDevices: number;
onlineDevices: number;
deviceOnlineRate: number;
};
chartStats: {
orderTrend: Array<{
date: string;
type: string;
value: number;
}>;
deviceDistribution: Array<{
type: string;
value: number;
}>;
incomeData: Array<{
type: string;
value: number;
}>;
};
tourismRanking: Array<{
id: string;
name: string;
value: number;
}>;
}
interface DashboardResponse {
resp_code: number;
resp_msg: string;
data: DashboardStatistics;
}
}