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 986 additions and 1349 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
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!