Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
ujia
/
uj-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4454cb72
authored
Nov 19, 2026
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
菜单获取从current` 接口 不再permcode过滤
1 parent
43faf638
Pipeline
#557
for
4454cb72
failed
in 0 seconds
Changes
38
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
274 additions
and
178 deletions
apps/web/shell/package.json
apps/web/shell/src/layouts/BasicLayout.tsx
apps/web/shell/src/layouts/SideNav.tsx
apps/web/shell/src/pages/Profile/index.tsx
apps/web/subapps/finance/package.json
apps/web/subapps/points/package.json
apps/web/subapps/points/src/pages/OrderList/components/OrderDetailDrawer.tsx
apps/web/subapps/points/src/pages/WithdrawManage/components/ApprovalDetailDrawer.tsx
apps/web/subapps/points/src/pages/WithdrawManage/components/CustomTagDrawer.tsx
apps/web/subapps/store/package.json
apps/web/subapps/store/src/features/store/StoreDetailDrawer.tsx
apps/web/subapps/store/src/pages/TemplateImport/index.tsx
apps/web/subapps/system/package.json
apps/web/subapps/system/src/api/modules/menu.ts
apps/web/subapps/usedcar/package.json
apps/web/subapps/usedcar/src/pages/Condition/index.tsx
apps/web/subapps/usedcar/src/pages/CustomerGroup/LiveCodesTab.tsx
apps/web/subapps/usedcar/src/pages/CustomerGroup/StoreConfigTab.tsx
apps/web/subapps/usedcar/src/pages/CustomerGroup/index.tsx
apps/web/subapps/usedcar/src/pages/Delivery/index.tsx
apps/web/subapps/usedcar/src/pages/Ledger/FinancialLedger.tsx
apps/web/subapps/usedcar/src/pages/Ledger/VehicleLedger.tsx
apps/web/subapps/usedcar/src/pages/Ledger/index.tsx
apps/web/subapps/usedcar/src/pages/Operation/components/ContractTab.tsx
apps/web/subapps/usedcar/src/pages/Operation/components/SunshineTab.tsx
apps/web/subapps/usedcar/src/pages/Operation/index.tsx
docs/PORT_CONVERSION.md
packages/biz/src/components/BrandLoader.tsx
packages/biz/src/components/SearchForm/index.tsx
packages/biz/src/components/formSchema.ts
packages/biz/src/components/index.ts
packages/platform-core/src/access/backend/adapter.ts
packages/platform-core/src/api/modules/menu.ts
packages/platform-sdk/src/compat/access/backend/adapter.ts
packages/platform-sdk/src/compat/api/modules/menu.ts
packages/ui/src/styles/ui.css
scripts/audit-module.mjs
scripts/finance-menu-migration.sql
apps/web/shell/package.json
View file @
4454cb7
{
"name"
:
"@uj/web-shell"
,
"version"
:
"0.0.1
1
"
,
"version"
:
"0.0.1
2
"
,
"private"
:
true
,
"type"
:
"module"
,
"scripts"
:
{
...
...
apps/web/shell/src/layouts/BasicLayout.tsx
View file @
4454cb7
...
...
@@ -10,7 +10,7 @@ import { menu as menuApi, cancelRequests } from '@/api';
import { logoutEverything } from '../subapp-lifecycle';
import { DownloadCenterButton } from '@uj/download-center';
import { Logo } from '@/components/Logo';
import {
Skeleton } from '@uj/ui
';
import {
BrandLoading } from '@uj/biz
';
import menuJson from '@/config/menu.json';
import { roleLabels } from '@/access';
import SideNav from './SideNav';
...
...
@@ -92,10 +92,11 @@ function BackGlyph() {
export default function BasicLayout() {
const navigate = useNavigate();
const location = useLocation();
const {
can, role, roleCodes, point
s } = useAccess();
const {
role, roleCode
s } = useAccess();
const { collapsed, toggleCollapsed, currentUser, loggedIn } = useAppStore();
// 后端菜单树:登录后拉取;接口失败则回落 menu.json 兜底(remoteGroups 保持 null)
// /current 已按当前登录角色装配好菜单,可见性以它为准,前端不再用 permCodes 二次过滤。
const [remoteGroups, setRemoteGroups] = useState<MenuGroupDef[] | null>(null);
useEffect(() => {
if (!loggedIn) return;
...
...
@@ -103,7 +104,7 @@ export default function BasicLayout() {
menuApi
.tree()
.then((tree) => {
if (alive) setRemoteGroups(buildMenus(tree,
points,
PATH_BY_RESOURCE));
if (alive) setRemoteGroups(buildMenus(tree, PATH_BY_RESOURCE));
})
.catch(() => {
// 接口未就绪/令牌失效:不阻断,走本地兜底菜单
...
...
@@ -112,7 +113,7 @@ export default function BasicLayout() {
return () => {
alive = false;
};
}, [loggedIn
, points
]);
}, [loggedIn]);
// 后端树为空(接口未就绪或该账号无任何菜单)时走兜底,避免侧边栏整组消失。
// useMemo 固定引用:下面的 openKeys 校准 effect 依赖 groups,若每次渲染都生成新数组会导致 effect 反复执行。
...
...
@@ -121,15 +122,13 @@ export default function BasicLayout() {
[remoteGroups],
);
// 交给自绘 SideNav 的分组:权限过滤后剔除空组,避免出现点不开的空章节。
// 交给自绘 SideNav 的分组:只剔除空组,避免出现点不开的空章节。
// 菜单显隐完全以 /system/menu/tree/current 为准——后端已按角色装配好,前端不再拿登录
// 返回的 permCodes 做二次过滤(两个接口口径不一致时会静默丢菜单、整组连标题都不渲染)。
// 这里只做过滤,不再把数据翻译成 antd Menu items —— 渲染结构由 SideNav 负责。
// can 来自 AccessProvider 的 useMemo value,引用稳定,故 useMemo 能真正固定住引用。
const visibleGroups: MenuGroupDef[] = useMemo(
() =>
groups
.map((g) => ({ ...g, children: g.children.filter((m) => !m.resource || can(m.resource)) }))
.filter((g) => g.children.length > 0),
[groups, can],
() => groups.filter((g) => g.children.length > 0),
[groups],
);
const flat = groups.flatMap((g) => g.children);
...
...
@@ -361,7 +360,7 @@ export default function BasicLayout() {
flexDirection: 'column',
}}
>
<Suspense fallback={<
Skeleton variant="default"
/>}>
<Suspense fallback={<
BrandLoading
/>}>
<Outlet />
</Suspense>
</Content>
...
...
apps/web/shell/src/layouts/SideNav.tsx
View file @
4454cb7
...
...
@@ -46,8 +46,9 @@ import type { MenuGroupDef } from '@/access';
* BasicLayout 里「原先 group 标题永远展开才换成 SubMenu」的修复回退掉。
*
* 因此只换渲染层:数据仍是后端菜单树经 buildMenus 得到的 MenuGroupDef[],
*
权限过滤
/ selectedKey 最长前缀 / openKeys 受控校准 / 切页时的
*
空组剔除
/ selectedKey 最长前缀 / openKeys 受控校准 / 切页时的
* PAGE_LEAVE_EVENT + cancelRequests + navigate 全部留在 BasicLayout,本组件不碰。
* 菜单显隐以 /system/menu/tree/current 为准,本组件不做任何权限判断。
*
* 二级菜单刻意不渲染 m.icon:12 个不同线性图标在 34px 行里会形成锯齿边,
* 且 iconMap 是白名单,后端新增页面漏登记就会静默回落。二级改用导轨上的统一节点,
...
...
apps/web/shell/src/pages/Profile/index.tsx
View file @
4454cb7
...
...
@@ -5,7 +5,8 @@ import { useEffect, useState, type ReactNode } from 'react';
import { useNavigate } from 'react-router-dom';
import { App, Avatar, Tag } from 'antd';
import { UserOutlined } from '@ant-design/icons';
import { UCard, UForm, UInput, UButton, UAlert, UText, Skeleton } from '@uj/ui';
import { UCard, UForm, UInput, UButton, UAlert, UText } from '@uj/ui';
import { BrandLoading } from '@uj/biz';
import { auth, type UserInfo } from '@/api';
import { useAppStore } from '@/store/useAppStore';
import { useAccess } from '@/access';
...
...
@@ -66,7 +67,7 @@ export default function Profile() {
}
};
if (loading) return <
Skeleton variant="detail"
/>;
if (loading) return <
BrandLoading
/>;
if (!info) return <UCard>{<UText type="secondary">暂无账号信息</UText>}</UCard>;
const codes = info.roleCodes?.length ? info.roleCodes : roleCodes;
...
...
apps/web/subapps/finance/package.json
View file @
4454cb7
{
"name"
:
"@uj/web-finance"
,
"version"
:
"0.0.
5
"
,
"version"
:
"0.0.
6
"
,
"private"
:
true
,
"type"
:
"module"
,
"scripts"
:
{
...
...
apps/web/subapps/points/package.json
View file @
4454cb7
{
"name"
:
"@uj/web-points"
,
"version"
:
"0.0.
6
"
,
"version"
:
"0.0.
7
"
,
"private"
:
true
,
"type"
:
"module"
,
"scripts"
:
{
...
...
apps/web/subapps/points/src/pages/OrderList/components/OrderDetailDrawer.tsx
View file @
4454cb7
import { useQuery } from '@tanstack/react-query';
import { Skeleton, UAlert, UButton, UDrawer, UTitle } from '@uj/ui';
import { UAlert, UButton, UDrawer, UTitle } from '@uj/ui';
import { BrandLoading } from '@uj/biz';
import { pointsApi, type WriteOffOrderDetail } from '@/api';
import { SETTLE_STATUS, optionLabel } from '@/features/shared/dictionaries';
import { numberOr, textOr } from '@/features/shared/format';
...
...
@@ -57,7 +58,7 @@ export function OrderDetailDrawer({ open, id, onClose }: OrderDetailDrawerProps)
}
/>
) : detail.isPending ? (
<
Skeleton variant="detail"
/>
<
BrandLoading
/>
) : (
<>
{/* 抽屉面板本身就是容器,不再套带描边的卡片,避免双重边框。 */}
...
...
apps/web/subapps/points/src/pages/WithdrawManage/components/ApprovalDetailDrawer.tsx
View file @
4454cb7
import { useQuery } from '@tanstack/react-query';
import { Skeleton, UTimeline, UText, UDrawer, UTitle } from '@uj/ui';
import { UTimeline, UText, UDrawer, UTitle } from '@uj/ui';
import { BrandLoading } from '@uj/biz';
import { withdrawApi, type ApprovalLogItem } from '@/api';
import { APPROVAL_OPERATION, APPROVAL_STATUS, statusMeta } from '@/features/shared/dictionaries';
import { dateTimeOr, numberOr, textOr } from '@/features/shared/format';
...
...
@@ -81,7 +82,7 @@ export function ApprovalDetailDrawer({ open, id, onClose }: ApprovalDetailDrawer
return (
<UDrawer title="详细信息" open={open} width={900} onClose={onClose}>
{detail.isPending ? (
<
Skeleton variant="detail"
/>
<
BrandLoading
/>
) : (
<div className="uj-points-detail">
<UTitle level={5}>订单信息</UTitle>
...
...
apps/web/subapps/points/src/pages/WithdrawManage/components/CustomTagDrawer.tsx
View file @
4454cb7
import { useState } from 'react';
import { useMutation } from '@tanstack/react-query';
import { Skeleton, UButton, UDrawer, UText, useUMessage } from '@uj/ui';
import { UButton, UDrawer, UText, useUMessage } from '@uj/ui';
import { BrandLoading } from '@uj/biz';
import { ConfirmModal } from '@/components';
import { withdrawApi, type TagNode } from '@/api';
import { errorMessage } from '@/features/shared/format';
...
...
@@ -94,7 +95,7 @@ export function CustomTagDrawer({ open, onClose }: CustomTagDrawerProps) {
<>
<UDrawer title="自定义标签" width={680} open={open} onClose={onClose}>
{tags.isLoading ? (
<
Skeleton
/>
<
BrandLoading
/>
) : (
<div className="uj-points-tag-panel">
<div className="uj-points-tag-root">
...
...
apps/web/subapps/store/package.json
View file @
4454cb7
{
"name"
:
"@uj/web-store"
,
"version"
:
"0.0.
6
"
,
"version"
:
"0.0.
7
"
,
"private"
:
true
,
"type"
:
"module"
,
"scripts"
:
{
...
...
apps/web/subapps/store/src/features/store/StoreDetailDrawer.tsx
View file @
4454cb7
import type { ReactNode } from 'react';
import type { TableColumnsType } from 'antd';
import { Skeleton, UAlert, UButton, UDrawer, UResult, UTable, UTabs, UTag, UText, tabLabel } from '@uj/ui';
import { UAlert, UButton, UDrawer, UResult, UTable, UTabs, UTag, UText, tabLabel } from '@uj/ui';
import { BrandLoading } from '@uj/biz';
import type { StoreListingDetail, StoreListingItem } from '@/api';
import type { StoreDictionaries } from './dictionaries';
import { dictionaryLabel, formatPolicyValue } from './formatters';
...
...
@@ -213,7 +214,7 @@ export function StoreDetailDrawer({
footer={footer}
>
{loading ? (
<
Skeleton variant="detail"
/>
<
BrandLoading
/>
) : error ? (
<UResult
status="error"
...
...
apps/web/subapps/store/src/pages/TemplateImport/index.tsx
View file @
4454cb7
import { useState } from 'react';
import { Skeleton, useUApp } from '@uj/ui';
import { useUApp } from '@uj/ui';
import { BrandLoading } from '@uj/biz';
import { PageHeader } from './components/PageHeader';
import { NoticeSection } from './components/NoticeSection';
import { StepsBar } from './components/StepsBar';
...
...
@@ -116,7 +117,7 @@ export default function TemplateImport() {
}
};
if (loading) return <
Skeleton
/>;
if (loading) return <
BrandLoading
/>;
return (
<div style={{ display: 'flex', flexDirection: 'column' }}>
...
...
apps/web/subapps/system/package.json
View file @
4454cb7
{
"name"
:
"@uj/web-system"
,
"version"
:
"0.0.
6
"
,
"version"
:
"0.0.
7
"
,
"private"
:
true
,
"type"
:
"module"
,
"scripts"
:
{
...
...
apps/web/subapps/system/src/api/modules/menu.ts
View file @
4454cb7
...
...
@@ -29,21 +29,15 @@ export interface MenuNode {
class
Menu
extends
ApiClient
{
/**
* 菜单树的请求缓存(同一登录态内菜单树不会变,没必要重复打网络)。
*
* 需要它的两个真实原因:
* 1) 开发期 React.StrictMode 会把 effect 跑成 mount → cleanup → mount,直接双发请求;
* 2) 权限点 points 会变化(AccessProvider 挂载后异步 auth.info() 返回再 applyLogin 一次),
* BasicLayout 的 effect 依赖 points,points 一变就会重跑。
*
* 缓存的是「网络请求」,不是「菜单结果」:调用方仍用当前 points 重新 buildMenus,
* 所以权限点更新后菜单过滤依旧准确,只是不会重复请求。
* 需要它仅因为开发期 React.StrictMode 会把 effect 跑成 mount → cleanup → mount,
* 导致同一棵树双发请求。菜单可见性以 /current 为准、不依赖权限点,故不需要按 points 重算。
*/
private
treePromise
:
Promise
<
MenuNode
[]
>
|
null
=
null
;
/**
* 当前登录用户的菜单树(/system/menu/tree/current)。
* 后端已按当前登录用户的角色装配并返回,前端
仍与登录下发的 permCodes 取交集后再渲染
*
(双保险:即便后端未按角色过滤,也不会有越权菜单被渲染出来)
。
* 后端已按当前登录用户的角色装配并返回,前端
原样渲染,不再与登录下发的 permCodes 取交集。
*
菜单显隐的唯一真源就是这棵树;越权菜单由后端装配时拦截,不在前端二次过滤
。
*/
tree
():
Promise
<
MenuNode
[]
>
{
if
(
!
this
.
treePromise
)
{
...
...
apps/web/subapps/usedcar/package.json
View file @
4454cb7
{
"name"
:
"@uj/web-usedcar"
,
"version"
:
"0.0.
7
"
,
"version"
:
"0.0.
8
"
,
"private"
:
true
,
"type"
:
"module"
,
"scripts"
:
{
...
...
apps/web/subapps/usedcar/src/pages/Condition/index.tsx
View file @
4454cb7
...
...
@@ -190,9 +190,10 @@ export default function Condition() {
}
/>
) : null}
<UCard size="small">
<UCard size="small"
fill
>
<DataTable<Row>
rowKey="id"
fillHeight
columns={columns}
dataSource={list.data?.records ?? []}
loading={list.isPending || list.isFetching}
...
...
apps/web/subapps/usedcar/src/pages/CustomerGroup/LiveCodesTab.tsx
View file @
4454cb7
...
...
@@ -120,9 +120,10 @@ export default function LiveCodesTab() {
}
/>
) : null}
<UCard size="small">
<UCard size="small"
fill
>
<DataTable<Row>
rowKey="id"
fillHeight
columns={columns}
dataSource={query.data?.records ?? []}
loading={query.isPending || query.isFetching}
...
...
apps/web/subapps/usedcar/src/pages/CustomerGroup/StoreConfigTab.tsx
View file @
4454cb7
...
...
@@ -102,9 +102,10 @@ export default function StoreConfigTab() {
}
/>
) : null}
<UCard size="small">
<UCard size="small"
fill
>
<DataTable<Row>
rowKey="id"
fillHeight
columns={[
{ title: '4S店名称', dataIndex: 'storeName', width: 260, line: 1, render: text },
{
...
...
apps/web/subapps/usedcar/src/pages/CustomerGroup/index.tsx
View file @
4454cb7
...
...
@@ -13,11 +13,12 @@ export default function CustomerGroup() {
if (!canPoint(UC.GROUP_VIEW))
return <UResult status="403" title="无访问一客一群的权限" subTitle="请联系管理员开通访问权限。" />;
return (
<PageShell title="一客一群">
<PageShell
fill
title="一客一群">
<UTabs activeKey={tab} onChange={setTab} items={[
{ key: 'group', label: '一客一群'
, children: <LiveCodesTab />
},
{ key: 'dealer', label: '4S店配置'
, children: <StoreConfigTab />
},
{ key: 'group', label: '一客一群' },
{ key: 'dealer', label: '4S店配置' },
]} />
{tab === 'group' ? <LiveCodesTab /> : <StoreConfigTab />}
</PageShell>
);
}
apps/web/subapps/usedcar/src/pages/Delivery/index.tsx
View file @
4454cb7
...
...
@@ -110,11 +110,13 @@ export default function Delivery() {
.slice(0, 20)
: undefined,
}));
// 常显字段固定 4 个(车牌/车架/车源/车型),与评估管理一致:筛选卡在常见宽度下 4 列,
// 一排正好放满;第 5 个常显字段会被挤到第二行。姓名/电话这类「下拉类型 + 关键词」组合
// 控件较宽,统一收进「更多筛选」,避免收起时换行、展开时与另一个同形控件看起来重复。
fields.splice(4, 0, {
name: 'personKeyword',
label: '',
label: '
姓名
',
type: 'input',
essential: true,
placeholder: '请输入交付专员姓名',
selector: {
name: 'personType',
...
...
@@ -128,7 +130,7 @@ export default function Delivery() {
});
fields.splice(5, 0, {
name: 'phoneKeyword',
label: '',
label: '
电话
',
type: 'input',
placeholder: '请输入交付专员电话',
selector: {
...
...
apps/web/subapps/usedcar/src/pages/Ledger/FinancialLedger.tsx
View file @
4454cb7
...
...
@@ -101,9 +101,10 @@ export default function FinancialLedger() {
{q.isError ? (
<UAlert type="error" showIcon title="财务台账加载失败" description={errorDetail(q.error)} />
) : null}
<UCard size="small">
<UCard size="small"
fill
>
<DataTable<Row>
rowKey="id"
fillHeight
columns={columns}
dataSource={q.data?.records ?? []}
loading={q.isPending || q.isFetching}
...
...
apps/web/subapps/usedcar/src/pages/Ledger/VehicleLedger.tsx
View file @
4454cb7
...
...
@@ -211,9 +211,10 @@ export default function VehicleLedger() {
{q.isError ? (
<UAlert type="error" showIcon title="车辆台账加载失败" description={errorDetail(q.error)} />
) : null}
<UCard size="small">
<UCard size="small"
fill
>
<DataTable<Row>
rowKey="id"
fillHeight
columns={columns}
dataSource={q.data?.records ?? []}
loading={q.isPending || q.isFetching}
...
...
apps/web/subapps/usedcar/src/pages/Ledger/index.tsx
View file @
4454cb7
...
...
@@ -13,15 +13,16 @@ export default function Ledger() {
<UResult status="403" title="无访问车辆台账的权限" subTitle="请联系管理员开通访问权限。" />
);
return (
<PageShell title="车辆台账">
<PageShell
fill
title="车辆台账">
<UTabs
activeKey={tab}
onChange={setTab}
items={[
{ key: 'vehicle', label: '车辆台账'
, children: <VehicleLedger />
},
{ key: 'financial', label: '财务台账'
, children: <FinancialLedger />
},
{ key: 'vehicle', label: '车辆台账' },
{ key: 'financial', label: '财务台账' },
]}
/>
{tab === 'vehicle' ? <VehicleLedger /> : <FinancialLedger />}
</PageShell>
);
}
apps/web/subapps/usedcar/src/pages/Operation/components/ContractTab.tsx
View file @
4454cb7
...
...
@@ -114,9 +114,10 @@ export default function ContractTab() {
/>
</UCard>
{q.isError ? <UAlert type="error" showIcon title="合同列表加载失败" /> : null}
<UCard size="small">
<UCard size="small"
fill
>
<DataTable<Contract>
rowKey="id"
fillHeight
columns={CONTRACT_COLUMNS}
dataSource={q.data?.records ?? []}
loading={q.isLoading}
...
...
apps/web/subapps/usedcar/src/pages/Operation/components/SunshineTab.tsx
View file @
4454cb7
...
...
@@ -113,9 +113,10 @@ export default function SunshineTab() {
onReset={() => setF({})}
/>
</UCard>
<UCard size="small">
<UCard size="small"
fill
>
<DataTable<Sunshine>
rowKey="id"
fillHeight
columns={SUNSHINE_COLUMNS}
dataSource={q.data?.records ?? []}
loading={q.isLoading}
...
...
apps/web/subapps/usedcar/src/pages/Operation/index.tsx
View file @
4454cb7
import { useState } from 'react';
import { UResult, UTabs } from '@uj/ui';
import { PageShell } from '@/components';
import { useAccess } from '@/access';
import { UC } from '@/permissions/codes';
import ContractTab from './components/ContractTab';
...
...
@@ -12,7 +13,7 @@ export default function Operation() {
<UResult status="403" title="无访问运营管理的权限" subTitle="请联系管理员开通访问权限。" />
);
return (
<
div className="uj-page
">
<
PageShell fill title="运营管理
">
<UTabs
activeKey={tab}
onChange={setTab}
...
...
@@ -22,6 +23,6 @@ export default function Operation() {
]}
/>
{tab === 'contract' ? <ContractTab /> : <SunshineTab />}
</
div
>
</
PageShell
>
);
}
docs/PORT_CONVERSION.md
View file @
4454cb7
...
...
@@ -149,9 +149,9 @@ UResult UEmpty USteps UTimeline UDropdown UDatePicker URadio USwit
-
全都不标
`essential`
→
非日期字段全部常显(锚点);
-
**
时间区间
`dateRange`
默认进「更多筛选」
**
(区间要跨
2
列才完整);例外:轻量表单(常显非日期
≤
2
且整页条件
≤
3
,如「积分详情」只有积分类型
+
积分变化时间)或显式
`essential:true`
的区间会常显。阈值在组件内
`lightForm`
启发式,
**
不要改页面去手调
**
。
-
收起区是
CSS
隐藏而非卸载(避免
Form
.
Item
卸载丢值),这点组件已处理,页面只管传字段。
-
**
「更多筛选」双数角标
**
(组件统一处理,页面不要自己算数):按钮文案右上角的
**
无背景上标
**
是
**
整张表的筛选条件总数
**
(含常显字段,按
`filterGroup`
归并、排除
`countsAsFilter:false`
),主色实心角标是
**
整张表已填写的条件数
**
,两者语义不同。总数不随填写变化、只作说明,所以不带底色
/
边框、不占按钮宽度;主色角标是唯一带底色的强调。计数口径:与
`initialValues`
相同的默认值不算用户设的条件(如
finance
页
`dateType:'payment'`
、
`paymentMethod:'全部'`
);无背景总数上标只在收起态显示(展开后条件都在眼前,再挂总数
纯属重复),主色已填数角标收起
/
展开两态都显示(展开态它是悬浮卡的触发区)。
hover
/
键盘
focus
主色实心的「已填数」角标才弹出条件卡,按钮文案与无背景总数上标
hover
都不触发:头部显示已填数量,每条条件按「标签
|
值
|
×」单行密集排列(行高
24
px
,一屏约
16
条,超出才滚动),右上角
×
行内删除(按
`filterGroup`
清整组并立即用剩余条件重查),底部左侧提示、右侧「全部清空」走
`onReset`
。只有已填数大于
0
才弹卡片,且
hover
满
500
ms
才出现(扫过不打扰);展开「更多筛选」时卡片照常可弹,但方向从向下改为向上(
`topRight`
),避免盖住刚展开的收拢区;点击切换展开
/
收起时卡片先收起,防止上下翻转时跳位。
-
**
「更多筛选」双数角标
**
(组件统一处理,页面不要自己算数):按钮文案右上角的
**
无背景上标
**
是
**
收进「更多筛选」的条件数
**
(不含常显字段,按
`filterGroup`
归并、排除
`countsAsFilter:false`
),主色实心角标是
**
整张表已填写的条件数
**
,两者语义不同。收起数不随填写变化、只作说明,所以不带底色
/
边框、不占按钮宽度;主色角标是唯一带底色的强调。计数口径:与
`initialValues`
相同的默认值不算用户设的条件(如
finance
页
`dateType:'payment'`
、
`paymentMethod:'全部'`
);无背景收起数上标只在收起态显示(展开后这些条件都在眼前,再挂数字
纯属重复),主色已填数角标收起
/
展开两态都显示(展开态它是悬浮卡的触发区)。
hover
/
键盘
focus
主色实心的「已填数」角标才弹出条件卡,按钮文案与无背景总数上标
hover
都不触发:头部显示已填数量,每条条件按「标签
|
值
|
×」单行密集排列(行高
24
px
,一屏约
16
条,超出才滚动),右上角
×
行内删除(按
`filterGroup`
清整组并立即用剩余条件重查),底部左侧提示、右侧「全部清空」走
`onReset`
。只有已填数大于
0
才弹卡片,且
hover
满
500
ms
才出现(扫过不打扰);展开「更多筛选」时卡片照常可弹,但方向从向下改为向上(
`topRight`
),避免盖住刚展开的收拢区;点击切换展开
/
收起时卡片先收起,防止上下翻转时跳位。
-
**
组合字段用
`filterGroup`
归并
**
:一个业务条件拆成多个平铺字段时(金额区间
`amtMin`
/
`amtMax`
、日期类型
+
区间
`dateType`
/
`dateValue`
),给同组字段标同一个
`filterGroup`
,角标里整组只算
1
个条件;不标就按字段各自计。字段表是唯一真源,不要在页面里另写一份计数。组合控件里只起辅助作用、单独变化不产生查询参数的字段(如
`dateType`
)标
`countsAsFilter: false`
,不参与计数。
-
按钮的
`aria-label`
在收起
/
展开两态都会报出「
共
N
个
/
已填
M
个
」供读屏使用;不再挂原生
`title`
,避免与悬浮卡叠两层提示;页面不需要传任何计数参数。主色已填角标自身带
`aria-label`
、可
Tab
聚焦并有
`focus-visible`
焦点框;悬浮卡内每个
×
另有
`aria-label`
(含条件标签),
`focus-visible`
有独立焦点底色。
-
按钮的
`aria-label`
在收起
/
展开两态都会报出「
N
个条件已收起
/
已填
M
项
」供读屏使用;不再挂原生
`title`
,避免与悬浮卡叠两层提示;页面不需要传任何计数参数。主色已填角标自身带
`aria-label`
、可
Tab
聚焦并有
`focus-visible`
焦点框;悬浮卡内每个
×
另有
`aria-label`
(含条件标签),
`focus-visible`
有独立焦点底色。
---
...
...
packages/biz/src/components/BrandLoader.tsx
View file @
4454cb7
...
...
@@ -106,3 +106,41 @@ export function BrandLoader({ size = 64, className }: BrandLoaderProps) {
</div>
);
}
export interface BrandLoadingProps {
/** 图标下方文案,传空字符串隐藏 */
label?: string;
size?: number;
className?: string;
/** 容器最小高度:抽屉/页面加载态要撑出可用的落点,默认 200px */
minHeight?: number | string;
}
/**
* BrandLoader 的带容器版本:居中图标 + 文案,给页面/抽屉的加载态直接用。
*
* 全系统页面/详情加载态只用这一种(原 antd Skeleton 骨架屏的 shimmer 波浪已下线):
* - 壳层路由 fallback(BasicLayout)→ BrandLoading
* - 主壳/子应用页面内 loading → BrandLoading
* - 详情抽屉 loading → BrandLoading
* 表格数据的加载态另走 TableLoader(由 UTable/FillTable 的 resolveTableLoading 注入),
* 两者视觉同源但语义分工:BrandLoading = 整块内容还在路上,TableLoader = 表格在拉数据。
*/
export function BrandLoading({
label = '正在加载…',
size = 64,
minHeight = 200,
className,
}: BrandLoadingProps) {
return (
<div
className={`uj-brand-loading${className ? ` ${className}` : ''}`}
style={{ minHeight }}
role="status"
aria-label={label || '正在加载'}
>
<BrandLoader size={size} />
{label ? <span className="uj-brand-loading__label">{label}</span> : null}
</div>
);
}
packages/biz/src/components/SearchForm/index.tsx
View file @
4454cb7
...
...
@@ -141,11 +141,11 @@ export function SearchForm<T extends Record<string, unknown>>({
};
const primaryFields = fields.filter(isPrimary);
const extraFields = fields.filter((field) => !isPrimary(field));
// 两个数字都按整张表算:常显条件同样是筛选条件,不能只在「更多筛选」里数。
// 同 filterGroup 归并成 1 个业务条件,countsAsFilter:false 的辅助字段不参与;
// 生效数另外排除与 initialValues 相同的默认值。
const hasExtra = extraFields.length > 0;
const conditionTotal = countConditions(fields);
// 「更多筛选」上标只数被收起来的条件:常显的已经看得见,不该计入。
// 口径与总数一致——同 filterGroup 归并成 1 个业务条件,countsAsFilter:false 的辅助字段不参与。
const hiddenCount = countConditions(extraFields);
// 主色「已填数」角标与悬浮卡按整张表算(含常显条件),排除与 initialValues 相同的默认值。
const activeConditions = collectActiveConditions(fields, values, formInitialValues);
const activeFilterCount = activeConditions.length;
...
...
@@ -368,21 +368,21 @@ export function SearchForm<T extends Record<string, unknown>>({
setActivePopoverOpen(false);
}}
aria-expanded={expanded}
aria-label={`${expanded ? '收起' : '更多筛选'}:
共 ${conditionTotal} 个条件,已填写 ${activeFilterCount} 个
`}
aria-label={`${expanded ? '收起' : '更多筛选'}:
${hiddenCount} 个条件已收起,当前已填写 ${activeFilterCount} 项
`}
>
<span className="uj-filter-more-btn__label">
{expanded ? '收起' : '更多筛选'}
{/*
总数上标只在收起态出现:展开后条件都在眼前,再挂一个总数
纯属重复。
{/*
收起数上标只在收起态出现:展开后这些条件都在眼前,再挂数字
纯属重复。
主色「已填数」角标两态保留(展开态它是悬浮卡的触发区)。 */}
{!expanded ? (
<sup className="uj-filter-more-total" aria-hidden>
{
conditionTotal
}
{
hiddenCount
}
</sup>
) : null}
</span>
{activeFilterCount > 0 ? (
<UPopover
// 触发区是主色实心的「已填数」角标:无背景的
总
数上标、按钮文案都不触发。
// 触发区是主色实心的「已填数」角标:无背景的
收起
数上标、按钮文案都不触发。
// 开/关由角标自己的 mouse/focus 事件控制,不给 Popover 留触发方式,
// 否则点击按钮也会经由 onOpenChange 把它打开。
trigger={[]}
...
...
packages/biz/src/components/formSchema.ts
View file @
4454cb7
...
...
@@ -42,7 +42,7 @@ export interface FieldSchema<T extends Record<string, unknown> = Record<string,
*/
essential
?:
boolean
;
/**
* 同一个业务条件的多个字段归为一组(仅 SearchForm 的筛选条件角标计数使用,
含常显字段
)。
* 同一个业务条件的多个字段归为一组(仅 SearchForm 的筛选条件角标计数使用,
常显/收起字段都按此归并
)。
* 例如金额区间拆成 amtMin/amtMax、日期类型+区间拆成 dateType/dateValue,
* 同组不论几个字段生效都只算 1 个条件。不设时按字段各自计数。
*/
...
...
packages/biz/src/components/index.ts
View file @
4454cb7
export
{
Logo
}
from
'./Logo'
;
export
{
BrandLoader
}
from
'./BrandLoader'
;
export
type
{
BrandLoaderProps
}
from
'./BrandLoader'
;
export
{
BrandLoader
,
BrandLoading
}
from
'./BrandLoader'
;
export
type
{
BrandLoaderProps
,
BrandLoadingProps
}
from
'./BrandLoader'
;
export
{
StatusTag
}
from
'./StatusTag'
;
export
{
default
as
PagePlaceholder
}
from
'./PagePlaceholder'
;
export
{
PageShell
}
from
'./PageShell'
;
...
...
packages/platform-core/src/access/backend/adapter.ts
View file @
4454cb7
...
...
@@ -21,22 +21,7 @@ function toFrontendPoint(code: string): string {
/* ---------------- 菜单树:后端 /system/menu/tree/current → 前端菜单结构 ---------------- */
/**
* 仅开发构建打印菜单诊断。platform-core 也会被测试/脚本等非 Vite 环境导入,
* 用可选链读 import.meta.env,避免 env 未注入时直接抛错。
*/
const
IS_DEV
=
(()
=>
{
try
{
return
Boolean
((
import
.
meta
as
unknown
as
{
env
?:
{
DEV
?:
boolean
}
}).
env
?.
DEV
);
}
catch
{
return
false
;
}
})();
/** 「分组 + 缺失码集合」为 key,权限点变化后能重新提示,同时避免每次 buildMenus 都刷屏。 */
const
warnedDroppedGroups
=
new
Set
<
string
>
();
/** 前端菜单项(path/label/icon 供渲染,resource 供权限与面包屑) */
/** 前端菜单项(path/label/icon 供渲染,resource 供面包屑等派生用途) */
export
interface
MenuItemDef
{
path
:
string
;
label
:
string
;
...
...
@@ -75,7 +60,9 @@ export interface MenuGroupDef {
* - status !== 1(停用)的节点丢弃。
* - path 与 icon 直接取自后端下发的 node.route / node.icon,前端不再做映射。
* 一级(分组)图标取 nodeType=1 节点自己的 icon,与二级同用一套图标名。
* - permCode 与当前账号持有的权限点取交集(/current 后端已按角色过滤,这里作双保险再过滤一次)。
* - 菜单可见性完全由后端 /current 决定:后端已按当前登录角色装配好菜单树,前端原样渲染,
* 不再拿登录返回的 permCodes 做交集(双保险)。曾因两个接口口径不一致,树里有页面但
* permCodes 缺对应 :view 码,页面被这里静默丢弃、整组连标题都不渲染且零日志。
* - node.route 缺失 → 跳过并告警(点了会 404,不应渲染)。
* - 分组/页面均按 sort 升序。
*
...
...
@@ -85,10 +72,8 @@ export interface MenuGroupDef {
*/
export
function
buildMenus
(
tree
:
MenuNode
[],
owned
:
Iterable
<
string
>
,
pathByResource
?:
ReadonlyMap
<
string
,
string
>
,
):
MenuGroupDef
[]
{
const
points
=
new
Set
(
owned
);
const
groups
:
MenuGroupDef
[]
=
[];
// 先统计 route 复用情况(只统计会进菜单的节点)
...
...
@@ -112,17 +97,15 @@ export function buildMenus(
.
sort
((
a
,
b
)
=>
a
.
sort
-
b
.
sort
);
pages
.
forEach
((
n
)
=>
{
const
code
=
n
.
permCode
;
if
(
!
code
)
return
;
// 归一为前端点号后与权限点集合比较(points 已是归一后的点号形态)
const
point
=
toFrontendPoint
(
code
);
if
(
!
points
.
has
(
point
))
return
;
// 路由由后端树直接下发;缺失则跳过(不应渲染一个点了会 404 的菜单项)
if
(
!
n
.
route
)
{
console
.
warn
(
`[menu] 后端菜单「
${
n
.
label
}
」(
${
code
}
) 未下发 route,已跳过`
);
console
.
warn
(
`[menu] 后端菜单「
${
n
.
label
}
」(
${
code
??
'无权限码'
})
未下发
route
,已跳过
`);
return;
}
// resource 仅用于 route 复用时的路径兜底,与显隐无关;无 permCode 也照常渲染。
const point = code ? toFrontendPoint(code) : '';
const i = point.lastIndexOf(':');
const
resource
=
(
i
>
0
?
point
.
slice
(
0
,
i
)
:
point
)
as
ResourceKey
;
const resource =
point ? ((i > 0 ? point.slice(0, i) : point) as ResourceKey) : undefined
;
let path = n.route;
const uses = routeUses.get(path) ?? 0;
if (uses > 1) {
...
...
@@ -138,32 +121,6 @@ export function buildMenus(
children.push({ path, label: n.label, icon: n.icon ?? null, resource });
});
// 整组被丢弃时点名原因。此前是静默 return:后端菜单树明明下发了分组,
// 侧边栏却连一级标题都没有,且控制台零输出,排查只能靠猜。
if
(
!
children
.
length
&&
pages
.
length
)
{
const
missing
=
pages
.
filter
((
n
)
=>
!!
n
.
permCode
&&
!
points
.
has
(
n
.
permCode
))
.
map
((
n
)
=>
`
${
n
.
label
}
→
${
n
.
permCode
}
`
);
if
(
missing
.
length
&&
IS_DEV
)
{
const
key
=
`
${
g
.
label
}
|
${
missing
.
join
(
'|'
)}
`
;
if
(
!
warnedDroppedGroups
.
has
(
key
))
{
warnedDroppedGroups
.
add
(
key
);
const
prefix
=
String
(
pages
[
0
]?.
permCode
??
''
)
.
split
(
':'
)
.
slice
(
0
,
2
)
.
join
(
':'
);
const
related
=
prefix
?
[...
points
].
filter
((
p
)
=>
p
.
startsWith
(
prefix
))
:
[];
console
.
warn
(
`[menu] 分组「
${
g
.
label
}
」整组未渲染:
${
missing
.
length
}
/
${
pages
.
length
}
个页面的 permCode 不在当前登录态 permCodes 中。\n`
+
` 缺失:
${
missing
.
join
(
'、'
)}
\n`
+
` permCodes 中
${
prefix
}
前缀的码:
${
related
.
length
?
related
.
join
(
'、'
)
:
'(无)'
}
\n`
+
' 原因:/system/menu/tree/current 与 /system/auth/login|info 的 permCodes 口径不同'
+
'(后者按 sys_role_menu 关联聚合),或权限码缓存未刷新。\n'
+
' 处理:补齐 sys_role_menu 授权 → POST /system/auth/perm/refresh → 退出重登(刷新 auth.info() 缓存)。'
,
);
}
}
}
if (children.length) groups.push({ group: g.label, icon: g.icon ?? null, children });
});
...
...
packages/platform-core/src/api/modules/menu.ts
View file @
4454cb7
...
...
@@ -32,21 +32,15 @@ export interface MenuNode {
class
Menu
extends
ApiClient
{
/**
* 菜单树的请求缓存(同一登录态内菜单树不会变,没必要重复打网络)。
*
* 需要它的两个真实原因:
* 1) 开发期 React.StrictMode 会把 effect 跑成 mount → cleanup → mount,直接双发请求;
* 2) 权限点 points 会变化(AccessProvider 挂载后异步 auth.info() 返回再 applyLogin 一次),
* BasicLayout 的 effect 依赖 points,points 一变就会重跑。
*
* 缓存的是「网络请求」,不是「菜单结果」:调用方仍用当前 points 重新 buildMenus,
* 所以权限点更新后菜单过滤依旧准确,只是不会重复请求。
* 需要它仅因为开发期 React.StrictMode 会把 effect 跑成 mount → cleanup → mount,
* 导致同一棵树双发请求。菜单可见性以 /current 为准、不依赖权限点,故不需要按 points 重算。
*/
private
treePromise
:
Promise
<
MenuNode
[]
>
|
null
=
null
;
/**
* 当前登录用户的菜单树(/system/menu/tree/current)。
* 后端已按当前登录用户的角色装配并返回,前端
仍与登录下发的 permCodes 取交集后再渲染
*
(双保险:即便后端未按角色过滤,也不会有越权菜单被渲染出来)
。
* 后端已按当前登录用户的角色装配并返回,前端
原样渲染,不再与登录下发的 permCodes 取交集。
*
菜单显隐的唯一真源就是这棵树;越权菜单由后端装配时拦截,不在前端二次过滤
。
*/
tree
():
Promise
<
MenuNode
[]
>
{
if
(
!
this
.
treePromise
)
{
...
...
packages/platform-sdk/src/compat/access/backend/adapter.ts
View file @
4454cb7
...
...
@@ -21,7 +21,7 @@ function toFrontendPoint(code: string): string {
/* ---------------- 菜单树:后端 /system/menu/tree/current → 前端菜单结构 ---------------- */
/** 前端菜单项(path/label/icon 供渲染,resource 供
权限与面包屑
) */
/** 前端菜单项(path/label/icon 供渲染,resource 供
面包屑等派生用途
) */
export
interface
MenuItemDef
{
path
:
string
;
label
:
string
;
...
...
@@ -53,12 +53,12 @@ export interface MenuGroupDef {
* - 只取 nodeType 1(分组)下的 nodeType 2(页面);nodeType 3 是按钮操作点,不进菜单。
* - status !== 1(停用)的节点丢弃。
* - path 与 icon 直接取自后端下发的 node.route / node.icon,前端不再做映射。
* - permCode 与当前账号持有的权限点取交集(/current 后端已按角色过滤,这里作双保险再过滤一次)。
* - 菜单可见性完全由后端 /current 决定:后端已按当前登录角色装配好菜单树,前端原样渲染,
* 不再拿登录返回的 permCodes 做交集(双保险)。
* - node.route 缺失 → 跳过并告警(点了会 404,不应渲染)。
* - 分组/页面均按 sort 升序。
*/
export
function
buildMenus
(
tree
:
MenuNode
[],
owned
:
Iterable
<
string
>
):
MenuGroupDef
[]
{
const
points
=
new
Set
(
owned
);
export
function
buildMenus
(
tree
:
MenuNode
[]):
MenuGroupDef
[]
{
const
groups
:
MenuGroupDef
[]
=
[];
(
tree
??
[])
...
...
@@ -71,21 +71,19 @@ export function buildMenus(tree: MenuNode[], owned: Iterable<string>): MenuGroup
.
sort
((
a
,
b
)
=>
a
.
sort
-
b
.
sort
)
.
forEach
((
n
)
=>
{
const
code
=
n
.
permCode
;
if
(
!
code
)
return
;
// 归一为前端点号后与权限点集合比较(points 已是归一后的点号形态)
const
point
=
toFrontendPoint
(
code
);
if
(
!
points
.
has
(
point
))
return
;
// 路由由后端树直接下发;缺失则跳过(不应渲染一个点了会 404 的菜单项)
if
(
!
n
.
route
)
{
console
.
warn
(
`[menu] 后端菜单「
${
n
.
label
}
」(
${
code
}
) 未下发 route,已跳过`
);
console
.
warn
(
`[menu] 后端菜单「
${
n
.
label
}
」(
${
code
??
'无权限码'
})
未下发
route
,已跳过
`);
return;
}
// resource 仅作派生用途,与显隐无关;无 permCode 也照常渲染。
const point = code ? toFrontendPoint(code) : '';
const i = point.lastIndexOf(':');
children.push({
path: n.route,
label: n.label,
icon: n.icon ?? null,
resource
:
(
i
>
0
?
point
.
slice
(
0
,
i
)
:
point
)
as
ResourceKey
,
resource:
point ? ((i > 0 ? point.slice(0, i) : point) as ResourceKey) : undefined
,
});
});
if (children.length) groups.push({ group: g.label, children });
...
...
packages/platform-sdk/src/compat/api/modules/menu.ts
View file @
4454cb7
...
...
@@ -29,21 +29,15 @@ export interface MenuNode {
class
Menu
extends
ApiClient
{
/**
* 菜单树的请求缓存(同一登录态内菜单树不会变,没必要重复打网络)。
*
* 需要它的两个真实原因:
* 1) 开发期 React.StrictMode 会把 effect 跑成 mount → cleanup → mount,直接双发请求;
* 2) 权限点 points 会变化(AccessProvider 挂载后异步 auth.info() 返回再 applyLogin 一次),
* BasicLayout 的 effect 依赖 points,points 一变就会重跑。
*
* 缓存的是「网络请求」,不是「菜单结果」:调用方仍用当前 points 重新 buildMenus,
* 所以权限点更新后菜单过滤依旧准确,只是不会重复请求。
* 需要它仅因为开发期 React.StrictMode 会把 effect 跑成 mount → cleanup → mount,
* 导致同一棵树双发请求。菜单可见性以 /current 为准、不依赖权限点,故不需要按 points 重算。
*/
private
treePromise
:
Promise
<
MenuNode
[]
>
|
null
=
null
;
/**
* 当前登录用户的菜单树(/system/menu/tree/current)。
* 后端已按当前登录用户的角色装配并返回,前端
仍与登录下发的 permCodes 取交集后再渲染
*
(双保险:即便后端未按角色过滤,也不会有越权菜单被渲染出来)
。
* 后端已按当前登录用户的角色装配并返回,前端
原样渲染,不再与登录下发的 permCodes 取交集。
*
菜单显隐的唯一真源就是这棵树;越权菜单由后端装配时拦截,不在前端二次过滤
。
*/
tree
():
Promise
<
MenuNode
[]
>
{
if
(
!
this
.
treePromise
)
{
...
...
packages/ui/src/styles/ui.css
View file @
4454cb7
...
...
@@ -437,17 +437,17 @@ html body {
grid-row
:
auto
;
}
}
/* 「更多筛选」双数角标:上标
总数是整张表的条件总数,主色实心数是
已填写的条件数。
总数上标只在收起态出现(展开后条件都在眼前,再挂总数
纯属重复);主色已填数角标
/* 「更多筛选」双数角标:上标
是收进「更多筛选」的条件数(不含常显字段),主色实心数是整张表
已填写的条件数。
收起数上标只在收起态出现(展开后这些条件都在眼前,再挂数字
纯属重复);主色已填数角标
两态都显示,展开态它还是悬浮条件卡的触发区。
总
数只是静态说明(不随填写变化),不该和强调性的已填数抢视觉重量:退化成无背景
收起
数只是静态说明(不随填写变化),不该和强调性的已填数抢视觉重量:退化成无背景
上标后按钮宽度回落到接近纯文案,主色角标成了唯一带底色的元素。 */
.uj-filter-more-btn
{
display
:
inline-flex
;
align-items
:
center
;
justify-content
:
center
;
gap
:
4px
;
/* 安全宽:按「更多筛选 + 两位数
总
数上标 + 两位数已填角标 + 箭头」的最宽态固定,
/* 安全宽:按「更多筛选 + 两位数
收起
数上标 + 两位数已填角标 + 箭头」的最宽态固定,
有无角标按钮都占同一宽度——角标从无到有时按钮不再变宽去挤紧邻字段。 */
box-sizing
:
border-box
;
min-width
:
126px
;
...
...
@@ -931,6 +931,23 @@ html body {
/* 与 LoginCoverage 的青绿脉冲逐字同源;登录页深色底、这里浅色底,色值不变 */
--uj-brand-pulse
:
#1fe0c8
;
}
/* 页面/详情加载态容器:BrandLoader 居中 + 文案。取代原 antd Skeleton 骨架屏
(shimmer 波浪),全系统页面级 loading 只有这一种图形。最小高度给抽屉/页面
一个稳定落点,避免内容到达前后高度跳变。 */
.uj-brand-loading
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
justify-content
:
center
;
gap
:
14px
;
width
:
100%
;
box-sizing
:
border-box
;
}
.uj-brand-loading__label
{
color
:
var
(
--uj-text-3
);
font-size
:
12px
;
letter-spacing
:
0.5px
;
}
.uj-brand-loader
{
flex
:
none
;
line-height
:
0
;
...
...
scripts/audit-module.mjs
View file @
4454cb7
...
...
@@ -635,6 +635,91 @@ function checkFile(file) {
}
}
}
// §7 / §9:整页列表的填充链。真源是 PORT_CONVERSION.md §7「需要整屏定高时给
// DataTable 传 fillHeight 并在外层用 PageShell fill」+ §9「列表页 fill 开整屏定高」。
// 三个断点任一缺失,表现就是「筛选区与列表紧贴 / 表头变高 / 表体空白变大」——
// 11-18 的 43faf63 一次移除 4 页 fillHeight 就是这么漏过基线的,故加闸门钉死。
// 抽屉 / 弹窗里的表不在该容器里(body 无定高),明确豁免,不强求 fill。
const isEmbedded = /Drawer\.tsx$/.test(file) || /Modal\.tsx$/.test(file);
const hasFilterCard = text.includes('uj-filter-card');
const hasDataTable = /<DataTable\b/.test(text);
if (isTs && hasFilterCard && hasDataTable && !isEmbedded) {
// ① PageShell 必须 fill(分页贴底、表体内滚的定高链第一段)。pane 组件(tab 里的
// LiveCodesTab/VehicleLedger 等)自己没有 PageShell,定高由宿主页负责,跳过。
const shell = /<PageShell\b[\s\S]{0,120}?>/.exec(text);
if (shell && !/\bfill\b/.test(shell[0])) {
add(
'list/page-shell-fill',
'§7 / §9',
'error',
file,
lineOf(text, shell.index),
'整页列表的 PageShell 必须带 fill:否则内容区不定高,表体无法内滚、分页贴不了底(§7 / §9)',
);
}
// ② 表格外层 UCard 必须 fill(.uj-card--fill 把高度传给表体)。
const tableCards = [...text.matchAll(/<UCard\b[^>]*>/g)].filter(
(m) => !/uj-filter-card/.test(m[0]),
);
if (!tableCards.some((m) => /\bfill\b/.test(m[0]))) {
add(
'list/table-card-fill',
'§7 / §9',
'error',
file,
tableCards.length ? lineOf(text, tableCards[0].index) : 1,
'表格外层 UCard 必须带 fill:否则 .uj-card--fill 高度链断开,出现表头变高 / 空白变大(§7 / §9)',
);
}
// ③ DataTable 必须 fillHeight。
if (!/\bfillHeight\b/.test(text)) {
const dt = /<DataTable\b/.exec(text);
add(
'list/table-fill-height',
'§7',
'error',
file,
dt ? lineOf(text, dt.index) : 1,
'整页列表的 DataTable 必须带 fillHeight:表体才能内滚、分页才能贴底(§7)',
);
}
}
// §13 tab 落地规则:单路由 + 页内 UTabs。tab 差异只在按钮 perm_code,内容是同一个
// 定高列表——所以 tab 只放 label/key,pane 在 tabs 之外按 activeKey 渲染。把 pane 塞进
// items[].children 会让它被 .ant-tabs-content-holder 包住、脱离 .uj-page__body 的定高
// flex 链,fill/fillHeight 随之失效(11-18 台账/一客一群就是这么坏的)。只报不改:
// 结构改写涉及 JSX 语义,交给人工按评估管理 / WithdrawManage 的形态改。
if (isTs && /<UTabs\b/.test(text) && /<PageShell\b/.test(text)) {
const shell = /<PageShell\b[\s\S]{0,120}?>/.exec(text);
if (shell && !/\bfill\b/.test(shell[0])) {
add(
'list/tab-host-shell-fill',
'§13 / §7 / §9',
'error',
file,
lineOf(text, shell.index),
'带页内 UTabs 的列表宿主页,PageShell 必须 fill:否则 pane 的 fill/fillHeight 没有定高链可接(§9)',
);
}
const tabsBlock = /<UTabs\b[\s\S]*?\/?>/.exec(text)?.[0] ?? '';
const itemsBlock = /items=\{([\s\S]*?)\}\s*\n\s*\/>|items=\{([\s\S]*?)\}\s*\n\s*[\w}]/.exec(
text,
);
const scoped = itemsBlock ? itemsBlock[1] || itemsBlock[2] || '' : tabsBlock;
if (/\bchildren\s*:/.test(scoped)) {
const m = /\bchildren\s*:/.exec(text);
add(
'list/tab-pane-children',
'§13 / §7',
'error',
file,
m ? lineOf(text, m.index) : 1,
'页面级 UTabs 的 items 不要带 children:把 pane 放进 .ant-tabs-content-holder 会断开定高 flex 链、让 fill/fillHeight 失效;改成 label/key-only + 按 activeKey 在 tabs 外渲染 pane(见评估管理 / WithdrawManage)',
);
}
}
}
/** 入口骨架:tokens.css 导入 + uj-scope 根类名(§5)。 */
...
...
scripts/finance-menu-migration.sql
View file @
4454cb7
...
...
@@ -108,16 +108,16 @@ INSERT IGNORE INTO `sys_role_menu` (`role_id`, `menu_id`)
SELECT
rm
.
`role_id`
,
101
FROM
`sys_role_menu`
rm
WHERE
rm
.
`menu_id`
=
96
;
-- ---------------------------------------------------------------------
-- 4b) 权限码口径补齐(关键,别漏)
-- /system/auth/login 与 /system/auth/info 的 permCodes 是按 sys_role_menu
-- 关联 sys_menu.perm_code 聚合的;/system/menu/tree/current 对超管返回全量树,
-- 两个接口口径不一致:树里能看到「财务管理」不等于 permCodes 里有 finance: 码。
-- 前端 packages/platform-core/src/access/backend/adapter.ts:103 的
-- points.has(n.permCode) 只要不匹配,页面节点就被 return,
-- children.length === 0 时整组不 push —— 侧边栏连一级标题都没有,且零日志。
-- 4b) 权限码口径补齐(历史坑,现前端已不再依赖,保留仅为数据一致性)
-- 背景:/system/auth/login|info 的 permCodes 按 sys_role_menu 关联 sys_menu.perm_code
-- 聚合;/system/menu/tree/current 对超管返回全量树,两接口口径曾不一致——树里有页面
-- 不等于 permCodes 里有 finance: 码。旧版前端 buildMenus 用 points.has(n.permCode)
-- 做交集,缺码就把页面节点 return、整组不渲染且零日志,这是本脚本存在的直接原因。
-- 现状:菜单显隐已改为完全以 /system/menu/tree/current 为准(单路由真源),前端
-- buildMenus / BasicLayout 不再拿 permCodes 二次过滤。故下面这段授权补齐不再是
-- 「不补就看不到菜单」的硬前提;仍保留是为了让 permCodes 与菜单树口径一致
-- (按钮级 PermButton / canPoint 仍按 permCodes 判定),避免角色导出/审计口径分歧。
-- 本脚本原地改了 96~100 的 perm_code(usedcar:payment:* → finance:payment:*),
-- 若某角色原本只授权了部分 menu_id,或 10027* 的新节点没进关联,
-- permCodes 就会缺 finance:payment:view,页面照样不显示。
-- 口径:凡是原本有「付款管理」页面(96)的角色,自动补齐 10027* 全部 6 行授权。
-- 幂等,可重复执行。
-- ---------------------------------------------------------------------
...
...
@@ -175,19 +175,20 @@ COMMIT;
-- 这样 SQL 回滚时旧页面仍在,不会出现菜单有、页面空的窗口。
--
-- ---------------------------------------------------------------------
-- 6) 跑完 SQL 之后必做:刷新权限码(否则菜单树有、侧边栏没有)
-- ① 后端权限码有缓存:调 POST /system/auth/perm/refresh
-- (前端 packages/platform-core/src/api/modules/auth.ts:105 已定义
-- auth.refreshPerm(),但全仓零调用,需手动触发或由后端刷)。
-- ② 退出登录再重新登录:登录流程会 menuApi.clearCache() + auth.clearCache(),
-- 重新拉 /system/auth/info 并 applyLogin() 覆盖 points。
-- 只按 F5 刷新页面也行(模块重建会重拉 info),但 SPA 内切页不重拉。
-- ③ 浏览器控制台验证(应看到 5 个 finance: 码、0 个 usedcar:payment 码):
-- 6) 跑完 SQL 之后的验证
-- ① 菜单显隐以 /system/menu/tree/current 为唯一真源,前端不再用 permCodes 过滤:
-- 页面是否在侧边栏出现,取决于该角色是否被授予对应 menu_id(sys_role_menu),
-- 不再取决于 permCodes 里有没有 finance:payment:view。
-- ② 仍要刷新 permCodes 的地方是按钮级权限(PermButton / canPoint):
-- - 后端权限码有缓存时调 POST /system/auth/perm/refresh
-- (前端 packages/platform-core/src/api/modules/auth.ts 的 auth.refreshPerm())。
-- - 或退出重登:登录流程 menuApi.clearCache() + auth.clearCache(),重拉
-- /system/auth/info 并 applyLogin() 覆盖 points;只按 F5 刷新页面也行。
-- ③ 浏览器控制台核对 permCodes 口径(应看到 finance: 码、0 个 usedcar:payment 码):
-- const s = JSON.parse(localStorage.getItem('session'));
-- console.log(s.permCodes.filter(c => c.startsWith('finance:')));
-- console.log(s.permCodes.filter(c => c.startsWith('usedcar:payment')));
-- 判据:必须含 'finance:payment:view' —— buildMenus 只认页面 :view 码,
-- 少这一个页面就不渲染,整组「财务管理」静默消失。
-- ④ 仍不显示时查 5b 的 granted_finance_nodes 是否为 6;
-- 超管账号不 bypass:/current 返回全量树,permCodes 却按 sys_role_menu 聚合。
-- 缺码只影响按钮级权限,不再影响页面菜单是否渲染。
-- ④ 页面仍不显示时查 sys_role_menu 是否授予 10027* 的 menu_id(尤其页面节点 97);
-- /current 是按角色装配的,树里没有就是没授权,与 permCodes 无关。
-- =====================================================================
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment