Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
ujia
/
uj-store
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 2c3be24c
authored
Oct 15, 2026
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'v1.0.0' of
http://192.168.3.233:8090/ujia/uj-store
into v1.0.0
2 parents
90ab68f9
21a74715
Pipeline
#360
for
2c3be24c
failed
in 0 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
202 additions
and
6 deletions
src/components/DataTable/index.tsx
src/features/store/ApprovalDetailPresentation.tsx
src/features/store/StoreDetailDrawer.test.tsx
src/pages/StoreApprove/__tests__/StoreApprove.test.tsx
src/pages/StoreApprove/approveTable.css
src/pages/StoreApprove/components/ApprovalActionModal.test.tsx
src/pages/StoreApprove/components/ApprovalActionModal.tsx
src/pages/StoreApprove/index.tsx
src/pages/StoreApprove/tools/columns.tsx
src/components/DataTable/index.tsx
View file @
2c3be24
...
...
@@ -304,5 +304,7 @@ function lineStyle(line: number): CSSProperties {
overflow: 'hidden',
WebkitBoxOrient: 'vertical',
WebkitLineClamp: line,
whiteSpace: 'pre-wrap',
overflowWrap: 'anywhere',
};
}
src/features/store/ApprovalDetailPresentation.tsx
View file @
2c3be24
...
...
@@ -278,7 +278,7 @@ export function ApprovalAuditTrail({
const approved = detail.status === 'APPROVED';
const showHours =
typeof pendingHours === 'number' && Number.isFinite(pendingHours) && pendingHours >= 0;
const futureCaption =
roles.length === 1
? '通过后即可生效' : '全部审批节点通过后自动生效';
const futureCaption =
level === roles.length
? '通过后即可生效' : '全部审批节点通过后自动生效';
return (
<section className="approval-detail-audit" aria-label="审批留痕列表">
...
...
@@ -332,6 +332,22 @@ export function ApprovalAuditTrail({
</div>
</div>
</article>
{roles.slice(level).map((role, index) => (
<article key={role} className="approval-detail-chaincard" aria-label="后续审批节点">
<span
className="approval-detail-chaincard__icon approval-detail-chaincard__icon--waiting"
aria-hidden="true"
>
{level + index + 1}
</span>
<div className="approval-detail-chaincard__content">
<div className="approval-detail-chaincard__title">
{role} · 第 {level + index + 1} 级审批节点(待流转)
</div>
<div className="approval-detail-chaincard__meta">待前序节点通过</div>
</div>
</article>
))}
<article className="approval-detail-chaincard" aria-label="待生效节点">
<span
className="approval-detail-chaincard__icon approval-detail-chaincard__icon--waiting"
...
...
src/features/store/StoreDetailDrawer.test.tsx
View file @
2c3be24
...
...
@@ -325,6 +325,40 @@ describe('store detail presentation', () => {
expect(screen.getByText(/192\.0\.2\.1/)).toBeInTheDocument();
});
it('includes the future finance node between the current business node and activation', () => {
show({
initialTab: 'logs',
detail: {
...detail,
approvalLogs: [
{ action: 'SUBMIT', operatorName: '运营甲', operateTime: detail.submitTime },
],
},
});
const trail = within(screen.getByLabelText('审批留痕列表'));
const cards = trail.getAllByRole('article');
expect(cards).toHaveLength(4);
expect(cards[1]).toHaveTextContent('优加商务经理');
expect(cards[2]).toHaveTextContent('优加财务经理');
expect(cards[2]).toHaveTextContent('待前序节点通过');
expect(cards[2]).not.toHaveTextContent('当前节点');
expect(cards[3]).toHaveTextContent('生效 · 写入门店列表');
});
it.each([1, 2])(
'does not duplicate finance or imply more approval at final level %s',
(totalLevel) => {
show({
initialTab: 'logs',
detail: { ...detail, totalLevel, currentLevel: totalLevel, approvalLogs: [] },
});
const trail = within(screen.getByLabelText('审批留痕列表'));
expect(trail.getAllByText(/优加财务经理/)).toHaveLength(1);
expect(trail.queryByLabelText('后续审批节点')).not.toBeInTheDocument();
expect(trail.getByLabelText('当前审批节点')).toHaveTextContent('通过后即可生效');
},
);
it('opens listing history directly and shows newest changes first', () => {
show({ mode: 'listing', initialTab: 'history', detail: { ...detail, status: 'APPROVED' } });
expect(screen.getByRole('tab', { name: '变更历史' })).toHaveAttribute('aria-selected', 'true');
...
...
src/pages/StoreApprove/__tests__/StoreApprove.test.tsx
View file @
2c3be24
...
...
@@ -110,6 +110,28 @@ function actionDialog(confirmLabel: string) {
}
describe('门店审批页面', () => {
it.each(['handleOpinion', 'rejectReason'] as const)(
'我已办的长意见支持换行省略和悬停查看全文(%s)',
async (source) => {
const opinion = '请核对政策。\n' + '产品分类与业务场景需要逐项确认。'.repeat(12) + 'END-OF-OPINION';
api.listApprovals.mockResolvedValue({
records: [{ ...row, [source]: opinion }],
total: 1,
current: 1,
size: 10,
pages: 1,
});
mount();
fireEvent.click(screen.getByRole('tab', { name: /我已办/ }));
const text = await screen.findByText(opinion, { exact: true, normalizer: (value) => value });
fireEvent.mouseOver(text);
const tooltip = await screen.findByRole('tooltip');
expect(tooltip).toHaveTextContent('END-OF-OPINION');
expect(tooltip).toHaveTextContent('产品分类与业务场景需要逐项确认。');
expect(text).toHaveStyle({ whiteSpace: 'pre-wrap', overflowWrap: 'anywhere' });
},
);
it('按原型展示分类摘要、无币种前缀的权威成本、提交时间和停留时长', async () => {
pending = [
{
...
...
src/pages/StoreApprove/approveTable.css
View file @
2c3be24
.store-approve-table-card
{
/* 保留表格自然高度,由页面内容区滚动,避免 flex 收缩后裁掉底部行和分页。 */
flex-shrink
:
0
;
}
.store-approve-table.ant-table-wrapper
.ant-table
.ant-table-thead
>
tr
>
th
{
height
:
38px
;
padding
:
0
12px
;
...
...
src/pages/StoreApprove/components/ApprovalActionModal.test.tsx
0 → 100644
View file @
2c3be24
import { render, screen, within } from '@testing-library/react';
import { describe, expect, it, vi } from 'vitest';
import type { ApprovalRow } from '@/api';
import { ApprovalActionModal, type ApprovalActionType } from './ApprovalActionModal';
function renderAction(
levels: Array<Pick<ApprovalRow, 'currentLevel' | 'totalLevel'>>,
type: ApprovalActionType = 'pass',
) {
const records: ApprovalRow[] = levels.map((level, index) => ({
listingId: String(index + 1),
storeName: `门店${index + 1}`,
merchantNo: `SQ00${index + 1}`,
businessScene: '精品升级',
status: 'PENDING',
...level,
}));
render(
<ApprovalActionModal
action={{ type, records }}
pending={false}
confirmed={false}
reason=""
onConfirmed={vi.fn()}
onReason={vi.fn()}
onCancel={vi.fn()}
onConfirm={vi.fn()}
/>,
);
return within(screen.getByRole('dialog')).getByRole('alert');
}
describe('通过确认的审批结果提示', () => {
it.each([
{ currentLevel: 2, totalLevel: 2 },
{ currentLevel: 1, totalLevel: 1 },
{ currentLevel: 3, totalLevel: 3 },
])('第 $currentLevel / $totalLevel 级终审通过后提示生效,不提示还有后续审批', (level) => {
const alert = renderAction([level]);
expect(alert).toHaveTextContent('通过当前审批节点后,记录将立即生效并进入门店列表。');
expect(alert).not.toHaveTextContent('后续审批');
});
it('中间审批节点提示仍需后续审批', () => {
const alert = renderAction([{ currentLevel: 1, totalLevel: 2 }]);
expect(alert).toHaveTextContent('记录将继续后续审批');
expect(alert).not.toHaveTextContent('立即生效');
});
it('批量全部终审时提示生效,不受终审总层级差异影响', () => {
const alert = renderAction(
[
{ currentLevel: 1, totalLevel: 1 },
{ currentLevel: 2, totalLevel: 2 },
],
'batch',
);
expect(alert).toHaveTextContent('记录将立即生效并进入门店列表');
expect(alert).not.toHaveTextContent('后续审批');
});
it('批量包含不同审批阶段时分别说明终审生效和继续后续审批', () => {
const alert = renderAction(
[
{ currentLevel: 2, totalLevel: 2 },
{ currentLevel: 1, totalLevel: 2 },
],
'batch',
);
expect(alert).toHaveTextContent('终审记录通过后将立即生效并进入门店列表');
expect(alert).toHaveTextContent('其余记录将继续后续审批');
});
it.each([
{},
{ currentLevel: null, totalLevel: null },
{ currentLevel: 0, totalLevel: 0 },
{ currentLevel: 3, totalLevel: 2 },
])('缺少或非法审批层级不承诺立即生效,也不假定还有后续审批:%j', (level) => {
const alert = renderAction([level]);
expect(alert).toHaveTextContent('系统将按记录的审批进度处理');
expect(alert).not.toHaveTextContent('立即生效');
expect(alert).not.toHaveTextContent('继续后续审批');
});
it('批量存在未知层级时不会将已知终审结果套用到全部记录', () => {
const alert = renderAction([{ currentLevel: 2, totalLevel: 2 }, {}], 'batch');
expect(alert).toHaveTextContent('系统将按记录的审批进度处理');
expect(alert).not.toHaveTextContent('立即生效');
});
});
src/pages/StoreApprove/components/ApprovalActionModal.tsx
View file @
2c3be24
...
...
@@ -21,6 +21,30 @@ const buttons: Record<ApprovalActionType, string> = {
batch: '确认批量通过',
revoke: '确认撤回',
};
function approvalResultMessage(records: ApprovalRow[]) {
const hasUnknownLevel = records.some(
({ currentLevel, totalLevel }) =>
typeof currentLevel !== 'number' ||
typeof totalLevel !== 'number' ||
!Number.isInteger(currentLevel) ||
!Number.isInteger(totalLevel) ||
currentLevel < 1 ||
totalLevel < currentLevel,
);
if (!records.length || hasUnknownLevel) {
return '通过当前审批节点后,系统将按记录的审批进度处理;完成全部审批节点后生效并进入门店列表。';
}
const finalCount = records.filter((row) => row.currentLevel === row.totalLevel).length;
if (finalCount === records.length) {
return '通过当前审批节点后,记录将立即生效并进入门店列表。';
}
if (finalCount > 0) {
return '本次审批包含不同审批阶段的记录:终审记录通过后将立即生效并进入门店列表;其余记录将继续后续审批,全部节点通过后生效。';
}
return '通过当前审批节点后,记录将继续后续审批;全部节点通过后才会生效并进入门店列表。';
}
interface Props {
action?: ApprovalAction;
spec?: StoreDictionaries;
...
...
@@ -71,7 +95,7 @@ export function ApprovalActionModal({
type="info"
showIcon
title="审批范围为门店+业务场景下的全部产品分类"
description=
"通过当前审批节点后,记录将继续后续审批;全部节点通过后才会生效并进入门店列表。"
description=
{approvalResultMessage(action?.records ?? [])}
/>
) : type === 'revoke' ? (
<UAlert type="warning" showIcon title="撤回后记录将退出当前审批流程。" />
...
...
src/pages/StoreApprove/index.tsx
View file @
2c3be24
...
...
@@ -313,7 +313,7 @@ export default function StoreApprove() {
) : list.isPending ? (
<Skeleton variant="table" />
) : (
<div className="store-table-card">
<div className="store-table-card
store-approve-table-card
">
<DataTable<ApprovalRow>
className="store-approve-table"
columns={buildApproveColumns(tab, STORE_DICTIONARIES)}
...
...
src/pages/StoreApprove/tools/columns.tsx
View file @
2c3be24
import type {
ColumnsType } from 'antd/es/t
able';
import type {
DataTableColumnsType } from '@/components/DataT
able';
import { UTag, UTooltip } from '@uj/ui';
import { StatusTag } from '@/components/StatusTag';
import type { ApprovalRow, ApproveTab } from '@/api';
...
...
@@ -16,8 +16,8 @@ function formatSubmitTime(value?: string | null): string {
export function buildApproveColumns(
tab: ApproveTab,
spec?: StoreDictionaries,
): ColumnsType<ApprovalRow> {
const columns: ColumnsType<ApprovalRow> = [
):
DataTable
ColumnsType<ApprovalRow> {
const columns:
DataTable
ColumnsType<ApprovalRow> = [
{
title: '门店名称',
dataIndex: 'storeName',
...
...
@@ -140,7 +140,9 @@ export function buildApproveColumns(
{ title: '处理时间', dataIndex: 'handleTime', width: 150, render: formatDateTime },
{
title: '处理意见',
key: 'handleOpinion',
width: 220,
line: 2,
render: (_, row) => row.handleOpinion || row.rejectReason || '—',
},
{ title: '记录状态', width: 100, render: (_, row) => <StatusTag status={row.status} /> },
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment