Commit e267b79a by liimin

feat(ui): 共享层补齐 U** 组件与 palette 真源,子应用去掉 antd 直连

- packages/ui 新增 App/Dropdown/Empty/Steps/Timeline 五个共享组件 + styles/ui.css,
  Alert/Card/Table/FillTable/Tag 改由共享层出语义;packages/biz 新增 PageShell,
  SearchForm/DataTable/formSchema 对齐新壳
- packages/design-tokens/src/palette.ts 成为色值唯一真源,tokens.css 与 themeConfig
  从它派生;scripts/check-tokens.mjs 把「palette 30 个色值 ↔ tokens.css 一致、
  子应用无写死颜色」变成可执行门禁(进 verify 链)
- eslint 共享配置改用 @typescript-eslint/no-restricted-imports 才有 allowTypeImports
  (import type { TableProps } from 'antd' 属合法类型引用),并新增 antd 直连禁令:
  缺组件就往 packages/ui 补一个 U** 再引用,不绕过共享层
- system 子应用 AccountModal/RoleModal 改成 AccountFormDrawer/RoleFormDrawer
  (抽屉无遮罩,值即按钮);points/store 两子应用页面逐页迁到共享组件
- platform-core buildMenus 增加 pathByResource 兜底:后端同一 route 被多页面节点复用
  时按兜底清单出路径并在控制台点名,正常数据行为不变
- 已知未决(交接):本轮只跑静态门禁,页面视觉与交互由你在 dev 里逐屏验收
1 parent 3fd22477
Showing 101 changed files with 2456 additions and 1485 deletions
:root { /* 令牌唯一真源在 @uj/design-tokens/tokens.css(main.tsx 里先于本文件引入)。
/* 原型 Design Token 对齐(:root CSS 变量保留,供自定义 CSS 复用) */ 这里绝不再写第二份 :root 变量 —— 同值重复定义会让「改了主壳一处、子应用不跟着变」。 */
--uj-primary: #2b5ce6;
--uj-brand-deep: #0f1b3d;
}
/* 全站授权字体:PingFang(苹方),从服务器远程获取 */ /* 全站授权字体:PingFang(苹方),从服务器远程获取 */
@font-face { @font-face {
...@@ -44,13 +41,16 @@ body { ...@@ -44,13 +41,16 @@ body {
overflow: hidden !important; overflow: hidden !important;
} }
/* 列表铺满内容区剩余高度:仅作为 flex 子项撑满父容器。 /* 列表铺满内容区剩余高度:.uj-table-fill 的规则随 @uj/ui 的 styles/ui.css 下发。
表体具体高度由 FillTable 组件用 ResizeObserver 测量后交给 antd scroll.y。 */ 不要在这里再写一份 —— 主壳的文档样式表穿不进子应用的 shadowRoot,
.uj-table-fill { 写了也只有主壳自己生效,子应用拿到的是一份不同步的副本。 */
flex: 1 1 auto;
min-height: 0; /* wujie 子应用宿主:撑满挂载容器,否则子应用内的 height:100% 链在第一段就断掉,
display: flex; 列表页的「表体内滚 + 分页贴底」永远算不出可用高度。 */
flex-direction: column; wujie-app {
display: block;
width: 100%;
height: 100%;
} }
/* 页面级兜底:任何元素(含被 portal 到 body 的 antd 浮层/tooltip)造成的横向溢出都不显示滚动条 */ /* 页面级兜底:任何元素(含被 portal 到 body 的 antd 浮层/tooltip)造成的横向溢出都不显示滚动条 */
......
...@@ -87,6 +87,17 @@ const fallbackGroups: MenuGroupDef[] = (() => { ...@@ -87,6 +87,17 @@ const fallbackGroups: MenuGroupDef[] = (() => {
return raw as MenuGroupDef[]; return raw as MenuGroupDef[];
})(); })();
/**
* 权限资源 → 页面 path(来自兜底菜单,即前端真正实现的页面清单)。
* buildMenus 只在后端把多个页面节点配成同一个 route 时才用它兜底;正常数据不参与。
*/
const PATH_BY_RESOURCE = new Map<string, string>();
fallbackGroups.forEach((g) =>
g.children.forEach((m) => {
if (m.resource) PATH_BY_RESOURCE.set(m.resource, m.path);
}),
);
export default function BasicLayout() { export default function BasicLayout() {
const navigate = useNavigate(); const navigate = useNavigate();
const location = useLocation(); const location = useLocation();
...@@ -101,7 +112,7 @@ export default function BasicLayout() { ...@@ -101,7 +112,7 @@ export default function BasicLayout() {
menuApi menuApi
.tree() .tree()
.then((tree) => { .then((tree) => {
if (alive) setRemoteGroups(buildMenus(tree, points)); if (alive) setRemoteGroups(buildMenus(tree, points, PATH_BY_RESOURCE));
}) })
.catch(() => { .catch(() => {
// 接口未就绪/令牌失效:不阻断,走本地兜底菜单 // 接口未就绪/令牌失效:不阻断,走本地兜底菜单
...@@ -284,12 +295,14 @@ export default function BasicLayout() { ...@@ -284,12 +295,14 @@ export default function BasicLayout() {
</div> </div>
</Header> </Header>
{/* 子应用列表页把滚动收在表体里(.uj-page--fill 定高),这里保留 auto
只服务主壳自己的长页面(工作台 / 个人资料);两层滚动不会同时出现。 */}
<Content <Content
style={{ style={{
flex: 1, flex: 1,
minHeight: 0, minHeight: 0,
overflow: 'auto', overflow: 'auto',
background: '#F4F6FA', background: 'var(--uj-bg)',
padding: 24, padding: 24,
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
......
:root { /* 令牌唯一真源:@uj/design-tokens/tokens.css(main.tsx 先于本文件引入)。
--uj-primary: #2b5ce6; 本文件只做主壳的布局与组件外观,不再重复定义任何 --uj-* 变量。 */
--uj-primary-hover: #4b75ea;
--uj-brand-1: #0b1437;
--uj-brand-2: #16245a;
--uj-bg: #f4f6fa;
--uj-surface: #ffffff;
--uj-border: #e8ecf3;
--uj-divider: #eef1f6;
--uj-text-1: #1d2533;
--uj-text-2: #4a5568;
--uj-text-3: #8a94a6;
--uj-success: #16a34a;
--uj-warning: #d97706;
--uj-error: #e5484d;
--uj-shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px -10px rgba(16, 24, 40, 0.12);
--uj-shadow-pop: 0 12px 40px -12px rgba(16, 24, 40, 0.2);
--uj-radius: 10px;
}
* { * {
box-sizing: border-box; box-sizing: border-box;
......
import { useEffect, useMemo, useState } from 'react'; import { useEffect, useMemo, useState } from 'react';
import { Empty } from 'antd';
import { busEvents } from '@uj/contracts'; import { busEvents } from '@uj/contracts';
import { SubAppProvider, readInitialPage, shortName, subappBus } from '@uj/platform-sdk'; import { SubAppProvider, readInitialPage, shortName, subappBus } from '@uj/platform-sdk';
import OrderList from './pages/OrderList'; import OrderList from './pages/OrderList';
...@@ -12,6 +11,7 @@ import WithdrawArrival from './pages/WithdrawArrival'; ...@@ -12,6 +11,7 @@ import WithdrawArrival from './pages/WithdrawArrival';
import type { PageParams, RouteDef } from './routes'; import type { PageParams, RouteDef } from './routes';
import { matchRoute } from './routes'; import { matchRoute } from './routes';
import { UEmpty } from '@uj/ui';
/** /**
* 页面表:主壳给的 subPath(形如 order/123)在这里换成组件与路径参数。 * 页面表:主壳给的 subPath(形如 order/123)在这里换成组件与路径参数。
* 新增页面 = 加一行 + 建一个页面目录;地址栏规则只在 routes.ts 里描述一次。 * 新增页面 = 加一行 + 建一个页面目录;地址栏规则只在 routes.ts 里描述一次。
...@@ -30,12 +30,7 @@ const ROUTES: RouteDef[] = [ ...@@ -30,12 +30,7 @@ const ROUTES: RouteDef[] = [
function renderPage(subPath: string) { function renderPage(subPath: string) {
const matched = matchRoute(ROUTES, subPath); const matched = matchRoute(ROUTES, subPath);
if (!matched) { if (!matched) {
return ( return <UEmpty description={`没有匹配「${subPath}」的页面,请从菜单进入`} />;
<Empty
description={`没有匹配「${subPath}」的页面,请从菜单进入`}
image={Empty.PRESENTED_IMAGE_SIMPLE}
/>
);
} }
const { Page, params } = matched; const { Page, params } = matched;
return <Page params={params as PageParams} />; return <Page params={params as PageParams} />;
......
import { registerGateway } from '@uj/api-core'; import { registerGateway } from '@uj/api-core';
import { import { djSmartcarlifeGateway, scrmCarlifeGateway, scrmShopmallGateway } from './glsx';
djSmartcarlifeGateway,
scrmCarlifeGateway,
scrmShopmallGateway,
} from './glsx';
// 接入一个新系统 = 在这里多登记一个策略(或在本文件 import 后 registerGateway)。 // 接入一个新系统 = 在这里多登记一个策略(或在本文件 import 后 registerGateway)。
// 未登记的网关 resolveGateway 直接抛错,避免「请求发出去了但走的是默认签名」这种难查故障。 // 未登记的网关 resolveGateway 直接抛错,避免「请求发出去了但走的是默认签名」这种难查故障。
......
...@@ -21,7 +21,7 @@ export function DetailCell({ cell }: { cell: DetailValue }) { ...@@ -21,7 +21,7 @@ export function DetailCell({ cell }: { cell: DetailValue }) {
{cell.tag.label} {cell.tag.label}
</UTag> </UTag>
) : ( ) : (
<span className={cell.code ? 'uj-points-code' : undefined}>{cell.value}</span> <span className={cell.code ? 'uj-code' : undefined}>{cell.value}</span>
)} )}
</dd> </dd>
</div> </div>
......
import type { ReactNode } from 'react'; import type { ReactNode } from 'react';
import { UButton, UText, UTitle } from '@uj/ui'; import { PageShell as SharedPageShell } from '@/components';
import { goTo } from './navigate'; import { goTo } from './navigate';
import './page.css';
interface PageShellProps { interface PageShellProps {
title: string; title: string;
...@@ -10,27 +9,20 @@ interface PageShellProps { ...@@ -10,27 +9,20 @@ interface PageShellProps {
/** 子页面用:返回目标路径(相对本子应用),老系统的每个详情页都有退回入口。 */ /** 子页面用:返回目标路径(相对本子应用),老系统的每个详情页都有退回入口。 */
back?: string; back?: string;
actions?: ReactNode; actions?: ReactNode;
/** 列表页:整屏定高、表体内滚、分页贴底。 */
fill?: boolean;
children: ReactNode; children: ReactNode;
} }
/** /**
* 积分管理所有页面共用的外壳:标题 + 说明 + 返回 + 右上角动作 + 内容。 * points 的页面外壳:共享层的薄封装,只多了「返回目标是一个相对路径」这一件本子应用的事。
* 七个页面只有内容不同,因此这层只到此为止,控件与筛选仍然各页自己配。 * 布局、标题层级、间距全部由 @uj/biz 的 PageShell 承担 —— 三个子应用共用一份,
* 这样 system / store 接过来的时候不会长出第二套字号。
*/ */
export function PageShell({ title, description, back, actions, children }: PageShellProps) { export function PageShell({ back, children, ...rest }: PageShellProps) {
return ( return (
<div className="uj-points-page"> <SharedPageShell {...rest} onBack={back ? () => goTo(back) : undefined}>
<div className="uj-points-page-header">
<div>
<UTitle level={3}>{title}</UTitle>
{description ? <UText type="secondary">{description}</UText> : null}
</div>
<div className="uj-points-page-tools">
{back ? <UButton onClick={() => goTo(back)}>返回</UButton> : null}
{actions}
</div>
</div>
{children} {children}
</div> </SharedPageShell>
); );
} }
...@@ -41,7 +41,7 @@ export function buildApprovalTransferColumns( ...@@ -41,7 +41,7 @@ export function buildApprovalTransferColumns(
title: '手机号', title: '手机号',
dataIndex: 'customerPhone', dataIndex: 'customerPhone',
width: 140, width: 140,
render: (value) => <span className="uj-points-code">{textOr(value)}</span>, render: (value) => <span className="uj-code">{textOr(value)}</span>,
}, },
{ {
title: '所属门店', title: '所属门店',
...@@ -73,13 +73,13 @@ export function buildApprovalTransferColumns( ...@@ -73,13 +73,13 @@ export function buildApprovalTransferColumns(
title: '收款人身份证', title: '收款人身份证',
dataIndex: 'idCardNo', dataIndex: 'idCardNo',
width: 180, width: 180,
render: (value) => <span className="uj-points-code">{textOr(value)}</span>, render: (value) => <span className="uj-code">{textOr(value)}</span>,
}, },
{ {
title: '收款银行卡号', title: '收款银行卡号',
dataIndex: 'recvBankCardNo', dataIndex: 'recvBankCardNo',
width: 230, width: 230,
render: (value) => <span className="uj-points-code">{textOr(value)}</span>, render: (value) => <span className="uj-code">{textOr(value)}</span>,
}, },
{ {
title: '收款银行', title: '收款银行',
...@@ -92,7 +92,7 @@ export function buildApprovalTransferColumns( ...@@ -92,7 +92,7 @@ export function buildApprovalTransferColumns(
title: '收款手机号', title: '收款手机号',
dataIndex: 'mobile', dataIndex: 'mobile',
width: 130, width: 130,
render: (value) => <span className="uj-points-code">{textOr(value)}</span>, render: (value) => <span className="uj-code">{textOr(value)}</span>,
}, },
]; ];
if (kind === 'batch') return shared; if (kind === 'batch') return shared;
...@@ -101,7 +101,7 @@ export function buildApprovalTransferColumns( ...@@ -101,7 +101,7 @@ export function buildApprovalTransferColumns(
title: '提现单号', title: '提现单号',
dataIndex: 'outSettleOrderId', dataIndex: 'outSettleOrderId',
width: 200, width: 200,
render: (value) => <span className="uj-points-code">{textOr(value)}</span>, render: (value) => <span className="uj-code">{textOr(value)}</span>,
}, },
...shared, ...shared,
{ {
......
...@@ -74,8 +74,8 @@ export const CHANNEL_PROVIDER: DictOption[] = [ ...@@ -74,8 +74,8 @@ export const CHANNEL_PROVIDER: DictOption[] = [
/** /**
* 提现单状态(0-8),对应老系统的 auditStatusStatusList。 * 提现单状态(0-8),对应老系统的 auditStatusStatusList。
* 颜色逐项对齐老列表圆点数组 ['#FDB757','#2CCA74','#5850FF','#2CCA74','#999999','#EB4E4E','#2CCA74','#F59619','#F59619'], * 颜色逐项对齐老列表的圆点数组,只有一处例外:
* 只有一处例外:老系统把「受理失败」涂成绿色,那是抄错的一行,这里按语义给红。 * 老系统把「受理失败」涂成绿色,那是抄错的一行,这里按语义给红。
*/ */
export const TRANSFER_STATUS: StatusMeta[] = [ export const TRANSFER_STATUS: StatusMeta[] = [
{ label: '待审核', color: 'gold' }, { label: '待审核', color: 'gold' },
......
/* 页面外壳与表格区:尺寸、圆角、阴影一律取设计令牌,不写裸色值。 */ /* points 的业务样式。
.uj-points-page { *
display: flex; * 页面骨架(标题 / 说明 / 返回 / 动作区 / 列表铺满)、筛选栅格与折叠、卡片描边阴影、
flex-direction: column; * 表格表头与分页,全部由 @uj/biz 的 PageShell 与 @uj/ui 的 styles/ui.css 承担 ——
gap: 16px; * 这里只留本域特有的东西:身份证、协议 iframe、标签树、明细网格、统计条。
min-width: 0; * 新增样式前先确认共享层没有;有就别再写第二份。
min-height: 100%; */
}
.uj-points-page-header { /* 统计条:一排等宽小卡。编号/金额用等宽数字,左右多列时能对齐。 */
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 20px;
}
.uj-points-page-header h3 {
margin: 0 0 6px;
}
.uj-points-page-header .ant-typography-secondary {
font-size: 13px;
line-height: 1.8;
}
.uj-points-page-tools {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.uj-points-filter-card {
border: 1px solid var(--uj-border);
box-shadow: var(--uj-shadow-card);
}
.uj-points-search-form {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 12px 20px;
}
.uj-points-search-form > :last-child {
grid-column: 1 / -1;
justify-self: end;
margin-bottom: 0;
}
.uj-points-table-card {
min-width: 0;
border: 1px solid var(--uj-border);
border-radius: 10px;
background: var(--uj-surface);
overflow: hidden;
box-shadow: var(--uj-shadow-card);
}
.uj-points-code {
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
font-size: 12px;
}
/* 表格里可点的单元格(身份证、免责协议):与右上角主按钮同源的颜色,不写裸色值。 */
.uj-points-link {
cursor: pointer;
color: var(--uj-primary, #2b5ce6);
}
.uj-points-subtext {
display: block;
color: var(--uj-text-3);
font-size: 12px;
margin-top: 3px;
}
/* 表头问号提示(平台方列):老系统就是「文字 + 一个灰色问号」,图标不能抢标题的分量。 */
.uj-points-header-hint { .uj-points-header-hint {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
...@@ -100,6 +44,8 @@ ...@@ -100,6 +44,8 @@
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 12px; gap: 12px;
/* 列表页里统计条只占自己那一行,剩余高度全给表格。 */
flex: none;
} }
.uj-points-statistics-item { .uj-points-statistics-item {
flex: 1 1 200px; flex: 1 1 200px;
...@@ -124,38 +70,19 @@ ...@@ -124,38 +70,19 @@
color: var(--uj-text-3); color: var(--uj-text-3);
} }
@media (max-width: 1100px) { @media (max-width: 1100px) {
.uj-points-search-form {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.uj-points-detail-grid { .uj-points-detail-grid {
grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-columns: repeat(2, minmax(0, 1fr));
} }
} }
@media (max-width: 640px) { @media (max-width: 640px) {
.uj-points-search-form,
.uj-points-detail-grid { .uj-points-detail-grid {
grid-template-columns: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr);
} }
.uj-points-page-header {
flex-direction: column;
}
} }
/* 工具条:左边一条计数,右边一排动作,窄屏时动作自己换行。 */ /* 统计条卡片的标题行:左标签、右「查看更多」。 */
.uj-points-toolbar { .uj-points-statistics-card {
display: flex; flex: none;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
padding: 12px 16px;
border-bottom: 1px solid var(--uj-border);
}
.uj-points-toolbar-actions {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
} }
.uj-points-statistics-head { .uj-points-statistics-head {
display: flex; display: flex;
......
import { useEffect } from 'react'; import { useEffect } from 'react';
import { useMutation, useQueries, useQuery, useQueryClient } from '@tanstack/react-query'; import { useMutation, useQueries, useQuery, useQueryClient } from '@tanstack/react-query';
import { App } from 'antd';
import { DEFAULT_PAGE_SIZE } from '@/components'; import { DEFAULT_PAGE_SIZE } from '@/components';
import { rows, totalOf, pageParams, type PageKey, type RpcListResult } from '@/api'; import { rows, totalOf, pageParams, type PageKey, type RpcListResult } from '@/api';
import { errorMessage } from './format'; import { errorMessage } from './format';
import { openExportUrl } from './files'; import { openExportUrl } from './files';
import { useUMessage } from '@uj/ui';
/** 列表页共享的分页状态:与 DataTable 的 pagination 直接对齐。 */ /** 列表页共享的分页状态:与 DataTable 的 pagination 直接对齐。 */
export interface ListPage { export interface ListPage {
current: number; current: number;
...@@ -100,7 +100,7 @@ export function useRefresh(scope: unknown[]) { ...@@ -100,7 +100,7 @@ export function useRefresh(scope: unknown[]) {
* 统一在这里做「无地址 = 失败」的兜底提示,页面只负责传当前筛选条件。 * 统一在这里做「无地址 = 失败」的兜底提示,页面只负责传当前筛选条件。
*/ */
export function useExport(fetcher: (params: Record<string, unknown>) => Promise<string>) { export function useExport(fetcher: (params: Record<string, unknown>) => Promise<string>) {
const { message } = App.useApp(); const message = useUMessage();
return useMutation({ return useMutation({
mutationKey: ['points', 'export'], mutationKey: ['points', 'export'],
mutationFn: async (params: Record<string, unknown>) => { mutationFn: async (params: Record<string, unknown>) => {
...@@ -114,7 +114,7 @@ export function useExport(fetcher: (params: Record<string, unknown>) => Promise< ...@@ -114,7 +114,7 @@ export function useExport(fetcher: (params: Record<string, unknown>) => Promise<
/** 写操作统一提示:老系统按 code=='0' 判断,适配层已在失败时抛错,这里只处理成功分支之外的文案。 */ /** 写操作统一提示:老系统按 code=='0' 判断,适配层已在失败时抛错,这里只处理成功分支之外的文案。 */
export function useActionMessage() { export function useActionMessage() {
const { message } = App.useApp(); const message = useUMessage();
return { return {
success: (text = '操作成功') => message.success(text), success: (text = '操作成功') => message.success(text),
fail: (error: unknown) => message.error(errorMessage(error)), fail: (error: unknown) => message.error(errorMessage(error)),
......
import { useState, type ReactNode } from 'react'; import { useState, type ReactNode } from 'react';
import { useMutation } from '@tanstack/react-query'; import { useMutation } from '@tanstack/react-query';
import { App } from 'antd';
import { ConfirmModal } from '@/components'; import { ConfirmModal } from '@/components';
import { errorMessage } from './format'; import { errorMessage } from './format';
import { useUMessage } from '@uj/ui';
export interface ConfirmRequest { export interface ConfirmRequest {
title: string; title: string;
/** 一句人话说明这次点确定会发生什么;老系统一律是「是否要结算?」这类反问。 */ /** 一句人话说明这次点确定会发生什么;老系统一律是「是否要结算?」这类反问。 */
...@@ -23,7 +23,7 @@ export interface ConfirmRequest { ...@@ -23,7 +23,7 @@ export interface ConfirmRequest {
* 页面只描述确认文案与动作,不再各抄一段 loading / 错误提示 / 刷新。 * 页面只描述确认文案与动作,不再各抄一段 loading / 错误提示 / 刷新。
*/ */
export function useConfirmAction(onDone?: () => void) { export function useConfirmAction(onDone?: () => void) {
const { message } = App.useApp(); const message = useUMessage();
const [request, setRequest] = useState<ConfirmRequest>(); const [request, setRequest] = useState<ConfirmRequest>();
const mutation = useMutation({ const mutation = useMutation({
mutationFn: (target: ConfirmRequest) => target.run(), mutationFn: (target: ConfirmRequest) => target.run(),
......
/* 子应用内样式只在 <wujie-app> 的 shadowRoot 内生效,不会污染主壳。 /* 子应用内样式只在 <wujie-app> 的 shadowRoot 内生效,不会污染主壳。
tokens.css 由 main.tsx 引入;根节点带 .uj-scope 让 CSS 变量有落点。 */ tokens.css 由 main.tsx 引入;根节点带 .uj-scope 让令牌在 shadowRoot 内有本地落点,
不依赖「自定义属性恰好能穿透 shadow DOM」这个侥幸。 */
.uj-points-app { .uj-points-app {
min-height: 100%; /* height(而非 min-height):列表页要靠这条定高链路把剩余空间量出来。
长页面由内部 .uj-page 撑高后在本容器里滚,不会把 iframe 撑破。 */
height: 100%;
width: 100%; width: 100%;
color: var(--uj-color-text-primary); overflow: auto;
color: var(--uj-text-1);
} }
...@@ -92,7 +92,7 @@ export default function OrderDetail({ params }: { params: PageParams }) { ...@@ -92,7 +92,7 @@ export default function OrderDetail({ params }: { params: PageParams }) {
return ( return (
<div className="uj-points-detail-item" key={field.key}> <div className="uj-points-detail-item" key={field.key}>
<dt>{field.label}</dt> <dt>{field.label}</dt>
<dd className={field.code ? 'uj-points-code' : undefined} title={text}> <dd className={field.code ? 'uj-code' : undefined} title={text}>
{text} {text}
</dd> </dd>
</div> </div>
......
import { useState } from 'react'; import { useState } from 'react';
import { useMutation } from '@tanstack/react-query'; import { useMutation } from '@tanstack/react-query';
import { App } from 'antd'; import { UAlert, UButton, UCard, UResult, UUpload, useUMessage } from '@uj/ui';
import { Skeleton, UAlert, UButton, UCard, UResult, UUpload, UText } from '@uj/ui';
import { DataTable, SearchForm, type FieldSchema, type RowActionSchema } from '@/components'; import { DataTable, SearchForm, type FieldSchema, type RowActionSchema } from '@/components';
import { pointsApi, type WriteOffOrder } from '@/api'; import { pointsApi, type WriteOffOrder } from '@/api';
import { PP } from '@/permissions/codes'; import { PP } from '@/permissions/codes';
...@@ -43,7 +42,7 @@ const FIELDS: FieldSchema<Record<string, unknown>>[] = [ ...@@ -43,7 +42,7 @@ const FIELDS: FieldSchema<Record<string, unknown>>[] = [
export default function OrderList() { export default function OrderList() {
const { can } = usePointsAccess(); const { can } = usePointsAccess();
const { message } = App.useApp(); const message = useUMessage();
const allowed = can(PP.ORDER_VIEW); const allowed = can(PP.ORDER_VIEW);
const [filters, setFilters] = useState<Record<string, unknown>>({}); const [filters, setFilters] = useState<Record<string, unknown>>({});
const [page, setPage] = useState(firstPage); const [page, setPage] = useState(firstPage);
...@@ -101,6 +100,7 @@ export default function OrderList() { ...@@ -101,6 +100,7 @@ export default function OrderList() {
return ( return (
<PageShell <PageShell
fill
title="积分核销订单" title="积分核销订单"
description="按项目与商户查询核销记录,逐笔结算或取消结算,也可用表格批量导入结算结果。" description="按项目与商户查询核销记录,逐笔结算或取消结算,也可用表格批量导入结算结果。"
actions={ actions={
...@@ -130,11 +130,9 @@ export default function OrderList() { ...@@ -130,11 +130,9 @@ export default function OrderList() {
</> </>
} }
> >
<UCard className="uj-points-filter-card" size="small"> <UCard className="uj-filter-card" size="small">
<SearchForm <SearchForm
fields={FIELDS} fields={FIELDS}
layout="vertical"
className="uj-points-search-form"
initialValues={{ bizRelName: '', merchantName: '', settlementStatus: '' }} initialValues={{ bizRelName: '', merchantName: '', settlementStatus: '' }}
onSearch={(values) => { onSearch={(values) => {
setFilters(compactParams(expandDateRanges({ ...values }, DATE_RANGES))); setFilters(compactParams(expandDateRanges({ ...values }, DATE_RANGES)));
...@@ -158,31 +156,29 @@ export default function OrderList() { ...@@ -158,31 +156,29 @@ export default function OrderList() {
</UButton> </UButton>
} }
/> />
) : list.query.isPending ? ( ) : null}
<Skeleton variant="table" /> <UCard size="small" fill>
) : ( <DataTable<WriteOffOrder>
<div className="uj-points-table-card"> columns={columns}
<DataTable<WriteOffOrder> rowKey="id"
columns={columns} fillHeight
rowKey="id" actionColumnWidth={150}
actionColumnWidth={150} dataSource={list.records}
dataSource={list.records} loading={list.query.isPending || list.query.isFetching}
loading={list.query.isFetching} rowActions={rowActions}
rowActions={rowActions} toolbarTitle={`共 ${list.total} 条核销记录`}
toolbarTitle={<UText type="secondary">共 {list.total} 条核销记录</UText>} pagination={{
pagination={{ current: page.current,
current: page.current, pageSize: page.size,
pageSize: page.size, total: list.total,
total: list.total, showSizeChanger: true,
showSizeChanger: true, pageSizeOptions: [10, 20, 50, 100],
pageSizeOptions: [10, 20, 50, 100], showTotal: (total) => `共 ${total} 条`,
showTotal: (total) => `共 ${total} 条`, onChange: (current, size) =>
onChange: (current, size) => setPage({ current: size === page.size ? current : 1, size }),
setPage({ current: size === page.size ? current : 1, size }), }}
}} />
/> </UCard>
</div>
)}
{settle.modal} {settle.modal}
</PageShell> </PageShell>
); );
......
...@@ -15,7 +15,7 @@ export function buildOrderColumns(): DataTableColumnsType<WriteOffOrder> { ...@@ -15,7 +15,7 @@ export function buildOrderColumns(): DataTableColumnsType<WriteOffOrder> {
title: '消费积分', title: '消费积分',
dataIndex: 'integralValue', dataIndex: 'integralValue',
width: 100, width: 100,
render: (value) => <span className="uj-points-code">{numberOr(value)}</span>, render: (value) => <span className="uj-code">{numberOr(value)}</span>,
}, },
{ {
title: '客户昵称', title: '客户昵称',
...@@ -27,7 +27,7 @@ export function buildOrderColumns(): DataTableColumnsType<WriteOffOrder> { ...@@ -27,7 +27,7 @@ export function buildOrderColumns(): DataTableColumnsType<WriteOffOrder> {
title: '手机号', title: '手机号',
dataIndex: 'customerPhone', dataIndex: 'customerPhone',
width: 120, width: 120,
render: (value) => <span className="uj-points-code">{textOr(value)}</span>, render: (value) => <span className="uj-code">{textOr(value)}</span>,
}, },
{ {
title: '核销员工', title: '核销员工',
...@@ -60,7 +60,7 @@ export function buildOrderColumns(): DataTableColumnsType<WriteOffOrder> { ...@@ -60,7 +60,7 @@ export function buildOrderColumns(): DataTableColumnsType<WriteOffOrder> {
title: '订单编号', title: '订单编号',
dataIndex: 'orderCode', dataIndex: 'orderCode',
width: 200, width: 200,
render: (value) => <span className="uj-points-code">{textOr(value)}</span>, render: (value) => <span className="uj-code">{textOr(value)}</span>,
}, },
]; ];
} }
import { useMemo, useState } from 'react'; import { useMemo, useState } from 'react';
import { Skeleton, UAlert, UButton, UCard, UResult, UTabs, UText } from '@uj/ui'; import { UAlert, UButton, UCard, UResult, UTabs } from '@uj/ui';
import { DataTable, SearchForm, type FieldSchema, type RowActionSchema } from '@/components'; import { DataTable, SearchForm, type FieldSchema, type RowActionSchema } from '@/components';
import { pointsApi, type StaffScoreRow } from '@/api'; import { pointsApi, type StaffScoreRow } from '@/api';
import { PP } from '@/permissions/codes'; import { PP } from '@/permissions/codes';
...@@ -71,6 +71,7 @@ export default function ScoreUsers() { ...@@ -71,6 +71,7 @@ export default function ScoreUsers() {
type: 'input', type: 'input',
placeholder: `请输入${subject}名称`, placeholder: `请输入${subject}名称`,
inputProps: { maxLength: 50 }, inputProps: { maxLength: 50 },
essential: true,
}, },
{ {
name: 'staffPhone', name: 'staffPhone',
...@@ -78,14 +79,16 @@ export default function ScoreUsers() { ...@@ -78,14 +79,16 @@ export default function ScoreUsers() {
type: 'input', type: 'input',
placeholder: `请输入${subject}手机号`, placeholder: `请输入${subject}手机号`,
inputProps: { maxLength: 11 }, inputProps: { maxLength: 11 },
essential: true,
}, },
{ {
name: 'merchantId', name: 'merchantId',
label: '门店名称', label: '门店名称',
type: 'select', type: 'select',
options: withAll(merchants.options), options: withAll(merchants.options),
essential: true,
}, },
{ name: 'rewardTime', label: '积分收益时间', type: 'dateRange' }, { name: 'rewardTime', label: '积分收益时间', type: 'dateRange', essential: true },
{ name: 'reviewTime', label: '积分付款时间', type: 'dateRange' }, { name: 'reviewTime', label: '积分付款时间', type: 'dateRange' },
{ name: 'successTime', label: '积分到账时间', type: 'dateRange' }, { name: 'successTime', label: '积分到账时间', type: 'dateRange' },
]; ];
...@@ -110,6 +113,7 @@ export default function ScoreUsers() { ...@@ -110,6 +113,7 @@ export default function ScoreUsers() {
return ( return (
<PageShell <PageShell
fill
title="用户积分明细" title="用户积分明细"
description="按渠道查看每个用户当前的积分与累计收益、兑换、抵扣,点开任意一行查看他的积分流水。" description="按渠道查看每个用户当前的积分与累计收益、兑换、抵扣,点开任意一行查看他的积分流水。"
actions={ actions={
...@@ -131,6 +135,7 @@ export default function ScoreUsers() { ...@@ -131,6 +135,7 @@ export default function ScoreUsers() {
} }
> >
<UTabs <UTabs
className="uj-page__tabs"
activeKey={tab} activeKey={tab}
onChange={(key) => { onChange={(key) => {
setTab(String(key)); setTab(String(key));
...@@ -141,16 +146,14 @@ export default function ScoreUsers() { ...@@ -141,16 +146,14 @@ export default function ScoreUsers() {
label: ( label: (
<> <>
{SCORE_TABS.find((tabItem) => tabItem.key === item.key)?.label}{' '} {SCORE_TABS.find((tabItem) => tabItem.key === item.key)?.label}{' '}
<span className="uj-points-code">{item.query.isFetching ? '…' : item.total}</span> <span className="uj-code">{item.query.isFetching ? '…' : item.total}</span>
</> </>
), ),
}))} }))}
/> />
<UCard className="uj-points-filter-card" size="small"> <UCard className="uj-filter-card" size="small">
<SearchForm <SearchForm
fields={fields} fields={fields}
layout="vertical"
className="uj-points-search-form"
initialValues={{ staffName: '', staffPhone: '', merchantId: '' }} initialValues={{ staffName: '', staffPhone: '', merchantId: '' }}
onSearch={(values) => { onSearch={(values) => {
setFilters(compactParams(expandDateRanges({ ...values }, DATE_RANGES))); setFilters(compactParams(expandDateRanges({ ...values }, DATE_RANGES)));
...@@ -174,30 +177,28 @@ export default function ScoreUsers() { ...@@ -174,30 +177,28 @@ export default function ScoreUsers() {
</UButton> </UButton>
} }
/> />
) : current.query.isPending ? ( ) : null}
<Skeleton variant="table" /> <UCard size="small" fill>
) : ( <DataTable<StaffScoreRow>
<div className="uj-points-table-card"> columns={buildStaffScoreColumns(tab)}
<DataTable<StaffScoreRow> rowKey={(row) => `${row.staffId ?? ''}-${row.merchantId ?? ''}-${row.staffPhone ?? ''}`}
columns={buildStaffScoreColumns(tab)} fillHeight
rowKey={(row) => `${row.staffId ?? ''}-${row.merchantId ?? ''}-${row.staffPhone ?? ''}`} actionColumnWidth={80}
actionColumnWidth={80} dataSource={current.records}
dataSource={current.records} loading={current.query.isPending || current.query.isFetching}
loading={current.query.isFetching} rowActions={rowActions}
rowActions={rowActions} toolbarTitle={`共 ${current.total} 条记录`}
toolbarTitle={<UText type="secondary">共 {current.total} 条记录</UText>} pagination={{
pagination={{ current: page.current,
current: page.current, pageSize: page.size,
pageSize: page.size, total: current.total,
total: current.total, showSizeChanger: true,
showSizeChanger: true, pageSizeOptions: [10, 20, 50, 100],
pageSizeOptions: [10, 20, 50, 100], showTotal: (total) => `共 ${total} 条`,
showTotal: (total) => `共 ${total} 条`, onChange: (next, size) => setPage({ current: size === page.size ? next : 1, size }),
onChange: (next, size) => setPage({ current: size === page.size ? next : 1, size }), }}
}} />
/> </UCard>
</div>
)}
</PageShell> </PageShell>
); );
} }
...@@ -21,31 +21,31 @@ export function buildStaffScoreColumns(channelSource: string): DataTableColumnsT ...@@ -21,31 +21,31 @@ export function buildStaffScoreColumns(channelSource: string): DataTableColumnsT
title: `${subject}手机号`, title: `${subject}手机号`,
dataIndex: 'staffPhone', dataIndex: 'staffPhone',
width: 130, width: 130,
render: (value) => <span className="uj-points-code">{textOr(value)}</span>, render: (value) => <span className="uj-code">{textOr(value)}</span>,
}, },
{ {
title: '当前积分', title: '当前积分',
dataIndex: 'currentScore', dataIndex: 'currentScore',
width: 110, width: 110,
render: (value) => <span className="uj-points-code">{numberOr(value)}</span>, render: (value) => <span className="uj-code">{numberOr(value)}</span>,
}, },
{ {
title: '累计收益积分', title: '累计收益积分',
dataIndex: 'totalRewardScore', dataIndex: 'totalRewardScore',
width: 130, width: 130,
render: (value) => <span className="uj-points-code">{numberOr(value)}</span>, render: (value) => <span className="uj-code">{numberOr(value)}</span>,
}, },
{ {
title: '累计兑换积分', title: '累计兑换积分',
dataIndex: 'totalWithdrawalScore', dataIndex: 'totalWithdrawalScore',
width: 130, width: 130,
render: (value) => <span className="uj-points-code">{numberOr(value)}</span>, render: (value) => <span className="uj-code">{numberOr(value)}</span>,
}, },
{ {
title: '累计抵扣积分', title: '累计抵扣积分',
dataIndex: 'totalDeductScore', dataIndex: 'totalDeductScore',
width: 130, width: 130,
render: (value) => <span className="uj-points-code">{numberOr(value)}</span>, render: (value) => <span className="uj-code">{numberOr(value)}</span>,
}, },
]; ];
} }
import { useMemo, useState } from 'react'; import { useMemo, useState } from 'react';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { Skeleton, UAlert, UButton, UCard, UResult, UText } from '@uj/ui'; import { UAlert, UButton, UCard, UResult } from '@uj/ui';
import { DataTable, SearchForm, type FieldSchema, type RowActionSchema } from '@/components'; import { DataTable, SearchForm, type FieldSchema, type RowActionSchema } from '@/components';
import { pointsApi, rows, type ScoreDetailRow, type StaffScoreRow } from '@/api'; import { pointsApi, rows, type ScoreDetailRow, type StaffScoreRow } from '@/api';
import { PP } from '@/permissions/codes'; import { PP } from '@/permissions/codes';
...@@ -105,6 +105,7 @@ export default function UserScoreDetail({ params }: { params: PageParams }) { ...@@ -105,6 +105,7 @@ export default function UserScoreDetail({ params }: { params: PageParams }) {
return ( return (
<PageShell <PageShell
fill
title="积分详情" title="积分详情"
description="这一位用户的积分流水;可按积分类型与变化时间筛选,也可导出全部记录。" description="这一位用户的积分流水;可按积分类型与变化时间筛选,也可导出全部记录。"
back="users" back="users"
...@@ -129,11 +130,9 @@ export default function UserScoreDetail({ params }: { params: PageParams }) { ...@@ -129,11 +130,9 @@ export default function UserScoreDetail({ params }: { params: PageParams }) {
</div> </div>
))} ))}
</div> </div>
<UCard className="uj-points-filter-card" size="small"> <UCard className="uj-filter-card" size="small">
<SearchForm <SearchForm
fields={fields} fields={fields}
layout="vertical"
className="uj-points-search-form"
initialValues={{ infoName: '' }} initialValues={{ infoName: '' }}
onSearch={(values) => { onSearch={(values) => {
setFilters(compactParams(expandDateRanges({ ...values }, DATE_RANGES))); setFilters(compactParams(expandDateRanges({ ...values }, DATE_RANGES)));
...@@ -157,30 +156,28 @@ export default function UserScoreDetail({ params }: { params: PageParams }) { ...@@ -157,30 +156,28 @@ export default function UserScoreDetail({ params }: { params: PageParams }) {
</UButton> </UButton>
} }
/> />
) : list.query.isPending ? ( ) : null}
<Skeleton variant="table" /> <UCard size="small" fill>
) : ( <DataTable<ScoreDetailRow>
<div className="uj-points-table-card"> columns={buildScoreDetailColumns()}
<DataTable<ScoreDetailRow> rowKey={(row) => row.id ?? `${row.infoName}-${row.updatedTime}`}
columns={buildScoreDetailColumns()} fillHeight
rowKey={(row) => row.id ?? `${row.infoName}-${row.updatedTime}`} actionColumnWidth={80}
actionColumnWidth={80} dataSource={list.records}
dataSource={list.records} loading={list.query.isPending || list.query.isFetching}
loading={list.query.isFetching} rowActions={rowActions}
rowActions={rowActions} toolbarTitle={`共 ${list.total} 条流水`}
toolbarTitle={<UText type="secondary">共 {list.total} 条流水</UText>} pagination={{
pagination={{ current: page.current,
current: page.current, pageSize: page.size,
pageSize: page.size, total: list.total,
total: list.total, showSizeChanger: true,
showSizeChanger: true, pageSizeOptions: [10, 20, 50, 100],
pageSizeOptions: [10, 20, 50, 100], showTotal: (total) => `共 ${total} 条`,
showTotal: (total) => `共 ${total} 条`, onChange: (next, size) => setPage({ current: size === page.size ? next : 1, size }),
onChange: (next, size) => setPage({ current: size === page.size ? next : 1, size }), }}
}} />
/> </UCard>
</div>
)}
<RevokeDialog open={!!revokeRow} record={revokeRow} onClose={() => setRevokeRow(undefined)} /> <RevokeDialog open={!!revokeRow} record={revokeRow} onClose={() => setRevokeRow(undefined)} />
</PageShell> </PageShell>
); );
......
import { useState } from 'react'; import { useState } from 'react';
import { App } from 'antd'; import { UForm, UInput, UText, useUMessage } from '@uj/ui';
import { UForm, UInput, UText } from '@uj/ui';
import { ConfirmModal } from '@/components'; import { ConfirmModal } from '@/components';
import type { ScoreDetailRow } from '@/api'; import type { ScoreDetailRow } from '@/api';
...@@ -19,7 +18,7 @@ interface RevokeDialogProps { ...@@ -19,7 +18,7 @@ interface RevokeDialogProps {
* 不做假成功提示,也不伪造一个后端没有的接口。等后端补齐再在这里接上。 * 不做假成功提示,也不伪造一个后端没有的接口。等后端补齐再在这里接上。
*/ */
export function RevokeDialog({ open, record, onClose }: RevokeDialogProps) { export function RevokeDialog({ open, record, onClose }: RevokeDialogProps) {
const { message } = App.useApp(); const message = useUMessage();
const [remark, setRemark] = useState(''); const [remark, setRemark] = useState('');
return ( return (
......
...@@ -20,19 +20,19 @@ export function buildScoreDetailColumns(): DataTableColumnsType<ScoreDetailRow> ...@@ -20,19 +20,19 @@ export function buildScoreDetailColumns(): DataTableColumnsType<ScoreDetailRow>
title: '积分明细', title: '积分明细',
dataIndex: 'rewardScore', dataIndex: 'rewardScore',
width: 110, width: 110,
render: (value, row) => <span className="uj-points-code">{deltaText(value, row.type)}</span>, render: (value, row) => <span className="uj-code">{deltaText(value, row.type)}</span>,
}, },
{ {
title: '变化后积分', title: '变化后积分',
dataIndex: 'finalTotalScore', dataIndex: 'finalTotalScore',
width: 120, width: 120,
render: (value) => <span className="uj-points-code">{numberOr(value)}</span>, render: (value) => <span className="uj-code">{numberOr(value)}</span>,
}, },
{ {
title: '变化前积分', title: '变化前积分',
dataIndex: 'currentTotalScore', dataIndex: 'currentTotalScore',
width: 120, width: 120,
render: (value) => <span className="uj-points-code">{numberOr(value)}</span>, render: (value) => <span className="uj-code">{numberOr(value)}</span>,
}, },
{ {
title: '积分变化时间', title: '积分变化时间',
......
import { useMemo, useState } from 'react'; import { useMemo, useState } from 'react';
import { useMutation } from '@tanstack/react-query'; import { useMutation } from '@tanstack/react-query';
import { Skeleton, UAlert, UButton, UCard, UResult, UText } from '@uj/ui'; import { UAlert, UButton, UCard, UResult } from '@uj/ui';
import { DataTable, SearchForm, type RowActionSchema } from '@/components'; import { DataTable, SearchForm, type RowActionSchema } from '@/components';
import { withdrawApi, type WithdrawRow } from '@/api'; import { withdrawApi, type WithdrawRow } from '@/api';
import { PP } from '@/permissions/codes'; import { PP } from '@/permissions/codes';
...@@ -84,15 +84,14 @@ export default function WithdrawArrival({ params }: { params: PageParams }) { ...@@ -84,15 +84,14 @@ export default function WithdrawArrival({ params }: { params: PageParams }) {
return ( return (
<PageShell <PageShell
fill
title="到账明细" title="到账明细"
description="这一个批次逐笔提现的到账情况;受理失败的记录可以重新发起打款。" description="这一个批次逐笔提现的到账情况;受理失败的记录可以重新发起打款。"
back="withdraw" back="withdraw"
> >
<UCard className="uj-points-filter-card" size="small"> <UCard className="uj-filter-card" size="small">
<SearchForm <SearchForm
fields={APPROVAL_TRANSFER_FIELDS} fields={APPROVAL_TRANSFER_FIELDS}
layout="vertical"
className="uj-points-search-form"
initialValues={{ customerName: '', customerPhone: '' }} initialValues={{ customerName: '', customerPhone: '' }}
onSearch={(values) => { onSearch={(values) => {
setFilters(compactParams(values)); setFilters(compactParams(values));
...@@ -104,43 +103,41 @@ export default function WithdrawArrival({ params }: { params: PageParams }) { ...@@ -104,43 +103,41 @@ export default function WithdrawArrival({ params }: { params: PageParams }) {
}} }}
/> />
</UCard> </UCard>
<div className="uj-points-table-card"> {list.query.isError ? (
{list.query.isError ? ( <UAlert
<UAlert type="error"
type="error" showIcon
showIcon title="到账明细加载失败"
title="到账明细加载失败" description={errorMessage(list.error)}
description={errorMessage(list.error)} action={
action={ <UButton type="link" onClick={() => void list.query.refetch()}>
<UButton type="link" onClick={() => void list.query.refetch()}> 重试
重试 </UButton>
</UButton> }
} />
/> ) : null}
) : list.query.isPending ? ( <UCard size="small" fill>
<Skeleton variant="table" /> <DataTable<WithdrawRow>
) : ( columns={columns}
<DataTable<WithdrawRow> rowKey="id"
columns={columns} fillHeight
rowKey="id" actionColumnWidth={110}
actionColumnWidth={110} dataSource={list.records}
dataSource={list.records} loading={list.query.isPending || list.query.isFetching || payAgain.isPending}
loading={list.query.isFetching || payAgain.isPending} rowActions={rowActions}
rowActions={rowActions} toolbarTitle={`共 ${list.total} 条到账记录`}
toolbarTitle={<UText type="secondary">共 {list.total} 条到账记录</UText>} pagination={{
pagination={{ current: page.current,
current: page.current, pageSize: page.size,
pageSize: page.size, total: list.total,
total: list.total, showSizeChanger: true,
showSizeChanger: true, pageSizeOptions: [10, 20, 50, 100],
pageSizeOptions: [10, 20, 50, 100], showTotal: (total) => `共 ${total} 条`,
showTotal: (total) => `共 ${total} 条`, onChange: (current, size) =>
onChange: (current, size) => setPage({ current: size === page.size ? current : 1, size }),
setPage({ current: size === page.size ? current : 1, size }), }}
}} />
/> </UCard>
)}
</div>
</PageShell> </PageShell>
); );
} }
import { useEffect, useMemo, useRef, useState } from 'react'; import { useEffect, useMemo, useRef, useState } from 'react';
import { App } from 'antd'; import { UAlert, UButton, UCard, UResult, useUMessage } from '@uj/ui';
import { Skeleton, UAlert, UButton, UCard, UResult, UText } from '@uj/ui';
import { DataTable, SearchForm, type RowActionSchema } from '@/components'; import { DataTable, SearchForm, type RowActionSchema } from '@/components';
import { withdrawApi, type WithdrawRow } from '@/api'; import { withdrawApi, type WithdrawRow } from '@/api';
import { PP } from '@/permissions/codes'; import { PP } from '@/permissions/codes';
...@@ -31,7 +30,7 @@ const REMOVE_TEXT = ...@@ -31,7 +30,7 @@ const REMOVE_TEXT =
*/ */
export default function WithdrawBatch({ params }: { params: PageParams }) { export default function WithdrawBatch({ params }: { params: PageParams }) {
const { can } = usePointsAccess(); const { can } = usePointsAccess();
const { message } = App.useApp(); const message = useUMessage();
const allowed = can(PP.APPROVAL_VIEW); const allowed = can(PP.APPROVAL_VIEW);
const id = params.id ?? ''; const id = params.id ?? '';
const [filters, setFilters] = useState<Record<string, unknown>>({}); const [filters, setFilters] = useState<Record<string, unknown>>({});
...@@ -95,6 +94,7 @@ export default function WithdrawBatch({ params }: { params: PageParams }) { ...@@ -95,6 +94,7 @@ export default function WithdrawBatch({ params }: { params: PageParams }) {
return ( return (
<PageShell <PageShell
fill
title="编辑批次" title="编辑批次"
description="这一个提现批次里的提现记录;解散整批或移出单条,被移出的记录会回到待审核。" description="这一个提现批次里的提现记录;解散整批或移出单条,被移出的记录会回到待审核。"
back="withdraw" back="withdraw"
...@@ -117,11 +117,9 @@ export default function WithdrawBatch({ params }: { params: PageParams }) { ...@@ -117,11 +117,9 @@ export default function WithdrawBatch({ params }: { params: PageParams }) {
) : null ) : null
} }
> >
<UCard className="uj-points-filter-card" size="small"> <UCard className="uj-filter-card" size="small">
<SearchForm <SearchForm
fields={APPROVAL_TRANSFER_FIELDS} fields={APPROVAL_TRANSFER_FIELDS}
layout="vertical"
className="uj-points-search-form"
initialValues={{ customerName: '', customerPhone: '' }} initialValues={{ customerName: '', customerPhone: '' }}
onSearch={(values) => { onSearch={(values) => {
setFilters(compactParams(values)); setFilters(compactParams(values));
...@@ -133,43 +131,41 @@ export default function WithdrawBatch({ params }: { params: PageParams }) { ...@@ -133,43 +131,41 @@ export default function WithdrawBatch({ params }: { params: PageParams }) {
}} }}
/> />
</UCard> </UCard>
<div className="uj-points-table-card"> {list.query.isError ? (
{list.query.isError ? ( <UAlert
<UAlert type="error"
type="error" showIcon
showIcon title="批次提现记录加载失败"
title="批次提现记录加载失败" description={list.error}
description={list.error} action={
action={ <UButton type="link" onClick={() => void list.query.refetch()}>
<UButton type="link" onClick={() => void list.query.refetch()}> 重试
重试 </UButton>
</UButton> }
} />
/> ) : null}
) : list.query.isPending ? ( <UCard size="small" fill>
<Skeleton variant="table" /> <DataTable<WithdrawRow>
) : ( columns={columns}
<DataTable<WithdrawRow> rowKey="id"
columns={columns} fillHeight
rowKey="id" actionColumnWidth={80}
actionColumnWidth={80} dataSource={list.records}
dataSource={list.records} loading={list.query.isPending || list.query.isFetching}
loading={list.query.isFetching} rowActions={rowActions}
rowActions={rowActions} toolbarTitle={`共 ${list.total} 条提现记录`}
toolbarTitle={<UText type="secondary">共 {list.total} 条提现记录</UText>} pagination={{
pagination={{ current: page.current,
current: page.current, pageSize: page.size,
pageSize: page.size, total: list.total,
total: list.total, showSizeChanger: true,
showSizeChanger: true, pageSizeOptions: [10, 20, 50, 100],
pageSizeOptions: [10, 20, 50, 100], showTotal: (total) => `共 ${total} 条`,
showTotal: (total) => `共 ${total} 条`, onChange: (current, size) =>
onChange: (current, size) => setPage({ current: size === page.size ? current : 1, size }),
setPage({ current: size === page.size ? current : 1, size }), }}
}} />
/> </UCard>
)}
</div>
{confirm.modal} {confirm.modal}
</PageShell> </PageShell>
); );
......
import { useMemo, useState } from 'react'; import { useMemo, useState } from 'react';
import { Skeleton, UAlert, UButton, UCard, UResult, UText } from '@uj/ui'; import { UAlert, UButton, UCard, UResult } from '@uj/ui';
import { DataTable, SearchForm, type RowActionSchema } from '@/components'; import { DataTable, SearchForm, type RowActionSchema } from '@/components';
import { withdrawApi, type ApprovalRow } from '@/api'; import { withdrawApi, type ApprovalRow } from '@/api';
import { PP } from '@/permissions/codes'; import { PP } from '@/permissions/codes';
...@@ -90,11 +90,9 @@ export default function WithdrawApprove() { ...@@ -90,11 +90,9 @@ export default function WithdrawApprove() {
return ( return (
<> <>
<UCard className="uj-points-filter-card" size="small"> <UCard className="uj-filter-card" size="small">
<SearchForm <SearchForm
fields={fields} fields={fields}
layout="vertical"
className="uj-points-search-form"
initialValues={{ initialValues={{
batchNo: '', batchNo: '',
oaSpNo: '', oaSpNo: '',
...@@ -114,43 +112,41 @@ export default function WithdrawApprove() { ...@@ -114,43 +112,41 @@ export default function WithdrawApprove() {
}} }}
/> />
</UCard> </UCard>
<div className="uj-points-table-card"> {list.query.isError ? (
{list.query.isError ? ( <UAlert
<UAlert type="error"
type="error" showIcon
showIcon title="审批批次加载失败"
title="审批批次加载失败" description={list.error}
description={list.error} action={
action={ <UButton type="link" onClick={() => void list.query.refetch()}>
<UButton type="link" onClick={() => void list.query.refetch()}> 重试
重试 </UButton>
</UButton> }
} />
/> ) : null}
) : list.query.isPending ? ( <UCard size="small" fill>
<Skeleton variant="table" /> <DataTable<ApprovalRow>
) : ( columns={buildApprovalColumns()}
<DataTable<ApprovalRow> rowKey="id"
columns={buildApprovalColumns()} fillHeight
rowKey="id" actionColumnWidth={200}
actionColumnWidth={200} dataSource={list.records}
dataSource={list.records} loading={list.query.isPending || list.query.isFetching}
loading={list.query.isFetching} rowActions={rowActions}
rowActions={rowActions} toolbarTitle={`共 ${list.total} 个批次`}
toolbarTitle={<UText type="secondary">共 {list.total} 个批次</UText>} pagination={{
pagination={{ current: page.current,
current: page.current, pageSize: page.size,
pageSize: page.size, total: list.total,
total: list.total, showSizeChanger: true,
showSizeChanger: true, pageSizeOptions: [10, 20, 50, 100],
pageSizeOptions: [10, 20, 50, 100], showTotal: (total) => `共 ${total} 条`,
showTotal: (total) => `共 ${total} 条`, onChange: (current, size) =>
onChange: (current, size) => setPage({ current: size === page.size ? current : 1, size }),
setPage({ current: size === page.size ? current : 1, size }), }}
}} />
/> </UCard>
)}
</div>
<ApprovalDetailDialog <ApprovalDetailDialog
open={!!detailId} open={!!detailId}
......
import { useMemo, useState } from 'react'; import { useMemo, useState } from 'react';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { App, Dropdown } from 'antd'; import { UAlert, UButton, UCard, UDropdown, UResult, useUMessage } from '@uj/ui';
import { Skeleton, UAlert, UButton, UCard, UResult, UText } from '@uj/ui';
import { import {
ConfirmModal, ConfirmModal,
DataTable, DataTable,
...@@ -65,7 +64,7 @@ type BatchAsk = { all: boolean; text: string }; ...@@ -65,7 +64,7 @@ type BatchAsk = { all: boolean; text: string };
*/ */
export default function WithdrawList() { export default function WithdrawList() {
const { can } = usePointsAccess(); const { can } = usePointsAccess();
const { message } = App.useApp(); const message = useUMessage();
const allowed = can(PP.WITHDRAW_VIEW); const allowed = can(PP.WITHDRAW_VIEW);
const notices = useActionMessage(); const notices = useActionMessage();
const [filters, setFilters] = useState<Record<string, unknown>>({}); const [filters, setFilters] = useState<Record<string, unknown>>({});
...@@ -326,11 +325,9 @@ export default function WithdrawList() { ...@@ -326,11 +325,9 @@ export default function WithdrawList() {
return ( return (
<> <>
<UCard className="uj-points-filter-card" size="small"> <UCard className="uj-filter-card" size="small">
<SearchForm <SearchForm
fields={fields} fields={fields}
layout="vertical"
className="uj-points-search-form"
initialValues={{ initialValues={{
outSettleOrderId: '', outSettleOrderId: '',
customerName: '', customerName: '',
...@@ -360,15 +357,28 @@ export default function WithdrawList() { ...@@ -360,15 +357,28 @@ export default function WithdrawList() {
/> />
</UCard> </UCard>
<SettleAmountStrip amounts={amounts.data} onOpenAll={() => setMoreAmounts(true)} /> <SettleAmountStrip amounts={amounts.data} onOpenAll={() => setMoreAmounts(true)} />
<div className="uj-points-table-card"> {list.query.isError ? (
<div className="uj-points-toolbar"> <UAlert
<UText type="secondary">共 {list.total} 条提现记录</UText> type="error"
<div className="uj-points-toolbar-actions"> showIcon
title="提现记录加载失败"
description={list.error}
action={
<UButton type="link" onClick={() => void list.query.refetch()}>
重试
</UButton>
}
/>
) : null}
<UCard size="small" fill>
<div className="uj-table-toolbar">
<div className="uj-table-toolbar__title">共 {list.total} 条提现记录</div>
<div className="uj-table-toolbar__actions">
{can(PP.WITHDRAW_BATCH) ? ( {can(PP.WITHDRAW_BATCH) ? (
<UButton onClick={() => void askBatch(true)}>全部生成批次</UButton> <UButton onClick={() => void askBatch(true)}>全部生成批次</UButton>
) : null} ) : null}
{can([PP.WITHDRAW_APPROVE, PP.WITHDRAW_PAY, PP.WITHDRAW_REJECT, PP.WITHDRAW_BATCH]) ? ( {can([PP.WITHDRAW_APPROVE, PP.WITHDRAW_PAY, PP.WITHDRAW_REJECT, PP.WITHDRAW_BATCH]) ? (
<Dropdown <UDropdown
menu={{ menu={{
items: [ items: [
{ key: '0', label: '批量审核' }, { key: '0', label: '批量审核' },
...@@ -380,10 +390,10 @@ export default function WithdrawList() { ...@@ -380,10 +390,10 @@ export default function WithdrawList() {
}} }}
> >
<UButton>批量操作</UButton> <UButton>批量操作</UButton>
</Dropdown> </UDropdown>
) : null} ) : null}
{can([PP.WITHDRAW_APPROVE, PP.WITHDRAW_PAY]) ? ( {can([PP.WITHDRAW_APPROVE, PP.WITHDRAW_PAY]) ? (
<Dropdown <UDropdown
menu={{ menu={{
items: [ items: [
{ key: '0', label: '一键审核' }, { key: '0', label: '一键审核' },
...@@ -393,7 +403,7 @@ export default function WithdrawList() { ...@@ -393,7 +403,7 @@ export default function WithdrawList() {
}} }}
> >
<UButton>一键操作</UButton> <UButton>一键操作</UButton>
</Dropdown> </UDropdown>
) : null} ) : null}
{can(PP.WITHDRAW_TAG) ? ( {can(PP.WITHDRAW_TAG) ? (
<UButton <UButton
...@@ -424,42 +434,27 @@ export default function WithdrawList() { ...@@ -424,42 +434,27 @@ export default function WithdrawList() {
) : null} ) : null}
</div> </div>
</div> </div>
{list.query.isError ? ( <DataTable<WithdrawRow>
<UAlert columns={columns}
type="error" rowKey="id"
showIcon rowSelection={selection}
title="提现记录加载失败" fillHeight
description={list.error} actionColumnWidth={180}
action={ dataSource={list.records}
<UButton type="link" onClick={() => void list.query.refetch()}> loading={list.query.isPending || list.query.isFetching}
重试 rowActions={rowActions}
</UButton> pagination={{
} current: page.current,
/> pageSize: page.size,
) : list.query.isPending ? ( total: list.total,
<Skeleton variant="table" /> showSizeChanger: true,
) : ( pageSizeOptions: [10, 20, 50, 100],
<DataTable<WithdrawRow> showTotal: (total) => `共 ${total} 条`,
columns={columns} onChange: (current, size) =>
rowKey="id" setPage({ current: size === page.size ? current : 1, size }),
rowSelection={selection} }}
actionColumnWidth={180} />
dataSource={list.records} </UCard>
loading={list.query.isFetching}
rowActions={rowActions}
pagination={{
current: page.current,
pageSize: page.size,
total: list.total,
showSizeChanger: true,
pageSizeOptions: [10, 20, 50, 100],
showTotal: (total) => `共 ${total} 条`,
onChange: (current, size) =>
setPage({ current: size === page.size ? current : 1, size }),
}}
/>
)}
</div>
<AuditDialog <AuditDialog
open={!!audit} open={!!audit}
......
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { Timeline } from 'antd'; import { Skeleton, UTimeline, UText, UModal, UTitle } from '@uj/ui';
import { Skeleton, UText, UModal, UTitle } from '@uj/ui';
import { withdrawApi, type ApprovalLogItem } from '@/api'; import { withdrawApi, type ApprovalLogItem } from '@/api';
import { APPROVAL_OPERATION, APPROVAL_STATUS, statusMeta } from '@/features/shared/dictionaries'; import { APPROVAL_OPERATION, APPROVAL_STATUS, statusMeta } from '@/features/shared/dictionaries';
import { dateTimeOr, numberOr, textOr } from '@/features/shared/format'; import { dateTimeOr, numberOr, textOr } from '@/features/shared/format';
...@@ -92,7 +91,7 @@ export function ApprovalDetailDialog({ open, id, onClose }: ApprovalDetailDialog ...@@ -92,7 +91,7 @@ export function ApprovalDetailDialog({ open, id, onClose }: ApprovalDetailDialog
{logs.data?.length ? ( {logs.data?.length ? (
<> <>
<UTitle level={5}>操作记录</UTitle> <UTitle level={5}>操作记录</UTitle>
<Timeline items={logs.data.map(timelineItem)} /> <UTimeline items={logs.data.map(timelineItem)} />
</> </>
) : null} ) : null}
</div> </div>
......
import { useState } from 'react'; import { useState } from 'react';
import { useMutation } from '@tanstack/react-query'; import { useMutation } from '@tanstack/react-query';
import { App } from 'antd'; import { UInput, UModal, UText, useUMessage } from '@uj/ui';
import { UInput, UModal, UText } from '@uj/ui';
import { withdrawApi } from '@/api'; import { withdrawApi } from '@/api';
import { errorMessage } from '@/features/shared/format'; import { errorMessage } from '@/features/shared/format';
...@@ -44,7 +43,7 @@ async function submit( ...@@ -44,7 +43,7 @@ async function submit(
} }
export function AuditDialog({ open, kind, ids, filters, onClose, onSuccess }: AuditDialogProps) { export function AuditDialog({ open, kind, ids, filters, onClose, onSuccess }: AuditDialogProps) {
const { message } = App.useApp(); const message = useUMessage();
const [remark, setRemark] = useState(''); const [remark, setRemark] = useState('');
const isReject = kind === 'reject' || kind === 'batchReject'; const isReject = kind === 'reject' || kind === 'batchReject';
const mutation = useMutation({ const mutation = useMutation({
......
import { useState } from 'react'; import { useState } from 'react';
import { useMutation } from '@tanstack/react-query'; import { useMutation } from '@tanstack/react-query';
import { App } from 'antd'; import { UCascader, UModal, UText, useUMessage } from '@uj/ui';
import { UCascader, UModal, UText } from '@uj/ui';
import { withdrawApi } from '@/api'; import { withdrawApi } from '@/api';
import { errorMessage } from '@/features/shared/format'; import { errorMessage } from '@/features/shared/format';
import { useTagTree } from '@/features/shared/options'; import { useTagTree } from '@/features/shared/options';
...@@ -18,7 +17,7 @@ export interface BatchTagDialogProps { ...@@ -18,7 +17,7 @@ export interface BatchTagDialogProps {
* 提交时只把路径最后一个标签 id 交出去。 * 提交时只把路径最后一个标签 id 交出去。
*/ */
export function BatchTagDialog({ open, ids, onClose, onSuccess }: BatchTagDialogProps) { export function BatchTagDialog({ open, ids, onClose, onSuccess }: BatchTagDialogProps) {
const { message } = App.useApp(); const message = useUMessage();
const tags = useTagTree(open, true); const tags = useTagTree(open, true);
const [path, setPath] = useState<string[]>([]); const [path, setPath] = useState<string[]>([]);
const mutation = useMutation({ const mutation = useMutation({
......
import { useState } from 'react'; import { useState } from 'react';
import { useMutation } from '@tanstack/react-query'; import { useMutation } from '@tanstack/react-query';
import { App } from 'antd'; import { Skeleton, UButton, UDrawer, UText, useUMessage } from '@uj/ui';
import { Skeleton, UButton, UDrawer, UText } from '@uj/ui';
import { ConfirmModal } from '@/components'; import { ConfirmModal } from '@/components';
import { withdrawApi, type TagNode } from '@/api'; import { withdrawApi, type TagNode } from '@/api';
import { errorMessage } from '@/features/shared/format'; import { errorMessage } from '@/features/shared/format';
...@@ -22,7 +21,7 @@ const MAX_LEVEL = 3; ...@@ -22,7 +21,7 @@ const MAX_LEVEL = 3;
* 节点数量有限,展开状态只是一个被折叠的父节点集合)。 * 节点数量有限,展开状态只是一个被折叠的父节点集合)。
*/ */
export function CustomTagDrawer({ open, onClose }: CustomTagDrawerProps) { export function CustomTagDrawer({ open, onClose }: CustomTagDrawerProps) {
const { message } = App.useApp(); const message = useUMessage();
const tags = useTagTree(open); const tags = useTagTree(open);
const [collapsed, setCollapsed] = useState<Set<string>>(new Set()); const [collapsed, setCollapsed] = useState<Set<string>>(new Set());
const [rootOpen, setRootOpen] = useState(true); const [rootOpen, setRootOpen] = useState(true);
......
import { useState } from 'react'; import { useState } from 'react';
import { useMutation } from '@tanstack/react-query'; import { useMutation } from '@tanstack/react-query';
import { App } from 'antd'; import { UAlert, UButton, UModal, UText, UUpload, useUMessage } from '@uj/ui';
import { UAlert, UButton, UModal, UText, UUpload } from '@uj/ui';
import { withdrawApi, type WithdrawImportResult } from '@/api'; import { withdrawApi, type WithdrawImportResult } from '@/api';
import { errorMessage } from '@/features/shared/format'; import { errorMessage } from '@/features/shared/format';
import { isExcel, readLegacyFile, sizeError } from '@/features/shared/files'; import { isExcel, readLegacyFile, sizeError } from '@/features/shared/files';
...@@ -33,7 +32,7 @@ const EMPTY_STATE: State = { fileName: '', payload: '' }; ...@@ -33,7 +32,7 @@ const EMPTY_STATE: State = { fileName: '', payload: '' };
* 弹窗按失败态展示可下载的失败模版。 * 弹窗按失败态展示可下载的失败模版。
*/ */
export function ImportDialog({ open, onSuccess, onClose }: ImportDialogProps) { export function ImportDialog({ open, onSuccess, onClose }: ImportDialogProps) {
const { message } = App.useApp(); const message = useUMessage();
const [state, setState] = useState<State>(EMPTY_STATE); const [state, setState] = useState<State>(EMPTY_STATE);
const [phase, setPhase] = useState<'pick' | 'running' | 'done'>('pick'); const [phase, setPhase] = useState<'pick' | 'running' | 'done'>('pick');
......
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { useMutation } from '@tanstack/react-query'; import { useMutation } from '@tanstack/react-query';
import { App } from 'antd';
import type { DefaultOptionType } from 'antd/es/cascader'; import type { DefaultOptionType } from 'antd/es/cascader';
import { UButton, UCascader, UForm, UInput, UModal, USelect, UText } from '@uj/ui'; import { UButton, UCascader, UForm, UInput, UModal, USelect, UText, useUMessage } from '@uj/ui';
import { withdrawApi, type ApprovalRow } from '@/api'; import { withdrawApi, type ApprovalRow } from '@/api';
import { EMPTY, errorMessage } from '@/features/shared/format'; import { EMPTY, errorMessage } from '@/features/shared/format';
import { import {
...@@ -48,7 +47,7 @@ function withChildren( ...@@ -48,7 +47,7 @@ function withChildren(
* 验证码发给所选渠道的管理员,默认选中第一个。 * 验证码发给所选渠道的管理员,默认选中第一个。
*/ */
export function PayApprovalDialog({ open, row, onClose, onSuccess }: PayApprovalDialogProps) { export function PayApprovalDialog({ open, row, onClose, onSuccess }: PayApprovalDialogProps) {
const { message } = App.useApp(); const message = useUMessage();
const [options, setOptions] = useState<DefaultOptionType[]>([]); const [options, setOptions] = useState<DefaultOptionType[]>([]);
const [levies, setLevies] = useState<Record<string, ApprovalLevy[]>>({}); const [levies, setLevies] = useState<Record<string, ApprovalLevy[]>>({});
const [path, setPath] = useState<string[]>([]); const [path, setPath] = useState<string[]>([]);
......
import { useEffect, useMemo, useState } from 'react'; import { useEffect, useMemo, useState } from 'react';
import { useQuery, useMutation } from '@tanstack/react-query'; import { useQuery, useMutation } from '@tanstack/react-query';
import { App } from 'antd'; import {
import { UButton, UCascader, UForm, UInput, UModal, URadio, USelect, UText } from '@uj/ui'; UButton,
UCascader,
UForm,
UInput,
UModal,
URadio,
USelect,
UText,
useUMessage,
} from '@uj/ui';
import { withdrawApi, type PayChannelOption } from '@/api'; import { withdrawApi, type PayChannelOption } from '@/api';
import { errorMessage } from '@/features/shared/format'; import { errorMessage } from '@/features/shared/format';
import { useChannelAdmins, usePayChannelTree } from '@/features/shared/options'; import { useChannelAdmins, usePayChannelTree } from '@/features/shared/options';
...@@ -58,7 +67,7 @@ export function PayDialog({ ...@@ -58,7 +67,7 @@ export function PayDialog({
onClose, onClose,
onSuccess, onSuccess,
}: PayDialogProps) { }: PayDialogProps) {
const { message } = App.useApp(); const message = useUMessage();
const useTree = String(transferType) === '0' || String(transferType) === '2'; const useTree = String(transferType) === '0' || String(transferType) === '2';
const [selection, setSelection] = useState<Selection>(EMPTY_SELECTION); const [selection, setSelection] = useState<Selection>(EMPTY_SELECTION);
const [path, setPath] = useState<string[]>([]); const [path, setPath] = useState<string[]>([]);
......
...@@ -29,7 +29,7 @@ export interface SettleAmountStripProps { ...@@ -29,7 +29,7 @@ export interface SettleAmountStripProps {
export function SettleAmountStrip({ amounts, onOpenAll }: SettleAmountStripProps) { export function SettleAmountStrip({ amounts, onOpenAll }: SettleAmountStripProps) {
const preview = itemsOf(amounts).slice(0, SETTLE_STATISTICS_PREVIEW); const preview = itemsOf(amounts).slice(0, SETTLE_STATISTICS_PREVIEW);
return ( return (
<UCard className="uj-points-filter-card" size="small"> <UCard className="uj-points-statistics-card" size="small">
<div className="uj-points-statistics-head"> <div className="uj-points-statistics-head">
<span>累计结算金额</span> <span>累计结算金额</span>
<UButton type="link" onClick={onOpenAll}> <UButton type="link" onClick={onOpenAll}>
......
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { useMutation } from '@tanstack/react-query'; import { useMutation } from '@tanstack/react-query';
import { App } from 'antd'; import { UForm, UInput, UModal, useUMessage } from '@uj/ui';
import { UForm, UInput, UModal } from '@uj/ui';
import { withdrawApi } from '@/api'; import { withdrawApi } from '@/api';
import { errorMessage } from '@/features/shared/format'; import { errorMessage } from '@/features/shared/format';
...@@ -21,7 +20,7 @@ export interface TagFormDialogProps { ...@@ -21,7 +20,7 @@ export interface TagFormDialogProps {
/** 新增/编辑提现标签:名称 1-50 字,层级由提交时的 parentId 决定(老系统最多三级)。 */ /** 新增/编辑提现标签:名称 1-50 字,层级由提交时的 parentId 决定(老系统最多三级)。 */
export function TagFormDialog({ open, tag, onClose, onSuccess }: TagFormDialogProps) { export function TagFormDialog({ open, tag, onClose, onSuccess }: TagFormDialogProps) {
const { message } = App.useApp(); const message = useUMessage();
const [name, setName] = useState(tag?.name ?? ''); const [name, setName] = useState(tag?.name ?? '');
useEffect(() => { useEffect(() => {
if (open) setName(tag?.name ?? ''); if (open) setName(tag?.name ?? '');
......
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { App } from 'antd'; import { UButton, UModal, UText, UTitle, UTooltip, useUMessage } from '@uj/ui';
import { UButton, UModal, UTooltip, UText, UTitle } from '@uj/ui';
import { withdrawApi, type WithdrawRow } from '@/api'; import { withdrawApi, type WithdrawRow } from '@/api';
import { import {
PAY_MODE, PAY_MODE,
...@@ -38,7 +37,7 @@ async function copyText(text: string): Promise<boolean> { ...@@ -38,7 +37,7 @@ async function copyText(text: string): Promise<boolean> {
* 操作记录按条铺开),失败原因只在状态为「失败」时出现。 * 操作记录按条铺开),失败原因只在状态为「失败」时出现。
*/ */
export function TransferDetailDialog({ open, id, onClose }: TransferDetailDialogProps) { export function TransferDetailDialog({ open, id, onClose }: TransferDetailDialogProps) {
const { message } = App.useApp(); const message = useUMessage();
const channels = useChannelTree(open); const channels = useChannelTree(open);
const detail = useQuery({ const detail = useQuery({
queryKey: ['points', 'transfer', id ?? ''], queryKey: ['points', 'transfer', id ?? ''],
......
...@@ -21,10 +21,12 @@ export default function WithdrawManage() { ...@@ -21,10 +21,12 @@ export default function WithdrawManage() {
return ( return (
<PageShell <PageShell
fill
title="积分提现管理" title="积分提现管理"
description="提现单从这里审核、付款、生成批次;批次再走 OA 付款审批,到账情况逐条可查。" description="提现单从这里审核、付款、生成批次;批次再走 OA 付款审批,到账情况逐条可查。"
> >
<UTabs <UTabs
className="uj-page__tabs"
activeKey={active.key} activeKey={active.key}
onChange={(key) => setTab(String(key))} onChange={(key) => setTab(String(key))}
items={TABS.map((item) => ({ key: item.key, label: item.label }))} items={TABS.map((item) => ({ key: item.key, label: item.label }))}
......
...@@ -46,6 +46,7 @@ export function buildApprovalFields( ...@@ -46,6 +46,7 @@ export function buildApprovalFields(
type: 'input', type: 'input',
placeholder: '请输入批次号', placeholder: '请输入批次号',
inputProps: { maxLength: 20 }, inputProps: { maxLength: 20 },
essential: true,
}, },
{ {
name: 'oaSpNo', name: 'oaSpNo',
...@@ -53,6 +54,7 @@ export function buildApprovalFields( ...@@ -53,6 +54,7 @@ export function buildApprovalFields(
type: 'input', type: 'input',
placeholder: '请输入OA审批编号', placeholder: '请输入OA审批编号',
inputProps: { maxLength: 20 }, inputProps: { maxLength: 20 },
essential: true,
}, },
{ {
name: 'channel', name: 'channel',
...@@ -89,8 +91,9 @@ export function buildApprovalFields( ...@@ -89,8 +91,9 @@ export function buildApprovalFields(
label: '状态', label: '状态',
type: 'select', type: 'select',
options: withAll(statusOptions(APPROVAL_STATUS)), options: withAll(statusOptions(APPROVAL_STATUS)),
essential: true,
}, },
{ name: 'approvalTime', label: '审批时间', type: 'dateRange' }, { name: 'approvalTime', label: '审批时间', type: 'dateRange', essential: true },
{ name: 'oaApprovalTime', label: 'OA审批时间', type: 'dateRange' }, { name: 'oaApprovalTime', label: 'OA审批时间', type: 'dateRange' },
{ name: 'userSettleTime', label: '付款时间', type: 'dateRange' }, { name: 'userSettleTime', label: '付款时间', type: 'dateRange' },
]; ];
......
...@@ -31,7 +31,7 @@ export function buildTransferColumns( ...@@ -31,7 +31,7 @@ export function buildTransferColumns(
channelNodes: ChannelNode[], channelNodes: ChannelNode[],
handlers: TransferColumnHandlers, handlers: TransferColumnHandlers,
): DataTableColumnsType<WithdrawRow> { ): DataTableColumnsType<WithdrawRow> {
const link = (enabled: boolean) => (enabled ? 'uj-points-link' : undefined); const link = (enabled: boolean) => (enabled ? 'uj-link' : undefined);
return [ return [
{ {
title: '提现单号', title: '提现单号',
...@@ -85,7 +85,7 @@ export function buildTransferColumns( ...@@ -85,7 +85,7 @@ export function buildTransferColumns(
title: '客户手机号', title: '客户手机号',
dataIndex: 'customerPhone', dataIndex: 'customerPhone',
width: 140, width: 140,
render: (value) => <span className="uj-points-code">{textOr(value)}</span>, render: (value) => <span className="uj-code">{textOr(value)}</span>,
}, },
{ {
title: '所属门店', title: '所属门店',
...@@ -121,7 +121,7 @@ export function buildTransferColumns( ...@@ -121,7 +121,7 @@ export function buildTransferColumns(
title: '提现金额', title: '提现金额',
dataIndex: 'payAmount', dataIndex: 'payAmount',
width: 110, width: 110,
render: (value) => <span className="uj-points-code">{centsToYuan(value)}</span>, render: (value) => <span className="uj-code">{centsToYuan(value)}</span>,
}, },
{ title: '收款人姓名', dataIndex: 'name', width: 110, render: (value) => textOr(value) }, { title: '收款人姓名', dataIndex: 'name', width: 110, render: (value) => textOr(value) },
{ {
...@@ -141,7 +141,7 @@ export function buildTransferColumns( ...@@ -141,7 +141,7 @@ export function buildTransferColumns(
title: '收款银行卡号', title: '收款银行卡号',
dataIndex: 'recvBankCardNo', dataIndex: 'recvBankCardNo',
width: 230, width: 230,
render: (value) => <span className="uj-points-code">{textOr(value)}</span>, render: (value) => <span className="uj-code">{textOr(value)}</span>,
}, },
{ {
title: '收款银行', title: '收款银行',
...@@ -220,7 +220,7 @@ export function buildTransferColumns( ...@@ -220,7 +220,7 @@ export function buildTransferColumns(
title: '结算金额/元', title: '结算金额/元',
dataIndex: 'settleAmount', dataIndex: 'settleAmount',
width: 130, width: 130,
render: (value) => <span className="uj-points-code">{centsToYuan(value)}</span>, render: (value) => <span className="uj-code">{centsToYuan(value)}</span>,
}, },
{ {
title: '免责协议', title: '免责协议',
......
...@@ -53,6 +53,7 @@ export function buildTransferFields( ...@@ -53,6 +53,7 @@ export function buildTransferFields(
type: 'input', type: 'input',
placeholder: '请输入提现单号', placeholder: '请输入提现单号',
inputProps: { maxLength: 25 }, inputProps: { maxLength: 25 },
essential: true,
}, },
{ {
name: 'customerName', name: 'customerName',
...@@ -60,6 +61,7 @@ export function buildTransferFields( ...@@ -60,6 +61,7 @@ export function buildTransferFields(
type: 'input', type: 'input',
placeholder: '请输入客户名称', placeholder: '请输入客户名称',
inputProps: { maxLength: 20 }, inputProps: { maxLength: 20 },
essential: true,
}, },
{ {
name: 'customerPhone', name: 'customerPhone',
...@@ -80,8 +82,9 @@ export function buildTransferFields( ...@@ -80,8 +82,9 @@ export function buildTransferFields(
label: '状态', label: '状态',
type: 'select', type: 'select',
options: withAll(statusOptions(TRANSFER_STATUS)), options: withAll(statusOptions(TRANSFER_STATUS)),
essential: true,
}, },
{ name: 'applyDateStr', label: '申请时间', type: 'dateRange' }, { name: 'applyDateStr', label: '申请时间', type: 'dateRange', essential: true },
{ name: 'payTimeStr', label: '付款时间', type: 'dateRange' }, { name: 'payTimeStr', label: '付款时间', type: 'dateRange' },
{ name: 'channel', label: '付款渠道', type: 'select', options: withAll(deps.channels) }, { name: 'channel', label: '付款渠道', type: 'select', options: withAll(deps.channels) },
{ {
......
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { Empty } from 'antd';
import { busEvents } from '@uj/contracts'; import { busEvents } from '@uj/contracts';
import { SubAppProvider, readInitialPage, shortName, subappBus } from '@uj/platform-sdk'; import { SubAppProvider, readInitialPage, shortName, subappBus } from '@uj/platform-sdk';
import TemplateImport from './pages/TemplateImport'; import TemplateImport from './pages/TemplateImport';
import StoreApprove from './pages/StoreApprove'; import StoreApprove from './pages/StoreApprove';
import StoreListing from './pages/StoreListing'; import StoreListing from './pages/StoreListing';
import { UEmpty } from '@uj/ui';
/** /**
* 页名 -> 页面组件。页名来自后端菜单 route 的末段: * 页名 -> 页面组件。页名来自后端菜单 route 的末段:
* /store/import -> import * /store/import -> import
...@@ -20,11 +20,7 @@ const PAGES = { ...@@ -20,11 +20,7 @@ const PAGES = {
function renderPage(page: string) { function renderPage(page: string) {
const Page = PAGES[page as keyof typeof PAGES]; const Page = PAGES[page as keyof typeof PAGES];
return Page ? ( return Page ? <Page /> : <UEmpty description={`没有名为「${page}」的页面`} />;
<Page />
) : (
<Empty description={`没有名为「${page}」的页面`} image={Empty.PRESENTED_IMAGE_SIMPLE} />
);
} }
function StoreApp() { function StoreApp() {
......
.approval-detail-header { .approval-detail-header {
color: #202733; color: var(--uj-text-1);
font-weight: 400; font-weight: 400;
} }
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
.approval-detail-header__identity h2 { .approval-detail-header__identity h2 {
min-width: 0; min-width: 0;
margin: 0; margin: 0;
color: #151b24; color: var(--uj-text-1);
font-size: 20px; font-size: 20px;
font-weight: 600; font-weight: 600;
line-height: 32px; line-height: 32px;
...@@ -36,14 +36,14 @@ ...@@ -36,14 +36,14 @@
height: 32px; height: 32px;
padding: 0; padding: 0;
border-radius: 7px; border-radius: 7px;
background: #eef1f6; background: var(--uj-divider);
color: #596579; color: var(--uj-text-2);
font-size: 18px; font-size: 18px;
} }
.approval-detail-header__close.ant-btn:hover { .approval-detail-header__close.ant-btn:hover {
background: #e2e7f0; background: var(--uj-border);
color: #202733; color: var(--uj-text-1);
} }
.approval-detail-status { .approval-detail-status {
...@@ -67,23 +67,23 @@ ...@@ -67,23 +67,23 @@
} }
.approval-detail-status--pending { .approval-detail-status--pending {
background: #fff6e5; background: var(--uj-warning-soft);
color: #a86808; color: var(--uj-warning);
} }
.approval-detail-status--approved { .approval-detail-status--approved {
background: var(--ant-color-primary-bg, #eef3ff); background: var(--ant-color-primary-bg, var(--uj-primary-soft));
color: var(--uj-primary, #2b5ce6); color: var(--uj-primary, var(--uj-primary));
} }
.approval-detail-status--rejected { .approval-detail-status--rejected {
background: #fff0ee; background: var(--uj-error-soft);
color: #c43c3c; color: var(--uj-error);
} }
.approval-detail-status--neutral { .approval-detail-status--neutral {
background: #f0f2f5; background: var(--uj-surface-3);
color: #758195; color: var(--uj-text-3);
} }
.approval-detail-meta { .approval-detail-meta {
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
.approval-detail-meta dt { .approval-detail-meta dt {
flex: none; flex: none;
color: #758195; color: var(--uj-text-3);
} }
.approval-detail-meta dd { .approval-detail-meta dd {
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
} }
.approval-detail-meta__time { .approval-detail-meta__time {
color: #758195; color: var(--uj-text-3);
font-weight: 400; font-weight: 400;
} }
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,7 @@
.approval-detail-flow__heading h3 { .approval-detail-flow__heading h3 {
margin: 0; margin: 0;
color: #28313f; color: var(--uj-text-1);
font-size: 14px; font-size: 14px;
font-weight: 600; font-weight: 600;
line-height: 24px; line-height: 24px;
...@@ -141,8 +141,8 @@ ...@@ -141,8 +141,8 @@
.approval-detail-flow__heading > span { .approval-detail-flow__heading > span {
padding: 1px 8px; padding: 1px 8px;
border-radius: 4px; border-radius: 4px;
background: var(--ant-color-primary-bg, #eef3ff); background: var(--ant-color-primary-bg, var(--uj-primary-soft));
color: var(--uj-primary, #2b5ce6); color: var(--uj-primary, var(--uj-primary));
font-size: 13px; font-size: 13px;
line-height: 22px; line-height: 22px;
} }
...@@ -171,12 +171,12 @@ ...@@ -171,12 +171,12 @@
right: calc(-50% + 24px); right: calc(-50% + 24px);
left: calc(50% + 24px); left: calc(50% + 24px);
height: 2px; height: 2px;
background: #e2e6ed; background: var(--uj-border);
content: ''; content: '';
} }
.approval-detail-flow__node--done:not(:last-child)::after { .approval-detail-flow__node--done:not(:last-child)::after {
background: var(--uj-primary, #2b5ce6); background: var(--uj-primary, var(--uj-primary));
} }
.approval-detail-flow__icon { .approval-detail-flow__icon {
...@@ -187,59 +187,59 @@ ...@@ -187,59 +187,59 @@
width: 30px; width: 30px;
height: 30px; height: 30px;
margin-bottom: 10px; margin-bottom: 10px;
border: 1.5px solid #cbd3df; border: 1.5px solid var(--uj-text-4);
border-radius: 50%; border-radius: 50%;
background: #fff; background: var(--uj-surface);
color: #758195; color: var(--uj-text-3);
font-size: 15px; font-size: 15px;
font-weight: 600; font-weight: 600;
} }
.approval-detail-flow__node--done .approval-detail-flow__icon, .approval-detail-flow__node--done .approval-detail-flow__icon,
.approval-detail-chaincard__icon--done { .approval-detail-chaincard__icon--done {
border-color: var(--uj-primary, #2b5ce6); border-color: var(--uj-primary, var(--uj-primary));
background: var(--uj-primary, #2b5ce6); background: var(--uj-primary, var(--uj-primary));
color: #fff; color: var(--uj-on-primary);
} }
.approval-detail-flow__node--current .approval-detail-flow__icon, .approval-detail-flow__node--current .approval-detail-flow__icon,
.approval-detail-chaincard__icon--current { .approval-detail-chaincard__icon--current {
border-color: #315efb; border-color: var(--uj-primary);
background: #315efb; background: var(--uj-primary);
color: #fff; color: var(--uj-on-primary);
} }
.approval-detail-flow__node--current .approval-detail-flow__icon { .approval-detail-flow__node--current .approval-detail-flow__icon {
box-shadow: 0 0 0 4px #e0e8ff; box-shadow: 0 0 0 4px var(--uj-primary-soft);
} }
.approval-detail-flow__node--rejected .approval-detail-flow__icon, .approval-detail-flow__node--rejected .approval-detail-flow__icon,
.approval-detail-chaincard__icon--rejected { .approval-detail-chaincard__icon--rejected {
border-color: #d64a49; border-color: var(--uj-error);
background: #d64a49; background: var(--uj-error);
color: #fff; color: var(--uj-on-primary);
} }
.approval-detail-flow__node > strong { .approval-detail-flow__node > strong {
color: #465164; color: var(--uj-text-2);
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
line-height: 22px; line-height: 22px;
} }
.approval-detail-flow__node--current > strong { .approval-detail-flow__node--current > strong {
color: #315efb; color: var(--uj-primary);
font-weight: 600; font-weight: 600;
} }
.approval-detail-flow__node--rejected > strong { .approval-detail-flow__node--rejected > strong {
color: #c43c3c; color: var(--uj-error);
} }
.approval-detail-flow__caption, .approval-detail-flow__caption,
.approval-detail-flow__time { .approval-detail-flow__time {
max-width: 100%; max-width: 100%;
color: #97a3b7; color: var(--uj-text-3);
font-size: 12px; font-size: 12px;
line-height: 18px; line-height: 18px;
overflow-wrap: anywhere; overflow-wrap: anywhere;
...@@ -254,12 +254,12 @@ ...@@ -254,12 +254,12 @@
} }
.store-approval-detail .ant-tabs > .ant-tabs-nav::before { .store-approval-detail .ant-tabs > .ant-tabs-nav::before {
border-bottom-color: #e2e6ed; border-bottom-color: var(--uj-border);
} }
.store-approval-detail .ant-tabs-tab { .store-approval-detail .ant-tabs-tab {
padding: 12px 16px; padding: 12px 16px;
color: #758195; color: var(--uj-text-3);
font-size: 16px; font-size: 16px;
line-height: 24px; line-height: 24px;
} }
...@@ -269,12 +269,12 @@ ...@@ -269,12 +269,12 @@
} }
.store-approval-detail .ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn { .store-approval-detail .ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn {
color: #315efb; color: var(--uj-primary);
font-weight: 600; font-weight: 600;
} }
.store-approval-detail .ant-tabs-ink-bar { .store-approval-detail .ant-tabs-ink-bar {
background: #315efb; background: var(--uj-primary);
} }
.approval-detail-tab-count { .approval-detail-tab-count {
...@@ -286,8 +286,8 @@ ...@@ -286,8 +286,8 @@
margin-left: 6px; margin-left: 6px;
padding: 0 5px; padding: 0 5px;
border-radius: 10px; border-radius: 10px;
background: #eef1f6; background: var(--uj-divider);
color: #596579; color: var(--uj-text-2);
font-size: 12px; font-size: 12px;
font-weight: 400; font-weight: 400;
} }
...@@ -303,9 +303,9 @@ ...@@ -303,9 +303,9 @@
align-items: flex-start; align-items: flex-start;
gap: 12px; gap: 12px;
padding: 14px 16px; padding: 14px 16px;
border: 1px solid #e0e6ef; border: 1px solid var(--uj-border);
border-radius: 8px; border-radius: 8px;
background: #fff; background: var(--uj-surface);
} }
.approval-detail-chaincard__icon { .approval-detail-chaincard__icon {
...@@ -322,8 +322,8 @@ ...@@ -322,8 +322,8 @@
.approval-detail-chaincard__icon--waiting, .approval-detail-chaincard__icon--waiting,
.approval-detail-chaincard__icon--stopped { .approval-detail-chaincard__icon--stopped {
background: #eef1f6; background: var(--uj-divider);
color: #758195; color: var(--uj-text-3);
} }
.approval-detail-chaincard__content { .approval-detail-chaincard__content {
...@@ -333,7 +333,7 @@ ...@@ -333,7 +333,7 @@
} }
.approval-detail-chaincard__title { .approval-detail-chaincard__title {
color: #28313f; color: var(--uj-text-1);
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
line-height: 24px; line-height: 24px;
...@@ -348,7 +348,7 @@ ...@@ -348,7 +348,7 @@
flex-wrap: wrap; flex-wrap: wrap;
gap: 0 8px; gap: 0 8px;
margin-top: 2px; margin-top: 2px;
color: #758195; color: var(--uj-text-3);
font-size: 13px; font-size: 13px;
line-height: 22px; line-height: 22px;
} }
...@@ -360,7 +360,7 @@ ...@@ -360,7 +360,7 @@
.approval-detail-chaincard__reason { .approval-detail-chaincard__reason {
margin: 6px 0 0; margin: 6px 0 0;
color: #596579; color: var(--uj-text-2);
font-size: 13px; font-size: 13px;
line-height: 22px; line-height: 22px;
white-space: pre-wrap; white-space: pre-wrap;
...@@ -368,7 +368,7 @@ ...@@ -368,7 +368,7 @@
.approval-detail-audit__empty { .approval-detail-audit__empty {
margin: 0; margin: 0;
color: #97a3b7; color: var(--uj-text-3);
font-size: 13px; font-size: 13px;
} }
......
...@@ -4,22 +4,22 @@ ...@@ -4,22 +4,22 @@
.approval-policy-panel__table { .approval-policy-panel__table {
overflow: hidden; overflow: hidden;
border: 1px solid #e0e6ef; border: 1px solid var(--uj-border);
border-radius: 8px; border-radius: 8px;
background: #fff; background: var(--uj-surface);
} }
.approval-policy-panel .ant-table { .approval-policy-panel .ant-table {
color: #465164; color: var(--uj-text-2);
font-size: 13px; font-size: 13px;
} }
.approval-policy-panel .ant-table-thead > tr > th { .approval-policy-panel .ant-table-thead > tr > th {
height: 38px; height: 38px;
padding: 9px 12px; padding: 9px 12px;
border-bottom-color: #e0e6ef; border-bottom-color: var(--uj-border);
background: #fafbfc; background: var(--uj-surface-2);
color: #758195; color: var(--uj-text-3);
font-size: 12px; font-size: 12px;
font-weight: 500; font-weight: 500;
line-height: 20px; line-height: 20px;
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
.approval-policy-panel .ant-table-tbody > tr > td { .approval-policy-panel .ant-table-tbody > tr > td {
height: 44px; height: 44px;
padding: 8px 12px; padding: 8px 12px;
border-bottom-color: #eef1f6; border-bottom-color: var(--uj-divider);
font-variant-numeric: tabular-nums; font-variant-numeric: tabular-nums;
line-height: 22px; line-height: 22px;
} }
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
} }
.approval-policy-panel .ant-table-tbody > tr.ant-table-row:hover > td { .approval-policy-panel .ant-table-tbody > tr.ant-table-row:hover > td {
background: #fafbfc; background: var(--uj-surface-2);
} }
.approval-policy-panel__category { .approval-policy-panel__category {
...@@ -47,8 +47,8 @@ ...@@ -47,8 +47,8 @@
max-width: 280px; max-width: 280px;
padding: 1px 7px; padding: 1px 7px;
border-radius: 4px; border-radius: 4px;
background: var(--ant-color-primary-bg, #eef3ff); background: var(--ant-color-primary-bg, var(--uj-primary-soft));
color: var(--uj-primary, #2b5ce6); color: var(--uj-primary, var(--uj-primary));
font-size: 12px; font-size: 12px;
font-weight: 500; font-weight: 500;
line-height: 20px; line-height: 20px;
...@@ -56,30 +56,30 @@ ...@@ -56,30 +56,30 @@
} }
.approval-policy-panel__value { .approval-policy-panel__value {
color: #465164; color: var(--uj-text-2);
font-variant-numeric: tabular-nums; font-variant-numeric: tabular-nums;
} }
.approval-policy-panel__note { .approval-policy-panel__note {
margin: 10px 0 0; margin: 10px 0 0;
color: #97a3b7; color: var(--uj-text-3);
font-size: 12px; font-size: 12px;
line-height: 20px; line-height: 20px;
overflow-wrap: anywhere; overflow-wrap: anywhere;
} }
.approval-cost-panel__name { .approval-cost-panel__name {
color: #28313f; color: var(--uj-text-1);
font-weight: 500; font-weight: 500;
} }
.approval-cost-panel__total { .approval-cost-panel__total {
color: #28313f; color: var(--uj-text-1);
font-weight: 600; font-weight: 600;
} }
.approval-cost-panel .ant-table-tbody .approval-cost-panel__description { .approval-cost-panel .ant-table-tbody .approval-cost-panel__description {
color: #97a3b7; color: var(--uj-text-3);
} }
@media (max-width: 600px) { @media (max-width: 600px) {
......
.listing-cost-panel { .listing-cost-panel {
color: #28313f; color: var(--uj-text-1);
font-size: 14px; font-size: 14px;
line-height: 22px; line-height: 22px;
} }
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
gap: 9px; gap: 9px;
margin: 0; margin: 0;
padding-bottom: 12px; padding-bottom: 12px;
border-bottom: 1px solid #e9edf3; border-bottom: 1px solid var(--uj-divider);
font-size: 14px; font-size: 14px;
font-weight: 600; font-weight: 600;
line-height: 22px; line-height: 22px;
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
width: 3px; width: 3px;
height: 14px; height: 14px;
border-radius: 2px; border-radius: 2px;
background: #315efb; background: var(--uj-primary);
content: ''; content: '';
} }
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
.listing-cost-panel__fields dt { .listing-cost-panel__fields dt {
padding-right: 12px; padding-right: 12px;
color: #758195; color: var(--uj-text-3);
} }
.listing-cost-panel__fields dd { .listing-cost-panel__fields dd {
...@@ -62,7 +62,7 @@ strong.listing-cost-panel__amount { ...@@ -62,7 +62,7 @@ strong.listing-cost-panel__amount {
.listing-cost-panel__hint, .listing-cost-panel__hint,
.listing-cost-panel__note { .listing-cost-panel__note {
color: #97a3b7; color: var(--uj-text-3);
font-size: 13px; font-size: 13px;
} }
......
.listing-detail-header { .listing-detail-header {
color: #202733; color: var(--uj-text-1);
font-weight: 400; font-weight: 400;
} }
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
.listing-detail-header__top h2 { .listing-detail-header__top h2 {
min-width: 0; min-width: 0;
margin: 0; margin: 0;
color: #151b24; color: var(--uj-text-1);
font-size: 20px; font-size: 20px;
font-weight: 600; font-weight: 600;
line-height: 32px; line-height: 32px;
...@@ -33,14 +33,14 @@ ...@@ -33,14 +33,14 @@
height: 32px; height: 32px;
padding: 0; padding: 0;
border-radius: 7px; border-radius: 7px;
background: #eef1f6; background: var(--uj-divider);
color: #596579; color: var(--uj-text-2);
font-size: 18px; font-size: 18px;
} }
.listing-detail-header__close.ant-btn:hover { .listing-detail-header__close.ant-btn:hover {
background: #e2e7f0; background: var(--uj-border);
color: #202733; color: var(--uj-text-1);
} }
.listing-detail-meta { .listing-detail-meta {
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
.listing-detail-meta dt { .listing-detail-meta dt {
flex: none; flex: none;
color: #758195; color: var(--uj-text-3);
} }
.listing-detail-meta dd { .listing-detail-meta dd {
...@@ -93,23 +93,23 @@ ...@@ -93,23 +93,23 @@
} }
.listing-detail-status--approved { .listing-detail-status--approved {
background: var(--ant-color-primary-bg, #eef3ff); background: var(--ant-color-primary-bg, var(--uj-primary-soft));
color: var(--uj-primary, #2b5ce6); color: var(--uj-primary, var(--uj-primary));
} }
.listing-detail-status--pending { .listing-detail-status--pending {
background: #fff8e2; background: var(--uj-warning-soft);
color: #ad7c00; color: var(--uj-warning);
} }
.listing-detail-status--rejected { .listing-detail-status--rejected {
background: #fff0ee; background: var(--uj-error-soft);
color: #c43c3c; color: var(--uj-error);
} }
.listing-detail-status--neutral { .listing-detail-status--neutral {
background: #f0f2f5; background: var(--uj-surface-3);
color: #758195; color: var(--uj-text-3);
} }
.store-listing-detail .ant-tabs > .ant-tabs-nav { .store-listing-detail .ant-tabs > .ant-tabs-nav {
...@@ -117,12 +117,12 @@ ...@@ -117,12 +117,12 @@
} }
.store-listing-detail .ant-tabs > .ant-tabs-nav::before { .store-listing-detail .ant-tabs > .ant-tabs-nav::before {
border-bottom-color: #e2e6ed; border-bottom-color: var(--uj-border);
} }
.store-listing-detail .ant-tabs-tab { .store-listing-detail .ant-tabs-tab {
padding: 12px 18px; padding: 12px 18px;
color: #758195; color: var(--uj-text-3);
font-size: 16px; font-size: 16px;
line-height: 24px; line-height: 24px;
} }
...@@ -132,16 +132,16 @@ ...@@ -132,16 +132,16 @@
} }
.store-listing-detail .ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn { .store-listing-detail .ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn {
color: #315efb; color: var(--uj-primary);
font-weight: 600; font-weight: 600;
} }
.store-listing-detail .ant-tabs-ink-bar { .store-listing-detail .ant-tabs-ink-bar {
background: #315efb; background: var(--uj-primary);
} }
.listing-store-info { .listing-store-info {
color: #28313f; color: var(--uj-text-1);
font-size: 14px; font-size: 14px;
line-height: 22px; line-height: 22px;
} }
...@@ -152,7 +152,7 @@ ...@@ -152,7 +152,7 @@
gap: 9px; gap: 9px;
margin: 0; margin: 0;
padding-bottom: 12px; padding-bottom: 12px;
border-bottom: 1px solid #e9edf3; border-bottom: 1px solid var(--uj-divider);
font-size: 14px; font-size: 14px;
font-weight: 600; font-weight: 600;
line-height: 22px; line-height: 22px;
...@@ -163,7 +163,7 @@ ...@@ -163,7 +163,7 @@
width: 3px; width: 3px;
height: 14px; height: 14px;
border-radius: 2px; border-radius: 2px;
background: #315efb; background: var(--uj-primary);
content: ''; content: '';
} }
...@@ -180,7 +180,7 @@ ...@@ -180,7 +180,7 @@
} }
.listing-store-info__fields dt { .listing-store-info__fields dt {
color: #758195; color: var(--uj-text-3);
} }
.listing-store-info__fields dd { .listing-store-info__fields dd {
...@@ -198,14 +198,14 @@ ...@@ -198,14 +198,14 @@
max-width: 100%; max-width: 100%;
padding: 1px 8px; padding: 1px 8px;
border-radius: 4px; border-radius: 4px;
background: var(--ant-color-primary-bg, #eef3ff); background: var(--ant-color-primary-bg, var(--uj-primary-soft));
color: var(--uj-primary, #2b5ce6); color: var(--uj-primary, var(--uj-primary));
font-size: 13px; font-size: 13px;
line-height: 22px; line-height: 22px;
} }
.listing-store-info__hint { .listing-store-info__hint {
color: #97a3b7; color: var(--uj-text-3);
font-size: 13px; font-size: 13px;
} }
......
.listing-change-history { .listing-change-history {
color: #28313f; color: var(--uj-text-1);
font-size: 14px; font-size: 14px;
line-height: 24px; line-height: 24px;
} }
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
gap: 9px; gap: 9px;
margin: 0; margin: 0;
padding-bottom: 12px; padding-bottom: 12px;
border-bottom: 1px solid #e9edf3; border-bottom: 1px solid var(--uj-divider);
font-size: 14px; font-size: 14px;
font-weight: 600; font-weight: 600;
line-height: 22px; line-height: 22px;
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
width: 3px; width: 3px;
height: 14px; height: 14px;
border-radius: 2px; border-radius: 2px;
background: #315efb; background: var(--uj-primary);
content: ''; content: '';
} }
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
grid-template-columns: 110px minmax(0, 1fr); grid-template-columns: 110px minmax(0, 1fr);
gap: 12px; gap: 12px;
padding: 16px 0; padding: 16px 0;
border-bottom: 1px solid #e9edf3; border-bottom: 1px solid var(--uj-divider);
} }
.listing-change-history__version:first-of-type { .listing-change-history__version:first-of-type {
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
} }
.listing-change-history__version-meta strong { .listing-change-history__version-meta strong {
color: #315efb; color: var(--uj-primary);
font-size: 13px; font-size: 13px;
font-weight: 600; font-weight: 600;
} }
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
.listing-change-history__version-meta span, .listing-change-history__version-meta span,
.listing-change-history__audit, .listing-change-history__audit,
.listing-change-history__empty { .listing-change-history__empty {
color: #97a3b7; color: var(--uj-text-3);
font-size: 13px; font-size: 13px;
} }
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
.listing-change-history__content h4 { .listing-change-history__content h4 {
margin: 0 0 8px; margin: 0 0 8px;
color: #28313f; color: var(--uj-text-1);
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
line-height: 24px; line-height: 24px;
...@@ -74,12 +74,12 @@ ...@@ -74,12 +74,12 @@
.listing-change-history__description { .listing-change-history__description {
margin: 0 0 4px; margin: 0 0 4px;
color: #596579; color: var(--uj-text-2);
} }
.listing-change-history__changes { .listing-change-history__changes {
margin: 0; margin: 0;
color: #596579; color: var(--uj-text-2);
} }
.listing-change-history__changes > div { .listing-change-history__changes > div {
......
.store-page { /* store 子应用只保留业务语义样式。
display: flex; 页面骨架、筛选栅格、表格排版、分页贴底都由 @uj/biz 的 PageShell / SearchForm
flex-direction: column; 与 @uj/ui 的 ui.css 承担 —— 三个子应用共用一份,别再按页面另抄一套。 */
gap: 16px;
min-width: 0;
min-height: 100%;
}
.store-page-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 20px;
}
.store-page-header h3,
.store-page-header h4 {
margin: 0 0 6px;
}
.store-page-header .ant-typography-secondary {
font-size: 13px;
line-height: 1.8;
}
.store-filter-card {
border: 1px solid var(--uj-border);
box-shadow: var(--uj-shadow-card);
}
.store-search-form {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 12px 20px;
}
.store-search-form > :last-child {
grid-column: 1 / -1;
justify-self: end;
margin-bottom: 0;
}
.store-search-form > :last-child button + button {
margin-left: 8px;
}
.store-table-card {
min-width: 0;
border: 1px solid var(--uj-border);
border-radius: 10px;
background: var(--uj-surface);
overflow: hidden;
box-shadow: var(--uj-shadow-card);
}
.store-code {
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
font-size: 12px;
}
.store-subtext {
display: block;
color: var(--uj-text-3);
font-size: 12px;
margin-top: 3px;
}
.store-row-actions {
display: flex;
flex-wrap: wrap;
gap: 8px;
align-items: center;
}
.store-confirm-records { .store-confirm-records {
max-height: 320px; max-height: 320px;
overflow: auto; overflow: auto;
margin: 16px 0; margin: var(--uj-space-4, 16px) 0;
border: 1px solid var(--uj-border); border: 1px solid var(--uj-border);
border-radius: 8px; border-radius: var(--uj-radius-md, 8px);
} }
.store-confirm-record { .store-confirm-record {
padding: 12px 16px; padding: var(--uj-space-3, 12px) var(--uj-space-4, 16px);
border-bottom: 1px solid var(--uj-divider); border-bottom: 1px solid var(--uj-divider);
} }
.store-confirm-record:last-child { .store-confirm-record:last-child {
border-bottom: 0; border-bottom: 0;
} }
@media (max-width: 1100px) {
.store-search-form {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (max-width: 640px) {
.store-search-form {
grid-template-columns: minmax(0, 1fr);
}
.store-page-header {
flex-direction: column;
}
}
/* 子应用内样式只在 shadowRoot 内生效。 /* 子应用内样式只在 shadowRoot 内生效。
业务 CSS(features/store 与各页面目录下的 .css)由各页面自行 import, 业务 CSS(features/store 与各页面目录下的 .css)由各页面自行 import,
它们的裸类名不会穿透到主壳 —— 这正是 wujie 相对联邦省下的样式边界工作。 它们的裸类名不会穿透到主壳 —— 这正是 wujie 相对联邦省下的样式边界工作。
注意:注释里不要写 glob 路径,星号紧跟斜杠的写法会提前终止 CSS 注释。 */ 注意:注释里不要写 glob 路径,星号紧跟斜杠的写法会提前终止 CSS 注释。
tokens.css 由 main.tsx 引入;根节点带 .uj-scope 让令牌在 shadowRoot 内有本地落点,
不依赖「自定义属性恰好能穿透 shadow DOM」这个侥幸。 */
.uj-store-app { .uj-store-app {
min-height: 100%; /* height(而非 min-height):列表页要靠这条定高链路把剩余空间量出来。
长页面由内部 .uj-page 撑高后在本容器里滚,不会把 iframe 撑破。 */
height: 100%;
width: 100%; width: 100%;
color: var(--uj-color-text-primary); overflow: auto;
color: var(--uj-text-1);
} }
.store-approve-table-card { /* 门店审批只保留业务语义样式:表格排版、行操作、分页都在 @uj/ui / themeConfig,
/* 保留表格自然高度,由页面内容区滚动,避免 flex 收缩后裁掉底部行和分页。 */ 这里再覆盖 .ant-* 只会让两张表长得不一样。 */
flex-shrink: 0;
}
.store-approve-table.ant-table-wrapper .ant-table .ant-table-thead > tr > th {
height: 38px;
padding: 0 12px;
background: #fbfcfd;
color: #6b7686;
font-size: 12px;
font-weight: 500;
white-space: nowrap;
}
.store-approve-table.ant-table-wrapper .ant-table .ant-table-tbody > tr > td {
height: 44px;
padding: 8px 12px;
color: #333c4a;
font-size: 13px;
line-height: 20px;
vertical-align: middle;
white-space: nowrap;
}
.store-approve-table .ant-table-tbody .ant-btn-link {
height: 28px;
padding: 0 8px;
font-size: 13px;
}
.store-approve-merchant {
color: #2b5ce6;
font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
font-size: 12px;
}
.store-approve-categories { .store-approve-categories {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 4px; gap: var(--uj-space-1, 4px);
white-space: nowrap; white-space: nowrap;
} }
.store-approve-categories[tabindex] { .store-approve-categories[tabindex] {
cursor: help; cursor: help;
} }
/* 反馈里的一串分类放在浮层里,长列表自己滚,不把 tooltip 撑成一整屏。 */
.store-approve-category-list { .store-approve-category-list {
max-height: 320px; max-height: 320px;
margin: 0; margin: 0;
...@@ -54,53 +20,42 @@ ...@@ -54,53 +20,42 @@
overflow-wrap: anywhere; overflow-wrap: anywhere;
white-space: normal; white-space: normal;
} }
.store-approve-category-list > li + li { .store-approve-category-list > li + li {
margin-top: 4px; margin-top: var(--uj-space-1, 4px);
} }
/* 分类/场景是「分组标签」,用淡品牌底;状态、时长才占用语义色。 */
.store-approve-tag { .store-approve-tag {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
height: 20px; height: 22px;
padding: 0 7px; padding: 0 var(--uj-space-2, 8px);
border-radius: 4px; border-radius: var(--uj-radius-xs, 4px);
background: var(--ant-color-primary-bg, #eef3ff); background: var(--uj-primary-soft);
color: var(--uj-primary, #2b5ce6); color: var(--uj-primary);
font-size: 11px; font-size: var(--uj-font-xs, 12px);
font-weight: 500; font-weight: 500;
white-space: nowrap; white-space: nowrap;
} }
.store-approve-category-count { .store-approve-category-count {
color: #333c4a; color: var(--uj-text-3);
font-size: 13px; font-size: var(--uj-font-xs, 12px);
}
.store-approve-money {
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
.store-approve-submit-time {
display: block;
color: #9aa5b5;
font-size: 12px;
white-space: nowrap;
} }
/* 停留时长:圆点 + 淡底,颜色只区分「正常 / 偏久 / 超时」三档。 */
.store-approve-stay { .store-approve-stay {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 5px; gap: 5px;
height: 22px; height: 22px;
padding: 0 8px; padding: 0 var(--uj-space-2, 8px);
border-radius: 5px; border-radius: var(--uj-radius-xs, 4px);
font-size: 11.5px; font-size: var(--uj-font-xs, 12px);
font-weight: 500; font-weight: 500;
font-variant-numeric: var(--uj-num, tabular-nums);
white-space: nowrap; white-space: nowrap;
} }
.store-approve-stay::before { .store-approve-stay::before {
width: 5px; width: 5px;
height: 5px; height: 5px;
...@@ -109,18 +64,19 @@ ...@@ -109,18 +64,19 @@
background: currentColor; background: currentColor;
content: ''; content: '';
} }
.store-approve-stay--normal { .store-approve-stay--normal {
background: var(--ant-color-primary-bg, #eef3ff); background: var(--uj-info-soft);
color: var(--uj-primary, #2b5ce6); color: var(--uj-info);
} }
.store-approve-stay--warning { .store-approve-stay--warning {
background: #fdf4e3; background: var(--uj-warning-soft);
color: #9a5f08; color: var(--uj-warning);
} }
.store-approve-stay--danger { .store-approve-stay--danger {
background: #fdecec; background: var(--uj-error-soft);
color: #a3262c; color: var(--uj-error);
}
.store-approve-stay--unknown {
background: var(--uj-neutral-soft);
color: var(--uj-text-2);
} }
...@@ -104,7 +104,7 @@ export function ApprovalActionModal({ ...@@ -104,7 +104,7 @@ export function ApprovalActionModal({
{action?.records.map((row) => ( {action?.records.map((row) => (
<div className="store-confirm-record" key={row.listingId}> <div className="store-confirm-record" key={row.listingId}>
<strong>{row.storeName}</strong> <strong>{row.storeName}</strong>
<span className="store-subtext">商户号:{row.merchantNo}</span> <span className="uj-cell-sub">商户号:{row.merchantNo}</span>
<div style={{ marginTop: 8 }}> <div style={{ marginTop: 8 }}>
<UTag color="blue">{dictionaryLabel(spec?.businessScenes, row.businessScene)}</UTag> <UTag color="blue">{dictionaryLabel(spec?.businessScenes, row.businessScene)}</UTag>
<span>{row.categoryCount ?? row.productCategories?.length ?? 0} 个产品分类</span> <span>{row.categoryCount ?? row.productCategories?.length ?? 0} 个产品分类</span>
...@@ -112,7 +112,7 @@ export function ApprovalActionModal({ ...@@ -112,7 +112,7 @@ export function ApprovalActionModal({
{needsConfirmation && ( {needsConfirmation && (
<> <>
<div style={{ marginTop: 8 }}>运营成本合计:{formatMoney(row.costTotal)}</div> <div style={{ marginTop: 8 }}>运营成本合计:{formatMoney(row.costTotal)}</div>
<span className="store-subtext"> <span className="uj-cell-sub">
{row.productCategories {row.productCategories
?.map((category) => dictionaryLabel(spec?.productCategories, category)) ?.map((category) => dictionaryLabel(spec?.productCategories, category))
.join('、')} .join('、')}
...@@ -136,7 +136,7 @@ export function ApprovalActionModal({ ...@@ -136,7 +136,7 @@ export function ApprovalActionModal({
disabled={pending} disabled={pending}
/> />
</UFormItem> </UFormItem>
<div className="store-row-actions"> <div className="uj-row-actions">
{rejectReasons.map((value) => ( {rejectReasons.map((value) => (
<UButton <UButton
key={value} key={value}
......
import { useEffect, useRef, useState } from 'react'; import { useEffect, useRef, useState } from 'react';
import { useMutation, useQueries, useQuery, useQueryClient } from '@tanstack/react-query'; import { useMutation, useQueries, useQuery, useQueryClient } from '@tanstack/react-query';
import { App } from 'antd'; import { UAlert, UButton, UCard, UResult, UTabs, useUMessage } from '@uj/ui';
import { Skeleton, UAlert, UButton, UCard, UResult, UTabs, UTitle, UText } from '@uj/ui';
import { P, PermButton, useAccess } from '@/access'; import { P, PermButton, useAccess } from '@/access';
import { import {
DataTable, DataTable,
DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE,
PageShell,
SearchForm, SearchForm,
type FieldSchema, type FieldSchema,
type RowActionSchema, type RowActionSchema,
...@@ -42,7 +42,7 @@ export default function StoreApprove() { ...@@ -42,7 +42,7 @@ export default function StoreApprove() {
const canRevoke = canPoint(P.STORE_APPROVE_REVOKE); const canRevoke = canPoint(P.STORE_APPROVE_REVOKE);
const canAct = (type: ApprovalAction['type']) => const canAct = (type: ApprovalAction['type']) =>
allowed && (type === 'revoke' ? canRevoke : type === 'reject' ? canReject : canPass); allowed && (type === 'revoke' ? canRevoke : type === 'reject' ? canReject : canPass);
const { message } = App.useApp(); const message = useUMessage();
const client = useQueryClient(); const client = useQueryClient();
const [tab, setTab] = useState<ApproveTab>(() => const [tab, setTab] = useState<ApproveTab>(() =>
new URLSearchParams(window.location.search).get('tab') === 'mine' ? 'mine' : 'todo', new URLSearchParams(window.location.search).get('tab') === 'mine' ? 'mine' : 'todo',
...@@ -259,16 +259,13 @@ export default function StoreApprove() { ...@@ -259,16 +259,13 @@ export default function StoreApprove() {
<UResult status="403" title="无门店审批访问权限" subTitle="请联系管理员确认账号权限。" /> <UResult status="403" title="无门店审批访问权限" subTitle="请联系管理员确认账号权限。" />
); );
return ( return (
<div className="store-page"> <PageShell
<div className="store-page-header"> fill
<div> title="门店审批"
<UTitle level={3}>门店审批</UTitle> description="按门店+业务场景审核上架数据,商务经理、财务经理依次审批;全部节点通过后生效。"
<UText type="secondary"> >
按门店+业务场景审核上架数据,商务经理、财务经理依次审批;全部节点通过后生效。
</UText>
</div>
</div>
<UTabs <UTabs
className="uj-page__tabs"
activeKey={tab} activeKey={tab}
onChange={(key) => { onChange={(key) => {
setTab(key as ApproveTab); setTab(key as ApproveTab);
...@@ -279,16 +276,14 @@ export default function StoreApprove() { ...@@ -279,16 +276,14 @@ export default function StoreApprove() {
key, key,
label: ( label: (
<> <>
{label} <span className="store-code">{lists[index].data?.total ?? '—'}</span> {label} <span className="uj-num">{lists[index].data?.total ?? '—'}</span>
</> </>
), ),
}))} }))}
/> />
<UCard className="store-filter-card" size="small"> <UCard className="uj-filter-card" size="small">
<SearchForm <SearchForm
fields={fields} fields={fields}
layout="vertical"
className="store-search-form"
initialValues={{ initialValues={{
keyword: '', keyword: '',
productCategory: '', productCategory: '',
...@@ -314,67 +309,60 @@ export default function StoreApprove() { ...@@ -314,67 +309,60 @@ export default function StoreApprove() {
</UButton> </UButton>
} }
/> />
) : list.isPending ? ( ) : null}
<Skeleton variant="table" /> <UCard size="small" fill>
) : ( <DataTable<ApprovalRow>
<div className="store-table-card store-approve-table-card"> fillHeight
<DataTable<ApprovalRow> columns={buildApproveColumns(tab, STORE_DICTIONARIES)}
className="store-approve-table" rowKey="listingId"
columns={buildApproveColumns(tab, STORE_DICTIONARIES)} scroll={{ x: tab === 'done' ? 1340 : tab === 'todo' ? 1216 : 1290 }}
rowKey="listingId" actionColumnWidth={tab === 'done' ? 80 : 130}
scroll={{ x: tab === 'done' ? 1340 : tab === 'todo' ? 1216 : 1290 }} actionColumnFixed="right"
actionColumnWidth={tab === 'done' ? 80 : 130} dataSource={list.data?.records ?? []}
actionColumnFixed="right" loading={list.isPending || list.isFetching}
dataSource={list.data?.records ?? []} rowActions={rowActions}
loading={list.isFetching} toolbarTitle={`共 ${list.data?.total ?? 0} 条记录${
rowActions={rowActions} tab === 'todo' ? ` · 已选 ${selectedCurrent.length} 条` : ''
toolbarTitle={ }`}
<UText type="secondary"> actions={
共 {list.data?.total ?? 0} 条记录 tab === 'todo'
{tab === 'todo' ? ` · 已选 ${selectedCurrent.length} 条` : ''} ? [
</UText> {
} label: '批量审批',
actions={ permission: P.STORE_APPROVE_AUDIT,
tab === 'todo' disabled: selectedCurrent.length === 0 || mutation.isPending || list.isFetching,
? [ onClick: () => openAction({ type: 'batch', records: selectedCurrent }),
{ },
label: '批量审批', ]
permission: P.STORE_APPROVE_AUDIT, : []
disabled: }
selectedCurrent.length === 0 || mutation.isPending || list.isFetching, rowSelection={
onClick: () => openAction({ type: 'batch', records: selectedCurrent }), tab === 'todo' && canPass
}, ? {
] columnWidth: 40,
: [] disabled: mutation.isPending || list.isFetching,
} selectedRowKeys: selectedCurrent.map((row) => row.listingId),
rowSelection={ onChange: (_, rows) => setSelected(rows),
tab === 'todo' && canPass getCheckboxProps: (row) => ({
? { disabled: row.status !== 'PENDING' || row.actionable !== true,
columnWidth: 40, }),
disabled: mutation.isPending || list.isFetching, }
selectedRowKeys: selectedCurrent.map((row) => row.listingId), : false
onChange: (_, rows) => setSelected(rows), }
getCheckboxProps: (row) => ({ pagination={{
disabled: row.status !== 'PENDING' || row.actionable !== true, current: page.current,
}), pageSize: page.size,
} total: list.data?.total ?? 0,
: false showSizeChanger: true,
} pageSizeOptions: [10, 20, 50, 100],
pagination={{ showTotal: (total) => `共 ${total} 条`,
current: page.current, onChange: (current, size) => {
pageSize: page.size, setPage({ current: size === page.size ? current : 1, size });
total: list.data?.total ?? 0, setSelected([]);
showSizeChanger: true, },
pageSizeOptions: [10, 20, 50, 100], }}
showTotal: (total) => `共 ${total} 条`, />
onChange: (current, size) => { </UCard>
setPage({ current: size === page.size ? current : 1, size });
setSelected([]);
},
}}
/>
</div>
)}
<StoreDetailDrawer <StoreDetailDrawer
open={!!drawer} open={!!drawer}
detail={detail.data} detail={detail.data}
...@@ -392,7 +380,7 @@ export default function StoreApprove() { ...@@ -392,7 +380,7 @@ export default function StoreApprove() {
}} }}
onRetry={() => void detail.refetch()} onRetry={() => void detail.refetch()}
footer={ footer={
<div className="store-row-actions" style={{ justifyContent: 'flex-end' }}> <div className="uj-row-actions" style={{ justifyContent: 'flex-end' }}>
<UButton <UButton
type="default" type="default"
disabled={mutation.isPending} disabled={mutation.isPending}
...@@ -451,6 +439,6 @@ export default function StoreApprove() { ...@@ -451,6 +439,6 @@ export default function StoreApprove() {
onConfirm={confirmAction} onConfirm={confirmAction}
/> />
)} )}
</div> </PageShell>
); );
} }
...@@ -23,13 +23,13 @@ export function buildApproveColumns( ...@@ -23,13 +23,13 @@ export function buildApproveColumns(
dataIndex: 'storeName', dataIndex: 'storeName',
width: tab === 'mine' ? 230 : 220, width: tab === 'mine' ? 230 : 220,
fixed: 'left', fixed: 'left',
render: (value) => <strong>{value}</strong>, render: (value) => <span className="uj-cell-strong">{value}</span>,
}, },
{ {
title: '门店商户号', title: '门店商户号',
dataIndex: 'merchantNo', dataIndex: 'merchantNo',
width: tab === 'mine' ? 120 : 110, width: tab === 'mine' ? 120 : 110,
render: (value) => <span className="store-approve-merchant">{value || '—'}</span>, render: (value) => <span className="uj-code">{value || '—'}</span>,
}, },
{ {
title: '产品分类', title: '产品分类',
...@@ -86,7 +86,7 @@ export function buildApproveColumns( ...@@ -86,7 +86,7 @@ export function buildApproveColumns(
width: 110, width: 110,
align: 'right', align: 'right',
render: (value) => ( render: (value) => (
<span className="store-approve-money"> <span className="uj-num">
{formatMoney(value).replace(/^¥/, '').replace(/\.00$/, '')} {formatMoney(value).replace(/^¥/, '').replace(/\.00$/, '')}
</span> </span>
), ),
...@@ -97,7 +97,7 @@ export function buildApproveColumns( ...@@ -97,7 +97,7 @@ export function buildApproveColumns(
render: (_, row) => ( render: (_, row) => (
<> <>
{row.submitUserName || '—'} {row.submitUserName || '—'}
<span className="store-approve-submit-time">{formatSubmitTime(row.submitTime)}</span> <span className="uj-cell-sub">{formatSubmitTime(row.submitTime)}</span>
</> </>
), ),
}, },
......
...@@ -17,14 +17,14 @@ export function buildColumns({ ...@@ -17,14 +17,14 @@ export function buildColumns({
dataIndex: 'storeName', dataIndex: 'storeName',
key: 'storeName', key: 'storeName',
width: 230, width: 230,
render: (value: string) => <span className="store-listing-name">{value || '—'}</span>, render: (value: string) => <span className="uj-cell-strong">{value || '—'}</span>,
}, },
merchantNo: { merchantNo: {
title: COLUMN_LABELS.merchantNo, title: COLUMN_LABELS.merchantNo,
dataIndex: 'merchantNo', dataIndex: 'merchantNo',
key: 'merchantNo', key: 'merchantNo',
width: 120, width: 120,
render: (value: string) => <span className="store-code">{value || '—'}</span>, render: (value: string) => <span className="uj-code">{value || '—'}</span>,
}, },
businessScene: { businessScene: {
title: COLUMN_LABELS.businessScene, title: COLUMN_LABELS.businessScene,
......
import { useEffect, useMemo, useState } from 'react'; import { useEffect, useMemo, useState } from 'react';
import { keepPreviousData, useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; import { keepPreviousData, useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { App } from 'antd';
import { DownloadOutlined, SettingOutlined } from '@ant-design/icons'; import { DownloadOutlined, SettingOutlined } from '@ant-design/icons';
import { Skeleton, UAlert, UButton, UCard, UResult, UText, UTitle } from '@uj/ui'; import { UAlert, UButton, UCard, UResult, useUMessage } from '@uj/ui';
import { P, useAccess } from '@/access'; import { P, useAccess } from '@/access';
import { store, type ListingPageParams, type StoreId, type StoreListingRow } from '@/api'; import { store, type ListingPageParams, type StoreId, type StoreListingRow } from '@/api';
import { import {
DataTable, DataTable,
DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE,
PageShell,
SearchForm, SearchForm,
type ActionSchema, type ActionSchema,
type FieldSchema, type FieldSchema,
...@@ -32,7 +32,7 @@ import './listing.css'; ...@@ -32,7 +32,7 @@ import './listing.css';
const CONFIG_KEY = ['store', 'listing', 'columns'] as const; const CONFIG_KEY = ['store', 'listing', 'columns'] as const;
export default function StoreListing() { export default function StoreListing() {
const { message } = App.useApp(); const message = useUMessage();
const { canPoint } = useAccess(); const { canPoint } = useAccess();
const allowed = canPoint(P.STORE_LISTING_VIEW); const allowed = canPoint(P.STORE_LISTING_VIEW);
const filterOptions = useStoreFilterOptions({ enabled: allowed, includeProducts: false }); const filterOptions = useStoreFilterOptions({ enabled: allowed, includeProducts: false });
...@@ -95,7 +95,13 @@ export default function StoreListing() { ...@@ -95,7 +95,13 @@ export default function StoreListing() {
const openDetail = (row: StoreListingRow, tab = 'info') => const openDetail = (row: StoreListingRow, tab = 'info') =>
setSelected({ id: row.listingId, tab }); setSelected({ id: row.listingId, tab });
const fields: FieldSchema<ListingFilters>[] = [ const fields: FieldSchema<ListingFilters>[] = [
{ name: 'storeName', label: '门店名称', type: 'input', placeholder: '模糊搜索', width: '100%' }, {
name: 'storeName',
label: '门店名称',
type: 'input',
placeholder: '模糊搜索',
width: '100%',
},
{ {
name: 'merchantNo', name: 'merchantNo',
label: '门店商户号', label: '门店商户号',
...@@ -159,25 +165,16 @@ export default function StoreListing() { ...@@ -159,25 +165,16 @@ export default function StoreListing() {
return ( return (
<UResult status="403" title="无门店列表访问权限" subTitle="请联系管理员开通访问权限。" /> <UResult status="403" title="无门店列表访问权限" subTitle="请联系管理员开通访问权限。" />
); );
if (listing.isPending) return <Skeleton variant="table" />;
return ( return (
<div className="store-page"> <PageShell
<div className="store-page-header"> fill
<div> title="门店列表"
<UTitle level={3} style={{ margin: 0 }}> description="仅展示审批通过的数据。一行对应一个门店与一个业务场景,门店名称相同、业务场景不同的记录分别展示。"
门店列表 >
</UTitle> <UCard className="uj-filter-card" size="small">
<UText type="secondary">
仅展示审批通过的数据。一行对应一个门店与一个业务场景,门店名称相同、业务场景不同的记录分别展示。
</UText>
</div>
</div>
<UCard className="store-filter-card" size="small">
<SearchForm<ListingFilters> <SearchForm<ListingFilters>
fields={fields} fields={fields}
layout="vertical"
className="store-search-form"
initialValues={{ businessScene: '' }} initialValues={{ businessScene: '' }}
onSearch={(values) => { onSearch={(values) => {
const next = { const next = {
...@@ -217,24 +214,18 @@ export default function StoreListing() { ...@@ -217,24 +214,18 @@ export default function StoreListing() {
{overExportLimit ? ( {overExportLimit ? (
<UAlert type="warning" showIcon title="筛选结果超过 50,000 条,请缩小范围后导出。" /> <UAlert type="warning" showIcon title="筛选结果超过 50,000 条,请缩小范围后导出。" />
) : null} ) : null}
<div className="store-listing-section"> <UCard size="small" fill>
<DataTable<StoreListingRow> <DataTable<StoreListingRow>
className="store-listing-table"
rowKey="listingId" rowKey="listingId"
fillHeight
columns={columns} columns={columns}
rowActions={rowActions} rowActions={rowActions}
actionColumnWidth={150} actionColumnWidth={150}
actionColumnFixed="right" actionColumnFixed="right"
toolbarTitle={ toolbarTitle={`已生效门店 ${total} 条`}
<UText strong>
已生效门店 <UText type="secondary">{total} 条</UText>
</UText>
}
toolbarClassName="store-listing-toolbar"
actions={actions} actions={actions}
dataSource={listing.data?.records ?? []} dataSource={listing.data?.records ?? []}
loading={listing.isFetching} loading={listing.isPending || listing.isFetching}
scroll={{ x: 950 }}
pagination={{ pagination={{
current: params.current ?? 1, current: params.current ?? 1,
pageSize: params.size ?? DEFAULT_PAGE_SIZE, pageSize: params.size ?? DEFAULT_PAGE_SIZE,
...@@ -251,7 +242,7 @@ export default function StoreListing() { ...@@ -251,7 +242,7 @@ export default function StoreListing() {
})), })),
}} }}
/> />
</div> </UCard>
<ColumnConfigModal <ColumnConfigModal
open={configOpen} open={configOpen}
columns={configuredColumns} columns={configuredColumns}
...@@ -277,6 +268,6 @@ export default function StoreListing() { ...@@ -277,6 +268,6 @@ export default function StoreListing() {
onClose={() => setSelected(null)} onClose={() => setSelected(null)}
onRetry={() => void detail.refetch()} onRetry={() => void detail.refetch()}
/> />
</div> </PageShell>
); );
} }
.store-listing-section { /* 门店列表只保留业务语义样式:表格排版、分页、行操作间距都在 @uj/ui 的共享层,
min-width: 0; 这里再写一遍 .ant-* 只会和 themeConfig 打架。 */
}
.store-listing-toolbar {
padding: 16px 20px;
}
.store-listing-table.ant-table-wrapper {
min-width: 0;
overflow: hidden;
border: 1px solid #e1e6ed;
border-radius: 10px;
background: #fff;
box-shadow: none;
}
.store-listing-table .ant-table:is(.ant-table-middle, .ant-table-medium) {
color: #333c4a;
font-size: 13px;
line-height: 1.57;
}
.store-listing-table
.ant-table:is(.ant-table-middle, .ant-table-medium)
.ant-table-thead
> tr
> th {
height: 38px;
padding: 0 12px;
border-bottom: 1px solid #e1e6ed;
background: #fbfcfd;
color: #6b7686;
font-size: 12px;
font-weight: 500;
line-height: 1.57;
white-space: nowrap;
}
.store-listing-table .ant-table-thead > tr > th::before {
display: none;
}
.store-listing-table
.ant-table:is(.ant-table-middle, .ant-table-medium)
.ant-table-tbody
> tr
> td {
height: 44px;
padding: 8px 12px;
border-bottom: 1px solid #edf0f5;
color: #333c4a;
font-size: 13px;
line-height: 1.57;
vertical-align: middle;
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
.store-listing-table
.ant-table:is(.ant-table-middle, .ant-table-medium)
.ant-table-tbody
> tr:last-child
> td {
border-bottom: 0;
}
.store-listing-table
.ant-table:is(.ant-table-middle, .ant-table-medium)
.ant-table-tbody
> tr:hover
> td,
.store-listing-table
.ant-table:is(.ant-table-middle, .ant-table-medium)
.ant-table-tbody
> tr
> td.ant-table-cell-row-hover {
background: #fbfcfd;
}
.store-listing-table .store-listing-name {
color: #121821;
font-weight: 500;
}
.store-listing-table .store-code { /* 业务场景是「分类」不是「状态」,用淡品牌底区分,不占用状态标签的语义色。 */
color: #2b5ce6; .store-listing-scene {
font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
font-size: 12px;
}
.store-listing-table .store-listing-scene {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
height: 20px; height: 22px;
padding: 0 7px; padding: 0 var(--uj-space-2, 8px);
border: 0; border-radius: var(--uj-radius-xs, 4px);
border-radius: 4px; background: var(--uj-primary-soft);
background: var(--ant-color-primary-bg, #eef3ff); color: var(--uj-primary);
color: var(--uj-primary, #2b5ce6); font-size: var(--uj-font-xs, 12px);
font-size: 11px;
font-weight: 500; font-weight: 500;
line-height: 1.57;
white-space: nowrap; white-space: nowrap;
} }
.store-listing-table .ant-table-tbody > tr > td:last-child .ant-btn-link {
display: inline-flex;
height: auto;
min-width: 0;
padding: 0;
border: 0;
border-radius: 0;
background: transparent;
color: #2b5ce6;
font-size: 13px;
font-weight: 400;
line-height: 1.57;
vertical-align: middle;
box-shadow: none;
}
.store-listing-table .ant-table-tbody > tr > td:last-child .ant-btn-link + .ant-btn-link {
margin-inline-start: 12px;
}
.store-listing-table .ant-table-tbody > tr > td:last-child .ant-btn-link:hover {
color: #2b5ce6;
text-decoration: underline;
}
.store-listing-table.ant-table-wrapper .ant-table-pagination.ant-pagination {
display: flex;
align-items: center;
justify-content: flex-end;
margin: 0;
padding: 13px 20px;
border-top: 1px solid #e1e6ed;
background: #fff;
color: #6b7686;
font-size: 12px;
}
.store-listing-table .ant-pagination .ant-pagination-total-text {
margin-inline-end: auto;
padding-inline-end: 12px;
}
.store-listing-table .ant-pagination .ant-pagination-item,
.store-listing-table .ant-pagination .ant-pagination-prev,
.store-listing-table .ant-pagination .ant-pagination-next {
min-width: 28px;
height: 28px;
margin-inline-end: 5px;
border-radius: 5px;
font-size: 12px;
line-height: 26px;
}
.store-listing-table .ant-pagination .ant-pagination-item-active {
border-color: #2b5ce6;
background: #2b5ce6;
font-weight: 500;
}
.store-listing-table .ant-pagination .ant-pagination-item-active a {
color: #fff;
}
.store-column-options { .store-column-options {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 8px; gap: var(--uj-space-2, 8px);
margin-block: 20px; margin-block: var(--uj-space-5, 20px);
} }
.store-column-option { .store-column-option {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
gap: 12px; gap: var(--uj-space-3, 12px);
padding: 8px 12px; padding: var(--uj-space-2, 8px) var(--uj-space-3, 12px);
border: 1px solid var(--ant-color-border-secondary, #e8ecf3); border: 1px solid var(--uj-border);
border-radius: var(--ant-border-radius, 8px); border-radius: var(--uj-radius-md, 8px);
} }
...@@ -26,11 +26,11 @@ function NodeIcon({ status, index }: NodeIconProps) { ...@@ -26,11 +26,11 @@ function NodeIcon({ status, index }: NodeIconProps) {
width: 32, width: 32,
height: 32, height: 32,
borderRadius: '50%', borderRadius: '50%',
background: '#16A34A', background: 'var(--uj-success)',
display: 'inline-flex', display: 'inline-flex',
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
color: '#fff', color: 'var(--uj-on-primary)',
flex: 'none', flex: 'none',
}} }}
> >
...@@ -45,15 +45,15 @@ function NodeIcon({ status, index }: NodeIconProps) { ...@@ -45,15 +45,15 @@ function NodeIcon({ status, index }: NodeIconProps) {
width: 32, width: 32,
height: 32, height: 32,
borderRadius: '50%', borderRadius: '50%',
background: '#2B5CE6', background: 'var(--uj-primary)',
display: 'inline-flex', display: 'inline-flex',
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
color: '#fff', color: 'var(--uj-on-primary)',
fontWeight: 600, fontWeight: 600,
fontSize: 13, fontSize: 13,
flex: 'none', flex: 'none',
boxShadow: '0 0 0 4px #EEF2FF', boxShadow: '0 0 0 4px var(--uj-primary-soft)',
}} }}
> >
{index + 1} {index + 1}
...@@ -66,12 +66,12 @@ function NodeIcon({ status, index }: NodeIconProps) { ...@@ -66,12 +66,12 @@ function NodeIcon({ status, index }: NodeIconProps) {
width: 32, width: 32,
height: 32, height: 32,
borderRadius: '50%', borderRadius: '50%',
background: '#fff', background: 'var(--uj-surface)',
border: '2px solid #D1D5DB', border: '2px solid var(--uj-text-4)',
display: 'inline-flex', display: 'inline-flex',
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
color: '#9CA3AF', color: 'var(--uj-text-3)',
flex: 'none', flex: 'none',
}} }}
> >
...@@ -80,7 +80,8 @@ function NodeIcon({ status, index }: NodeIconProps) { ...@@ -80,7 +80,8 @@ function NodeIcon({ status, index }: NodeIconProps) {
); );
} }
const lineColor = (status: ChainNodeStatus) => (status === 'done' ? '#16A34A' : '#E5E7EB'); const lineColor = (status: ChainNodeStatus) =>
status === 'done' ? 'var(--uj-success)' : 'var(--uj-border)';
function NodeLine({ status }: { status: ChainNodeStatus }) { function NodeLine({ status }: { status: ChainNodeStatus }) {
return ( return (
...@@ -151,10 +152,10 @@ export function ApprovalChainPreview({ ...@@ -151,10 +152,10 @@ export function ApprovalChainPreview({
return ( return (
<UCard <UCard
styles={{ body: { padding: '20px 24px 24px' } }} styles={{ body: { padding: '20px 24px 24px' } }}
style={{ marginBottom: 20, border: '1px solid #E5E7EB', borderRadius: 10 }} style={{ marginBottom: 20, border: '1px solid var(--uj-border)', borderRadius: 10 }}
title={ title={
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
<InfoCircleFilled style={{ color: '#2B5CE6', fontSize: 14 }} /> <InfoCircleFilled style={{ color: 'var(--uj-primary)', fontSize: 14 }} />
<span style={{ fontSize: 15, fontWeight: 600 }}>审批链预览</span> <span style={{ fontSize: 15, fontWeight: 600 }}>审批链预览</span>
</div> </div>
} }
...@@ -190,10 +191,10 @@ export function ApprovalChainPreview({ ...@@ -190,10 +191,10 @@ export function ApprovalChainPreview({
fontWeight: 600, fontWeight: 600,
color: color:
n.status === 'active' n.status === 'active'
? '#2B5CE6' ? 'var(--uj-primary)'
: n.status === 'done' : n.status === 'done'
? '#16A34A' ? 'var(--uj-success)'
: '#6B7280', : 'var(--uj-text-3)',
textAlign: 'center', textAlign: 'center',
}} }}
> >
...@@ -203,7 +204,7 @@ export function ApprovalChainPreview({ ...@@ -203,7 +204,7 @@ export function ApprovalChainPreview({
style={{ style={{
marginTop: 4, marginTop: 4,
fontSize: 12, fontSize: 12,
color: '#9CA3AF', color: 'var(--uj-text-3)',
textAlign: 'center', textAlign: 'center',
}} }}
> >
...@@ -214,7 +215,7 @@ export function ApprovalChainPreview({ ...@@ -214,7 +215,7 @@ export function ApprovalChainPreview({
style={{ style={{
marginTop: 4, marginTop: 4,
fontSize: 11, fontSize: 11,
color: '#C7CDD6', color: 'var(--uj-text-4)',
textAlign: 'center', textAlign: 'center',
}} }}
> >
......
...@@ -90,10 +90,10 @@ export function FailDetailCard({ checkResult, fileSize, onReUpload }: FailDetail ...@@ -90,10 +90,10 @@ export function FailDetailCard({ checkResult, fileSize, onReUpload }: FailDetail
<UCard <UCard
styles={{ body: { padding: '18px 20px 14px' } }} styles={{ body: { padding: '18px 20px 14px' } }}
style={{ style={{
border: '1px solid #E5E7EB', border: '1px solid var(--uj-border)',
marginBottom: 20, marginBottom: 20,
borderRadius: 12, borderRadius: 12,
background: '#fff', background: 'var(--uj-surface)',
overflow: 'hidden', overflow: 'hidden',
}} }}
title={ title={
...@@ -103,13 +103,17 @@ export function FailDetailCard({ checkResult, fileSize, onReUpload }: FailDetail ...@@ -103,13 +103,17 @@ export function FailDetailCard({ checkResult, fileSize, onReUpload }: FailDetail
width: 8, width: 8,
height: 8, height: 8,
borderRadius: '50%', borderRadius: '50%',
background: '#2563EB', background: 'var(--uj-primary)',
flex: 'none', flex: 'none',
}} }}
/> />
<span style={{ fontSize: 17, fontWeight: 700, color: '#111827' }}>校验失败明细</span> <span style={{ fontSize: 17, fontWeight: 700, color: 'var(--uj-text-1)' }}>
校验失败明细
</span>
{failRows > 0 && ( {failRows > 0 && (
<span style={{ fontSize: 13, color: '#9CA3AF', marginLeft: 4 }}>共 {failRows} 条</span> <span style={{ fontSize: 13, color: 'var(--uj-text-3)', marginLeft: 4 }}>
共 {failRows} 条
</span>
)} )}
</div> </div>
} }
...@@ -122,7 +126,7 @@ export function FailDetailCard({ checkResult, fileSize, onReUpload }: FailDetail ...@@ -122,7 +126,7 @@ export function FailDetailCard({ checkResult, fileSize, onReUpload }: FailDetail
icon={<UploadOutlined />} icon={<UploadOutlined />}
type="link" type="link"
onClick={onReUpload} onClick={onReUpload}
style={{ color: '#111827' }} style={{ color: 'var(--uj-text-1)' }}
> >
重新上传 重新上传
</UButton> </UButton>
...@@ -160,13 +164,13 @@ export function FailDetailCard({ checkResult, fileSize, onReUpload }: FailDetail ...@@ -160,13 +164,13 @@ export function FailDetailCard({ checkResult, fileSize, onReUpload }: FailDetail
key={c.key} key={c.key}
style={{ style={{
textAlign: 'left', textAlign: 'left',
color: '#6B7280', color: 'var(--uj-text-3)',
fontWeight: 400, fontWeight: 400,
fontSize: 13, fontSize: 13,
padding: '10px 8px', padding: '10px 8px',
borderBottom: '1px solid #F3F4F6', borderBottom: '1px solid var(--uj-surface-3)',
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
background: '#fff', background: 'var(--uj-surface)',
}} }}
> >
{c.label} {c.label}
...@@ -178,12 +182,12 @@ export function FailDetailCard({ checkResult, fileSize, onReUpload }: FailDetail ...@@ -178,12 +182,12 @@ export function FailDetailCard({ checkResult, fileSize, onReUpload }: FailDetail
{hasFailures ? ( {hasFailures ? (
failures.map((f, i) => ( failures.map((f, i) => (
<tr key={`${f.rowIndex ?? i}-${f.levelCode ?? ''}-${f.productCategory ?? ''}`}> <tr key={`${f.rowIndex ?? i}-${f.levelCode ?? ''}-${f.productCategory ?? ''}`}>
{/* 行号(蓝 #2563EB) */} {/* 行号(蓝 var(--uj-primary)) */}
<td <td
style={{ style={{
padding: '14px 8px', padding: '14px 8px',
borderBottom: '1px solid #F3F4F6', borderBottom: '1px solid var(--uj-surface-3)',
color: '#2563EB', color: 'var(--uj-primary)',
fontWeight: 500, fontWeight: 500,
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
}} }}
...@@ -194,8 +198,8 @@ export function FailDetailCard({ checkResult, fileSize, onReUpload }: FailDetail ...@@ -194,8 +198,8 @@ export function FailDetailCard({ checkResult, fileSize, onReUpload }: FailDetail
<td <td
style={{ style={{
padding: '14px 8px', padding: '14px 8px',
borderBottom: '1px solid #F3F4F6', borderBottom: '1px solid var(--uj-surface-3)',
color: '#111827', color: 'var(--uj-text-1)',
fontWeight: 500, fontWeight: 500,
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
overflow: 'hidden', overflow: 'hidden',
...@@ -205,24 +209,24 @@ export function FailDetailCard({ checkResult, fileSize, onReUpload }: FailDetail ...@@ -205,24 +209,24 @@ export function FailDetailCard({ checkResult, fileSize, onReUpload }: FailDetail
> >
{f.storeName ?? '-'} {f.storeName ?? '-'}
</td> </td>
{/* 门店商户号(蓝 #2563EB) */} {/* 门店商户号(蓝 var(--uj-primary)) */}
<td <td
style={{ style={{
padding: '14px 8px', padding: '14px 8px',
borderBottom: '1px solid #F3F4F6', borderBottom: '1px solid var(--uj-surface-3)',
color: '#2563EB', color: 'var(--uj-primary)',
fontWeight: 500, fontWeight: 500,
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
}} }}
> >
{f.merchantNo ?? '-'} {f.merchantNo ?? '-'}
</td> </td>
{/* 失败原因(红 #991B1B) */} {/* 失败原因(红 var(--uj-error)) */}
<td <td
style={{ style={{
padding: '14px 8px', padding: '14px 8px',
borderBottom: '1px solid #F3F4F6', borderBottom: '1px solid var(--uj-surface-3)',
color: '#991B1B', color: 'var(--uj-error)',
fontWeight: 500, fontWeight: 500,
lineHeight: 1.5, lineHeight: 1.5,
wordBreak: 'break-all', wordBreak: 'break-all',
...@@ -239,13 +243,13 @@ export function FailDetailCard({ checkResult, fileSize, onReUpload }: FailDetail ...@@ -239,13 +243,13 @@ export function FailDetailCard({ checkResult, fileSize, onReUpload }: FailDetail
colSpan={FAIL_COL_LABELS.length} colSpan={FAIL_COL_LABELS.length}
style={{ style={{
padding: '18px 8px', padding: '18px 8px',
color: '#6B7280', color: 'var(--uj-text-3)',
fontSize: 13, fontSize: 13,
textAlign: 'center', textAlign: 'center',
borderBottom: '1px solid #F3F4F6', borderBottom: '1px solid var(--uj-surface-3)',
}} }}
> >
<InfoCircleFilled style={{ color: '#9CA3AF', marginRight: 6 }} /> <InfoCircleFilled style={{ color: 'var(--uj-text-3)', marginRight: 6 }} />
明细已生成失败文件,请点击右上角「下载失败明细」查看完整失败原因 明细已生成失败文件,请点击右上角「下载失败明细」查看完整失败原因
</td> </td>
</tr> </tr>
...@@ -256,11 +260,11 @@ export function FailDetailCard({ checkResult, fileSize, onReUpload }: FailDetail ...@@ -256,11 +260,11 @@ export function FailDetailCard({ checkResult, fileSize, onReUpload }: FailDetail
{/* 底部 L1 / L2 校验说明(截图 2 行灰字) */} {/* 底部 L1 / L2 校验说明(截图 2 行灰字) */}
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, paddingTop: 6 }}> <div style={{ display: 'flex', flexDirection: 'column', gap: 8, paddingTop: 6 }}>
<div style={{ fontSize: 13, color: '#6B7280', lineHeight: 1.6 }}> <div style={{ fontSize: 13, color: 'var(--uj-text-3)', lineHeight: 1.6 }}>
<span>表头级(L2)校验:</span> <span>表头级(L2)校验:</span>
<span <span
style={{ style={{
color: '#047857', color: 'var(--uj-success)',
fontWeight: 600, fontWeight: 600,
margin: '0 6px', margin: '0 6px',
}} }}
...@@ -269,11 +273,11 @@ export function FailDetailCard({ checkResult, fileSize, onReUpload }: FailDetail ...@@ -269,11 +273,11 @@ export function FailDetailCard({ checkResult, fileSize, onReUpload }: FailDetail
</span> </span>
<span>—— {l2}</span> <span>—— {l2}</span>
</div> </div>
<div style={{ fontSize: 13, color: '#6B7280', lineHeight: 1.6 }}> <div style={{ fontSize: 13, color: 'var(--uj-text-3)', lineHeight: 1.6 }}>
<span>文件级(L1)校验:</span> <span>文件级(L1)校验:</span>
<span <span
style={{ style={{
color: '#047857', color: 'var(--uj-success)',
fontWeight: 600, fontWeight: 600,
margin: '0 6px', margin: '0 6px',
}} }}
......
import { useEffect, useMemo } from 'react'; import { useEffect, useMemo } from 'react';
import { InfoCircleFilled } from '@ant-design/icons'; import { InfoCircleFilled } from '@ant-design/icons';
import { App } from 'antd'; import { UCard, UForm, UFormItem, UInput, USelect, useUMessage } from '@uj/ui';
import { UCard, UForm, UFormItem, USelect, UInput } from '@uj/ui';
import type { USelectProps } from '@uj/ui'; import type { USelectProps } from '@uj/ui';
import type { StoreImportCheckVO } from '@/api/modules/store'; import type { StoreImportCheckVO } from '@/api/modules/store';
...@@ -24,7 +23,7 @@ export interface ImportInfoCardProps { ...@@ -24,7 +23,7 @@ export interface ImportInfoCardProps {
} }
export function ImportInfoCard({ values, checkResult, onChange }: ImportInfoCardProps) { export function ImportInfoCard({ values, checkResult, onChange }: ImportInfoCardProps) {
const { message } = App.useApp(); const message = useUMessage();
const [form] = UForm.useForm<ImportInfoValues>(); const [form] = UForm.useForm<ImportInfoValues>();
/** /**
...@@ -96,10 +95,10 @@ export function ImportInfoCard({ values, checkResult, onChange }: ImportInfoCard ...@@ -96,10 +95,10 @@ export function ImportInfoCard({ values, checkResult, onChange }: ImportInfoCard
return ( return (
<UCard <UCard
styles={{ body: { padding: 20 } }} styles={{ body: { padding: 20 } }}
style={{ marginBottom: 20, border: '1px solid #E5E7EB' }} style={{ marginBottom: 20, border: '1px solid var(--uj-border)' }}
title={ title={
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
<InfoCircleFilled style={{ color: '#2B5CE6', fontSize: 14 }} /> <InfoCircleFilled style={{ color: 'var(--uj-primary)', fontSize: 14 }} />
<span style={{ fontSize: 15, fontWeight: 600 }}>导入信息</span> <span style={{ fontSize: 15, fontWeight: 600 }}>导入信息</span>
</div> </div>
} }
...@@ -122,7 +121,7 @@ export function ImportInfoCard({ values, checkResult, onChange }: ImportInfoCard ...@@ -122,7 +121,7 @@ export function ImportInfoCard({ values, checkResult, onChange }: ImportInfoCard
<UFormItem <UFormItem
label={ label={
<span> <span>
所属组织<span style={{ color: '#E5484D', marginLeft: 2 }}>*</span> 所属组织<span style={{ color: 'var(--uj-error)', marginLeft: 2 }}>*</span>
</span> </span>
} }
name="org" name="org"
...@@ -134,7 +133,7 @@ export function ImportInfoCard({ values, checkResult, onChange }: ImportInfoCard ...@@ -134,7 +133,7 @@ export function ImportInfoCard({ values, checkResult, onChange }: ImportInfoCard
<UFormItem <UFormItem
label={ label={
<span> <span>
业务场景<span style={{ color: '#E5484D', marginLeft: 2 }}>*</span> 业务场景<span style={{ color: 'var(--uj-error)', marginLeft: 2 }}>*</span>
</span> </span>
} }
name="scene" name="scene"
...@@ -146,7 +145,7 @@ export function ImportInfoCard({ values, checkResult, onChange }: ImportInfoCard ...@@ -146,7 +145,7 @@ export function ImportInfoCard({ values, checkResult, onChange }: ImportInfoCard
<UFormItem <UFormItem
label={ label={
<span> <span>
产品分类<span style={{ color: '#E5484D', marginLeft: 2 }}>*</span> 产品分类<span style={{ color: 'var(--uj-error)', marginLeft: 2 }}>*</span>
</span> </span>
} }
name="categories" name="categories"
...@@ -169,13 +168,13 @@ export function ImportInfoCard({ values, checkResult, onChange }: ImportInfoCard ...@@ -169,13 +168,13 @@ export function ImportInfoCard({ values, checkResult, onChange }: ImportInfoCard
marginTop: 4, marginTop: 4,
}} }}
> >
<div style={{ fontSize: 12, color: '#8A94A6', lineHeight: 1.6 }}> <div style={{ fontSize: 12, color: 'var(--uj-text-3)', lineHeight: 1.6 }}>
决定本次导入数据的数据可见范围 决定本次导入数据的数据可见范围
</div> </div>
<div style={{ fontSize: 12, color: '#8A94A6', lineHeight: 1.6 }}> <div style={{ fontSize: 12, color: 'var(--uj-text-3)', lineHeight: 1.6 }}>
同一门店有多个业务场景时需拆分为独立行导入 同一门店有多个业务场景时需拆分为独立行导入
</div> </div>
<div style={{ fontSize: 12, color: '#8A94A6', lineHeight: 1.6 }}> <div style={{ fontSize: 12, color: 'var(--uj-text-3)', lineHeight: 1.6 }}>
决定模板中「产品分类」列的枚举范围 决定模板中「产品分类」列的枚举范围
</div> </div>
</div> </div>
......
...@@ -16,8 +16,8 @@ export function NoticeSection() { ...@@ -16,8 +16,8 @@ export function NoticeSection() {
}} }}
style={{ style={{
marginBottom: 20, marginBottom: 20,
border: '1px solid #C7D2FE', border: '1px solid var(--uj-info-border)',
background: 'linear-gradient(90deg, #EEF2FF 0%, #F5F3FF 100%)', background: 'var(--uj-primary-soft)',
}} }}
> >
<div <div
...@@ -35,8 +35,8 @@ export function NoticeSection() { ...@@ -35,8 +35,8 @@ export function NoticeSection() {
gap: 6, gap: 6,
padding: '2px 10px', padding: '2px 10px',
borderRadius: 10, borderRadius: 10,
background: '#2B5CE6', background: 'var(--uj-primary)',
color: '#fff', color: 'var(--uj-on-primary)',
fontSize: 12, fontSize: 12,
fontWeight: 500, fontWeight: 500,
}} }}
...@@ -44,7 +44,7 @@ export function NoticeSection() { ...@@ -44,7 +44,7 @@ export function NoticeSection() {
<BulbFilled style={{ fontSize: 12 }} /> <BulbFilled style={{ fontSize: 12 }} />
上架联动规则 上架联动规则
</span> </span>
<span style={{ fontSize: 14, fontWeight: 600, color: '#2B5CE6' }}> <span style={{ fontSize: 14, fontWeight: 600, color: 'var(--uj-primary)' }}>
主服务商切换与外部系统联动要点 主服务商切换与外部系统联动要点
</span> </span>
</div> </div>
...@@ -56,7 +56,7 @@ export function NoticeSection() { ...@@ -56,7 +56,7 @@ export function NoticeSection() {
display: 'flex', display: 'flex',
gap: 10, gap: 10,
fontSize: 13, fontSize: 13,
color: '#4B5563', color: 'var(--uj-text-2)',
lineHeight: 1.7, lineHeight: 1.7,
marginBottom: i === rules.length - 1 ? 0 : 6, marginBottom: i === rules.length - 1 ? 0 : 6,
}} }}
...@@ -67,8 +67,8 @@ export function NoticeSection() { ...@@ -67,8 +67,8 @@ export function NoticeSection() {
width: 22, width: 22,
height: 22, height: 22,
borderRadius: '50%', borderRadius: '50%',
background: '#E0E7FF', background: 'var(--uj-primary-soft)',
color: '#2B5CE6', color: 'var(--uj-primary)',
fontSize: 11, fontSize: 11,
fontWeight: 600, fontWeight: 600,
display: 'inline-flex', display: 'inline-flex',
......
import { useState } from 'react'; import { useState } from 'react';
import { App } from 'antd';
import { DownloadOutlined } from '@ant-design/icons'; import { DownloadOutlined } from '@ant-design/icons';
import { UButton } from '@uj/ui'; import { UButton, useUMessage } from '@uj/ui';
import { store } from '@/api'; import { store } from '@/api';
const DEFAULT_TEMPLATE = '【优加】门店上架模版-V1.0.1.xlsx'; const DEFAULT_TEMPLATE = '【优加】门店上架模版-V1.0.1.xlsx';
export function PageHeader() { export function PageHeader() {
const { message } = App.useApp(); const message = useUMessage();
const [downloading, setDownloading] = useState(false); const [downloading, setDownloading] = useState(false);
const handleDownload = async () => { const handleDownload = async () => {
...@@ -34,38 +33,15 @@ export function PageHeader() { ...@@ -34,38 +33,15 @@ export function PageHeader() {
]; ];
return ( return (
<div <div className="uj-page__header" style={{ marginBottom: 20 }}>
style={{
display: 'flex',
justifyContent: 'space-between',
alignItems: 'flex-start',
marginBottom: 20,
}}
>
<div> <div>
<h1 <h2 className="uj-page__title">导入门店信息</h2>
style={{ <p className="uj-page__desc">
fontSize: 20,
fontWeight: 600,
margin: 0,
color: '#1A202C',
}}
>
导入门店信息
</h1>
<p
style={{
fontSize: 13,
color: '#6B7280',
margin: '8px 0 0',
lineHeight: 1.6,
}}
>
按《{DEFAULT_TEMPLATE}》导入单个门店的商务政策(一行 = 一个产品分类), 按《{DEFAULT_TEMPLATE}》导入单个门店的商务政策(一行 = 一个产品分类),
校验通过并提交审批,审批通过后门店方可对外展示。 校验通过并提交审批,审批通过后门店方可对外展示。
</p> </p>
</div> </div>
<div style={{ display: 'flex', gap: 12 }}> <div className="uj-page__tools">
{actions.map((a) => ( {actions.map((a) => (
<UButton key={a.key} icon={a.icon ?? undefined} loading={a.loading} onClick={a.onClick}> <UButton key={a.key} icon={a.icon ?? undefined} loading={a.loading} onClick={a.onClick}>
{a.label} {a.label}
......
...@@ -38,8 +38,8 @@ export function PolicyConfirmHeader({ ...@@ -38,8 +38,8 @@ export function PolicyConfirmHeader({
}} }}
> >
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
<InfoCircleFilled style={{ color: '#2B5CE6', fontSize: 14 }} /> <InfoCircleFilled style={{ color: 'var(--uj-primary)', fontSize: 14 }} />
<span style={{ fontSize: 15, fontWeight: 600, color: '#1A202C' }}> <span style={{ fontSize: 15, fontWeight: 600, color: 'var(--uj-text-1)' }}>
商务政策确认 · {storeName} / 共 {displayRows} 行 商务政策确认 · {storeName} / 共 {displayRows} 行
</span> </span>
</div> </div>
......
...@@ -48,10 +48,10 @@ export function CategoryTag({ text }: { text: string }) { ...@@ -48,10 +48,10 @@ export function CategoryTag({ text }: { text: string }) {
/** 金额列渲染(加粗深灰) */ /** 金额列渲染(加粗深灰) */
export function MoneyCell({ value }: { value: string }) { export function MoneyCell({ value }: { value: string }) {
return <span style={{ fontWeight: 600, color: '#1F2937' }}>{value}</span>; return <span style={{ fontWeight: 600, color: 'var(--uj-text-1)' }}>{value}</span>;
} }
/** 激励费列(数值加粗) */ /** 激励费列(数值加粗) */
export function FeeValueCell({ value }: { value: string }) { export function FeeValueCell({ value }: { value: string }) {
return <span style={{ fontWeight: 600, color: '#1F2937' }}>{value}</span>; return <span style={{ fontWeight: 600, color: 'var(--uj-text-1)' }}>{value}</span>;
} }
...@@ -3,29 +3,29 @@ import type { PolicyConfirmRow } from '../../tools/policyTableData'; ...@@ -3,29 +3,29 @@ import type { PolicyConfirmRow } from '../../tools/policyTableData';
import { SceneTag, CategoryTag, MoneyCell, FeeValueCell } from './cells'; import { SceneTag, CategoryTag, MoneyCell, FeeValueCell } from './cells';
const storeInfoHeaderStyle: React.CSSProperties = { const storeInfoHeaderStyle: React.CSSProperties = {
background: '#EFF4FF', background: 'var(--uj-primary-soft)',
color: '#2B5CE6', color: 'var(--uj-primary)',
fontWeight: 600, fontWeight: 600,
fontSize: 13, fontSize: 13,
}; };
const bizPolicyHeaderStyle: React.CSSProperties = { const bizPolicyHeaderStyle: React.CSSProperties = {
background: '#ECFDF5', background: 'var(--uj-success-soft)',
color: '#047857', color: 'var(--uj-success)',
fontWeight: 600, fontWeight: 600,
fontSize: 13, fontSize: 13,
}; };
const costHeaderStyle: React.CSSProperties = { const costHeaderStyle: React.CSSProperties = {
background: '#FFF7ED', background: 'var(--uj-warning-soft)',
color: '#C2410C', color: 'var(--uj-warning)',
fontWeight: 600, fontWeight: 600,
fontSize: 13, fontSize: 13,
}; };
const cellStyle: React.CSSProperties = { const cellStyle: React.CSSProperties = {
fontSize: 12.5, fontSize: 12.5,
color: '#374151', color: 'var(--uj-text-2)',
padding: '10px 12px', padding: '10px 12px',
}; };
...@@ -66,7 +66,7 @@ export function buildPolicyColumns( ...@@ -66,7 +66,7 @@ export function buildPolicyColumns(
rowSpan: getRowSpan(index ?? 0, (r) => r.storeName), rowSpan: getRowSpan(index ?? 0, (r) => r.storeName),
style: cellStyle, style: cellStyle,
}), }),
render: (v) => <span style={{ color: '#1A202C', fontWeight: 500 }}>{v}</span>, render: (v) => <span style={{ color: 'var(--uj-text-1)', fontWeight: 500 }}>{v}</span>,
}, },
{ {
title: '门店商户号', title: '门店商户号',
...@@ -80,7 +80,7 @@ export function buildPolicyColumns( ...@@ -80,7 +80,7 @@ export function buildPolicyColumns(
rowSpan: getRowSpan(index ?? 0, (r) => `${r.storeName}|${r.storeMerchantNo}`), rowSpan: getRowSpan(index ?? 0, (r) => `${r.storeName}|${r.storeMerchantNo}`),
style: cellStyle, style: cellStyle,
}), }),
render: (v) => <a style={{ color: '#2563EB', fontSize: 12.5 }}>{v}</a>, render: (v) => <a style={{ color: 'var(--uj-primary)', fontSize: 12.5 }}>{v}</a>,
}, },
{ {
title: '业务场景', title: '业务场景',
......
...@@ -110,7 +110,7 @@ export function PolicyConfirmTable({ ...@@ -110,7 +110,7 @@ export function PolicyConfirmTable({
<UCard <UCard
styles={{ body: { padding: '16px 16px 12px' } }} styles={{ body: { padding: '16px 16px 12px' } }}
style={{ style={{
border: '1px solid #E5E7EB', border: '1px solid var(--uj-border)',
marginBottom: 20, marginBottom: 20,
borderRadius: 10, borderRadius: 10,
overflow: 'hidden', overflow: 'hidden',
...@@ -124,7 +124,7 @@ export function PolicyConfirmTable({ ...@@ -124,7 +124,7 @@ export function PolicyConfirmTable({
style={{ style={{
marginTop: 12, marginTop: 12,
padding: '10px 12px', padding: '10px 12px',
background: '#F9FAFB', background: 'var(--uj-surface-2)',
borderRadius: 6, borderRadius: 6,
}} }}
> >
......
import { Steps } from 'antd'; import { USteps } from '@uj/ui';
export interface StepsBarProps { export interface StepsBarProps {
current?: number; current?: number;
...@@ -27,14 +27,14 @@ export function StepsBar({ current = 0 }: StepsBarProps) { ...@@ -27,14 +27,14 @@ export function StepsBar({ current = 0 }: StepsBarProps) {
return ( return (
<div <div
style={{ style={{
background: '#fff', background: 'var(--uj-surface)',
borderRadius: 10, borderRadius: 10,
padding: '20px 32px 12px', padding: '20px 32px 12px',
marginBottom: 20, marginBottom: 20,
border: '1px solid #E5E7EB', border: '1px solid var(--uj-border)',
}} }}
> >
<Steps current={current} items={stepItems} size="default" status="process" /> <USteps current={current} items={stepItems} size="default" status="process" />
</div> </div>
); );
} }
...@@ -21,18 +21,18 @@ const labelStyle: React.CSSProperties = { ...@@ -21,18 +21,18 @@ const labelStyle: React.CSSProperties = {
width: 120, width: 120,
flex: 'none', flex: 'none',
fontSize: 13, fontSize: 13,
color: '#8A94A6', color: 'var(--uj-text-3)',
}; };
const valueStyle: React.CSSProperties = { const valueStyle: React.CSSProperties = {
fontSize: 13, fontSize: 13,
color: '#1A202C', color: 'var(--uj-text-1)',
fontWeight: 500, fontWeight: 500,
}; };
const descStyle: React.CSSProperties = { const descStyle: React.CSSProperties = {
fontSize: 12, fontSize: 12,
color: '#9CA3AF', color: 'var(--uj-text-3)',
marginLeft: 6, marginLeft: 6,
}; };
...@@ -114,7 +114,11 @@ export function SubmitConfirmCard({ ...@@ -114,7 +114,11 @@ export function SubmitConfirmCard({
}, },
{ {
label: '运营成本合计', label: '运营成本合计',
value: <span style={{ color: '#2B5CE6', fontWeight: 600 }}>{finalInfo.operatingCost}</span>, value: (
<span style={{ color: 'var(--uj-primary)', fontWeight: 600 }}>
{finalInfo.operatingCost}
</span>
),
desc: finalInfo.operatingCostDetail, desc: finalInfo.operatingCostDetail,
}, },
{ {
...@@ -136,10 +140,10 @@ export function SubmitConfirmCard({ ...@@ -136,10 +140,10 @@ export function SubmitConfirmCard({
return ( return (
<UCard <UCard
styles={{ body: { padding: '20px 24px' } }} styles={{ body: { padding: '20px 24px' } }}
style={{ marginBottom: 20, border: '1px solid #E5E7EB', borderRadius: 10 }} style={{ marginBottom: 20, border: '1px solid var(--uj-border)', borderRadius: 10 }}
title={ title={
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
<InfoCircleFilled style={{ color: '#2B5CE6', fontSize: 14 }} /> <InfoCircleFilled style={{ color: 'var(--uj-primary)', fontSize: 14 }} />
<span style={{ fontSize: 15, fontWeight: 600 }}>提交确认</span> <span style={{ fontSize: 15, fontWeight: 600 }}>提交确认</span>
</div> </div>
} }
...@@ -149,8 +153,8 @@ export function SubmitConfirmCard({ ...@@ -149,8 +153,8 @@ export function SubmitConfirmCard({
style={{ style={{
padding: '10px 14px', padding: '10px 14px',
borderRadius: 8, borderRadius: 8,
background: '#FFF7ED', background: 'var(--uj-warning-soft)',
border: '1px solid #FED7AA', border: '1px solid var(--uj-warning-border)',
display: 'flex', display: 'flex',
alignItems: 'flex-start', alignItems: 'flex-start',
gap: 8, gap: 8,
...@@ -158,13 +162,13 @@ export function SubmitConfirmCard({ ...@@ -158,13 +162,13 @@ export function SubmitConfirmCard({
}} }}
> >
<ExclamationCircleOutlined <ExclamationCircleOutlined
style={{ color: '#EA580C', fontSize: 16, marginTop: 1, flex: 'none' }} style={{ color: 'var(--uj-warning)', fontSize: 16, marginTop: 1, flex: 'none' }}
/> />
<div style={{ flex: 1, fontSize: 12, lineHeight: '20px' }}> <div style={{ flex: 1, fontSize: 12, lineHeight: '20px' }}>
<span style={{ color: '#9A3412', fontWeight: 600 }}> <span style={{ color: 'var(--uj-warning)', fontWeight: 600 }}>
本次存在校验失败数据:共 {checkResult.failRows} 行失败。 本次存在校验失败数据:共 {checkResult.failRows} 行失败。
</span> </span>
<span style={{ color: '#7C2D12', marginLeft: 4 }}> <span style={{ color: 'var(--uj-warning)', marginLeft: 4 }}>
本次将只提交「通过 {checkResult.passRows ?? 0} 行(listingIds 共{' '} 本次将只提交「通过 {checkResult.passRows ?? 0} 行(listingIds 共{' '}
{checkResult.listingIds?.length ?? 0}{' '} {checkResult.listingIds?.length ?? 0}{' '}
条)」进入审批,失败行需要您下载明细后修正再上传。 条)」进入审批,失败行需要您下载明细后修正再上传。
...@@ -176,7 +180,7 @@ export function SubmitConfirmCard({ ...@@ -176,7 +180,7 @@ export function SubmitConfirmCard({
<div <div
style={{ style={{
padding: '14px 16px', padding: '14px 16px',
background: '#F9FAFB', background: 'var(--uj-surface-2)',
borderRadius: 8, borderRadius: 8,
marginBottom: 18, marginBottom: 18,
}} }}
...@@ -186,11 +190,11 @@ export function SubmitConfirmCard({ ...@@ -186,11 +190,11 @@ export function SubmitConfirmCard({
onChange={(e) => onCheckedChange?.(e.target.checked)} onChange={(e) => onCheckedChange?.(e.target.checked)}
style={{ fontSize: 13, fontWeight: 500 }} style={{ fontSize: 13, fontWeight: 500 }}
> >
<span style={{ color: '#374151' }}> <span style={{ color: 'var(--uj-text-2)' }}>
我已确认该门店 {finalInfo.sceneCount} 个业务场景共 {displayRows} 行数据准确无误 我已确认该门店 {finalInfo.sceneCount} 个业务场景共 {displayRows} 行数据准确无误
</span> </span>
</UCheckbox> </UCheckbox>
<div style={{ fontSize: 12, color: '#9CA3AF', marginTop: 6, paddingLeft: 24 }}> <div style={{ fontSize: 12, color: 'var(--uj-text-3)', marginTop: 6, paddingLeft: 24 }}>
提交后如需调整,请在该门店「待审批」状态下撤回。 提交后如需调整,请在该门店「待审批」状态下撤回。
</div> </div>
</div> </div>
......
import { useState, useCallback, useEffect, useRef } from 'react'; import { useState, useCallback, useEffect, useRef } from 'react';
import { App } from 'antd';
import { import {
InfoCircleFilled, InfoCircleFilled,
UploadOutlined, UploadOutlined,
...@@ -11,7 +10,7 @@ import { ...@@ -11,7 +10,7 @@ import {
import type { UploadProps, UploadFile } from 'antd'; import type { UploadProps, UploadFile } from 'antd';
import type { RcFile } from 'antd/es/upload/interface'; import type { RcFile } from 'antd/es/upload/interface';
import type { UploadRef } from 'antd/es/upload'; import type { UploadRef } from 'antd/es/upload';
import { UCard, UUpload, UText, UButton } from '@uj/ui'; import { UButton, UCard, UText, UUpload, useUMessage } from '@uj/ui';
import { store } from '@/api'; import { store } from '@/api';
import type { StoreImportCheckVO } from '@/api/modules/store'; import type { StoreImportCheckVO } from '@/api/modules/store';
import { validateFileExtension, validateFileSize, UPLOAD_RULES } from '../tools/uploadValidate'; import { validateFileExtension, validateFileSize, UPLOAD_RULES } from '../tools/uploadValidate';
...@@ -37,7 +36,7 @@ export function UploadCard({ ...@@ -37,7 +36,7 @@ export function UploadCard({
onFileChange, onFileChange,
onUploadSuccess, onUploadSuccess,
}: UploadCardProps) { }: UploadCardProps) {
const { message } = App.useApp(); const message = useUMessage();
const [uploading, setUploading] = useState(false); const [uploading, setUploading] = useState(false);
const [downloading, setDownloading] = useState(false); const [downloading, setDownloading] = useState(false);
const [fileList, setFileList] = useState<UploadFile[]>([]); const [fileList, setFileList] = useState<UploadFile[]>([]);
...@@ -216,10 +215,10 @@ export function UploadCard({ ...@@ -216,10 +215,10 @@ export function UploadCard({
return ( return (
<UCard <UCard
styles={{ body: { padding: 20 } }} styles={{ body: { padding: 20 } }}
style={{ border: '1px solid #E5E7EB', marginBottom: 20 }} style={{ border: '1px solid var(--uj-border)', marginBottom: 20 }}
title={ title={
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
<InfoCircleFilled style={{ color: '#2B5CE6', fontSize: 14 }} /> <InfoCircleFilled style={{ color: 'var(--uj-primary)', fontSize: 14 }} />
<span style={{ fontSize: 15, fontWeight: 600 }}>上传门店上架表</span> <span style={{ fontSize: 15, fontWeight: 600 }}>上传门店上架表</span>
</div> </div>
} }
...@@ -238,7 +237,7 @@ export function UploadCard({ ...@@ -238,7 +237,7 @@ export function UploadCard({
width: 48, width: 48,
height: 48, height: 48,
borderRadius: 12, borderRadius: 12,
background: '#EEF2FF', background: 'var(--uj-primary-soft)',
display: 'inline-flex', display: 'inline-flex',
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
...@@ -246,9 +245,9 @@ export function UploadCard({ ...@@ -246,9 +245,9 @@ export function UploadCard({
}} }}
> >
{uploading ? ( {uploading ? (
<LoadingOutlined style={{ fontSize: 22, color: '#2B5CE6' }} /> <LoadingOutlined style={{ fontSize: 22, color: 'var(--uj-primary)' }} />
) : ( ) : (
<UploadOutlined style={{ fontSize: 22, color: '#2B5CE6' }} /> <UploadOutlined style={{ fontSize: 22, color: 'var(--uj-primary)' }} />
)} )}
</div> </div>
<p <p
...@@ -256,7 +255,7 @@ export function UploadCard({ ...@@ -256,7 +255,7 @@ export function UploadCard({
style={{ style={{
fontSize: 15, fontSize: 15,
fontWeight: 500, fontWeight: 500,
color: '#374151', color: 'var(--uj-text-2)',
marginBottom: 8, marginBottom: 8,
}} }}
> >
...@@ -266,7 +265,7 @@ export function UploadCard({ ...@@ -266,7 +265,7 @@ export function UploadCard({
className="ant-upload-hint" className="ant-upload-hint"
style={{ style={{
fontSize: 12, fontSize: 12,
color: '#9CA3AF', color: 'var(--uj-text-3)',
marginBottom: 6, marginBottom: 6,
}} }}
> >
...@@ -285,7 +284,7 @@ export function UploadCard({ ...@@ -285,7 +284,7 @@ export function UploadCard({
<div <div
style={{ style={{
fontSize: 12, fontSize: 12,
color: '#C7CDD6', color: 'var(--uj-text-4)',
}} }}
> >
模板版本:v1.0.1 · 系统将校验模板版本一致性 模板版本:v1.0.1 · 系统将校验模板版本一致性
...@@ -311,9 +310,9 @@ export function UploadCard({ ...@@ -311,9 +310,9 @@ export function UploadCard({
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
padding: '14px 16px', padding: '14px 16px',
background: '#F9FAFB', background: 'var(--uj-surface-2)',
borderRadius: 8, borderRadius: 8,
border: '1px solid #E5E7EB', border: '1px solid var(--uj-border)',
}} }}
> >
<div <div
...@@ -321,7 +320,7 @@ export function UploadCard({ ...@@ -321,7 +320,7 @@ export function UploadCard({
width: 36, width: 36,
height: 36, height: 36,
borderRadius: 8, borderRadius: 8,
background: '#E7F5EE', background: 'var(--uj-success-soft)',
display: 'inline-flex', display: 'inline-flex',
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
...@@ -329,7 +328,7 @@ export function UploadCard({ ...@@ -329,7 +328,7 @@ export function UploadCard({
flex: 'none', flex: 'none',
}} }}
> >
<FileExcelOutlined style={{ color: '#16A34A', fontSize: 18 }} /> <FileExcelOutlined style={{ color: 'var(--uj-success)', fontSize: 18 }} />
</div> </div>
<div style={{ flex: 1, minWidth: 0 }}> <div style={{ flex: 1, minWidth: 0 }}>
<div <div
...@@ -344,7 +343,7 @@ export function UploadCard({ ...@@ -344,7 +343,7 @@ export function UploadCard({
style={{ style={{
fontSize: 14, fontSize: 14,
fontWeight: 600, fontWeight: 600,
color: '#1A202C', color: 'var(--uj-text-1)',
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
overflow: 'hidden', overflow: 'hidden',
textOverflow: 'ellipsis', textOverflow: 'ellipsis',
...@@ -352,18 +351,22 @@ export function UploadCard({ ...@@ -352,18 +351,22 @@ export function UploadCard({
> >
{fileList[0].name} {fileList[0].name}
</span> </span>
<CheckCircleFilled style={{ color: '#16A34A', fontSize: 16, flex: 'none' }} /> <CheckCircleFilled
style={{ color: 'var(--uj-success)', fontSize: 16, flex: 'none' }}
/>
</div> </div>
<div style={{ fontSize: 12, color: '#6B7280' }}> <div style={{ fontSize: 12, color: 'var(--uj-text-3)' }}>
{fileList[0].size ? Math.max(1, Math.round(fileList[0].size / 1024)) : '-'} KB {fileList[0].size ? Math.max(1, Math.round(fileList[0].size / 1024)) : '-'} KB
<CheckCircleFilled style={{ color: '#16A34A', fontSize: 12, marginLeft: 6 }} /> <CheckCircleFilled
style={{ color: 'var(--uj-success)', fontSize: 12, marginLeft: 6 }}
/>
</div> </div>
{statLineText && ( {statLineText && (
<div <div
style={{ style={{
marginTop: 6, marginTop: 6,
fontSize: 12, fontSize: 12,
color: '#4B5563', color: 'var(--uj-text-2)',
lineHeight: 1.6, lineHeight: 1.6,
}} }}
> >
...@@ -377,7 +380,7 @@ export function UploadCard({ ...@@ -377,7 +380,7 @@ export function UploadCard({
icon={<CloseOutlined />} icon={<CloseOutlined />}
onClick={() => handleRemove()} onClick={() => handleRemove()}
style={{ style={{
color: '#9CA3AF', color: 'var(--uj-text-3)',
padding: '4px 8px', padding: '4px 8px',
flex: 'none', flex: 'none',
marginLeft: 8, marginLeft: 8,
......
...@@ -14,20 +14,20 @@ interface StatCardProps { ...@@ -14,20 +14,20 @@ interface StatCardProps {
const toneMap: Record<StatItem['tone'], { border: string; accent: string }> = { const toneMap: Record<StatItem['tone'], { border: string; accent: string }> = {
primary: { primary: {
border: '1px solid #C7D2FE', border: '1px solid var(--uj-info-border)',
accent: '#2B5CE6', accent: 'var(--uj-primary)',
}, },
success: { success: {
border: '1px solid #86EFAC', border: '1px solid var(--uj-success-border)',
accent: '#16A34A', accent: 'var(--uj-success)',
}, },
warning: { warning: {
border: '1px solid #FCD34D', border: '1px solid var(--uj-warning-border)',
accent: '#CA8A04', accent: 'var(--uj-warning)',
}, },
default: { default: {
border: '1px solid #E5E7EB', border: '1px solid var(--uj-border)',
accent: '#6B7280', accent: 'var(--uj-text-3)',
}, },
}; };
...@@ -40,13 +40,13 @@ function StatCard({ item }: StatCardProps) { ...@@ -40,13 +40,13 @@ function StatCard({ item }: StatCardProps) {
borderLeft: `3px solid ${tone.accent}`, borderLeft: `3px solid ${tone.accent}`,
border: tone.border, border: tone.border,
borderRadius: 10, borderRadius: 10,
background: '#fff', background: 'var(--uj-surface)',
}} }}
> >
<div <div
style={{ style={{
fontSize: 13, fontSize: 13,
color: '#6B7280', color: 'var(--uj-text-3)',
marginBottom: 10, marginBottom: 10,
fontWeight: 500, fontWeight: 500,
}} }}
...@@ -57,7 +57,7 @@ function StatCard({ item }: StatCardProps) { ...@@ -57,7 +57,7 @@ function StatCard({ item }: StatCardProps) {
style={{ style={{
fontSize: 26, fontSize: 26,
fontWeight: 700, fontWeight: 700,
color: '#1A202C', color: 'var(--uj-text-1)',
marginBottom: 8, marginBottom: 8,
lineHeight: 1.2, lineHeight: 1.2,
}} }}
...@@ -67,7 +67,7 @@ function StatCard({ item }: StatCardProps) { ...@@ -67,7 +67,7 @@ function StatCard({ item }: StatCardProps) {
<div <div
style={{ style={{
fontSize: 12, fontSize: 12,
color: '#9CA3AF', color: 'var(--uj-text-3)',
lineHeight: 1.5, lineHeight: 1.5,
}} }}
> >
......
import { useState } from 'react'; import { useState } from 'react';
import { App, Skeleton } from 'antd'; import { Skeleton, useUApp } from '@uj/ui';
import { PageHeader } from './components/PageHeader'; import { PageHeader } from './components/PageHeader';
import { NoticeSection } from './components/NoticeSection'; import { NoticeSection } from './components/NoticeSection';
import { StepsBar } from './components/StepsBar'; import { StepsBar } from './components/StepsBar';
...@@ -21,7 +21,7 @@ import type { StoreImportCheckVO } from '@/api/modules/store'; ...@@ -21,7 +21,7 @@ import type { StoreImportCheckVO } from '@/api/modules/store';
export default function TemplateImport() { export default function TemplateImport() {
const loading = false; const loading = false;
const { message, modal } = App.useApp(); const { message, modal } = useUApp();
const [currentStep, setCurrentStep] = useState<0 | 1 | 2 | 3>(0); const [currentStep, setCurrentStep] = useState<0 | 1 | 2 | 3>(0);
const [importInfo, setImportInfo] = useState<ImportInfoValues | null>(null); const [importInfo, setImportInfo] = useState<ImportInfoValues | null>(null);
const [selectedFile, setSelectedFile] = useState<File | null>(null); const [selectedFile, setSelectedFile] = useState<File | null>(null);
......
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { Empty } from 'antd';
import { busEvents } from '@uj/contracts'; import { busEvents } from '@uj/contracts';
import { SubAppProvider, readInitialPage, shortName, subappBus } from '@uj/platform-sdk'; import { SubAppProvider, readInitialPage, shortName, subappBus } from '@uj/platform-sdk';
import RoleManage from './pages/RoleManage'; import RoleManage from './pages/RoleManage';
import AccountManage from './pages/AccountManage'; import AccountManage from './pages/AccountManage';
import { UEmpty } from '@uj/ui';
/** /**
* 页名 -> 页面组件。 * 页名 -> 页面组件。
* 页名来自后端菜单 route 的末段:/system/role -> role、/system/user -> user。 * 页名来自后端菜单 route 的末段:/system/role -> role、/system/user -> user。
...@@ -19,11 +19,7 @@ const PAGES = { ...@@ -19,11 +19,7 @@ const PAGES = {
function renderPage(page: string) { function renderPage(page: string) {
const Page = PAGES[page as keyof typeof PAGES]; const Page = PAGES[page as keyof typeof PAGES];
return Page ? ( return Page ? <Page /> : <UEmpty description={`没有名为「${page}」的页面`} />;
<Page />
) : (
<Empty description={`没有名为「${page}」的页面`} image={Empty.PRESENTED_IMAGE_SIMPLE} />
);
} }
function SystemApp() { function SystemApp() {
......
/* 子应用内样式只在 <wujie-app> 的 shadowRoot 内生效,不会污染主壳。 /* 子应用内样式只在 <wujie-app> 的 shadowRoot 内生效,不会污染主壳。
tokens.css 由 main.tsx 引入;根节点带 .uj-scope 让 CSS 变量有落点。 */ tokens.css 由 main.tsx 引入;根节点带 .uj-scope 让令牌在 shadowRoot 内有本地落点,
不依赖「自定义属性恰好能穿透 shadow DOM」这个侥幸。 */
.uj-system-app { .uj-system-app {
min-height: 100%; /* height(而非 min-height):列表页要靠这条定高链路把剩余空间量出来。
长页面由内部 .uj-page 撑高后在本容器里滚,不会把 iframe 撑破。 */
height: 100%;
width: 100%; width: 100%;
color: var(--uj-color-text-primary); overflow: auto;
color: var(--uj-text-1);
} }
import { useEffect } from 'react'; import { useEffect } from 'react';
import { message } from 'antd';
import { useMutation } from '@tanstack/react-query'; import { useMutation } from '@tanstack/react-query';
import { UButton, UForm, UModal } from '@uj/ui'; import { UButton, UDrawer, UForm, useUMessage } from '@uj/ui';
import { user, type OrgNode, type RoleOption, type UserPageItem } from '@/api'; import { user, type OrgNode, type RoleOption, type UserPageItem } from '@/api';
import { CombiForm, type FieldSchema } from '@/components'; import { CombiForm, type FieldSchema } from '@/components';
import { dataScopeOptions } from '@/constants/dataScope'; import { dataScopeOptions } from '@/constants/dataScope';
...@@ -17,23 +16,24 @@ interface AccountFormValues extends Record<string, unknown> { ...@@ -17,23 +16,24 @@ interface AccountFormValues extends Record<string, unknown> {
roleIds: number[]; roleIds: number[];
} }
export interface AccountModalProps { export interface AccountFormDrawerProps {
open: boolean; open: boolean;
account?: UserPageItem; account?: UserPageItem;
orgTree: OrgNode[]; orgTree: OrgNode[];
roleOptions: RoleOption[]; roleOptions: RoleOption[];
onCancel: () => void; onClose: () => void;
onSuccess: () => void; onSuccess: () => void;
} }
export function AccountModal({ export function AccountFormDrawer({
open, open,
account, account,
orgTree, orgTree,
roleOptions, roleOptions,
onCancel, onClose,
onSuccess, onSuccess,
}: AccountModalProps) { }: AccountFormDrawerProps) {
const message = useUMessage();
const [form] = UForm.useForm<AccountFormValues>(); const [form] = UForm.useForm<AccountFormValues>();
const selectedRoleIds = UForm.useWatch('roleIds', form) ?? []; const selectedRoleIds = UForm.useWatch('roleIds', form) ?? [];
const isEdit = Boolean(account); const isEdit = Boolean(account);
...@@ -141,7 +141,7 @@ export function AccountModal({ ...@@ -141,7 +141,7 @@ export function AccountModal({
}, },
{ {
name: 'roleIds', name: 'roleIds',
label: '角色分配', label: '选择角色',
type: 'selectMultiple', type: 'selectMultiple',
section: '角色分配', section: '角色分配',
itemStyle: { gridColumn: '1 / -1' }, itemStyle: { gridColumn: '1 / -1' },
...@@ -150,16 +150,19 @@ export function AccountModal({ ...@@ -150,16 +150,19 @@ export function AccountModal({
]; ];
return ( return (
<UModal <UDrawer
open={open} open={open}
title={isEdit ? '编辑账号' : '新增账号'} title={isEdit ? '编辑账号' : '新增账号'}
width={520} size={560}
okText="保存" onClose={onClose}
cancelText="取消" footer={
confirmLoading={saveMutation.isPending} <div style={footerStyle}>
onCancel={onCancel} <UButton onClick={onClose}>取消</UButton>
onOk={() => form.submit()} <UButton type="primary" loading={saveMutation.isPending} onClick={() => form.submit()}>
styles={{ body: { maxHeight: '65vh', overflowY: 'auto', paddingTop: 8 } }} 保存
</UButton>
</div>
}
> >
<CombiForm<AccountFormValues> <CombiForm<AccountFormValues>
mode="form" mode="form"
...@@ -194,10 +197,11 @@ export function AccountModal({ ...@@ -194,10 +197,11 @@ export function AccountModal({
return undefined; return undefined;
}} }}
/> />
</UModal> </UDrawer>
); );
} }
const footerStyle = { display: 'flex', justifyContent: 'flex-end', gap: 8 };
const twoColumnStyle = { display: 'grid', gridTemplateColumns: '1fr 1fr', columnGap: 12 }; const twoColumnStyle = { display: 'grid', gridTemplateColumns: '1fr 1fr', columnGap: 12 };
function SectionTitle({ children }: { children: string }) { function SectionTitle({ children }: { children: string }) {
return ( return (
...@@ -209,7 +213,7 @@ function SectionTitle({ children }: { children: string }) { ...@@ -209,7 +213,7 @@ function SectionTitle({ children }: { children: string }) {
} }
const sectionTitleStyle = { const sectionTitleStyle = {
borderBottom: '1px solid #eef0f4', borderBottom: '1px solid var(--uj-divider)',
alignItems: 'center', alignItems: 'center',
display: 'flex', display: 'flex',
gap: 6, gap: 6,
...@@ -218,7 +222,12 @@ const sectionTitleStyle = { ...@@ -218,7 +222,12 @@ const sectionTitleStyle = {
margin: '0 0 12px', margin: '0 0 12px',
padding: '0 0 8px', padding: '0 0 8px',
}; };
const sectionMarkerStyle = { backgroundColor: '#315ce8', borderRadius: 2, height: 10, width: 3 }; const sectionMarkerStyle = {
backgroundColor: 'var(--uj-primary)',
borderRadius: 2,
height: 10,
width: 3,
};
const roleListStyle = { display: 'flex', flexWrap: 'wrap', gap: 8 } as const; const roleListStyle = { display: 'flex', flexWrap: 'wrap', gap: 8 } as const;
const roleOptionStyle = { const roleOptionStyle = {
alignItems: 'center', alignItems: 'center',
......
import { useMemo, useState } from 'react'; import { useMemo, useState } from 'react';
import { message } from 'antd';
import { useMutation, useQuery } from '@tanstack/react-query'; import { useMutation, useQuery } from '@tanstack/react-query';
import { UCard, UTag, UText, UTitle } from '@uj/ui'; import { UCard, UTag, UText, useUMessage } from '@uj/ui';
import { import {
DataTable, DataTable,
DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE,
ConfirmModal, ConfirmModal,
PageShell,
SearchForm, SearchForm,
type FieldSchema, type FieldSchema,
type DataTableColumnsType, type DataTableColumnsType,
...@@ -14,7 +14,7 @@ import { ...@@ -14,7 +14,7 @@ import {
} from '@/components'; } from '@/components';
import { P, PermButton } from '@/access'; import { P, PermButton } from '@/access';
import { org, role, user, type UserPageItem, type UserPageParams } from '@/api'; import { org, role, user, type UserPageItem, type UserPageParams } from '@/api';
import { AccountModal } from './components/AccountModal'; import { AccountFormDrawer } from './components/AccountFormDrawer';
import { createAccountPageParams, toOrgCascaderOptions, withAllOption } from './tools/account'; import { createAccountPageParams, toOrgCascaderOptions, withAllOption } from './tools/account';
const accountStatusOptions = [ const accountStatusOptions = [
...@@ -40,9 +40,10 @@ function toParams(values: Record<string, unknown>, pagination: SearchPagination) ...@@ -40,9 +40,10 @@ function toParams(values: Record<string, unknown>, pagination: SearchPagination)
} }
export default function AccountManage() { export default function AccountManage() {
const message = useUMessage();
const [params, setParams] = useState<UserPageParams>({ current: 1, size: DEFAULT_PAGE_SIZE }); const [params, setParams] = useState<UserPageParams>({ current: 1, size: DEFAULT_PAGE_SIZE });
const [queryVersion, setQueryVersion] = useState(0); const [queryVersion, setQueryVersion] = useState(0);
const [accountModalOpen, setAccountModalOpen] = useState(false); const [accountFormOpen, setAccountFormOpen] = useState(false);
const [editingAccount, setEditingAccount] = useState<UserPageItem>(); const [editingAccount, setEditingAccount] = useState<UserPageItem>();
const [resettingAccount, setResettingAccount] = useState<UserPageItem>(); const [resettingAccount, setResettingAccount] = useState<UserPageItem>();
const [changingStatusAccount, setChangingStatusAccount] = useState<UserPageItem>(); const [changingStatusAccount, setChangingStatusAccount] = useState<UserPageItem>();
...@@ -97,7 +98,12 @@ export default function AccountManage() { ...@@ -97,7 +98,12 @@ export default function AccountManage() {
[result], [result],
); );
const fields: FieldSchema<Record<string, unknown>>[] = [ const fields: FieldSchema<Record<string, unknown>>[] = [
{ name: 'keyword', label: '账号 / 姓名', type: 'input', placeholder: '模糊搜索' }, {
name: 'keyword',
label: '账号 / 姓名',
type: 'input',
placeholder: '模糊搜索',
},
{ {
name: 'orgId', name: 'orgId',
label: '所属组织', label: '所属组织',
...@@ -126,7 +132,9 @@ export default function AccountManage() { ...@@ -126,7 +132,9 @@ export default function AccountManage() {
width: 160, width: 160,
line: 1, line: 1,
render: (value) => ( render: (value) => (
<UText style={{ color: '#315ce8', fontFamily: 'monospace' }}>{value}</UText> <UText>
<code className="uj-code">{value}</code>
</UText>
), ),
}, },
{ title: '姓名', dataIndex: 'name', width: 130, line: 1 }, { title: '姓名', dataIndex: 'name', width: 130, line: 1 },
...@@ -137,23 +145,27 @@ export default function AccountManage() { ...@@ -137,23 +145,27 @@ export default function AccountManage() {
dataIndex: 'roleNames', dataIndex: 'roleNames',
width: 290, width: 290,
render: (names: string[]) => render: (names: string[]) =>
names.length names.length ? (
? names.map((name, index) => ( <span className="uj-tag-list">
<UTag {names.map((name) => (
key={name} <UTag key={name} color="blue">
color="blue"
style={index < names.length - 1 ? { marginRight: 4 } : undefined}
>
{name} {name}
</UTag> </UTag>
)) ))}
: '—', </span>
) : (
'—'
),
}, },
{ title: '数据域', dataIndex: 'dataScopeLabel' }, { title: '数据域', dataIndex: 'dataScopeLabel' },
{ {
title: '状态', title: '状态',
width: 90, width: 90,
render: (_, row) => (row.status === 1 ? '启用' : '停用'), render: (_, row) => (
<UTag color={row.status === 1 ? 'green' : 'default'}>
{row.status === 1 ? '启用' : '停用'}
</UTag>
),
}, },
{ title: '最后登录', dataIndex: 'lastLoginAt', width: 170 }, { title: '最后登录', dataIndex: 'lastLoginAt', width: 170 },
]; ];
...@@ -163,7 +175,7 @@ export default function AccountManage() { ...@@ -163,7 +175,7 @@ export default function AccountManage() {
permission: P.SYSTEM_USER_UPDATE, permission: P.SYSTEM_USER_UPDATE,
onClick: (row) => { onClick: (row) => {
setEditingAccount(row.source); setEditingAccount(row.source);
setAccountModalOpen(true); setAccountFormOpen(true);
}, },
}, },
{ {
...@@ -179,25 +191,23 @@ export default function AccountManage() { ...@@ -179,25 +191,23 @@ export default function AccountManage() {
}, },
]; ];
return ( return (
<div style={{ padding: 10, display: 'flex', flexDirection: 'column', gap: 16 }}> <PageShell
<div style={{ display: 'flex', justifyContent: 'space-between' }}> fill
<div> title="账号管理"
<UTitle level={3} style={{ margin: 0 }}> description="维护系统用户账号,分配角色与组织归属。"
账号管理 actions={
</UTitle>
<UText type="secondary">维护系统用户账号,分配角色与组织归属。</UText>
</div>
<PermButton <PermButton
permission={P.SYSTEM_USER_SAVE} permission={P.SYSTEM_USER_SAVE}
onClick={() => { onClick={() => {
setEditingAccount(undefined); setEditingAccount(undefined);
setAccountModalOpen(true); setAccountFormOpen(true);
}} }}
> >
新增账号 新增账号
</PermButton> </PermButton>
</div> }
<UCard size="small"> >
<UCard className="uj-filter-card" size="small">
<SearchForm <SearchForm
fields={fields} fields={fields}
initialValues={{ orgId: [''], roleId: '', status: '' }} initialValues={{ orgId: [''], roleId: '', status: '' }}
...@@ -211,9 +221,10 @@ export default function AccountManage() { ...@@ -211,9 +221,10 @@ export default function AccountManage() {
}} }}
/> />
</UCard> </UCard>
<UCard size="small" styles={{ body: { padding: 0 } }}> <UCard size="small" fill>
<DataTable<AccountRow> <DataTable<AccountRow>
rowKey="id" rowKey="id"
fillHeight
columns={columns} columns={columns}
rowActions={rowActions} rowActions={rowActions}
actionColumnWidth={220} actionColumnWidth={220}
...@@ -230,14 +241,14 @@ export default function AccountManage() { ...@@ -230,14 +241,14 @@ export default function AccountManage() {
}} }}
/> />
</UCard> </UCard>
<AccountModal <AccountFormDrawer
open={accountModalOpen} open={accountFormOpen}
account={editingAccount} account={editingAccount}
orgTree={orgTree} orgTree={orgTree}
roleOptions={roleOptions} roleOptions={roleOptions}
onCancel={() => setAccountModalOpen(false)} onClose={() => setAccountFormOpen(false)}
onSuccess={() => { onSuccess={() => {
setAccountModalOpen(false); setAccountFormOpen(false);
setQueryVersion((version) => version + 1); setQueryVersion((version) => version + 1);
}} }}
/> />
...@@ -261,6 +272,6 @@ export default function AccountManage() { ...@@ -261,6 +272,6 @@ export default function AccountManage() {
if (changingStatusAccount) statusMutation.mutate(changingStatusAccount); if (changingStatusAccount) statusMutation.mutate(changingStatusAccount);
}} }}
/> />
</div> </PageShell>
); );
} }
...@@ -277,7 +277,7 @@ function descendantsOf(node: MenuNode): MenuNode[] { ...@@ -277,7 +277,7 @@ function descendantsOf(node: MenuNode): MenuNode[] {
} }
const summaryStyle = { const summaryStyle = {
color: '#64748b', color: 'var(--uj-text-3)',
display: 'flex', display: 'flex',
flexWrap: 'wrap' as const, flexWrap: 'wrap' as const,
fontSize: 13, fontSize: 13,
...@@ -286,7 +286,7 @@ const summaryStyle = { ...@@ -286,7 +286,7 @@ const summaryStyle = {
}; };
const sectionTitleStyle = { const sectionTitleStyle = {
alignItems: 'center', alignItems: 'center',
borderBottom: '1px solid #eef0f4', borderBottom: '1px solid var(--uj-divider)',
display: 'flex', display: 'flex',
fontSize: 14, fontSize: 14,
gap: 6, gap: 6,
...@@ -294,19 +294,29 @@ const sectionTitleStyle = { ...@@ -294,19 +294,29 @@ const sectionTitleStyle = {
margin: '20px 0 12px', margin: '20px 0 12px',
padding: '0 0 8px', padding: '0 0 8px',
}; };
const sectionMarkerStyle = { backgroundColor: '#315ce8', borderRadius: 2, height: 10, width: 3 }; const sectionMarkerStyle = {
const matrixStyle = { border: '1px solid #dfe6f2', borderRadius: 10, minHeight: 80, padding: 12 }; backgroundColor: 'var(--uj-primary)',
borderRadius: 2,
height: 10,
width: 3,
};
const matrixStyle = {
border: '1px solid var(--uj-border)',
borderRadius: 10,
minHeight: 80,
padding: 12,
};
const treeStyle = { display: 'flex', flexDirection: 'column' as const, gap: 8 }; const treeStyle = { display: 'flex', flexDirection: 'column' as const, gap: 8 };
const treeNodeStyle = { display: 'flex', flexDirection: 'column' as const, gap: 8 }; const treeNodeStyle = { display: 'flex', flexDirection: 'column' as const, gap: 8 };
const treeLabelStyle = { alignItems: 'center', display: 'flex', gap: 8, minHeight: 24 }; const treeLabelStyle = { alignItems: 'center', display: 'flex', gap: 8, minHeight: 24 };
const treeBranchStyle = { const treeBranchStyle = {
color: '#94a3b8', color: 'var(--uj-text-3)',
display: 'inline-block', display: 'inline-block',
textAlign: 'center' as const, textAlign: 'center' as const,
width: 12, width: 12,
}; };
const treeToggleStyle = { const treeToggleStyle = {
color: '#94a3b8', color: 'var(--uj-text-3)',
height: 20, height: 20,
margin: 0, margin: 0,
minWidth: 20, minWidth: 20,
...@@ -316,7 +326,7 @@ const treeToggleStyle = { ...@@ -316,7 +326,7 @@ const treeToggleStyle = {
const buttonListStyle = { display: 'flex', flexDirection: 'column' as const, gap: 4 }; const buttonListStyle = { display: 'flex', flexDirection: 'column' as const, gap: 4 };
const permissionButtonStyle = { const permissionButtonStyle = {
alignItems: 'center', alignItems: 'center',
color: '#334155', color: 'var(--uj-text-2)',
display: 'flex', display: 'flex',
fontSize: 12, fontSize: 12,
gap: 6, gap: 6,
...@@ -325,10 +335,10 @@ const permissionButtonStyle = { ...@@ -325,10 +335,10 @@ const permissionButtonStyle = {
}; };
const permissionMarkStyle = { const permissionMarkStyle = {
alignItems: 'center', alignItems: 'center',
border: '1px solid #d8e0ec', border: '1px solid var(--uj-border)',
borderRadius: 3, borderRadius: 3,
boxSizing: 'border-box' as const, boxSizing: 'border-box' as const,
color: '#fff', color: 'var(--uj-on-primary)',
display: 'inline-flex', display: 'inline-flex',
fontSize: 10, fontSize: 10,
height: 15, height: 15,
...@@ -338,13 +348,13 @@ const permissionMarkStyle = { ...@@ -338,13 +348,13 @@ const permissionMarkStyle = {
width: 15, width: 15,
}; };
const permissionStateStyle = { const permissionStateStyle = {
checked: { backgroundColor: '#315ce8', borderColor: '#315ce8' }, checked: { backgroundColor: 'var(--uj-primary)', borderColor: 'var(--uj-primary)' },
partial: { backgroundColor: '#315ce8', borderColor: '#315ce8' }, partial: { backgroundColor: 'var(--uj-primary)', borderColor: 'var(--uj-primary)' },
empty: { backgroundColor: '#fff' }, empty: { backgroundColor: 'var(--uj-surface)' },
na: { backgroundColor: '#f4f7fb', color: '#a8b5c5' }, na: { backgroundColor: 'var(--uj-surface-2)', color: 'var(--uj-text-3)' },
}; };
const legendStyle = { const legendStyle = {
color: '#64748b', color: 'var(--uj-text-3)',
display: 'flex', display: 'flex',
flexWrap: 'wrap' as const, flexWrap: 'wrap' as const,
fontSize: 12, fontSize: 12,
......
import { useEffect } from 'react'; import { useEffect } from 'react';
import { message } from 'antd';
import { useMutation } from '@tanstack/react-query'; import { useMutation } from '@tanstack/react-query';
import { UForm, UModal } from '@uj/ui'; import { UButton, UDrawer, UForm, useUMessage } from '@uj/ui';
import { role, type RolePageItem } from '@/api'; import { role, type RolePageItem } from '@/api';
import { CombiForm, type FieldSchema } from '@/components'; import { CombiForm, type FieldSchema } from '@/components';
import { dataScopeOptions } from '@/constants/dataScope'; import { dataScopeOptions } from '@/constants/dataScope';
...@@ -15,10 +14,10 @@ interface RoleFormValues extends Record<string, unknown> { ...@@ -15,10 +14,10 @@ interface RoleFormValues extends Record<string, unknown> {
defaultDataScope: number; defaultDataScope: number;
} }
export interface RoleModalProps { export interface RoleFormDrawerProps {
open: boolean; open: boolean;
roleItem?: RolePageItem; roleItem?: RolePageItem;
onCancel: () => void; onClose: () => void;
onSuccess: () => void; onSuccess: () => void;
} }
...@@ -27,7 +26,8 @@ const statusOptions = [ ...@@ -27,7 +26,8 @@ const statusOptions = [
{ label: '停用', value: 0 }, { label: '停用', value: 0 },
]; ];
export function RoleModal({ open, roleItem, onCancel, onSuccess }: RoleModalProps) { export function RoleFormDrawer({ open, roleItem, onClose, onSuccess }: RoleFormDrawerProps) {
const message = useUMessage();
const [form] = UForm.useForm<RoleFormValues>(); const [form] = UForm.useForm<RoleFormValues>();
const isEdit = Boolean(roleItem); const isEdit = Boolean(roleItem);
const saveMutation = useMutation({ const saveMutation = useMutation({
...@@ -125,16 +125,19 @@ export function RoleModal({ open, roleItem, onCancel, onSuccess }: RoleModalProp ...@@ -125,16 +125,19 @@ export function RoleModal({ open, roleItem, onCancel, onSuccess }: RoleModalProp
]; ];
return ( return (
<UModal <UDrawer
open={open} open={open}
title={isEdit ? '编辑角色' : '新增角色'} title={isEdit ? '编辑角色' : '新增角色'}
width={520} size={560}
okText="保存" onClose={onClose}
cancelText="取消" footer={
confirmLoading={saveMutation.isPending} <div style={footerStyle}>
onCancel={onCancel} <UButton onClick={onClose}>取消</UButton>
onOk={() => form.submit()} <UButton type="primary" loading={saveMutation.isPending} onClick={() => form.submit()}>
styles={{ body: { maxHeight: '65vh', overflowY: 'auto', paddingTop: 8 } }} 保存
</UButton>
</div>
}
> >
<CombiForm<RoleFormValues> <CombiForm<RoleFormValues>
mode="form" mode="form"
...@@ -146,10 +149,11 @@ export function RoleModal({ open, roleItem, onCancel, onSuccess }: RoleModalProp ...@@ -146,10 +149,11 @@ export function RoleModal({ open, roleItem, onCancel, onSuccess }: RoleModalProp
sectionContentStyle={twoColumnStyle} sectionContentStyle={twoColumnStyle}
renderSectionTitle={(title) => <SectionTitle>{title}</SectionTitle>} renderSectionTitle={(title) => <SectionTitle>{title}</SectionTitle>}
/> />
</UModal> </UDrawer>
); );
} }
const footerStyle = { display: 'flex', justifyContent: 'flex-end', gap: 8 };
const twoColumnStyle = { display: 'grid', gridTemplateColumns: '1fr 1fr', columnGap: 12 }; const twoColumnStyle = { display: 'grid', gridTemplateColumns: '1fr 1fr', columnGap: 12 };
function SectionTitle({ children }: { children: string }) { function SectionTitle({ children }: { children: string }) {
return ( return (
...@@ -161,7 +165,7 @@ function SectionTitle({ children }: { children: string }) { ...@@ -161,7 +165,7 @@ function SectionTitle({ children }: { children: string }) {
} }
const sectionTitleStyle = { const sectionTitleStyle = {
alignItems: 'center', alignItems: 'center',
borderBottom: '1px solid #eef0f4', borderBottom: '1px solid var(--uj-divider)',
display: 'flex', display: 'flex',
fontSize: 14, fontSize: 14,
gap: 6, gap: 6,
...@@ -169,4 +173,9 @@ const sectionTitleStyle = { ...@@ -169,4 +173,9 @@ const sectionTitleStyle = {
margin: '0 0 12px', margin: '0 0 12px',
padding: '0 0 8px', padding: '0 0 8px',
}; };
const sectionMarkerStyle = { backgroundColor: '#315ce8', borderRadius: 2, height: 10, width: 3 }; const sectionMarkerStyle = {
backgroundColor: 'var(--uj-primary)',
borderRadius: 2,
height: 10,
width: 3,
};
import { useMemo, useState } from 'react'; import { useMemo, useState } from 'react';
import { message } from 'antd';
import { useMutation, useQuery } from '@tanstack/react-query'; import { useMutation, useQuery } from '@tanstack/react-query';
import { UCard, UTag, UText, UTitle } from '@uj/ui'; import { UCard, UTag, UText, useUMessage } from '@uj/ui';
import { import {
DataTable, DataTable,
DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE,
ConfirmModal, ConfirmModal,
PageShell,
SearchForm, SearchForm,
type FieldSchema, type FieldSchema,
type DataTableColumnsType, type DataTableColumnsType,
...@@ -14,7 +14,7 @@ import { ...@@ -14,7 +14,7 @@ import {
} from '@/components'; } from '@/components';
import { P, PermButton } from '@/access'; import { P, PermButton } from '@/access';
import { role, type RolePageItem, type RolePageParams } from '@/api'; import { role, type RolePageItem, type RolePageParams } from '@/api';
import { RoleModal } from './components/RoleModal'; import { RoleFormDrawer } from './components/RoleFormDrawer';
import { RoleDetailDrawer } from './components/RoleDetailDrawer'; import { RoleDetailDrawer } from './components/RoleDetailDrawer';
import { getBaseList } from './tools/constants'; import { getBaseList } from './tools/constants';
...@@ -43,6 +43,7 @@ function createRolePageParams( ...@@ -43,6 +43,7 @@ function createRolePageParams(
} }
export default function RoleManage() { export default function RoleManage() {
const message = useUMessage();
const [params, setParams] = useState<RolePageParams>({ const [params, setParams] = useState<RolePageParams>({
current: 1, current: 1,
size: DEFAULT_PAGE_SIZE, size: DEFAULT_PAGE_SIZE,
...@@ -50,7 +51,7 @@ export default function RoleManage() { ...@@ -50,7 +51,7 @@ export default function RoleManage() {
status: undefined, status: undefined,
}); });
const [queryVersion, setQueryVersion] = useState(0); const [queryVersion, setQueryVersion] = useState(0);
const [roleModalOpen, setRoleModalOpen] = useState(false); const [roleFormOpen, setRoleFormOpen] = useState(false);
const [editingRole, setEditingRole] = useState<RolePageItem>(); const [editingRole, setEditingRole] = useState<RolePageItem>();
const [detailRole, setDetailRole] = useState<RolePageItem>(); const [detailRole, setDetailRole] = useState<RolePageItem>();
const [deletingRole, setDeletingRole] = useState<RolePageItem>(); const [deletingRole, setDeletingRole] = useState<RolePageItem>();
...@@ -83,7 +84,12 @@ export default function RoleManage() { ...@@ -83,7 +84,12 @@ export default function RoleManage() {
[result], [result],
); );
const fields: FieldSchema<Record<string, unknown>>[] = [ const fields: FieldSchema<Record<string, unknown>>[] = [
{ name: 'keyword', label: '角色名称 / 编码', type: 'input', placeholder: '模糊搜索' }, {
name: 'keyword',
label: '角色名称 / 编码',
type: 'input',
placeholder: '模糊搜索',
},
{ {
name: 'type', name: 'type',
label: '类型', label: '类型',
...@@ -104,7 +110,11 @@ export default function RoleManage() { ...@@ -104,7 +110,11 @@ export default function RoleManage() {
dataIndex: 'code', dataIndex: 'code',
width: 220, width: 220,
line: 1, line: 1,
render: (v) => <UText style={{ color: '#315ce8', fontFamily: 'monospace' }}>{v}</UText>, render: (v) => (
<UText>
<code className="uj-code">{v}</code>
</UText>
),
}, },
{ title: '账号数', dataIndex: 'userCount' }, { title: '账号数', dataIndex: 'userCount' },
{ title: '角色描述', dataIndex: 'description', width: 450, line: 1 }, { title: '角色描述', dataIndex: 'description', width: 450, line: 1 },
...@@ -133,7 +143,7 @@ export default function RoleManage() { ...@@ -133,7 +143,7 @@ export default function RoleManage() {
permission: P.SYSTEM_ROLE_UPDATE, permission: P.SYSTEM_ROLE_UPDATE,
onClick: (row) => { onClick: (row) => {
setEditingRole(row.source); setEditingRole(row.source);
setRoleModalOpen(true); setRoleFormOpen(true);
}, },
}, },
{ {
...@@ -144,27 +154,23 @@ export default function RoleManage() { ...@@ -144,27 +154,23 @@ export default function RoleManage() {
}, },
]; ];
return ( return (
<div style={{ padding: 10, display: 'flex', flexDirection: 'column', gap: 16 }}> <PageShell
<div style={{ display: 'flex', justifyContent: 'space-between' }}> fill
<div> title="角色管理"
<UTitle level={3} style={{ margin: 0 }}> description="维护角色清单与基本信息,支持按关键字筛选;角色的菜单可见范围在「查看详情」中配置。"
角色管理 actions={
</UTitle>
<UText type="secondary">
维护角色清单与基本信息,支持按关键字筛选;角色的菜单可见范围在「查看详情」中配置。
</UText>
</div>
<PermButton <PermButton
permission={P.SYSTEM_ROLE_SAVE} permission={P.SYSTEM_ROLE_SAVE}
onClick={() => { onClick={() => {
setEditingRole(undefined); setEditingRole(undefined);
setRoleModalOpen(true); setRoleFormOpen(true);
}} }}
> >
新增角色 新增角色
</PermButton> </PermButton>
</div> }
<UCard size="small"> >
<UCard className="uj-filter-card" size="small">
<SearchForm <SearchForm
fields={fields} fields={fields}
initialValues={{ type: '', status: '' }} initialValues={{ type: '', status: '' }}
...@@ -178,9 +184,10 @@ export default function RoleManage() { ...@@ -178,9 +184,10 @@ export default function RoleManage() {
}} }}
/> />
</UCard> </UCard>
<UCard size="small" styles={{ body: { padding: 0 } }}> <UCard size="small" fill>
<DataTable<Row> <DataTable<Row>
rowKey="id" rowKey="id"
fillHeight
columns={columns} columns={columns}
rowActions={rowActions} rowActions={rowActions}
actionColumnWidth={280} actionColumnWidth={280}
...@@ -198,12 +205,12 @@ export default function RoleManage() { ...@@ -198,12 +205,12 @@ export default function RoleManage() {
}} }}
/> />
</UCard> </UCard>
<RoleModal <RoleFormDrawer
open={roleModalOpen} open={roleFormOpen}
roleItem={editingRole} roleItem={editingRole}
onCancel={() => setRoleModalOpen(false)} onClose={() => setRoleFormOpen(false)}
onSuccess={() => { onSuccess={() => {
setRoleModalOpen(false); setRoleFormOpen(false);
setQueryVersion((version) => version + 1); setQueryVersion((version) => version + 1);
}} }}
/> />
...@@ -221,6 +228,6 @@ export default function RoleManage() { ...@@ -221,6 +228,6 @@ export default function RoleManage() {
if (deletingRole) deleteMutation.mutate(deletingRole); if (deletingRole) deleteMutation.mutate(deletingRole);
}} }}
/> />
</div> </PageShell>
); );
} }
...@@ -134,6 +134,9 @@ export function DataTable<T extends object>({ ...@@ -134,6 +134,9 @@ export function DataTable<T extends object>({
disabled: action.disabled, disabled: action.disabled,
onClick, onClick,
type, type,
// 行内操作按 small 出:默认高度会把每一行撑到 60px 以上,
// 两个四字操作并排就会换行,整行再翻一倍(见 .uj-row-actions 的 nowrap 说明)。
size: isRowAction ? ('small' as const) : undefined,
style: style:
isRowAction && type === 'text' isRowAction && type === 'text'
? { ? {
...@@ -161,24 +164,24 @@ export function DataTable<T extends object>({ ...@@ -161,24 +164,24 @@ export function DataTable<T extends object>({
fixed: actionColumnFixed, fixed: actionColumnFixed,
render: (_: unknown, record: T) => { render: (_: unknown, record: T) => {
const visibleActions = rowActions.filter((action) => action.visible?.(record) ?? true); const visibleActions = rowActions.filter((action) => action.visible?.(record) ?? true);
const lastPermissionActionIndex = visibleActions.reduce( // 操作间距由 .uj-row-actions 的 gap 统一给:原来按「后面还有没有权限按钮」
(lastIndex, action, index) => (action.permission ? index : lastIndex), // 手算 marginRight,多一个无权限的动作就会漏出半格间距。
-1, return (
<div className="uj-row-actions">
{visibleActions.map((action, index) => {
const label =
typeof action.label === 'function' ? action.label(record) : action.label;
const danger =
typeof action.danger === 'function' ? action.danger(record) : action.danger;
return renderActionButton(
{ ...action, danger, label },
() => action.onClick(record),
`row-action-${index}`,
true,
);
})}
</div>
); );
return visibleActions.map((action, index) => {
const label = typeof action.label === 'function' ? action.label(record) : action.label;
const danger =
typeof action.danger === 'function' ? action.danger(record) : action.danger;
return renderActionButton(
{ ...action, danger, label },
() => action.onClick(record),
`row-action-${index}`,
true,
action.permission && index < lastPermissionActionIndex
? { marginRight: 8 }
: undefined,
);
});
}, },
} }
: undefined; : undefined;
...@@ -202,36 +205,27 @@ export function DataTable<T extends object>({ ...@@ -202,36 +205,27 @@ export function DataTable<T extends object>({
return ( return (
<> <>
{toolbarTitle || actions?.length ? ( {toolbarTitle || actions?.length ? (
<div <div className={['uj-table-toolbar', toolbarClassName].filter(Boolean).join(' ')}>
className={toolbarClassName} <div className="uj-table-toolbar__title">{toolbarTitle}</div>
style={{ {actions?.length ? (
display: 'flex', <div className="uj-table-toolbar__actions">
alignItems: 'center', {actions.map((action, index) =>
justifyContent: 'space-between', renderActionButton(action, action.onClick, `toolbar-action-${index}`),
flexWrap: 'wrap', )}
gap: 12, </div>
padding: 16, ) : null}
}}
>
<div>{toolbarTitle}</div>
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
{actions?.map((action, index) =>
renderActionButton(action, action.onClick, `toolbar-action-${index}`),
)}
</div>
</div> </div>
) : null} ) : null}
<TableComponent <TableComponent
{...props} {...props}
// 默认 medium:antd 的默认档是 large(上下各 16px padding),
// 列表页因此比设计令牌(Table.cellPaddingBlockMD 11)整整高出一档。
size={props.size ?? 'middle'}
dataSource={dataSource} dataSource={dataSource}
columns={tableColumns} columns={tableColumns}
tableLayout={hasLineLimit ? 'fixed' : undefined} tableLayout={hasLineLimit ? 'fixed' : undefined}
rowSelection={resolvedSelection} rowSelection={resolvedSelection}
scroll={{ ...props.scroll, x: props.scroll?.x ?? minTableWidth }} scroll={{ ...props.scroll, x: props.scroll?.x ?? minTableWidth }}
styles={{
header: { cell: { paddingLeft: 20 } },
body: { cell: { paddingLeft: 20 } },
}}
pagination={ pagination={
resolvedPagination === false resolvedPagination === false
? false ? false
......
import type { ReactNode } from 'react';
import { UButton } from '@uj/ui';
export interface PageShellProps {
title: ReactNode;
/** 一句说明这个页面能做什么;写业务动作,不写字段名。 */
description?: ReactNode;
/** 子页面用:返回上一级。路由跳转方式由调用方提供,共享层不认识具体子应用的路由表。 */
onBack?: () => void;
/** 返回按钮文案,默认「返回」。 */
backLabel?: string;
/** 右上角动作区。 */
actions?: ReactNode;
/**
* 列表页:整屏定高,内容区(表格卡片)自己撑满剩余高度、表体内滚、分页贴底。
* 长表单页不要开,否则内容会被裁掉。
*/
fill?: boolean;
children: ReactNode;
}
/**
* 三个子应用共用的页面外壳:标题 + 说明 + 返回 + 右上角动作 + 内容。
*
* 统一这一层的原因:system 用内联 `padding: 10` 自己拼一遍、points 有 PageShell、
* store 又是第三套 .store-page/.store-page-header —— 同一件事三个写法,
* 标题字号、说明行高、动作间距全靠各自记,页面一多就参差。
*
* 只到页面骨架为止:控件、筛选、表格仍然是各页自己配(见「页面抽象阶梯」)。
*/
export function PageShell({
title,
description,
onBack,
backLabel = '返回',
actions,
fill = false,
children,
}: PageShellProps) {
return (
<div className={fill ? 'uj-page uj-page--fill' : 'uj-page'}>
<div className="uj-page__header">
<div>
<h2 className="uj-page__title">{title}</h2>
{description ? <p className="uj-page__desc">{description}</p> : null}
</div>
{onBack || actions ? (
<div className="uj-page__tools">
{onBack ? <UButton onClick={onBack}>{backLabel}</UButton> : null}
{actions}
</div>
) : null}
</div>
{fill ? <div className="uj-page__body">{children}</div> : children}
</div>
);
}
import { useState } from 'react';
import { UCascader, UButton, UDatePicker, UForm, UFormItem, UInput, URadio, USelect } from '@uj/ui'; import { UCascader, UButton, UDatePicker, UForm, UFormItem, UInput, URadio, USelect } from '@uj/ui';
import type { FieldSchema } from '../formSchema'; import type { FieldSchema } from '../formSchema';
import { DEFAULT_PAGE_SIZE } from '../DataTable'; import { DEFAULT_PAGE_SIZE } from '../DataTable';
...@@ -7,15 +8,26 @@ export interface SearchPagination { ...@@ -7,15 +8,26 @@ export interface SearchPagination {
size: number; size: number;
} }
/** 标签列:文字区 96px + 与控件之间 8px,控件因此收窄约 1/3 且左缘对齐。 */
const LABEL_COL = { style: { width: 104, paddingInlineEnd: 8 } };
export interface SearchFormProps<T extends Record<string, unknown>> { export interface SearchFormProps<T extends Record<string, unknown>> {
/**
* 字段表。`essential: true` 的字段常显,其余收进「更多筛选」。
*
* 真源就在字段定义那一行 —— 哪个条件重要是一个业务判断,只有写它的人知道;
* 不在 SearchForm 上传 visibleCount,也不在别处维护第二份「常显字段」清单,
* 那样改一次要改两处、还容易漏。
*/
fields: FieldSchema<T>[]; fields: FieldSchema<T>[];
initialValues?: Partial<T>; initialValues?: Partial<T>;
/** 查询或重置时传出的分页参数,默认第 1 页、每页 10 条。 */ /** 查询或重置时传出的分页参数,默认第 1 页、每页 10 条。 */
pagination?: Partial<SearchPagination>; pagination?: Partial<SearchPagination>;
onSearch: (values: T, pagination: SearchPagination) => void; onSearch: (values: T, pagination: SearchPagination) => void;
onReset?: (values: Partial<T>, pagination: SearchPagination) => void; onReset?: (values: Partial<T>, pagination: SearchPagination) => void;
layout?: 'inline' | 'vertical';
className?: string; className?: string;
/** 默认是否展开「更多筛选」,默认收起。 */
defaultExpanded?: boolean;
} }
export function SearchForm<T extends Record<string, unknown>>({ export function SearchForm<T extends Record<string, unknown>>({
fields, fields,
...@@ -23,14 +35,27 @@ export function SearchForm<T extends Record<string, unknown>>({ ...@@ -23,14 +35,27 @@ export function SearchForm<T extends Record<string, unknown>>({
pagination, pagination,
onSearch, onSearch,
onReset, onReset,
layout = 'vertical',
className, className,
defaultExpanded = false,
}: SearchFormProps<T>) { }: SearchFormProps<T>) {
const [form] = UForm.useForm(); const [form] = UForm.useForm();
// 空数组 = 监听整张表单。用于「收起状态下已设条件」的角标计数:
// 收起了不等于没生效,用户必须看得见自己身上还挂着几个条件。
const values = UForm.useWatch([], form) as Partial<T> | undefined;
const [expanded, setExpanded] = useState(defaultExpanded);
const searchPagination: SearchPagination = { const searchPagination: SearchPagination = {
current: pagination?.current ?? 1, current: pagination?.current ?? 1,
size: pagination?.size ?? DEFAULT_PAGE_SIZE, size: pagination?.size ?? DEFAULT_PAGE_SIZE,
}; };
// 一条 essential 都没有时保持原行为:全部常显、不出现「更多筛选」。
// 让页面可以逐批迁移,不会因为共享层升级就突然把条件藏起来。
const hasSplit = fields.some((field) => field.essential);
const primaryFields = hasSplit ? fields.filter((field) => field.essential) : fields;
const extraFields = hasSplit ? fields.filter((field) => !field.essential) : [];
const activeExtraCount = extraFields.filter((field) => isSet(values?.[field.name])).length;
const control = (field: FieldSchema<T>) => { const control = (field: FieldSchema<T>) => {
const common = { const common = {
disabled: typeof field.disabled === 'boolean' ? field.disabled : false, disabled: typeof field.disabled === 'boolean' ? field.disabled : false,
...@@ -60,59 +85,89 @@ export function SearchForm<T extends Record<string, unknown>>({ ...@@ -60,59 +85,89 @@ export function SearchForm<T extends Record<string, unknown>>({
<UInput {...common} style={{ width }} /> <UInput {...common} style={{ width }} />
); );
}; };
const renderField = (field: FieldSchema<T>) => (
<UFormItem
key={field.name}
name={field.name as string}
label={field.label}
style={{ marginBottom: 0, minWidth: 0 }}
>
{control(field)}
</UFormItem>
);
return ( return (
<UForm <UForm
form={form} form={form}
initialValues={initialValues} initialValues={initialValues}
layout={layout === 'inline' ? 'vertical' : layout} // 标签在左、控件在右:标签列宽固定,四组控件的左缘落在同一条竖线上。
// 竖排标签会把筛选区抬高一整行,横向排列后整条筛选带只占控件本身的高度。
layout="horizontal"
labelCol={LABEL_COL}
colon={false}
className={className} className={className}
style={searchFormStyle} size="small"
onFinish={(values) => onSearch(values as T, searchPagination)} onFinish={(submitValues) => onSearch(submitValues as T, searchPagination)}
> >
{fields.map((field) => ( {/* 字段与动作同处一行:动作贴最后一列底部,筛选区整体只占一条 72px 左右的横带,
<UFormItem 而不是「一排字段 + 单独一排按钮」。窄屏由 ui.css 的媒体查询退回整行。 */}
key={field.name} <div className="uj-filter-grid">
name={field.name as string} {primaryFields.map(renderField)}
label={field.label}
style={{ marginBottom: 0, minWidth: 0 }} <div className="uj-filter-actions">
> {extraFields.length ? (
{control(field)} <UButton
</UFormItem> type="text"
))} size="small"
<UFormItem style={searchActionsStyle}> className="uj-filter-more-btn"
<UButton onClick={() => setExpanded((open) => !open)}
type="default" aria-expanded={expanded}
onClick={() => { >
const resetValues = fields.reduce<Record<string, unknown>>((values, field) => { {expanded ? '收起' : '更多筛选'}
const initialValue = initialValues?.[field.name]; {!expanded && activeExtraCount > 0 ? (
values[field.name] = <span className="uj-filter-more-count">{activeExtraCount}</span>
initialValue ?? ) : null}
(field.type === 'input' || field.type === 'textarea' ? '' : undefined); <span className={`uj-filter-toggle-icon${expanded ? ' is-open' : ''}`} aria-hidden>
return values; ▾
}, {}); </span>
form.setFieldsValue(resetValues); </UButton>
onReset?.(initialValues ?? {}, searchPagination); ) : null}
}} <UButton
> type="default"
重置 size="small"
</UButton> onClick={() => {
<UButton htmlType="submit" style={{ marginLeft: 8 }}> const resetValues = fields.reduce<Record<string, unknown>>((acc, field) => {
查询 const initialValue = initialValues?.[field.name];
</UButton> acc[field.name] =
</UFormItem> initialValue ??
(field.type === 'input' || field.type === 'textarea' ? '' : undefined);
return acc;
}, {});
form.setFieldsValue(resetValues);
onReset?.(initialValues ?? {}, searchPagination);
}}
>
重置
</UButton>
<UButton size="small" htmlType="submit">查询</UButton>
</div>
</div>
{/* 收起用 CSS 隐藏而不是卸载:antd 的 Form.Item 一旦卸载就把值从 store 里丢掉,
于是「设了条件 → 收起 → 查询」会静默变成不带该条件,属于最难排查的一类 bug。 */}
{extraFields.length ? (
<div className="uj-filter-more" style={expanded ? undefined : { display: 'none' }}>
{extraFields.map(renderField)}
</div>
) : null}
</UForm> </UForm>
); );
} }
const searchFormStyle = { /** 一个条件算「已设」:非空、非 undefined,且不是只含空值的数组(级联的 [''] 属于没选)。 */
columnGap: 16, function isSet(value: unknown): boolean {
display: 'grid', if (value === undefined || value === null || value === '') return false;
gridTemplateColumns: 'repeat(4, minmax(0, 1fr))', if (Array.isArray(value)) return value.some((item) => isSet(item));
rowGap: 12, return true;
}; }
const searchActionsStyle = {
display: 'flex',
gridColumn: '1 / -1',
justifyContent: 'flex-end',
marginBottom: 0,
};
...@@ -27,6 +27,13 @@ export interface FieldSchema<T extends Record<string, unknown> = Record<string, ...@@ -27,6 +27,13 @@ export interface FieldSchema<T extends Record<string, unknown> = Record<string,
options?: FieldOption[]; options?: FieldOption[];
rules?: Rule[]; rules?: Rule[];
section?: string; section?: string;
/**
* 常显字段标记(仅筛选表单使用)。
*
* 标 true 的字段始终显示,未标的收进「更多筛选」—— 字段表里至少有一条 true 时才启用收起,
* 否则全部常显(保持旧行为)。这就是「哪些条件重要」的唯一真源,不要另建配置。
*/
essential?: boolean;
itemStyle?: CSSProperties; itemStyle?: CSSProperties;
/** input 类型的扩展属性,如最大长度、数字键盘等。 */ /** input 类型的扩展属性,如最大长度、数字键盘等。 */
inputProps?: InputProps; inputProps?: InputProps;
......
export { Logo } from './Logo'; export { Logo } from './Logo';
export { StatusTag } from './StatusTag'; export { StatusTag } from './StatusTag';
export { default as PagePlaceholder } from './PagePlaceholder'; export { default as PagePlaceholder } from './PagePlaceholder';
export { PageShell } from './PageShell';
export type { PageShellProps } from './PageShell';
export { SearchForm } from './SearchForm'; export { SearchForm } from './SearchForm';
export type { SearchFormProps, SearchPagination } from './SearchForm'; export type { SearchFormProps, SearchPagination } from './SearchForm';
export type { ActionSchema, FieldOption, FieldSchema, FieldType } from './formSchema'; export type { ActionSchema, FieldOption, FieldSchema, FieldType } from './formSchema';
......
...@@ -4,6 +4,13 @@ ...@@ -4,6 +4,13 @@
* 但只要它们读的是同一份 themeConfig 对象,视觉就一致 —— 这是「跨应用共享」 * 但只要它们读的是同一份 themeConfig 对象,视觉就一致 —— 这是「跨应用共享」
* 里唯一不需要 singleton 的一层。 * 里唯一不需要 singleton 的一层。
* *
* themeConfig.ts 由 scripts/sync-from-uj-store.mjs 从旧仓原样搬入,零改动。 * 两份真源的分工(务必别合并成一份):
* - themeConfig.ts + palette.ts 交给 antd(JS 侧);
* - tokens.css 交给自定义 CSS(CSS 侧)。
* 同值只允许写在 palette.ts 一处,tokens.css 里的字面量由 scripts/check-tokens.mjs 对账。
*
* themeConfig.ts 最初由 scripts/sync-from-uj-store.mjs 从旧仓搬入,但迁移已冻结
* (MIGRATION_FROZEN 且不覆盖已存在文件),本仓源码独立演进,改动不会被同步冲掉。
*/ */
export * from './themeConfig'; export * from './themeConfig';
export * from './palette';
/**
* 色板与尺度的 JS 侧真源。
*
* 为什么需要这份文件:themeConfig.ts 交给 antd,tokens.css 交给自定义 CSS,
* 两边各写一遍字面量必然漂移 —— 仓里已经有实例:账号列的 #315ce8 与主色 #2b5ce6
* 是两个蓝,肉眼能看出那条线不干净。JS 侧一律从这里取值,CSS 侧由
* scripts/check-tokens.mjs 对账,漂了跑不过 verify。
*
* 只有「antd 组件 token 与自定义 CSS 都会用到」的量才进这里;
* 纯 CSS 布局量(间距刻度、阴影)留在 tokens.css,不必让 JS 知道。
*/
export const palette = {
brand: {
primary: '#2B5CE6',
primaryHover: '#4B75EA',
primaryActive: '#1F49C4',
primarySoft: '#EEF3FF',
deep1: '#0B1437',
deep2: '#16245A',
},
/** 表面四层:页面底 / 卡片 / 表头 / hover。卡片之间的层级差主要来自这里,不靠加边框。 */
surface: {
page: '#F4F6FA',
base: '#FFFFFF',
raised: '#F8FAFC',
hover: '#F2F5FA',
/** 品牌底上的文字/图标。单列一档:它跟随品牌色而不是跟随表面色。 */
onPrimary: '#FFFFFF',
},
line: {
border: '#E6EBF2',
borderStrong: '#D6DEE9',
divider: '#EEF1F6',
},
text: {
primary: '#1D2533',
secondary: '#4A5568',
tertiary: '#8A94A6',
quaternary: '#B3BAC7',
/** 表头文字:比 tertiary 实一点,保证 12px 下仍可读。 */
header: '#5A6779',
},
semantic: {
success: '#16A34A',
warning: '#D97706',
error: '#E5484D',
info: '#2B5CE6',
},
/** 语义色的淡底:标签与提示条成对取用,避免各处自己调 alpha 调出四种绿。 */
soft: {
success: '#E9F7EF',
warning: '#FDF3E5',
error: '#FDEDEE',
info: '#EEF3FF',
neutral: '#F2F4F8',
},
softBorder: {
success: '#C6EBD6',
warning: '#F6DFBA',
error: '#F8CFD1',
info: '#D6E2FB',
neutral: '#E4E8EF',
},
} as const;
export const radius = {
xs: 4,
sm: 6,
md: 8,
lg: 10,
card: 12,
pill: 999,
} as const;
export const control = {
/** 控件统一高度:36 是主壳已定的档位,改动会让按钮/输入/选择同时错位,不要单独调。 */
height: 36,
heightSm: 30,
/** 表格正文比页面正文小一号:后台密集信息下的常规做法,也让列能多放一列。 */
tableFont: 13,
} as const;
export const shadow = {
/** 与 tokens.css 的 --uj-shadow-* 同值,对账脚本会校验。 */
card: '0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px -10px rgba(16, 24, 40, 0.12)',
raise: '0 2px 4px rgba(16, 24, 40, 0.05), 0 16px 32px -14px rgba(16, 24, 40, 0.2)',
pop: '0 12px 40px -12px rgba(16, 24, 40, 0.2)',
} as const;
import type { ThemeConfig } from 'antd'; import type { ThemeConfig } from 'antd';
import { control, palette, radius, shadow } from './palette';
// 品牌色板(稳重内敛 · 企业级) // 品牌色板(稳重内敛 · 企业级)
// 说明:brandDeep / brandGradient 原用于 Sider 与工作台欢迎条底; // 说明:brandDeep / brandGradient 原用于 Sider 与工作台欢迎条底;
// 现将两处明度过低的深色底均已弃用(Sider 改由 design.css 的 .uj-sider 垂直 matte 深蓝承接, // 现将两处明度过低的深色底均已弃用(Sider 改由 design.css 的 .uj-sider 垂直 matte 深蓝承接,
// 工作台欢迎条改为浅色卡片 + 品牌色点睛)。这两个色值暂无代码引用,保留作品牌资产备查。 // 工作台欢迎条改为浅色卡片 + 品牌色点睛)。这两个色值暂无代码引用,保留作品牌资产备查。
export const brandDeep = '#0B1437'; // 墨蓝导航底(深色态,暂未引用) export const brandDeep = palette.brand.deep1; // 墨蓝导航底(深色态,暂未引用)
export const brandGradient = 'linear-gradient(160deg, #0B1437 0%, #16245A 100%)'; // 暂未引用 export const brandGradient = `linear-gradient(160deg, ${palette.brand.deep1} 0%, ${palette.brand.deep2} 100%)`; // 暂未引用
export const brandAccent = '#2B5CE6'; // 主操作蓝 export const brandAccent = palette.brand.primary; // 主操作蓝
/**
* 全站唯一的一份 antd 主题。
*
* 精致度主要在这一层做,而不是在 CSS 里覆盖 .ant-*:
* ConfigProvider 的 component token 是 antd 官方认可的定制入口,几何量(高度、内间距、
* 居中计算)会跟着 token 一起重算;用 CSS 覆盖组件内部盒模型,折叠态/滚动吸顶这类
* 有内部计算的部位一定算歪。design.css 里那段关于 Menu 的注释说的是同一条规矩。
*
* 少数 token 表达不了的(表格填充高度、筛选面板折叠、等宽数字)才落到
* packages/ui/src/styles/ui.css。
*/
export const themeConfig: ThemeConfig = { export const themeConfig: ThemeConfig = {
cssVar: {}, cssVar: {},
token: { token: {
colorPrimary: brandAccent, colorPrimary: palette.brand.primary,
colorLink: brandAccent, colorLink: palette.brand.primary,
colorLinkHover: '#4B75EA', colorLinkHover: palette.brand.primaryHover,
colorSuccess: '#16A34A', colorLinkActive: palette.brand.primaryActive,
colorWarning: '#D97706', colorSuccess: palette.semantic.success,
colorError: '#E5484D', colorWarning: palette.semantic.warning,
colorInfo: brandAccent, colorError: palette.semantic.error,
colorBgLayout: '#F4F6FA', colorInfo: palette.brand.primary,
colorBgContainer: '#FFFFFF',
colorBorderSecondary: '#E8ECF3', colorBgLayout: palette.surface.page,
colorBorder: '#E2E7EF', colorBgContainer: palette.surface.base,
colorText: '#1D2533', colorBgElevated: palette.surface.base,
colorTextHeading: '#1D2533', colorFillAlter: palette.surface.raised,
colorTextDescription: '#4A5568', controlItemBgHover: palette.surface.hover,
colorTextSecondary: '#4A5568',
borderRadius: 8, colorText: palette.text.primary,
borderRadiusLG: 12, colorTextHeading: palette.text.primary,
controlHeight: 36, colorTextSecondary: palette.text.secondary,
colorTextTertiary: palette.text.tertiary,
colorTextQuaternary: palette.text.quaternary,
colorTextDescription: palette.text.secondary,
colorTextDisabled: palette.text.quaternary,
colorBorder: palette.line.border,
colorBorderSecondary: palette.line.border,
colorSplit: palette.line.divider,
/**
* 语义色的淡底与淡描边:antd 的 Alert / Tag / Result 取的是这四个 *Bg / *Border 别名,
* 不在这里给,它们就会回退到 antd 自己算的 alpha 淡色 —— 和 CSS 侧 palette.soft 不同源,
* 表现就是「同一个成功态,提示条和标签是两种绿」。
*/
colorSuccessBg: palette.soft.success,
colorSuccessBorder: palette.softBorder.success,
colorWarningBg: palette.soft.warning,
colorWarningBorder: palette.softBorder.warning,
colorErrorBg: palette.soft.error,
colorErrorBorder: palette.softBorder.error,
colorInfoBg: palette.soft.info,
colorInfoBorder: palette.softBorder.info,
borderRadius: radius.md,
borderRadiusSM: radius.sm,
borderRadiusLG: radius.card,
controlHeight: control.height,
// size="small" 的控件(全站只有筛选区的 SearchForm 用):antd 由 controlHeight
// 派生成 27px,比默认高度矮一档后单行输入在密集筛选带里显得「点不中」。
// 这里定为 32px —— 比默认矮 4px、比派生值高 5px,标签左置后整条筛选带只有一行。
controlHeightSM: 32,
fontSize: 14, fontSize: 14,
fontSizeSM: 12,
fontFamily: fontFamily:
"'PingFang', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif", "'PingFang', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif",
boxShadowSecondary: '0 6px 20px -8px rgba(16,24,40,.12)',
// 阴影分三档:卡片静置、hover 抬起、浮层。原来只有一档,卡片和 hover 一样平。
boxShadow: shadow.card,
boxShadowSecondary: shadow.pop,
boxShadowTertiary: '0 4px 12px -6px rgba(16, 24, 40, 0.10)',
wireframe: false, wireframe: false,
}, },
components: { components: {
...@@ -41,7 +89,7 @@ export const themeConfig: ThemeConfig = { ...@@ -41,7 +89,7 @@ export const themeConfig: ThemeConfig = {
headerHeight: 60, headerHeight: 60,
headerPadding: '0 20px', headerPadding: '0 20px',
siderBg: 'transparent', siderBg: 'transparent',
bodyBg: '#F4F6FA', bodyBg: palette.surface.page,
}, },
Menu: { Menu: {
// —— 颜色(暗色模式)—— // —— 颜色(暗色模式)——
...@@ -68,12 +116,165 @@ export const themeConfig: ThemeConfig = { ...@@ -68,12 +116,165 @@ export const themeConfig: ThemeConfig = {
collapsedWidth: 68, collapsedWidth: 68,
}, },
Card: { Card: {
borderRadiusLG: 12, borderRadiusLG: radius.card,
// 卡片靠「浅底 + 无描边 + 柔影」成立;再叠一圈 #e2e8f0 的实描边是原来越来越「硬」的根因。
colorBorderSecondary: palette.line.divider,
headerBg: 'transparent',
headerHeight: 48,
headerHeightSM: 40,
headerPadding: 14,
headerPaddingSM: 10,
headerFontSize: 15,
headerFontSizeSM: 14,
bodyPadding: 20,
bodyPaddingSM: 16,
actionsBg: palette.surface.raised,
}, },
Button: { Button: {
controlHeight: 36, controlHeight: control.height,
borderRadius: 8, controlHeightSM: control.heightSm,
primaryShadow: '0 6px 16px -6px rgba(43,92,230,.5)', borderRadius: radius.md,
fontWeight: 500,
primaryShadow: '0 4px 12px -4px rgba(43,92,230,.42)',
defaultShadow: 'none',
defaultBorderColor: palette.line.border,
defaultColor: palette.text.secondary,
contentFontSizeSM: 13,
},
/**
* 表格是三个子应用的信息主体,也是「粗糙」最集中的地方。
* 表头用 raised 底 + 12px 次级字色,正文降到 13px,行高靠 padding 撑而不是靠字号撑,
* 分隔线取 divider(比 border 更淡)—— 这几项合起来就是「密但不挤、清但不硬」。
*/
Table: {
headerBg: palette.surface.raised,
headerColor: palette.text.header,
headerSplitColor: 'transparent',
headerBorderRadius: 8,
borderColor: palette.line.divider,
colorText: palette.text.primary,
// 三档尺寸都给,避免页面里 size 写成 small/large 时字号又跳回 14。
cellFontSize: control.tableFont,
cellFontSizeMD: control.tableFont,
cellFontSizeSM: control.tableFont,
rowHoverBg: palette.surface.raised,
rowSelectedBg: palette.soft.info,
rowSelectedHoverBg: '#E4ECFD',
cellPaddingBlockMD: 11,
// 左右留白取 antd 的 middle 默认值 16,不再追「与卡片 20px 对齐」:
// 20px 会把 90~110px 的窄列挤到内容宽不足 4 个汉字,
// 表头「变更次数」这类四字标题就换行,整行表头被撑成两倍高。
cellPaddingInlineMD: 16,
selectionColumnWidth: 48,
},
Pagination: {
itemBg: 'transparent',
itemSize: 30,
itemSizeSM: 26,
borderRadius: radius.sm,
colorText: palette.text.secondary,
itemActiveBg: palette.brand.primary,
itemActiveColor: '#FFFFFF',
itemActiveColorHover: '#FFFFFF',
fontSize: 13,
},
Tag: {
defaultBg: palette.soft.neutral,
defaultColor: palette.text.secondary,
borderRadiusSM: radius.sm,
fontSizeSM: 12,
},
Alert: {
containerBorderRadius: radius.md,
defaultPadding: '10px 16px',
withDescriptionPadding: '14px 18px',
withDescriptionIconSize: 20,
fontSize: 13,
},
Form: {
itemMarginBottom: 18,
verticalLabelPadding: '0 0 6px',
labelColor: palette.text.secondary,
labelFontSize: 13,
},
Input: {
controlHeight: control.height,
borderRadius: radius.md,
colorBgContainer: palette.surface.base,
hoverBorderColor: palette.brand.primaryHover,
activeBorderColor: palette.brand.primary,
activeShadow: '0 0 0 3px rgba(43,92,230,.12)',
errorActiveShadow: '0 0 0 3px rgba(229,72,77,.12)',
paddingBlock: 6,
},
Select: {
controlHeight: control.height,
borderRadius: radius.md,
optionActiveBg: palette.surface.hover,
optionSelectedBg: palette.soft.info,
optionSelectedColor: palette.brand.primary,
optionSelectedFontWeight: 500,
activeBorderColor: palette.brand.primary,
activeOutlineColor: '0 0 0 3px rgba(43,92,230,.12)',
optionPadding: '8px 12px',
optionHeight: 32,
optionFontSize: 13,
},
Modal: {
borderRadiusLG: radius.card,
titleFontSize: 16,
headerBg: 'transparent',
contentBg: palette.surface.base,
footerBg: 'transparent',
},
Drawer: {
paddingLG: 24,
footerPaddingBlock: 14,
footerPaddingInline: 24,
colorBgElevated: palette.surface.base,
},
Tabs: {
horizontalItemPadding: '10px 16px',
horizontalMargin: '0 0 16px',
itemColor: palette.text.secondary,
itemSelectedColor: palette.brand.primary,
itemHoverColor: palette.brand.primary,
inkBarColor: palette.brand.primary,
titleFontSize: 14,
cardBg: palette.surface.raised,
},
Descriptions: {
titleColor: palette.text.primary,
labelColor: palette.text.tertiary,
contentColor: palette.text.primary,
itemPaddingBottom: 12,
labelBg: 'transparent',
},
Skeleton: {
paragraphMarginTop: 12,
titleHeight: 18,
blockRadius: radius.sm,
color: palette.surface.hover,
},
Divider: {
colorSplit: palette.line.divider,
},
Empty: {
colorTextDescription: palette.text.tertiary,
},
Tooltip: {
borderRadius: radius.sm,
fontSize: 12,
},
Steps: {
iconSize: 26,
iconSizeSM: 20,
iconFontSize: 13,
titleLineHeight: 22,
},
Switch: {
handleSize: 18,
handleSizeSM: 12,
}, },
}, },
}; };
/* --------------------------------------------------------------------------- /* ---------------------------------------------------------------------------
* 设计令牌:shell 与所有子应用各自引入同一份。 * 设计令牌唯一真源。
* *
* 为什么不用 :root:antd 6 的 CSS 变量在 wujie 的 shadowRoot 内可见性需要 PoC 实测, * 为什么一份 CSS 变量要同时挂在 :root 与 .uj-scope 上:
* 令牌放在 .uj-scope 上由各应用根节点显式携带,比依赖 :root 穿透更可控。 * - :root 让主壳自身(登录页、Sider、工作台)不必依赖任何子应用上下文;
* 当前只定义品牌与页面底色,business 语义色沿用 antd token。 * - .uj-scope 让子应用在自己的 shadowRoot 内有一份**本地**定义。
* 自定义属性虽然能从文档 :root 继承穿透进 shadow DOM,但那是侥幸而非契约:
* 主壳一旦改用 shadow 隔离、或子应用独立运行(本地 vite,没有主壳),
* 依赖继承的那批 var(--uj-border) 会当场解析成空值。子应用 main.tsx 已引这份 CSS,
* 落点就在根节点 className 的 .uj-scope 上。
*
* 历史包袱(已收敛,别再引回来):
* 旧版这里只定义 --uj-color-* 五个,主壳 design.css 另写一套 --uj-*,
* points 的 CSS 两边混用。--uj-color-* 这一套除 index.css 的 text-primary 外没有任何消费者,
* 本文件统一采用简短的 --uj-* 命名;--uj-color-* 别名暂时不保留,
* 三个子应用 .uj-*-app 根规则改为直接引 --uj-text-1。
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */
:root,
.uj-scope { .uj-scope {
--uj-color-bg-page: #f5f7fa; /* ---- 品牌 ---- */
--uj-color-bg-card: #ffffff; --uj-primary: #2b5ce6;
--uj-color-border: #e2eaf0; --uj-primary-hover: #4b75ea;
--uj-color-text-primary: #0d1b2a; --uj-primary-active: #1f49c4;
--uj-color-text-secondary: #56697d; --uj-primary-soft: #eef3ff; /* 选中底、图标容器这类「品牌色但要淡」 */
--uj-radius-card: 8px; --uj-brand-1: #0b1437;
--uj-shadow-card: 0 1px 2px rgb(13 27 42 / 6%); --uj-brand-2: #16245a;
/* ---- 表面:四层递进,卡片不再靠「加个边框」区分自己 ---- */
--uj-bg: #f4f6fa; /* 页面底 */
--uj-surface: #ffffff; /* 卡片、弹层 */
--uj-surface-2: #f8fafc; /* 表头、只读信息带 */
--uj-surface-3: #f2f5fa; /* hover、次级填充 */
--uj-on-primary: #ffffff; /* 品牌底上的文字/图标,不随表面层变化 */
/* ---- 描边:两层 + 分隔线。企业级的「精致」一半在这三层分得开 ---- */
--uj-border: #e6ebf2; /* 卡片外框、控件描边 */
--uj-border-strong: #d6dee9; /* hover 描边、需要被看见的分隔 */
--uj-divider: #eef1f6; /* 行与行、区块之间 */
/* ---- 文字:四档。第三档只用于「说明」,第四档只用于占位/禁用 ---- */
--uj-text-1: #1d2533;
--uj-text-2: #4a5568;
--uj-text-3: #8a94a6;
--uj-text-4: #b3bac7;
/* 表头文字:12px 下比 tertiary 实一点,又不跟正文抢。 */
--uj-text-header: #5a6779;
/* ---- 语义色 + 配套淡底(标签、提示条成对取用,避免各自调 alpha 调出四种绿) ---- */
--uj-success: #16a34a;
--uj-success-soft: #e9f7ef;
--uj-success-border: #c6ebd6;
--uj-warning: #d97706;
--uj-warning-soft: #fdf3e5;
--uj-warning-border: #f6dfba;
--uj-error: #e5484d;
--uj-error-soft: #fdedee;
--uj-error-border: #f8cfd1;
--uj-info: #2b5ce6;
--uj-info-soft: #eef3ff;
--uj-info-border: #d6e2fb;
--uj-neutral-soft: #f2f4f8;
--uj-neutral-border: #e4e8ef;
/* ---- 高度:两级静置 + 一级抬起(hover)+ 浮层 ---- */
--uj-shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px -10px rgba(16, 24, 40, 0.12);
--uj-shadow-raise: 0 2px 4px rgba(16, 24, 40, 0.05), 0 16px 32px -14px rgba(16, 24, 40, 0.2);
--uj-shadow-pop: 0 12px 40px -12px rgba(16, 24, 40, 0.2);
/* 聚焦环:控件 focus 一律用它,不要各自写 box-shadow 调 alpha */
--uj-ring: 0 0 0 3px rgba(43, 92, 230, 0.14);
/* ---- 刻度:4px 基线。间距只从这一档里取,不写 10 / 13 / 18 这种孤值 ---- */
--uj-space-1: 4px;
--uj-space-2: 8px;
--uj-space-3: 12px;
--uj-space-4: 16px;
--uj-space-5: 20px;
--uj-space-6: 24px;
--uj-space-8: 32px;
/* ---- 圆角:卡片走 lg、控件走 md、标签走 sm;pill 只给胶囊态控件 ---- */
--uj-radius-xs: 4px;
--uj-radius-sm: 6px;
--uj-radius-md: 8px;
--uj-radius-lg: 10px;
--uj-radius-card: 12px;
--uj-radius-pill: 999px;
/* ---- 字号:正文 14 是基准,向下只留 13/12 两级说明,不出现 12.5 这种值 ---- */
--uj-font-xs: 12px;
--uj-font-sm: 13px;
--uj-font-md: 14px;
--uj-font-lg: 15px;
--uj-font-xl: 16px;
--uj-font-2xl: 20px;
--uj-font-3xl: 24px;
/* ---- 数字列:等宽数字,金额/数量/时间对得齐 ---- */
--uj-num: tabular-nums;
} }
...@@ -39,7 +39,9 @@ export const app = (options = {}) => ...@@ -39,7 +39,9 @@ export const app = (options = {}) =>
], ],
...(options.noRestrictedImports ...(options.noRestrictedImports
? { ? {
'no-restricted-imports': [ // 用 TS 版规则而不是 core 版:只有它支持 allowTypeImports,
// 而 `import type { TableProps } from 'antd'` 是合法的(类型不产生运行时耦合)。
'@typescript-eslint/no-restricted-imports': [
'error', 'error',
{ {
patterns: [ patterns: [
...@@ -53,6 +55,12 @@ export const app = (options = {}) => ...@@ -53,6 +55,12 @@ export const app = (options = {}) =>
message: message:
'子应用禁止直接引用 api/core 或 PEM 虚拟模块:请求必须经 props.request 由主壳代理。', '子应用禁止直接引用 api/core 或 PEM 虚拟模块:请求必须经 props.request 由主壳代理。',
}, },
{
group: ['antd', 'antd/*'],
allowTypeImports: true,
message:
'子应用必须经 @uj/ui 消费组件(UAlert / UTable / useUMessage …)。缺组件就往 packages/ui 补一个 U** 再引用,不要绕过共享层直接用 antd。',
},
], ],
}, },
], ],
...@@ -111,7 +119,8 @@ export const mp = () => ...@@ -111,7 +119,8 @@ export const mp = () =>
}, },
{ {
group: ['@uj/platform-sdk', '@uj/platform-sdk/*'], group: ['@uj/platform-sdk', '@uj/platform-sdk/*'],
message: '小程序不经由主壳 props.request,请勿引用 web 子应用 SDK @uj/platform-sdk。', message:
'小程序不经由主壳 props.request,请勿引用 web 子应用 SDK @uj/platform-sdk。',
}, },
{ {
group: ['@uj/vite-config', '@uj/vite-config/*'], group: ['@uj/vite-config', '@uj/vite-config/*'],
......
...@@ -56,11 +56,30 @@ export interface MenuGroupDef { ...@@ -56,11 +56,30 @@ export interface MenuGroupDef {
* - permCode 与当前账号持有的权限点取交集(/current 后端已按角色过滤,这里作双保险再过滤一次)。 * - permCode 与当前账号持有的权限点取交集(/current 后端已按角色过滤,这里作双保险再过滤一次)。
* - node.route 缺失 → 跳过并告警(点了会 404,不应渲染)。 * - node.route 缺失 → 跳过并告警(点了会 404,不应渲染)。
* - 分组/页面均按 sort 升序。 * - 分组/页面均按 sort 升序。
*
* `pathByResource` 是「权限资源 → 前端实际持有的页面路径」清单(来自兜底 menu.json),
* 只在**后端数据缺陷**时使用:同一 route 被多个页面节点复用 → 点哪个菜单都进同一页。
* 路由的真源仍然是后端的 node.route;这里只在复用发生时兜底,并在控制台点名,不改正常数据的行为。
*/ */
export function buildMenus(tree: MenuNode[], owned: Iterable<string>): MenuGroupDef[] { export function buildMenus(
tree: MenuNode[],
owned: Iterable<string>,
pathByResource?: ReadonlyMap<string, string>,
): MenuGroupDef[] {
const points = new Set(owned); const points = new Set(owned);
const groups: MenuGroupDef[] = []; const groups: MenuGroupDef[] = [];
// 先统计 route 复用情况(只统计会进菜单的节点)
const routeUses = new Map<string, number>();
(tree ?? []).forEach((g) => {
if (g.nodeType !== 1 || g.status !== 1) return;
(g.children ?? []).forEach((n) => {
if (n.nodeType === 2 && n.status === 1 && n.route) {
routeUses.set(n.route, (routeUses.get(n.route) ?? 0) + 1);
}
});
});
(tree ?? []) (tree ?? [])
.filter((n) => n.nodeType === 1 && n.status === 1) .filter((n) => n.nodeType === 1 && n.status === 1)
.sort((a, b) => a.sort - b.sort) .sort((a, b) => a.sort - b.sort)
...@@ -81,12 +100,20 @@ export function buildMenus(tree: MenuNode[], owned: Iterable<string>): MenuGroup ...@@ -81,12 +100,20 @@ export function buildMenus(tree: MenuNode[], owned: Iterable<string>): MenuGroup
return; return;
} }
const i = point.lastIndexOf(':'); const i = point.lastIndexOf(':');
children.push({ const resource = (i > 0 ? point.slice(0, i) : point) as ResourceKey;
path: n.route, let path = n.route;
label: n.label, const uses = routeUses.get(path) ?? 0;
icon: n.icon ?? null, if (uses > 1) {
resource: (i > 0 ? point.slice(0, i) : point) as ResourceKey, const repaired = pathByResource?.get(resource);
}); if (repaired) {
console.error(
`[menu] 后端菜单「${n.label}」(${code}) 的 route ${path} 被 ${uses} 个页面复用,` +
`已回落到前端页面清单的 ${repaired}。请把后端菜单节点的 route 改成互不相同。`,
);
path = repaired;
}
}
children.push({ path, label: n.label, icon: n.icon ?? null, resource });
}); });
if (children.length) groups.push({ group: g.label, children }); if (children.length) groups.push({ group: g.label, children });
}); });
......
import { Alert } from 'antd'; import { Alert, type AlertProps } from 'antd';
/** 项目提示条。统一命名入口。 */ export type UAlertProps = AlertProps;
export const UAlert = Alert;
/**
* 项目提示条。
* 淡底与淡描边由 themeConfig 的 color*Bg / color*Border 别名统一给出,
* 不在页面里为每种状态各写一套背景色。
*/
export function UAlert({ className, ...rest }: UAlertProps) {
return <Alert className={['uj-alert', className].filter(Boolean).join(' ')} {...rest} />;
}
import { App as AntApp } from 'antd';
import { useMemo } from 'react';
/** 取当前 App 边界上的 message / notification / modal 实例。 */
export function useUApp() {
return AntApp.useApp();
}
/**
* 只要 message 的场景用这个,别在页面里解构整个 useApp。
* 返回的实例走 ConfigProvider 的主题与 locale,静态 message.xxx 拿不到,
* 在 wujie 的 shadowRoot 内还会挂到文档 body 上、脱离子应用样式作用域。
*/
export function useUMessage() {
const { message } = useUApp();
return useMemo(() => message, [message]);
}
import { App as AntApp, type AppProps } from 'antd';
export type UAppProps = AppProps;
/**
* 项目统一的 antd App 边界。
*
* 为什么要单独封一层:`import { App } from 'antd'` 在三个子应用里出现了 14 次,
* 目的全是拿 `App.useApp()` 的 message/notification —— 但那意味着每个页面都直接认识 antd。
* 子应用不许直引 antd(eslint 门禁),入口层由 @uj/ui 承担,页面只认 useUApp。
*
* 挂载点在 platform-sdk 的 SubAppProvider 里(那里是唯一的 ConfigProvider + App 边界),
* 本组件只给需要显式声明边界的场景用,行为与 antd App 一致。
*/
export function UApp(props: UAppProps) {
return <AntApp {...props} />;
}
import { Card } from 'antd'; import { Card, type CardProps } from 'antd';
/** 项目卡片容器。当前直接复用 antd Card,作为统一命名入口,后续可注入项目默认样式。 */ export type UCardProps = CardProps & {
export const UCard = Card; /**
* 铺满父容器剩余高度,内部由表体自己滚动(列表页用)。
* 只是往根节点加一格布局类,不改 Card 的 DOM 结构,所以 antd 的尺寸计算不受影响。
*/
fill?: boolean;
};
/**
* 项目卡片容器。
*
* 与旧版的关键差异:默认 variant="borderless"。卡片靠「浅底 + 柔影」分层,
* 再叠一圈实描边会让每块内容都多一条硬线 —— 三个子应用原来既在 UCard 外
* 又各自写一遍 border + box-shadow(store-filter-card / uj-points-table-card),
* 阴影值还被旧令牌覆盖成单层弱影,所以子应用的卡片一直比主壳「平」。
*
* 需要表达「可点击 / 选中」时才显式传 variant="outlined"。
*/
export function UCard({ variant = 'borderless', fill, className, ...rest }: UCardProps) {
return (
<Card
variant={variant}
className={['uj-card', fill ? 'uj-card--fill' : '', className].filter(Boolean).join(' ')}
{...rest}
/>
);
}
import { Dropdown, type DropdownProps } from 'antd';
export type UDropdownProps = DropdownProps;
/**
* 项目统一下拉菜单。
* 触发方式、placement 一律沿用 antd 默认,不在这一层改行为 —— 封装只为收口引用入口,
* 让「能不能从 antd 直引」这条门禁在子应用里可以强制生效。
*/
export function UDropdown(props: UDropdownProps) {
return <Dropdown {...props} />;
}
import { Empty, type EmptyProps } from 'antd';
export type UEmptyProps = EmptyProps;
/**
* 项目统一空态。
*
* 默认走简版插画:antd 的默认插画是一只大箱子,放在卡片里会把「这里没有数据」
* 说成「这里什么都没有」。列表与详情里的空态只需要一行克制的说明。
*
* 三个子应用原先各自 `import { Empty } from 'antd'`(含 App.tsx 的兜底页),
* 本组件是那份统一入口;空态撑满表体的行为在 Table 的 locale 里注入,见 ui.css 的
* .uj-table-fill 一节。
*/
export function UEmpty({ image = Empty.PRESENTED_IMAGE_SIMPLE, ...rest }: UEmptyProps) {
return <Empty image={image} {...rest} />;
}
...@@ -4,22 +4,28 @@ import { useFillHeight } from './tools/useFillHeight'; ...@@ -4,22 +4,28 @@ import { useFillHeight } from './tools/useFillHeight';
/** /**
* 自动铺满父容器剩余高度的表格。 * 自动铺满父容器剩余高度的表格。
* *
* 原理:用 ResizeObserver 测量外层容器高度,扣除表头与分页高度后, * 原理:测量外层容器高度,扣除表头与分页后作为 antd Table 的 scroll.y ——
* 作为 antd Table 的 scroll.y —— 表体精确填满、表头吸顶、表体内部纵向滚动。 * 表头吸顶、表体内部纵向滚动、分页贴底。测量与自校正细节见 useFillHeight。
* 与 antd 内部 DOM 结构解耦,版本无关。
* *
* 用法:放在具有确定高度的 flex 容器内(如外层 .uj-table-fill 的父级)。 * 三个必须一起成立的配套(后两条在 @uj/ui 的 styles/ui.css):
* 例: * 1) .uj-table-fill 的 flex 规则必须随子应用打包 —— 旧版它写在主壳文档样式表里,
* <div style={{ height: '100%', display: 'flex', flexDirection: 'column' }}> * shadowRoot 内不生效,于是 wrap.clientHeight 恒为 0,fillHeight 实际是坏的;
* <FillTable columns={cols} dataSource={data} rowKey="id" /> * 2) 表体 min-height 取 --uj-table-body-h:antd 的 scroll.y 只是上限,数据少时
* </div> * 表体会塌成内容高度,补一个同样大小的下限才会铺满;
* 3) 空态高度用 --uj-fill-h 由占位单元格吃掉 —— 表头还在、空态垂直居中、分页落底。
*
* 用法:放在具有确定高度的 flex 容器内(.uj-card--fill > .ant-card-body)。
*/ */
export function FillTable<T extends object = Record<string, unknown>>(props: TableProps<T>) { export function FillTable<T extends object = Record<string, unknown>>(props: TableProps<T>) {
const { wrapRef, bodyHeight } = useFillHeight(); const { wrapRef, size } = useFillHeight();
return ( return (
<div ref={wrapRef} className="uj-table-fill"> <div ref={wrapRef} className="uj-table-fill">
<Table {...props} scroll={{ ...props.scroll, y: bodyHeight ?? props.scroll?.y }} /> <Table
{...props}
rootClassName="uj-table"
scroll={{ ...props.scroll, y: size?.scrollY ?? props.scroll?.y }}
/>
</div> </div>
); );
} }
import { useLayoutEffect, useRef, useState } from 'react'; import { useCallback, useLayoutEffect, useRef, useState } from 'react';
export interface FillHeight {
/** antd Table 的 scroll.y:表体滚动容器的最大高度。 */
scrollY: number;
/** 空态占位单元格的高度:扣掉横向滚动条,正好等于表体的可视高度。 */
fillHeight: number;
}
/** 表体最小高度:容器再矮也不让表体塌成一条线。 */
const MIN_BODY_H = 60;
/** /**
* 测量填充表格可滚动表体的高度。 * 测量填充表格可滚动表体的高度(做法对齐 atlas 的 useTableFill)。
* 监听外层容器尺寸,扣除表头与分页高度后返回 scroll.y, *
* 与 antd 内部 DOM 结构解耦,版本无关。 * antd 的 scroll.y 只是 inline max-height —— 只是上限、不会撑高,所以数据少时
* 表体会塌成内容高度、下方留白。这里把同一个值写到 --uj-table-body-h,
* CSS 给 .ant-table-body 设了同样的 min-height(见 ui.css),于是
* 表体实际高 = clamp(min-height, 内容高, max-height) ≡ y
* 表格总高恒等于容器高度,与行数/滚动条无关。
*
* 首帧的「容器 − 表头 − 分页器」只是种子值(表头换行、分页器有无都会让公式偏一点),
* 第二轮起用表格实际渲染高度自校正:overflow = wrapper.offsetHeight − avail,y -= overflow。
* 因为表体高恒等于 y,这一步一次收敛,与表头/分页器测得准不准无关。
*
* 三个不能改的约束:
* 1) 自校正必须挂在「新 y 已生效」之后(useLayoutEffect 依赖 size)——在 rAF 里 setState
* 之后立刻量到的还是旧 DOM,y 会被连续放大,直到分页器被容器裁掉。
* 2) |overflow| ≤ 1px 时必须直接 return,不回落到公式值——否则 y 会在两个值之间横跳。
* 3) 只观察外部输入:容器、分页器。绝不观察 .ant-table-wrapper —— 它的高度由 y 决定,
* 观察它等于接上自捻回路,分页器会肉眼可见地抖。
*/ */
export function useFillHeight() { export function useFillHeight() {
const wrapRef = useRef<HTMLDivElement>(null); const wrapRef = useRef<HTMLDivElement>(null);
const [bodyHeight, setBodyHeight] = useState<number | undefined>(undefined); const [size, setSize] = useState<FillHeight | undefined>(undefined);
/** 当前已生效的 y。用 ref 而非 state:measure 要读最新值,且它自身不该触发渲染。 */
const currentRef = useRef<number | undefined>(undefined);
/** 自校正安全阀:数学上一次收敛,这里只防异常布局下的死循环。 */
const roundsRef = useRef(0);
/** @returns 是否改动了 y(true 表示还要等它生效后复核一轮) */
const measure = useCallback((): boolean => {
const wrap = wrapRef.current;
if (!wrap) return false;
const host = wrap.clientHeight;
if (host <= 0) return false; // 还没布局出来
const cs = getComputedStyle(wrap);
const padY = (parseFloat(cs.paddingTop) || 0) + (parseFloat(cs.paddingBottom) || 0);
const avail = host - padY;
const wrapper = wrap.querySelector<HTMLElement>('.ant-table-wrapper');
let next: number;
// 表体自己也是滚动容器:横向滚动条占掉的可视高度必须从空态占位里扣掉,
// 否则占位比可视区高,空列表会凭空多出一根竖向滚动条。
const applyFillHeight = (y: number): number => {
const body = wrap.querySelector<HTMLElement>('.ant-table-body');
const hScroll = body ? Math.max(0, body.offsetHeight - body.clientHeight) : 0;
const fillHeight = Math.max(0, y - hScroll);
wrap.style.setProperty('--uj-fill-h', `${fillHeight}px`);
return fillHeight;
};
if (wrapper && currentRef.current !== undefined) {
// ① 自校正:用表格实际渲染高度反推
const overflow = wrapper.offsetHeight - avail;
if (Math.abs(overflow) <= 1) {
// 已贴合,锁死 y。横向滚动条仍可能在数据/列宽变化后出现或消失,单独刷新占位高度。
applyFillHeight(currentRef.current);
return false;
}
next = Math.max(Math.floor(currentRef.current - overflow), MIN_BODY_H);
} else {
// ② 首帧种子:扣除表头与分页器的 margin box(antd 默认 margin: 16px 0)
const theadH = wrap.querySelector('.ant-table-thead')?.getBoundingClientRect().height ?? 0;
const pager = wrap.querySelector<HTMLElement>('.ant-pagination');
let pagerH = 0;
if (pager) {
const ps = getComputedStyle(pager);
pagerH =
pager.getBoundingClientRect().height +
(parseFloat(ps.marginTop) || 0) +
(parseFloat(ps.marginBottom) || 0);
}
next = Math.max(Math.floor(avail - theadH - pagerH) - 2, MIN_BODY_H);
}
if (currentRef.current !== undefined && Math.abs(next - currentRef.current) <= 1) return false;
currentRef.current = next;
const fillHeight = applyFillHeight(next);
wrap.style.setProperty('--uj-table-body-h', `${next}px`);
setSize({ scrollY: next, fillHeight });
return true;
}, []);
// ① 收敛主循环:size 变化 → antd 已把新 max-height 写进 DOM → 此刻量到的才是真值。
useLayoutEffect(() => {
if (roundsRef.current >= 8) return;
const changed = measure();
roundsRef.current = changed ? roundsRef.current + 1 : 0;
}, [size, measure]);
// ② 外部输入变化才重测:容器尺寸 / 分页器尺寸 / 表格或分页器从无到有。
useLayoutEffect(() => { useLayoutEffect(() => {
const wrap = wrapRef.current; const wrap = wrapRef.current;
if (!wrap) return; if (!wrap) return;
const el = wrap;
const measure = () => { const trigger = () => {
const header = wrap.querySelector('.ant-table-thead'); roundsRef.current = 0;
const pagination = wrap.querySelector('.ant-table-pagination'); measure();
const headerH = header ? (header as HTMLElement).getBoundingClientRect().height : 0;
const pagH = pagination ? (pagination as HTMLElement).offsetHeight : 0;
const available = Math.max(0, wrap.clientHeight - headerH - pagH);
setBodyHeight((prev) => (prev === available ? prev : available));
}; };
const ro = new ResizeObserver(measure); let watchedPager: Element | null = null;
ro.observe(wrap); // 函数声明而非 const:ro 的回调要调用它,它又要往 ro 上挂观察,两者互相引用。
measure(); function watchPager() {
return () => ro.disconnect(); const pager = el.querySelector('.ant-pagination');
}, []); if (pager && pager !== watchedPager) {
watchedPager = pager;
ro.observe(pager);
}
}
const ro = new ResizeObserver(() => {
trigger();
// 分页器可能晚于首帧才出现,这里顺带挂上观察
watchPager();
});
ro.observe(el);
watchPager();
// 结构变化才重测。签名必须同时含「表格」与「分页器」:
// 只看表格会漏掉「表格已在、分页器后来出现」——首屏 loading 的真实场景,
// 漏掉它 y 就停在没扣分页器高度的值上,分页器被容器裁掉。
// 行数据增删不改变签名,避免无谓重测。
const signature = () =>
`${Boolean(el.querySelector('.ant-table-wrapper'))}|${Boolean(
el.querySelector('.ant-pagination'),
)}`;
let lastSig = signature();
const mo = new MutationObserver(() => {
watchPager();
const sig = signature();
if (sig === lastSig) return;
lastSig = sig;
trigger();
});
mo.observe(el, { childList: true, subtree: true });
return () => {
ro.disconnect();
mo.disconnect();
};
}, [measure]);
return { wrapRef, bodyHeight }; return { wrapRef, size };
} }
import { Steps, type StepsProps } from 'antd';
export type UStepsProps = StepsProps;
/**
* 项目统一步骤条(模板导入的四步流程用)。
* 尺寸与字号由 themeConfig 的 Steps token 下发,这里只作统一命名入口。
*/
export function USteps(props: UStepsProps) {
return <Steps {...props} />;
}
import { Table, type TableProps } from 'antd'; import { Table, type TableProps } from 'antd';
/** /**
* 项目统一表格。约定默认尺寸 middle,后续可在此注入统一分页/空态/列设置等。 * 项目统一表格。
*
* rootClassName 统一挂 uj:表头底色、行 hover、分隔线、分页贴底这些规则
* 都在 @uj/ui 的 styles/ui.css 里以 .uj-table 为作用域,页面不需要自己写。
* 组件的几何量仍然由 themeConfig 的 Table token 下发。
*/ */
export function UTable<T>(props: TableProps<T>) { export function UTable<T>(props: TableProps<T>) {
const { size = 'middle', ...rest } = props; const { size = 'middle', rootClassName, ...rest } = props;
return <Table<T> size={size} {...rest} />; return (
<Table<T>
size={size}
rootClassName={['uj-table', rootClassName].filter(Boolean).join(' ')}
{...rest}
/>
);
} }
import { Tag } from 'antd'; import { Tag, type TagProps } from 'antd';
/** 项目标签。统一命名入口。 */ export type UTagProps = TagProps;
export const UTag = Tag;
/**
* 项目标签。
*
* 默认无描边:后台列表里的标签常成组出现(角色、场景、分类),每个都描一圈边会显得吵;
* 柔和填充 + 6px 圆角既分得清层级,又不抢正文。需要强分隔时显式传 bordered。
*/
export function UTag({ bordered = false, className, ...rest }: UTagProps) {
return (
<Tag
bordered={bordered}
className={['uj-tag', className].filter(Boolean).join(' ')}
{...rest}
/>
);
}
import { Timeline, type TimelineProps } from 'antd';
export type UTimelineProps = TimelineProps;
/**
* 项目统一时间轴(提现审批流转用)。
* 圆点配色取 themeConfig 的语义色,不在页面里为「已完成 / 当前」各写一个 hex。
*/
export function UTimeline(props: UTimelineProps) {
return <Timeline {...props} />;
}
...@@ -2,6 +2,17 @@ ...@@ -2,6 +2,17 @@
// 模块化管理:每个组件一个文件夹,位于 ./components/<Name>/index.tsx, // 模块化管理:每个组件一个文件夹,位于 ./components/<Name>/index.tsx,
// 本文件为统一导出口,外部消费方式不变: // 本文件为统一导出口,外部消费方式不变:
// import { UButton, UTable } from '@uj/ui'; // import { UButton, UTable } from '@uj/ui';
//
// 子应用禁止从 antd 直引组件(eslint no-restricted-imports 门禁)。
// 缺什么就在这里补一个 U*,再去页面里消费 —— 不要在页面里绕过去。
// 样式层:精致度与布局的公共规则。CSS 会随各应用打包进自己的 style-*.css,
// 在 wujie 的 shadowRoot 内生效;主壳文档样式表穿不进 shadow DOM,别把规则写回 shell。
import './styles/ui.css';
export { UApp } from './components/App';
export type { UAppProps } from './components/App';
export { useUApp, useUMessage } from './components/App/hooks';
export { UButton } from './components/Button'; export { UButton } from './components/Button';
export type { UButtonProps } from './components/Button'; export type { UButtonProps } from './components/Button';
...@@ -20,8 +31,11 @@ export { UForm, UFormItem } from './components/Form'; ...@@ -20,8 +31,11 @@ export { UForm, UFormItem } from './components/Form';
export { UTypography, UTitle, UText, UParagraph } from './components/Typography'; export { UTypography, UTitle, UText, UParagraph } from './components/Typography';
export { UCard } from './components/Card'; export { UCard } from './components/Card';
export type { UCardProps } from './components/Card';
export { UTag } from './components/Tag'; export { UTag } from './components/Tag';
export type { UTagProps } from './components/Tag';
export { UAlert } from './components/Alert'; export { UAlert } from './components/Alert';
export type { UAlertProps } from './components/Alert';
export { UModal } from './components/Modal'; export { UModal } from './components/Modal';
export { UDrawer } from './components/Drawer'; export { UDrawer } from './components/Drawer';
export type { UDrawerProps } from './components/Drawer'; export type { UDrawerProps } from './components/Drawer';
...@@ -36,6 +50,14 @@ export { UCheckbox } from './components/Checkbox'; ...@@ -36,6 +50,14 @@ export { UCheckbox } from './components/Checkbox';
export { UList } from './components/List'; export { UList } from './components/List';
export { UTooltip } from './components/Tooltip'; export { UTooltip } from './components/Tooltip';
export { UResult } from './components/Result'; export { UResult } from './components/Result';
export { UEmpty } from './components/Empty';
export type { UEmptyProps } from './components/Empty';
export { USteps } from './components/Steps';
export type { UStepsProps } from './components/Steps';
export { UTimeline } from './components/Timeline';
export type { UTimelineProps } from './components/Timeline';
export { UDropdown } from './components/Dropdown';
export type { UDropdownProps } from './components/Dropdown';
export { UDatePicker } from './components/DatePicker'; export { UDatePicker } from './components/DatePicker';
export type { UDatePickerProps } from './components/DatePicker'; export type { UDatePickerProps } from './components/DatePicker';
......
/* ---------------------------------------------------------------------------
* @uj/ui 样式层
*
* 边界(很重要,别再往这里堆组件内部样式):
* - 组件自身的颜色、字号、内间距、圆角 → themeConfig 的 component token。
* 那是 antd 官方入口,几何量会参与组件内部计算;用 CSS 覆盖一定会算歪。
* - 本文件只放两类东西:
* 1) 布局契约(页面高度链、列表两段式、表体填充);
* 2) token 表达不了的少量视觉收口(等宽数字、空态填充、分页贴底)。
*
* 为什么必须在 packages/ui 里:子应用跑在 wujie 的 shadowRoot 内,
* 主壳的文档样式表穿不进去。旧版把 .uj-table-fill 写在 shell/index.css,
* 于是 fillHeight 在子应用里量到 0 —— 铺满高度一直是坏的。
* ------------------------------------------------------------------------- */
/* ============ 页面高度链 ============ */
/* 文档根:子应用跑在 shadowRoot 里,主壳那份 html/body{height:100%} 穿不进来。
少了这一段,子应用根的 height:100% 退化成内容高度,
整条「页面 → 卡片 → 表体」的铺满链在第一段就断了。 */
html,
body {
height: 100%;
margin: 0;
}
/* antd <App> 边界(SubAppProvider / 主壳入口各挂一层):它默认是块级容器、没有高度,
却正好夹在 #root 与子应用根之间 —— 不补这一条,百分比高度到它这里同样断掉。 */
.ant-app {
height: 100%;
}
/* 子应用根:占满 iframe/shadow 宿主,滚动交给页面自己决定。
列表页正好一屏(表体内滚)时这里不会出现滚动条;
长表单页由 .uj-page 撑高,滚动条落在这里。 */
.uj-page-host,
#root {
height: 100%;
}
/* 页面外壳:默认自然高度(内容长了就滚),min-height 保证短页面也撑满一屏。 */
.uj-page {
display: flex;
flex-direction: column;
gap: var(--uj-space-4, 16px);
min-width: 0;
min-height: 100%;
}
/* 列表页:整屏定高,表体内部滚动、分页贴卡片底。
用 height 而不是 min-height —— 否则表体会被内容撑开,分页永远滚到看不见的地方。 */
.uj-page--fill {
height: 100%;
min-height: 0;
overflow: hidden;
}
.uj-page__header {
flex: none;
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: var(--uj-space-5, 20px);
}
.uj-page__title {
margin: 0 0 6px;
color: var(--uj-text-1);
font-size: var(--uj-font-2xl, 20px);
font-weight: 600;
line-height: 1.4;
}
.uj-page__desc {
margin: 0;
color: var(--uj-text-3);
font-size: var(--uj-font-sm, 13px);
line-height: 1.7;
}
.uj-page__tools {
flex: none;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: var(--uj-space-2, 8px);
}
/* 页内分段导航(Tabs):不参与伸缩,间距交给页面 gap,避免 antd 默认 margin 叠成两层。 */
.uj-page__tabs {
flex: none;
}
.uj-page__tabs .ant-tabs-nav {
margin-bottom: 0;
}
.uj-page__tabs .ant-tabs-nav::before {
border-bottom-color: var(--uj-divider);
}
/* 列表页里表头与表体之间只有一层卡片间距,不再额外叠 gap。 */
.uj-page--fill > .uj-page__body {
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
gap: var(--uj-space-4, 16px);
}
/* ============ 卡片 ============ */
/* 卡片靠浅底 + 柔影分层,不靠描边。阴影取令牌,两级:静置 / hover 抬起。 */
.uj-card {
border: 1px solid transparent;
border-radius: var(--uj-radius-card, 12px);
background: var(--uj-surface, #fff);
box-shadow: var(--uj-shadow-card);
}
/* 铺满的列表卡片:自己撑满剩余高度,内部(表体)滚动。 */
.uj-card--fill {
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.uj-card--fill > .ant-card-body {
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
padding: 0;
}
/* ============ 筛选面板 ============ */
.uj-filter-card {
flex: none;
}
.uj-filter-card > .ant-card-body {
padding: 12px 16px;
}
/* 筛选字段栅格:桌面 4 列 + 动作列,动作与字段同排、垂直居中;
标签在控件左侧,控件左缘因此落在同一条竖线上(标签列宽由 SearchForm 的 labelCol 给出)。 */
.uj-filter-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
column-gap: var(--uj-space-4, 16px);
row-gap: var(--uj-space-3, 12px);
align-items: center;
}
.uj-filter-grid .ant-form-item,
.uj-filter-more .ant-form-item {
margin-bottom: 0;
min-width: 0;
}
/* 标签是字段名,不是正文:压小一档、不换行、右侧留 8px 与控件分开。
宽度由 labelCol 内联给出(104px),这里只管排版。 */
.uj-filter-grid .ant-form-item-label,
.uj-filter-more .ant-form-item-label {
padding-bottom: 0;
}
.uj-filter-grid .ant-form-item-label > label,
.uj-filter-more .ant-form-item-label > label {
height: auto;
color: var(--uj-text-2);
font-size: var(--uj-font-xs, 12px);
}
/* 动作区:固定在栅格最后一列(动作列),与字段同一排、垂直居中。 */
.uj-filter-actions {
grid-column: -2 / -1;
display: flex;
justify-content: flex-end;
align-items: center;
gap: var(--uj-space-2, 8px);
white-space: nowrap;
}
/* 收起后的第二排:与第一排同栅格,靠一条淡分隔线区隔,不另起一个卡片。 */
.uj-filter-more {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
column-gap: var(--uj-space-4, 16px);
row-gap: var(--uj-space-3, 12px);
align-items: center;
padding-top: var(--uj-space-3, 12px);
margin-top: var(--uj-space-3, 12px);
border-top: 1px solid var(--uj-divider);
}
/* 「更多筛选」角标:收起状态下也要让人看见自己设过几个条件,避免隐性筛选。 */
.uj-filter-more-btn {
display: inline-flex;
align-items: center;
gap: 6px;
}
.uj-filter-more-count {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 18px;
height: 18px;
padding: 0 5px;
border-radius: var(--uj-radius-pill, 999px);
background: var(--uj-primary);
color: #fff;
font-size: 11px;
font-weight: 600;
line-height: 1;
font-variant-numeric: var(--uj-num, tabular-nums);
}
.uj-filter-toggle-icon {
font-size: 11px;
transition: transform 0.2s ease;
}
.uj-filter-toggle-icon.is-open {
transform: rotate(180deg);
}
/* 标签移到左侧后每组字段多占 104px,列数按「控件至少约 170px」反推:
1700 以下 3 列、1400 以下 2 列、1100 以下 1 列;动作列在窄屏退回整行。 */
@media (max-width: 1700px) {
.uj-filter-grid {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.uj-filter-grid .uj-filter-actions {
grid-column: 1 / -1;
}
.uj-filter-more {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
}
@media (max-width: 1400px) {
.uj-filter-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.uj-filter-more {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (max-width: 1100px) {
.uj-filter-grid,
.uj-filter-more {
grid-template-columns: minmax(0, 1fr);
}
.uj-page__header {
flex-direction: column;
}
}
/* ============ 表格:填充、空态、分页贴底 ============ */
/* 填充表格:外层拿满父容器,表体高度由 FillTable 测量后交给 scroll.y。 */
.uj-table-fill {
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
/* 容器高度只由 flex 链决定,表格再高也不许把它撑开(否则滚动条被顶到外壳) */
overflow: hidden;
}
.uj-table-fill > .ant-spin-nested-loading,
.uj-table-fill > .ant-spin-nested-loading > .ant-spin-container {
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
}
/* 表体高度下限:antd 的 scroll.y 只是 inline max-height —— 只是上限、不会撑高,
数据少时列表会塌成一条、下方留白。补一个同样大小的下限(由 hook 写成
--uj-table-body-h),实际高恒等于 y ≡ 容器给到的高度,列表自然铺满。
overflow-y 用 auto:rc-table 默认是 scroll,内容没超出也常驻一条滚动条,空列表会挂条。 */
.uj-table-fill .ant-table-body {
min-height: var(--uj-table-body-h, 0px);
overflow-y: auto !important;
}
/* 表体滚动条收细:默认 15px 的槽在密集表格里太抢眼,
而且横向滚动条越窄,表体可视高度越接近测量值。 */
.uj-table-fill .ant-table-body {
scrollbar-width: thin;
scrollbar-color: var(--uj-border-strong) transparent;
}
.uj-table-fill .ant-table-body::-webkit-scrollbar {
width: 8px;
height: 8px;
}
.uj-table-fill .ant-table-body::-webkit-scrollbar-thumb {
border-radius: 4px;
background: var(--uj-border-strong);
}
.uj-table-fill .ant-table-body::-webkit-scrollbar-track {
background: transparent;
}
/* 工具条:左计数、右动作。原 DataTable 用内联 style 写死 padding/gap,
现在收成一个类,三处列表页共用同一套间距。 */
.uj-table-toolbar {
flex: none;
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
gap: var(--uj-space-3, 12px);
padding: 12px 20px;
border-bottom: 1px solid var(--uj-divider);
}
.uj-table-toolbar__title {
color: var(--uj-text-3);
font-size: var(--uj-font-sm, 13px);
font-variant-numeric: var(--uj-num, tabular-nums);
}
.uj-table-toolbar__actions {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: var(--uj-space-2, 8px);
}
/* 空态铺满表体:FillTable 把测到的可视高度写成 --uj-fill-h,
由占位单元格吃掉这段高度,表头仍然可见(用户得知道自己看的是哪几列)。 */
.uj-table-fill .ant-table-tbody > tr.ant-table-placeholder > td {
height: var(--uj-fill-h, auto);
padding: 0;
border-bottom: 0;
}
.uj-table-fill .ant-table-placeholder .ant-empty {
margin: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
gap: var(--uj-space-3, 12px);
}
/* 空态插画不抢戏:表格里的空态是「说明」不是「主视觉」。 */
.uj-table-fill .ant-empty-image {
height: 56px;
opacity: 0.9;
}
.uj-table-fill .ant-empty-description {
color: var(--uj-text-3);
font-size: var(--uj-font-sm, 13px);
}
/* 分页贴底:外边距归零,上下用 padding 撑出与卡片边缘的呼吸。 */
.uj-table .ant-table-pagination.ant-pagination {
flex: none;
display: flex;
align-items: center;
justify-content: flex-end;
margin: 0;
padding: 12px 20px;
border-top: 1px solid var(--uj-divider);
}
/* 总数文案推到左侧:页码靠右、总数靠左,中间留白,比挤在一起更像成品。 */
.uj-table .ant-pagination .ant-pagination-total-text {
margin-inline-end: auto;
color: var(--uj-text-3);
font-size: var(--uj-font-sm, 13px);
font-variant-numeric: var(--uj-num, tabular-nums);
}
/* 页码:数字等宽,翻页时不会因 9→10 左右抖动。 */
.uj-table .ant-pagination .ant-pagination-item,
.uj-table .ant-pagination .ant-pagination-prev,
.uj-table .ant-pagination .ant-pagination-next,
.uj-table .ant-pagination .ant-pagination-jump-next,
.uj-table .ant-pagination .ant-pagination-jump-prev {
font-variant-numeric: var(--uj-num, tabular-nums);
}
.uj-table .ant-pagination .ant-pagination-item-active {
border-color: var(--uj-primary);
font-weight: 600;
}
/* 表头不再有「列分隔竖线」,靠底色与字色区分 —— 密集表格里竖线越多越像 Excel。 */
.uj-table .ant-table-thead > tr > th::before {
display: none;
}
/* 金额、数量、时间列:等宽数字。页面里别再用内联 fontFamily 各写一遍。 */
.uj-num,
.uj-code {
font-variant-numeric: var(--uj-num, tabular-nums);
}
.uj-code {
color: var(--uj-text-2);
font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
font-size: 12px;
}
/* 表格里的可点文字:与主色同源,不用 #315ce8 这类随手蓝。 */
.uj-link {
color: var(--uj-primary);
cursor: pointer;
}
.uj-link:hover {
color: var(--uj-primary-hover);
}
/* 单元格副行:主值下面的补充说明,靠字号和色阶分层而不是加粗。 */
.uj-cell-sub {
display: block;
margin-top: 2px;
color: var(--uj-text-3);
font-size: var(--uj-font-xs, 12px);
line-height: 1.5;
}
/* 单元格主值加重:500 而不是浏览器默认的 700 —— 表格里 700 会盖过表头。 */
.uj-cell-strong {
color: var(--uj-text-1);
font-weight: 500;
}
/* 行内操作:间距由容器给,避免每列自己写 marginRight。
不换行是刻意的:换行只会在「列宽差几像素」时发生,代价是把整行撑高一倍,
而列宽本身是页面给的配置(actionColumnWidth),该改配置而不是靠换行兜底。 */
.uj-row-actions {
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: flex-end;
white-space: nowrap;
gap: var(--uj-space-1, 4px);
}
/* 一组标签:间距同样由容器给,多个标签时不会挤成一串。 */
.uj-tag-list {
display: inline-flex;
flex-wrap: wrap;
gap: var(--uj-space-1, 4px);
}
/**
* 设计令牌对账 + 子应用颜色门禁。
*
* 两个判据,都能用代码跑,不依赖人肉 review:
* 1) palette.ts(交给 antd 的 JS 侧真源)里每个色值都必须能在 tokens.css 找到 ——
* 否则就是「组件按 A 配色、自定义 CSS 按 B 配色」,肉眼能看出那条线不干净。
* 2) 子应用源码里不允许出现写死的十六进制颜色 —— 一律用 var(--uj-*)。
* 需求原话是「精致、统一」,靠提示词约束不住;这里做成跑不过就红。
*
* 主壳 design.css 暂不纳入第 2 条:它是主壳自己的视觉稿,且还带着历史色值,
* 收敛它属于另一轮改造,先把子应用这条线守住。
*/
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const read = (rel) => fs.readFileSync(path.join(ROOT, rel), 'utf8');
const errors = [];
/* ---------- 1. palette.ts → tokens.css ---------- */
const paletteSource = read('packages/design-tokens/src/palette.ts');
const tokensCss = read('packages/design-tokens/src/tokens.css');
const paletteHexes = new Set(
[...paletteSource.matchAll(/'#([0-9a-fA-F]{6})'/g)].map((m) => m[1].toLowerCase()),
);
const cssHexes = new Set(
[...tokensCss.matchAll(/#([0-9a-fA-F]{6})\b/g)].map((m) => m[1].toLowerCase()),
);
for (const hex of paletteHexes) {
if (!cssHexes.has(hex)) {
errors.push(`palette.ts 的 #${hex} 在 tokens.css 里没有对应变量(JS 与 CSS 已漂移)`);
}
}
/* ---------- 2. 子应用不得写死颜色 ---------- */
const SUBAPP_ROOTS = ['system', 'store', 'points'].map((name) =>
path.join(ROOT, 'apps/web/subapps', name, 'src'),
);
const walk = (dir, out = []) => {
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
const full = path.join(dir, entry.name);
if (entry.isDirectory()) walk(full, out);
else if (/\.(css|tsx?)$/.test(entry.name)) out.push(full);
}
return out;
};
for (const root of SUBAPP_ROOTS) {
if (!fs.existsSync(root)) continue;
for (const file of walk(root)) {
const lines = fs.readFileSync(file, 'utf8').split(/\r?\n/);
lines.forEach((line, index) => {
const hit = /#[0-9a-fA-F]{3,8}\b/.exec(line);
if (hit) {
errors.push(
`${path.relative(ROOT, file)}:${index + 1} 写死颜色 ${hit[0]},请改用 var(--uj-*) 令牌`,
);
}
});
}
}
if (errors.length) {
console.error(`[tokens] 未通过 ${errors.length} 项:`);
for (const error of errors) console.error(` - ${error}`);
process.exit(1);
}
console.log(
`[tokens] 通过:palette ${paletteHexes.size} 个色值与 tokens.css 对齐,子应用无写死颜色。`,
);
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!