首页统计

This commit is contained in:
2025-10-01 03:51:53 +08:00
parent dbd4d4d198
commit 66d09ef19c
32 changed files with 1293 additions and 499 deletions
+161 -98
View File
@@ -1,123 +1,186 @@
import React, { useEffect, useState } from 'react';
import { Card, Space, Typography, Row, Col, Statistic, Progress, Button } from 'antd';
import { RocketOutlined, TeamOutlined, AppstoreOutlined, CloudServerOutlined, TrophyOutlined, ThunderboltOutlined, GlobalOutlined, SafetyOutlined } from '@ant-design/icons';
import React, { useEffect, useRef, useState } from 'react';
import { Card, Space, Typography, Row, Col, Statistic, Segmented, Button, message } from 'antd';
import { ShoppingCartOutlined, PayCircleOutlined, ReloadOutlined } from '@ant-design/icons';
import { Line, Pie } from '@ant-design/plots';
import TenantScopeFilter from '@/components/TenantScopeFilter';
import { dashboardApi } from '@/services/dashboard';
const { Title, Paragraph } = Typography;
const { Title, Text } = Typography;
const Welcome: React.FC = () => {
const [time, setTime] = useState(new Date());
const [tenantId, setTenantId] = useState<string>();
const [includeChildren, setIncludeChildren] = useState<boolean>(true);
const [statType, setStatType] = useState<'day' | 'month' | 'year'>('day');
const [loading, setLoading] = useState<boolean>(false);
const [pageLoading, setPageLoading] = useState<boolean>(true);
const firstLoadRef = useRef(true);
const [stat, setStat] = useState<any>({ orderStats: {}, chartStats: {} });
const load = async () => {
if (firstLoadRef.current) setPageLoading(true);
setLoading(true);
try {
const res: any = await dashboardApi.statistics({ tenantId, includeChildren, statType });
setStat(res?.data || res);
} catch (e) {
message.error('加载统计失败');
} finally {
setLoading(false);
if (firstLoadRef.current) {
firstLoadRef.current = false;
setPageLoading(false);
}
}
};
// 仅当选择了租户后再拉取,避免进入页面出现“空 -> 有”的闪动
useEffect(() => {
const timer = setInterval(() => setTime(new Date()), 1000);
return () => clearInterval(timer);
}, []);
if (!tenantId) return;
load();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [tenantId, includeChildren, statType]);
const stats = [
{ title: '今日订单', value: 1234, icon: <AppstoreOutlined />, color: '#667eea' },
{ title: '活跃用户', value: 856, icon: <TeamOutlined />, color: '#764ba2' },
{ title: '设备在线', value: 98, suffix: '%', icon: <CloudServerOutlined />, color: '#f093fb' },
{ title: '系统可用率', value: 99.9, suffix: '%', icon: <SafetyOutlined />, color: '#4facfe' },
];
const orderStats = stat?.orderStats || {};
const chartStats = stat?.chartStats || {};
const quickActions = [
{ title: '新增订单', icon: <AppstoreOutlined />, color: '#667eea' },
{ title: '用户管理', icon: <TeamOutlined />, color: '#764ba2' },
{ title: '设备监控', icon: <CloudServerOutlined />, color: '#f093fb' },
{ title: '系统设置', icon: <SafetyOutlined />, color: '#4facfe' },
];
const trendData = chartStats?.orderTrend || [];
const distributionData = chartStats?.orderDistribution || [];
const trendConfig: any = {
data: trendData,
xField: 'date',
yField: 'value',
seriesField: 'type',
smooth: true,
height: 300,
legend: { position: 'top' },
tooltip: { shared: true },
animation: false,
};
const distributionConfig: any = {
data: distributionData,
angleField: 'value',
colorField: 'type',
radius: 0.9,
label: { type: 'outer', content: '{name}\n{percentage}' },
animation: false,
};
return (
<div className="page-enter" style={{ padding: 24 }}>
<Card className="modern-card" style={{ background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)', border: 'none', marginBottom: 24, color: 'white' }}>
<Row align="middle" justify="space-between">
<Col>
<Space direction="vertical" size={8}>
<Title level={2} style={{ color: 'white', margin: 0 }}>
<RocketOutlined style={{ marginRight: 12 }} /> 欢迎使用 Go-Fly Admin
</Title>
<Paragraph style={{ color: 'rgba(255,255,255,0.8)', margin: 0, fontSize: 16 }}>现代化的智能管理平台 · 科技驱动未来</Paragraph>
<Paragraph style={{ color: 'rgba(255,255,255,0.6)', margin: 0 }}>当前时间:{time.toLocaleString()}</Paragraph>
</Space>
{/* 顶部工具区:左标题,右侧筛选/粒度/刷新 */}
<Card className="modern-card" style={{ marginBottom: 16 }}>
<Row align="middle" justify="space-between" gutter={[12, 12]}>
<Col flex="none">
<Title level={4} style={{ margin: 0 }}>首页统计</Title>
</Col>
<Col>
<TenantScopeFilter useSwitchTenant onChanged={() => { /* 切换后由后端上下文生效 */ }} />
<Col flex="auto">
<Space style={{ width: '100%', justifyContent: 'flex-end', flexWrap: 'wrap' }} size={12}>
<TenantScopeFilter autoApply onChanged={(tid, inc) => { setTenantId(tid); setIncludeChildren(!!inc); }} />
<Space>
<span>统计粒度</span>
<Segmented
options={[
{ label: '日', value: 'day' },
{ label: '月', value: 'month' },
{ label: '年', value: 'year' },
]}
value={statType}
onChange={(val) => setStatType(val as any)}
/>
</Space>
<Button type="primary" icon={<ReloadOutlined />} loading={loading && !pageLoading} onClick={load}>刷新</Button>
</Space>
</Col>
</Row>
</Card>
<Row gutter={[24, 24]} style={{ marginBottom: 24 }}>
{stats.map((stat, index) => (
<Col xs={12} sm={12} md={6} key={index}>
<Card className="modern-card" style={{ textAlign: 'center', borderLeft: `4px solid ${stat.color}`, background: 'var(--bg-card)' }}>
<div style={{ color: stat.color, fontSize: 24, marginBottom: 8 }}>{stat.icon}</div>
<Statistic title={stat.title} value={stat.value} suffix={stat.suffix} valueStyle={{ color: 'var(--text-primary)', fontSize: 28, fontWeight: 'bold' }} />
</Card>
</Col>
))}
</Row>
<Row gutter={[24, 24]}>
{/* KPI 指标卡:两列均分,内容居中,不留空白 */}
<Row gutter={[16, 16]}>
<Col xs={24} md={12}>
<Card className="modern-card" title={<span style={{ color: 'var(--text-primary)' }}><ThunderboltOutlined style={{ marginRight: 8, color: '#667eea' }} />系统状态</span>}>
<Space direction="vertical" style={{ width: '100%' }} size={16}>
<div>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 8 }}>
<span style={{ color: 'var(--text-secondary)' }}>CPU 使用率</span>
<span style={{ color: 'var(--text-primary)' }}>45%</span>
</div>
<Progress percent={45} strokeColor="#667eea" />
</div>
<div>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 8 }}>
<span style={{ color: 'var(--text-secondary)' }}>内存使用率</span>
<span style={{ color: 'var(--text-primary)' }}>68%</span>
</div>
<Progress percent={68} strokeColor="#764ba2" />
</div>
<div>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 8 }}>
<span style={{ color: 'var(--text-secondary)' }}>磁盘使用率</span>
<span style={{ color: 'var(--text-primary)' }}>32%</span>
</div>
<Progress percent={32} strokeColor="#f093fb" />
</div>
</Space>
</Card>
</Col>
<Col xs={24} md={12}>
<Card className="modern-card" title={<span style={{ color: 'var(--text-primary)' }}><TrophyOutlined style={{ marginRight: 8, color: '#667eea' }} />快捷操作</span>}>
<Row gutter={[16, 16]}>
{quickActions.map((action, index) => (
<Col span={12} key={index}>
<Button
block
size="large"
className="tech-button"
style={{ height: 64, background: `linear-gradient(135deg, ${action.color}33, ${action.color}11)`, border: `1px solid ${action.color}44`, color: action.color, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}
>
<div style={{ fontSize: 20, marginBottom: 4 }}>{action.icon}</div>
<div style={{ fontSize: 12 }}>{action.title}</div>
</Button>
<Card loading={pageLoading}>
<Space direction="vertical" style={{ width: '100%' }} size={12}>
<Space align="center" size={8}>
<ShoppingCartOutlined />
<Text strong>订单</Text>
</Space>
<Row gutter={8} align="middle" style={{ width: '100%' }}>
<Col xs={12} sm={10} md={10}><Text type="secondary">总订单数</Text></Col>
<Col xs={12} sm={14} md={14} style={{ textAlign: 'right' }}>
<Statistic value={orderStats.totalOrders || 0} valueStyle={{ fontWeight: 600, whiteSpace: 'nowrap' }} groupSeparator="," />
</Col>
))}
</Row>
</Row>
<Row gutter={8} align="middle" style={{ width: '100%' }}>
<Col xs={12} sm={10} md={10}><Text type="secondary">退款订单数</Text></Col>
<Col xs={12} sm={14} md={14} style={{ textAlign: 'right' }}>
<Statistic value={orderStats.refundedOrders || 0} valueStyle={{ fontWeight: 600, whiteSpace: 'nowrap' }} groupSeparator="," />
</Col>
</Row>
<Row gutter={8} align="middle" style={{ width: '100%' }}>
<Col xs={12} sm={10} md={10}><Text type="secondary">今日订单</Text></Col>
<Col xs={12} sm={14} md={14} style={{ textAlign: 'right' }}>
<Statistic value={orderStats.todayOrders || 0} valueStyle={{ fontWeight: 600, whiteSpace: 'nowrap' }} groupSeparator="," />
</Col>
</Row>
<Row gutter={8} align="middle" style={{ width: '100%' }}>
<Col xs={12} sm={10} md={10}><Text type="secondary">今日退款</Text></Col>
<Col xs={12} sm={14} md={14} style={{ textAlign: 'right' }}>
<Statistic value={orderStats.todayRefundedOrders || 0} valueStyle={{ fontWeight: 600, whiteSpace: 'nowrap' }} groupSeparator="," />
</Col>
</Row>
</Space>
</Card>
</Col>
<Col xs={24} md={12}>
<Card loading={pageLoading}>
<Space direction="vertical" style={{ width: '100%' }} size={12}>
<Space align="center" size={8}>
<PayCircleOutlined />
<Text strong>收入</Text>
</Space>
<Row gutter={8} align="middle" style={{ width: '100%' }}>
<Col xs={12} sm={10} md={10}><Text type="secondary">订单总金额(元)</Text></Col>
<Col xs={12} sm={14} md={14} style={{ textAlign: 'right' }}>
<Statistic value={(orderStats.totalAmount || 0) / 100} precision={2} valueStyle={{ fontWeight: 600, whiteSpace: 'nowrap' }} groupSeparator="," />
</Col>
</Row>
<Row gutter={8} align="middle" style={{ width: '100%' }}>
<Col xs={12} sm={10} md={10}><Text type="secondary">退款金额(元)</Text></Col>
<Col xs={12} sm={14} md={14} style={{ textAlign: 'right' }}>
<Statistic value={(orderStats.refundAmount || 0) / 100} precision={2} valueStyle={{ fontWeight: 600, whiteSpace: 'nowrap' }} groupSeparator="," />
</Col>
</Row>
<Row gutter={8} align="middle" style={{ width: '100%' }}>
<Col xs={12} sm={10} md={10}><Text type="secondary">净收入(元)</Text></Col>
<Col xs={12} sm={14} md={14} style={{ textAlign: 'right' }}>
<Statistic value={(orderStats.netIncome || 0) / 100} precision={2} valueStyle={{ fontWeight: 600, whiteSpace: 'nowrap' }} groupSeparator="," />
</Col>
</Row>
<Row gutter={8} align="middle" style={{ width: '100%' }}>
<Col xs={12} sm={10} md={10}><Text type="secondary">净订单数(笔)</Text></Col>
<Col xs={12} sm={14} md={14} style={{ textAlign: 'right' }}>
<Statistic value={(orderStats.totalOrders || 0) - (orderStats.refundedOrders || 0)} valueStyle={{ fontWeight: 600, whiteSpace: 'nowrap' }} groupSeparator="," />
</Col>
</Row>
</Space>
</Card>
</Col>
</Row>
<Card className="modern-card" style={{ marginTop: 24 }} title={<span style={{ color: 'var(--text-primary)' }}><GlobalOutlined style={{ marginRight: 8, color: '#667eea' }} />平台特性</span>}>
<Row gutter={[24, 24]}>
<Col xs={24} sm={12} md={8}>
<div style={{ textAlign: 'center', padding: 16 }}>
<div style={{ fontSize: 32, color: '#667eea', marginBottom: 12 }}><RocketOutlined /></div>
<Title level={4} style={{ color: 'var(--text-primary)' }}>高性能架构</Title>
<Paragraph style={{ color: 'var(--text-secondary)' }}>基于微服务架构,支持高并发访问,确保系统稳定运行</Paragraph>
</div>
</Col>
</Row>
</Card>
{/* 图表区:趋势 + 状态分布 */}
<Row gutter={[16, 16]} style={{ marginTop: 16 }}>
<Col xs={24} md={16}>
<Card title="订单趋势(创建/完成/退款)" loading={pageLoading}>
<Line {...trendConfig} />
</Card>
</Col>
<Col xs={24} md={8}>
<Card title="订单状态分布" loading={pageLoading}>
<Pie {...distributionConfig} />
</Card>
</Col>
</Row>
</div>
);
};
@@ -83,7 +83,7 @@ const TourismPage: React.FC = () => {
onTenantChanged={(tenantId, includeChildren) => {
setParams((prev) => ({ ...(prev || {}), tenantId, includeChildren }));
}}
onFinish={async (values) => setParams(values)}
onFinish={async (values) => setParams((prev) => ({ ...(prev || {}), ...values }))}
>
<ProFormText name="tourismName" label="景区名称" placeholder="请输入景区名称" />
</SearchBarPlus>
@@ -149,4 +149,3 @@ const TourismPage: React.FC = () => {
};
export default TourismPage;
@@ -56,12 +56,16 @@ const TenantTable: React.FC<TenantTableProps> = ({ parentTenantId, actionRef, on
columns={columns}
toolBarRender={false}
request={async (p) => {
const res = await tenantApi.getTenantList({ parentTenantId, tenantName: (p as any).tenantName, status: (p as any).status as any, current: (p as any).current, pageSize: (p as any).pageSize });
// 默认按启用筛选;当未选择时传 1
const status = (p as any)?.status ?? 1;
const res = await tenantApi.getTenantList({ parentTenantId, tenantName: (p as any).tenantName, status: status as any, current: (p as any).current, pageSize: (p as any).pageSize });
const list = (res as any)?.data?.data || [];
const total = (res as any)?.data?.total || list.length;
return { data: list, total, success: true };
}}
pagination={{ pageSize: 10 }}
// 让搜索表单默认展示“启用”
form={{ initialValues: { status: 1 } }}
search={{ labelWidth: 'auto' }}
/>
);
@@ -1,6 +1,6 @@
import React, { useCallback, useEffect, useState } from "react";
import { PageContainer } from "@ant-design/pro-components";
import { Space, message, Button } from "antd";
import { Space, message, Button, Select } from "antd";
import { ActionBar, GradientButton, GlassCard } from "@/components/ui";
import { PlusOutlined } from "@ant-design/icons";
import TenantForm from "./components/TenantForm";
@@ -17,6 +17,23 @@ const TenantManage: React.FC = () => {
const [editing, setEditing] = useState(false);
const [initialValues, setInitialValues] = useState<UITenantFormValues | undefined>(undefined);
const [treeCache, setTreeCache] = useState<TenantTreeNode[]>([]);
// 状态筛选:1=启用, 0=停用, 'all'=全部;默认启用
const [statusFilter, setStatusFilter] = useState<1 | 0 | 'all'>(1);
// 路径拼接:去掉前缀 null/undefined、首尾斜杠,仅用单斜杠连接
const joinPath = (base?: string, id?: string) => {
const b = String(base || '')
.trim()
.replace(/^null/gi, '')
.replace(/^undefined/gi, '')
.replace(/\/+$/g, '')
.replace(/^\/+/, '');
const t = String(id || '')
.trim()
.replace(/^\/+/, '')
.replace(/\/+$/g, '');
return b ? `${b}/${t}` : t;
};
const fetchTree = useCallback(async () => {
setLoading(true);
@@ -43,7 +60,7 @@ const TenantManage: React.FC = () => {
if (list && list.length === 1 && !Array.isArray((list[0] as any).children)) {
try {
const parentId = (list[0] as any).tenantId;
const resPage: any = await tenantApi.getTenantList({ parentTenantId: parentId, current: 1, pageSize: 1000 } as any);
const resPage: any = await tenantApi.getTenantList({ parentTenantId: parentId, status: (statusFilter === 'all' ? undefined : statusFilter) as any, current: 1, pageSize: 1000 } as any);
const children = resPage?.data?.data || [];
if (children && children.length) {
(list[0] as any).children = children.map((c: any) => ({ tenantId: c.tenantId, tenantName: c.tenantName, tenantType: c.tenantType, status: c.status, contactPerson: c.contactPerson, contactPhone: c.contactPhone }));
@@ -68,7 +85,7 @@ const TenantManage: React.FC = () => {
} catch {}
// 确保至少补一层孩子,方便默认展开后可见
if (!Array.isArray(node.children) || node.children.length === 0) {
const resp: any = await tenantApi.getTenantList({ parentTenantId: node.tenantId, current: 1, pageSize: 1000 } as any);
const resp: any = await tenantApi.getTenantList({ parentTenantId: node.tenantId, status: (statusFilter === 'all' ? undefined : statusFilter) as any, current: 1, pageSize: 1000 } as any);
const children = resp?.data?.data || [];
if (children && children.length) {
node.children = children.map((c: any) => ({ tenantId: c.tenantId, tenantName: c.tenantName, tenantType: c.tenantType, status: c.status, contactPerson: c.contactPerson, contactPhone: c.contactPhone }));
@@ -77,12 +94,73 @@ const TenantManage: React.FC = () => {
})
);
} catch {}
// 递进加载至第三级,保证三级部门可见
const loadChildrenFor = async (nodes?: any[]): Promise<any[]> => {
const resultChildren: any[] = [];
if (!Array.isArray(nodes)) return resultChildren;
await Promise.all(nodes.map(async (node: any) => {
if (!node) return;
// 再次兜底补全基础信息
try {
if (node.tenantType == null || node.status == null || node.contactPerson == null || node.contactPhone == null) {
const detail: any = await tenantApi.getTenantDetail(node.tenantId);
const d = detail?.data || {};
if (node.tenantType == null) node.tenantType = d.tenantType;
if (node.status == null) node.status = d.status;
if (node.contactPerson == null) node.contactPerson = d.contactPerson;
if (node.contactPhone == null) node.contactPhone = d.contactPhone;
}
} catch {}
const needLoad = !Array.isArray(node.children) || node.children.length === 0;
if (needLoad) {
try {
const resp: any = await tenantApi.getTenantList({ parentTenantId: node.tenantId, status: (statusFilter === 'all' ? undefined : statusFilter) as any, current: 1, pageSize: 1000 } as any);
const children = resp?.data?.data || [];
if (children && children.length) {
node.children = children.map((c: any) => ({ tenantId: c.tenantId, tenantName: c.tenantName, tenantType: c.tenantType, status: c.status, contactPerson: c.contactPerson, contactPhone: c.contactPhone }));
}
} catch {}
}
if (Array.isArray(node.children)) resultChildren.push(...node.children);
}));
return resultChildren;
};
try {
const level2 = await loadChildrenFor(list);
await loadChildrenFor(level2);
} catch {}
// 按状态筛选(仅当选择启用或停用时)
const filterTreeByStatus = (nodes?: any[]): any[] => {
if (statusFilter === 'all') return Array.isArray(nodes) ? nodes : [];
const want = statusFilter;
const walk = (arr?: any[]): any[] => {
if (!Array.isArray(arr)) return [];
const res: any[] = [];
for (const n of arr) {
const v = (typeof (n as any)?.status === 'boolean') ? ((n as any).status ? 1 : 0) : (n as any)?.status;
if (v === want) {
const item: any = { ...n };
if (Array.isArray((n as any).children)) item.children = walk((n as any).children);
res.push(item);
} else if (Array.isArray((n as any).children)) {
const sub = walk((n as any).children);
if (sub.length) res.push(...sub);
}
}
return res;
};
return walk(nodes);
};
const finalList = filterTreeByStatus(list);
setTreeCache(list);
setData(list);
setData(finalList);
} catch (e) {
message.error("获取租户数据失败");
} finally { setLoading(false); }
}, []);
}, [statusFilter]);
useEffect(() => { fetchTree(); }, [fetchTree]);
@@ -136,6 +214,22 @@ const TenantManage: React.FC = () => {
<Button onClick={fetchTree}>刷新</Button>
</Space>
)}
right={(
<Space>
<span>状态:</span>
<Select
size="middle"
style={{ width: 120 }}
value={statusFilter}
onChange={(v: any) => setStatusFilter(v)}
options={[
{ value: 1, label: '启用' },
{ value: 0, label: '停用' },
{ value: 'all', label: '全部' },
]}
/>
</Space>
)}
/>
<GlassCard>
@@ -163,15 +257,15 @@ const TenantManage: React.FC = () => {
try {
const parent: any = await tenantApi.getTenantDetail(payload.parentTenantId);
const p = parent?.data || {};
const base = p.tenantPath || p.tenantId || '';
payload.tenantPath = base ? `${base}/${payload.tenantId}` : payload.tenantId;
const base = p?.tenantPath || p?.tenantId || payload.parentTenantId;
payload.tenantPath = joinPath(base, payload.tenantId);
payload.tenantLevel = (p.tenantLevel || 0) + 1;
} catch {
payload.tenantPath = payload.parentTenantId ? `${payload.parentTenantId}/${payload.tenantId}` : payload.tenantId;
payload.tenantPath = joinPath(payload.parentTenantId, payload.tenantId);
payload.tenantLevel = 1;
}
} else {
payload.tenantPath = payload.tenantId;
payload.tenantPath = joinPath(undefined, payload.tenantId);
payload.tenantLevel = 1;
}
}
@@ -181,11 +275,7 @@ const TenantManage: React.FC = () => {
const cur: any = await tenantApi.getTenantDetail(payload.tenantId);
const cd = cur?.data || {};
if (!payload.parentTenantId && cd.parentTenantId) payload.parentTenantId = cd.parentTenantId;
const joinPath = (base?: string, id?: string) => {
const b = String(base || '').replace(/\/+$/g, '').replace(/^null/gi, '');
const t = String(id || '').replace(/^\/+/, '');
return b ? `${b}/${t}` : t;
};
// 使用统一的 joinPath 规范化路径
const badPath = !payload.tenantPath || /^null/i.test(String(payload.tenantPath)) || /\/$/.test(String(payload.tenantPath));
if (badPath) {
let base = '';
@@ -1,4 +1,5 @@
import logo from '@/assets/logo.png';
import logo from '@/assets/logo.png';
import React, { useEffect, useRef, useState } from 'react';
import { LoginForm, ProFormText, ProFormCaptcha, ProFormCheckbox } from '@ant-design/pro-components';
import { AppstoreOutlined, LockOutlined, UserOutlined } from '@ant-design/icons';
@@ -26,14 +27,25 @@ const LoginPage: React.FC = () => {
if (loading) return;
setLoading(true);
try {
const res = await login({ ...values, deviceId: uuid });
const res = await login({ ...values, clientId: 'webApp', deviceId: uuid });
// 检查多种可能的token字段位置
const accessToken = res?.access_token || res?.data?.access_token || res?.accessToken;
if (accessToken) {
sessionStorage.setItem('access_token', accessToken);
localStorage.setItem('tenant_client_id', String(values.clientId ?? ''));
// 登录后预热可访问租户树缓存,便于各页快速使用
try {
const { ensureTenantCacheTokenGuard, setTenantTreeCache } = await import('@/utils/tenantCache');
const { tenantApi } = await import('@/services/tenant');
ensureTenantCacheTokenGuard();
const treeRes: any = await tenantApi.getAccessibleTenants();
let list: any[] = [];
if (typeof treeRes?.success !== 'undefined') list = treeRes.success ? (treeRes.data || []) : [];
else if (Array.isArray(treeRes)) list = treeRes as any[];
if (list && list.length) setTenantTreeCache(list);
} catch {}
localStorage.setItem('tenant_client_id', 'webApp');
message.success('登录成功,正在跳转...');
// 使用umi的history进行路由跳转
@@ -84,6 +96,8 @@ const LoginPage: React.FC = () => {
>
<ProFormText
name="clientId"
initialValue="webApp"
disabled
fieldProps={{ size: 'large', prefix: <AppstoreOutlined /> }}
placeholder="请输入租户标识"
rules={[{ required: true, message: '请输入租户标识' }]}