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 80880e3f
authored
Oct 10, 2026
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix(access): 修复权限点号残留并清理合并集成类型错误
1 parent
61c13c53
Pipeline
#316
for
80880e3f
failed
in 0 seconds
Changes
15
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
76 additions
and
160 deletions
.workbuddy/memory/2026-10-10.md
pnpm-lock.yaml
src/access/points.ts
src/access/runtime/AccessProvider.tsx
src/api/modules/__tests__/store.test.ts
src/api/modules/store.ts
src/components/__tests__/store-permissions.test.tsx
src/pages/TemplateImport/components/FailDetailCard.tsx
src/pages/TemplateImport/components/PolicyConfirmTable/index.tsx
src/pages/TemplateImport/components/SubmitConfirmCard.tsx
src/pages/TemplateImport/components/UploadCard.tsx
src/pages/TemplateImport/components/ValidationStats.tsx
src/pages/TemplateImport/index.tsx
src/router/index.tsx
src/store/useAppStore.ts
.workbuddy/memory/2026-10-10.md
View file @
80880e3
...
@@ -40,3 +40,25 @@
...
@@ -40,3 +40,25 @@
3.
角色改由 antd
`Tag color="blue"`
渲染;窄屏(<1100px)
`.uj-profile-grid`
退化为单列。
3.
角色改由 antd
`Tag color="blue"`
渲染;窄屏(<1100px)
`.uj-profile-grid`
退化为单列。
-
`UCard`
即 antd
`Card`
,可吃
`className`
+
`styles={{body}}`
(渐变背景直接设在 body 上,避免圆角错位)。
-
`UCard`
即 antd
`Card`
,可吃
`className`
+
`styles={{body}}`
(渐变背景直接设在 body 上,避免圆角错位)。
-
类型检查
`tsc --noEmit`
通过(EXIT=0)。
-
类型检查
`tsc --noEmit`
通过(EXIT=0)。
## 权限点映射改动的全局消费方排查(合并后)
-
背景:远端分支合并进本地(merge 已由超人提交
`c36c047`
),需排查"移除 RESOURCE_ALIAS + ResourceKey 改冒号"后哪些页面/组件受影响。
-
**权限判定两条独立路径**
(关键,别混淆):
-
页面级
`can(resource)`
→ 走
`points`
集合(生产为后端 permCodes;开发兜底为
`matrixToPoints`
推导的裸资源码 +
`:manage`
)。
`can`
有三段兜底:
`points.has(resource)`
→
`:manage`
→
`startsWith(resource + ':')`
,所以后端只下发
`store:approve:view`
时
`can('store:approve')`
仍能命中。
-
按钮级
`canPoint(point)`
→ 严格
`points.has(point)`
,
**无兜底**
,必须与后端码逐字符一致。
-
**本次修复的点号残留(映射改动的直接债务)**
:
-
`points.ts`
:
`STORE_APPROVE_MANAGE`
由
`'store.approve:manage'`
→
`'store:approve:manage'`
;
`STORE_LISTING_DELETE`
由
`'store.listing:delete'`
→
`'store:list:delete'`
。两者当前无源码引用(仅 docs 出现),但值错会在未来引用时静默隐藏按钮。
-
`points.ts`
:
`STORE_APPROVE`
/
`STORE_LISTING`
恢复为
**裸资源**
(
`'store:approve'`
/
`'store:list'`
),与其"页面级裸资源"注释一致,与
`STORE_*_VIEW`
区分职责。
-
`store-permissions.test.tsx:54-55`
:
`can('store.approve')`
/
`can('store.listing')`
→
`can('store:approve')`
/
`can('store:list')`
(同时修命名 listing→list)。这是 tsc 报错源之一。
-
**已核实未受影响的消费方**
(不用动):
`AccountManage`
(
`SYSTEM_USER_SAVE`
)、
`RoleManage`
(
`SYSTEM_ROLE_VIEW/SAVE`
)、
`StoreApprove`
/
`StoreListing`
的
`P.*`
调用点、
`columns.tsx`
的
`Perm`
。它们都按常量名引用,改值即生效。
-
**顺带修的合并集成错误(非权限相关)**
:
-
`PolicyConfirmTable/index.tsx`
:给
`tableProps`
显式标注
`TableProps<PolicyConfirmRow>`
,修
`pagination: false`
被推断成
`boolean`
导致赋给
`UTable`
类型不兼容;同时去掉冗余
`as const`
。(根因:
`@uj/ui`
的
`UTable`
只是 antd Table 薄封装,
**不存在 `UTableProps` 类型**
,改用 antd
`TableProps`
。)
-
`ValidationStats.tsx:107`
:把后端下发的
`distinctProductCategoryCount`
(变量
`categoryCount`
)补回统计 desc 文案,而非删变量。
-
`useAppStore.ts`
:
`login`
/
`setCurrentUser`
/
`currentUser`
的
`account`
改为
**可选**
,兼容合并进来的测试
`login({name, role})`
。已确认
`currentUser.account`
仅
`Dashboard:121`
使用且已有
`|| '-'`
兜底。
-
`store.test.ts:187,198`
:
`payload`
改为
`{ listingIds: [1001, 1002] }`
、
`uploadImport({ file })`
,对齐
`store.ts`
当前签名。
-
**遗留待超人拍板(我没擅自改)**
:
-
`store.test.ts:191`
断言
`config.data.get('templateVersion') === 'V1.0.1'`
,但
`store.ts`
的
`uploadImport`
实现
**只 append `file`/`remark`,不 append `templateVersion`**
。这条断言编译能过、运行时必失败。需决定:是给实现补
`templateVersion`
入参(远端分支的新契约),还是删掉该断言。
-
`P.STORE_APPROVE_AUDIT`
/
`P.STORE_LISTING_DELETE`
仍挂后端不存在的动作码(见上一节)。
-
**环境限制(非代码问题)**
:
`node_modules`
缺
`vitest`
/
`@testing-library/react`
/
`lossless-json`
(
`package.json`
均已声明)。沙箱内 pnpm 因 shell 缺
`sed/dirname/uname`
跑不起来,需超人在
**本机终端**
执行
`pnpm install`
。缺依赖会导致 39 条
`TS2307`
+ 连带
`TS7006/TS7031 implicit any`
报错。
-
最终状态:
**真实类型错误 0 条**
,剩余全部为缺依赖所致。
pnpm-lock.yaml
View file @
80880e3
...
@@ -44,7 +44,7 @@ importers:
...
@@ -44,7 +44,7 @@ importers:
devDependencies
:
devDependencies
:
'
@testing-library/jest-dom'
:
'
@testing-library/jest-dom'
:
specifier
:
^7.0.1
specifier
:
^7.0.1
version
:
7.0.1(@testing-library/dom@10.4.2)(vitest@5.0.2(
jsdom@30.1.1)(vite@6.4.3
(yaml@2.9.1)))
version
:
7.0.1(@testing-library/dom@10.4.2)(vitest@5.0.2(
@types/node@26.6.5)(jsdom@30.1.1)(vite@6.4.3(@types/node@26.6.5)
(yaml@2.9.1)))
'
@testing-library/react'
:
'
@testing-library/react'
:
specifier
:
^16.3.3
specifier
:
^16.3.3
version
:
16.3.3(@testing-library/dom@10.4.2)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)
version
:
16.3.3(@testing-library/dom@10.4.2)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)
...
@@ -93,6 +93,9 @@ importers:
...
@@ -93,6 +93,9 @@ importers:
vite
:
vite
:
specifier
:
^6.0.0
specifier
:
^6.0.0
version
:
6.4.3(@types/node@26.6.5)(yaml@2.9.1)
version
:
6.4.3(@types/node@26.6.5)(yaml@2.9.1)
vitest
:
specifier
:
^5.0.2
version
:
5.0.2(@types/node@26.6.5)(jsdom@30.1.1)(vite@6.4.3(@types/node@26.6.5)(yaml@2.9.1))
packages/ui
:
packages/ui
:
devDependencies
:
devDependencies
:
...
@@ -2048,6 +2051,7 @@ packages:
...
@@ -2048,6 +2051,7 @@ packages:
undici-types@8.9.0
:
undici-types@8.9.0
:
resolution
:
{
integrity
:
sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==
}
resolution
:
{
integrity
:
sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==
}
undici@8.11.2
:
undici@8.11.2
:
resolution
:
{
integrity
:
sha512-u4UB2/IrKdU6lFxumHmmo1a3fCQO5tzQllRorfoRS63txhrB7xTpSn1PftwC4qEHkOaqP95fCWW4lJzwErwzhQ==
}
resolution
:
{
integrity
:
sha512-u4UB2/IrKdU6lFxumHmmo1a3fCQO5tzQllRorfoRS63txhrB7xTpSn1PftwC4qEHkOaqP95fCWW4lJzwErwzhQ==
}
engines
:
{
node
:
'
>=22.19.0'
}
engines
:
{
node
:
'
>=22.19.0'
}
...
@@ -3037,7 +3041,7 @@ snapshots:
...
@@ -3037,7 +3041,7 @@ snapshots:
picocolors
:
1.1.1
picocolors
:
1.1.1
pretty-format
:
27.5.1
pretty-format
:
27.5.1
'
@testing-library/jest-dom@7.0.1(@testing-library/dom@10.4.2)(vitest@5.0.2(
jsdom@30.1.1)(vite@6.4.3
(yaml@2.9.1)))'
:
'
@testing-library/jest-dom@7.0.1(@testing-library/dom@10.4.2)(vitest@5.0.2(
@types/node@26.6.5)(jsdom@30.1.1)(vite@6.4.3(@types/node@26.6.5)
(yaml@2.9.1)))'
:
dependencies
:
dependencies
:
'
@adobe/css-tools'
:
4.5.0
'
@adobe/css-tools'
:
4.5.0
'
@testing-library/dom'
:
10.4.2
'
@testing-library/dom'
:
10.4.2
...
@@ -3047,7 +3051,7 @@ snapshots:
...
@@ -3047,7 +3051,7 @@ snapshots:
picocolors
:
1.1.1
picocolors
:
1.1.1
redent
:
3.0.0
redent
:
3.0.0
optionalDependencies
:
optionalDependencies
:
vitest
:
5.0.2(
jsdom@30.1.1)(vite@6.4.3
(yaml@2.9.1))
vitest
:
5.0.2(
@types/node@26.6.5)(jsdom@30.1.1)(vite@6.4.3(@types/node@26.6.5)
(yaml@2.9.1))
'
@testing-library/react@16.3.3(@testing-library/dom@10.4.2)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)'
:
'
@testing-library/react@16.3.3(@testing-library/dom@10.4.2)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)'
:
dependencies
:
dependencies
:
...
@@ -3175,14 +3179,14 @@ snapshots:
...
@@ -3175,14 +3179,14 @@ snapshots:
transitivePeerDependencies
:
transitivePeerDependencies
:
-
supports-color
-
supports-color
'
@vitest/mocker@5.0.2(vite@6.4.3(yaml@2.9.1))'
:
'
@vitest/mocker@5.0.2(vite@6.4.3(
@types/node@26.6.5)(
yaml@2.9.1))'
:
dependencies
:
dependencies
:
'
@jridgewell/trace-mapping'
:
0.3.31
'
@jridgewell/trace-mapping'
:
0.3.31
'
@vitest/spy'
:
5.0.2
'
@vitest/spy'
:
5.0.2
estree-walker
:
3.0.3
estree-walker
:
3.0.3
magic-string
:
1.4.2
magic-string
:
1.4.2
optionalDependencies
:
optionalDependencies
:
vite
:
6.4.3(yaml@2.9.1)
vite
:
6.4.3(
@types/node@26.6.5)(
yaml@2.9.1)
'
@vitest/spy@5.0.2'
:
{}
'
@vitest/spy@5.0.2'
:
{}
...
@@ -4120,6 +4124,7 @@ snapshots:
...
@@ -4120,6 +4124,7 @@ snapshots:
typescript@5.9.3
:
{}
typescript@5.9.3
:
{}
undici-types@8.9.0
:
{}
undici-types@8.9.0
:
{}
undici@8.11.2
:
{}
undici@8.11.2
:
{}
update-browserslist-db@1.3.3(browserslist@4.29.2)
:
update-browserslist-db@1.3.3(browserslist@4.29.2)
:
...
@@ -4145,10 +4150,10 @@ snapshots:
...
@@ -4145,10 +4150,10 @@ snapshots:
fsevents
:
2.3.3
fsevents
:
2.3.3
yaml
:
2.9.1
yaml
:
2.9.1
vitest@5.0.2(
jsdom@30.1.1)(vite@6.4.3
(yaml@2.9.1))
:
vitest@5.0.2(
@types/node@26.6.5)(jsdom@30.1.1)(vite@6.4.3(@types/node@26.6.5)
(yaml@2.9.1))
:
dependencies
:
dependencies
:
'
@types/chai'
:
5.2.3
'
@types/chai'
:
5.2.3
'
@vitest/mocker'
:
5.0.2(vite@6.4.3(yaml@2.9.1))
'
@vitest/mocker'
:
5.0.2(vite@6.4.3(
@types/node@26.6.5)(
yaml@2.9.1))
chai
:
6.2.2
chai
:
6.2.2
es-module-lexer
:
2.3.2
es-module-lexer
:
2.3.2
expect-type
:
1.4.0
expect-type
:
1.4.0
...
@@ -4159,9 +4164,10 @@ snapshots:
...
@@ -4159,9 +4164,10 @@ snapshots:
tinybench
:
6.2.0
tinybench
:
6.2.0
tinyexec
:
1.3.1
tinyexec
:
1.3.1
tinyglobby
:
0.2.17
tinyglobby
:
0.2.17
vite
:
6.4.3(yaml@2.9.1)
vite
:
6.4.3(
@types/node@26.6.5)(
yaml@2.9.1)
why-is-node-running
:
3.2.2
why-is-node-running
:
3.2.2
optionalDependencies
:
optionalDependencies
:
'
@types/node'
:
26.6.5
jsdom
:
30.1.1
jsdom
:
30.1.1
transitivePeerDependencies
:
transitivePeerDependencies
:
-
msw
-
msw
...
...
src/access/points.ts
View file @
80880e3
...
@@ -8,17 +8,21 @@
...
@@ -8,17 +8,21 @@
export
type
PermissionPoint
=
string
;
export
type
PermissionPoint
=
string
;
export
const
P
=
{
export
const
P
=
{
// 门店审批
// 门店审批(后端码:store:approve:*)
STORE_APPROVE
:
'store:approve:view'
,
/** 页面级裸资源:供 can() 判定页面可见性,不用于 canPoint */
STORE_APPROVE
:
'store:approve'
,
STORE_APPROVE_VIEW
:
'store:approve:view'
,
STORE_APPROVE_VIEW
:
'store:approve:view'
,
STORE_APPROVE_MANAGE
:
'store.approve:manage'
,
STORE_APPROVE_MANAGE
:
'store:approve:manage'
,
/** 「审核」按钮挂在后端的审批通过动作码上 */
STORE_APPROVE_AUDIT
:
'store:approve:pass'
,
STORE_APPROVE_AUDIT
:
'store:approve:pass'
,
STORE_APPROVE_REJECT
:
'store:approve:reject'
,
STORE_APPROVE_REJECT
:
'store:approve:reject'
,
// 门店列表
// 门店列表(后端码:store:list:*)
STORE_LISTING
:
'store:list:view'
,
/** 页面级裸资源:供 can() 判定页面可见性,不用于 canPoint */
STORE_LISTING
:
'store:list'
,
STORE_LISTING_VIEW
:
'store:list:view'
,
STORE_LISTING_VIEW
:
'store:list:view'
,
STORE_LISTING_EXPORT
:
'store:list:export'
,
STORE_LISTING_EXPORT
:
'store:list:export'
,
STORE_LISTING_DELETE
:
'store.listing:delete'
,
/** 后端当前未下发删除动作码,引用此点的按钮默认隐藏 */
STORE_LISTING_DELETE
:
'store:list:delete'
,
/** 角色管理
/** 角色管理
* system:role:view - 查看角色详情
* system:role:view - 查看角色详情
* system:role:save - 新增/编辑/删除角色
* system:role:save - 新增/编辑/删除角色
...
...
src/access/runtime/AccessProvider.tsx
View file @
80880e3
...
@@ -80,7 +80,7 @@ export function AccessProvider({ children }: { children: ReactNode }) {
...
@@ -80,7 +80,7 @@ export function AccessProvider({ children }: { children: ReactNode }) {
can: (resource, required = 'view') => {
can: (resource, required = 'view') => {
if (points.has(resource)) return true;
if (points.has(resource)) return true;
if (required === 'full') return points.has(`${resource}:manage`);
if (required === 'full') return points.has(`${resource}:manage`);
// 后端若只下发叶子权限码(如 store
.listing
:export),亦视为该资源可见
// 后端若只下发叶子权限码(如 store
:list
:export),亦视为该资源可见
return [...points].some((p) => p.startsWith(`${resource}:`));
return [...points].some((p) => p.startsWith(`${resource}:`));
},
},
points,
points,
...
...
src/api/modules/__tests__/store.test.ts
View file @
80880e3
...
@@ -184,7 +184,8 @@ describe('store API contract', () => {
...
@@ -184,7 +184,8 @@ describe('store API contract', () => {
it
(
'retains existing import upload and submission behavior'
,
async
()
=>
{
it
(
'retains existing import upload and submission behavior'
,
async
()
=>
{
const
file
=
new
File
([
'example'
],
'import.xlsx'
);
const
file
=
new
File
([
'example'
],
'import.xlsx'
);
const
payload
=
{
taskId
:
'task-1'
,
storeName
:
'门店'
,
businessScene
:
'AFTER_SALE_MEMBER'
};
// 契约对齐 store.ts:submitImport 只接收 listingIds(草稿记录 ID 列表)
const
payload
=
{
listingIds
:
[
1001
,
1002
]
};
serve
((
config
)
=>
{
serve
((
config
)
=>
{
if
(
config
.
url
===
'/store/import/check'
)
{
if
(
config
.
url
===
'/store/import/check'
)
{
expect
(
config
.
data
.
get
(
'file'
)).
toBe
(
file
);
expect
(
config
.
data
.
get
(
'file'
)).
toBe
(
file
);
...
@@ -195,7 +196,7 @@ describe('store API contract', () => {
...
@@ -195,7 +196,7 @@ describe('store API contract', () => {
expect
(
JSON
.
parse
(
config
.
data
)).
toEqual
(
payload
);
expect
(
JSON
.
parse
(
config
.
data
)).
toEqual
(
payload
);
return
{
data
:
result
({
approveId
:
'approval-1'
})
};
return
{
data
:
result
({
approveId
:
'approval-1'
})
};
});
});
expect
(
await
store
.
uploadImport
(
file
)).
toEqual
({
taskId
:
'task-1'
});
expect
(
await
store
.
uploadImport
(
{
file
}
)).
toEqual
({
taskId
:
'task-1'
});
expect
(
await
store
.
submitImport
(
payload
)).
toEqual
({
approveId
:
'approval-1'
});
expect
(
await
store
.
submitImport
(
payload
)).
toEqual
({
approveId
:
'approval-1'
});
});
});
});
});
...
...
src/api/modules/store.ts
View file @
80880e3
...
@@ -119,113 +119,14 @@ export interface StoreImportCheckVO {
...
@@ -119,113 +119,14 @@ export interface StoreImportCheckVO {
listingIds
:
number
[];
listingIds
:
number
[];
/** 是否已落库(导入成功为 true;仅校验失败为 false) */
/** 是否已落库(导入成功为 true;仅校验失败为 false) */
submitted
:
boolean
;
submitted
:
boolean
;
}
/** 导入文件名(校验结果展示用,可选) */
fileName
?:
string
;
/** POST /store/import/check 请求参数(FormData) */
/** 导入文件大小(字节,可选) */
export
interface
StoreImportCheckParams
{
fileSize
?:
number
;
file
:
File
;
/** L1 格式 / 模板版本校验是否通过(false 表示格式不正确或模板版本不一致) */
/** 备注(可选,≤ 200 字) */
failL1Passed
?:
boolean
;
remark
?:
string
;
/** L2 列结构校验是否通过(false 表示存在缺失列或多余列) */
}
failL2Passed
?:
boolean
;
/** POST /store/import/submit 请求体:把草稿记录提交为待审批(不重新解析文件) */
export
interface
StoreImportCommitDTO
{
/** 导入返回的上架记录 ID 列表(同一门店的多个业务场景) */
listingIds
:
number
[];
}
/** 校验失败明细行 */
export
interface
StoreImportFailVO
{
rowIndex
?:
number
;
storeName
:
string
;
merchantNo
:
string
;
productCategory
:
string
;
/** 校验层级编码:L3-单元格级 L4-业务级 L5-重复上架级 */
levelCode
:
string
;
/** 校验层级文案:如「L4 业务级」 */
levelLabel
:
string
;
/** 失败原因 */
reason
:
string
;
}
/** 导入行(产品分类明细) */
export
interface
StoreImportRowDTO
{
/** 门店名称(营业执照全称) */
storeName
:
string
;
merchantNo
:
string
;
/** 业务场景(展示用 label,落库为 baseSceneCode) */
businessScene
:
string
;
/** 业务场景编码(D+ baseSceneCode,如 110102) */
businessSceneCode
:
string
;
/** 产品分类(系统字典标准名,可多级以「-」分隔) */
productCategory
:
string
;
/** 产品分类 ID(D+ dj_car_life_goods_category_configuration.category_type) */
productCategoryId
:
number
;
/** 产品分类层级(D+ dj_car_life_goods_category_configuration.level,1 起) */
productCategoryLevel
:
number
;
marketFee1CalcMode
:
string
;
marketFee1CalcWay
:
string
;
marketFee1Value
:
number
;
/** 数值单位:RATIO-比例 AMOUNT-金额(由计算方式推导) */
marketFee1Unit
:
string
;
marketFee2CalcMode
:
string
;
marketFee2CalcWay
:
string
;
marketFee2Value
:
number
;
marketFee2Unit
:
string
;
/** 一线阳光是否开启线上积分:1-是 0-否 */
sunshine1OnlinePoint
:
number
;
sunshine1CalcMode
:
string
;
sunshine1CalcWay
:
string
;
sunshine1Value
:
number
;
sunshine1Unit
:
string
;
sunshine2OnlinePoint
:
number
;
sunshine2CalcMode
:
string
;
sunshine2CalcWay
:
string
;
sunshine2Value
:
number
;
sunshine2Unit
:
string
;
/** 装修、设备总投入 */
costDecoration
:
number
;
/** 当月产生(房租、水电、耗材等) */
costMonthly
:
number
;
/** 人工成本 */
costLabor
:
number
;
}
/** POST /store/import/check 响应 data */
export
interface
StoreImportCheckVO
{
templateVersion
:
string
;
/** 解析总行数 */
totalRows
:
number
;
/** 校验通过行数 */
passRows
:
number
;
/** 校验失败行数 */
failRows
:
number
;
storeName
:
string
;
merchantNo
:
string
;
/** 所属组织(完整层级路径 label,例如「优加主体 / 线上运营部」) */
orgPath
:
string
;
/** 业务场景(多个以「/」分隔,label,例如「售后会员权益升级 / 售前延保」) */
businessScene
:
string
;
/** 产品分类(去重后的 label,多个以「/」分隔,例如「太阳膜-原厂/车衣-原厂/精品-小桌板」) */
productCategories
:
string
;
/** 校验失败明细 */
failures
:
StoreImportFailVO
[];
/** 导入行(产品分类明细) */
previewRows
:
StoreImportRowDTO
[];
/** 导入失败明细文件下载地址(全部成功时为 null) */
failFileUrl
:
string
|
null
;
/** 下一个待审批角色名称,如「优加商务经理」 */
nextRoleName
:
string
;
/** 去重后的产品分类数,例如 6(2 个业务场景 × 6 个分类 → 6) */
distinctProductCategoryCount
:
number
;
/** 去重后的业务场景数,例如 2 */
distinctBusinessSceneCount
:
number
;
/** 产品分类总行数,例如 12 */
productCategoryRowCount
:
number
;
/** 本次落库 / 提交的上架记录 ID(按业务场景拆分,一条 = 一个场景) */
listingIds
:
number
[];
/** 是否已落库(导入成功为 true;仅校验失败为 false) */
submitted
:
boolean
;
}
}
/** POST /store/import/check 请求参数(FormData) */
/** POST /store/import/check 请求参数(FormData) */
...
...
src/components/__tests__/store-permissions.test.tsx
View file @
80880e3
...
@@ -51,8 +51,8 @@ describe('门店操作权限', () => {
...
@@ -51,8 +51,8 @@ describe('门店操作权限', () => {
const { can } = useAccess();
const { can } = useAccess();
return (
return (
<>
<>
{can('store
.
approve') && <span>审批菜单</span>}
{can('store
:
approve') && <span>审批菜单</span>}
{can('store
.listing
') && <span>门店菜单</span>}
{can('store
:list
') && <span>门店菜单</span>}
</>
</>
);
);
}
}
...
...
src/pages/TemplateImport/components/FailDetailCard.tsx
View file @
80880e3
...
@@ -49,7 +49,6 @@ export function FailDetailCard({ checkResult, onReUpload }: FailDetailCardProps)
...
@@ -49,7 +49,6 @@ export function FailDetailCard({ checkResult, onReUpload }: FailDetailCardProps)
* 底部 L1 / L2 通过校验文字(复用 checkResult 的字段,无则从 failures.length 推断)
* 底部 L1 / L2 通过校验文字(复用 checkResult 的字段,无则从 failures.length 推断)
*/
*/
const l1 = useMemo(() => {
const l1 = useMemo(() => {
const file = checkResult?.fileName ? `${checkResult.fileName}` : '';
const size =
const size =
typeof checkResult?.fileSize === 'number'
typeof checkResult?.fileSize === 'number'
? checkResult.fileSize === 0
? checkResult.fileSize === 0
...
...
src/pages/TemplateImport/components/PolicyConfirmTable/index.tsx
View file @
80880e3
import { useMemo } from 'react';
import { useMemo } from 'react';
import { UCard, UTable, UText } from '@uj/ui';
import { UCard, UTable, UText } from '@uj/ui';
import type {
UTableProps } from '@uj/ui
';
import type {
TableProps } from 'antd
';
import { buildPolicyColumns } from './columns';
import { buildPolicyColumns } from './columns';
import type { StoreImportRowDTO } from '@/api/modules/store';
import type { StoreImportRowDTO } from '@/api/modules/store';
import { mockPolicyRows, convertPreviewRows } from '../../tools/policyTableData';
import { mockPolicyRows, convertPreviewRows } from '../../tools/policyTableData';
...
@@ -82,13 +82,14 @@ export function PolicyConfirmTable({
...
@@ -82,13 +82,14 @@ export function PolicyConfirmTable({
return mockPolicyRows;
return mockPolicyRows;
}, [dataSource, previewRows]);
}, [dataSource, previewRows]);
const tableProps = {
// 显式标注 TableProps:否则 pagination:false 会被推断成 boolean,赋给 UTable 时类型不兼容
const tableProps: TableProps<PolicyConfirmRow> = {
rowKey: (r: PolicyConfirmRow) => `${r.storeMerchantNo}-${r.businessScene}-${r.productCategory}`,
rowKey: (r: PolicyConfirmRow) => `${r.storeMerchantNo}-${r.businessScene}-${r.productCategory}`,
columns: columns as
U
TableProps<PolicyConfirmRow>['columns'],
columns: columns as TableProps<PolicyConfirmRow>['columns'],
dataSource: rows,
dataSource: rows,
size: 'middle'
as const
,
size: 'middle',
// tableLayout='fixed' 强制按每列 width 渲染,避免 ant 自动压缩到父容器宽度
// tableLayout='fixed' 强制按每列 width 渲染,避免 ant 自动压缩到父容器宽度
tableLayout: 'fixed'
as const
,
tableLayout: 'fixed',
// 明确给 scroll.x,让 antd Table 内部生成横向滚动容器(内层 table width=x)
// 明确给 scroll.x,让 antd Table 内部生成横向滚动容器(内层 table width=x)
scroll: { x: scrollX },
scroll: { x: scrollX },
pagination: false,
pagination: false,
...
...
src/pages/TemplateImport/components/SubmitConfirmCard.tsx
View file @
80880e3
...
@@ -37,10 +37,7 @@ const descStyle: React.CSSProperties = {
...
@@ -37,10 +37,7 @@ const descStyle: React.CSSProperties = {
marginLeft: 6,
marginLeft: 6,
};
};
function buildInfoFromCheckResult(
function buildInfoFromCheckResult(vo: StoreImportCheckVO): SubmitConfirmInfo {
vo: StoreImportCheckVO,
currentUserName: string,
): SubmitConfirmInfo {
const preview = vo.previewRows ?? [];
const preview = vo.previewRows ?? [];
const first = preview[0];
const first = preview[0];
const deco = Math.round(first?.costDecoration ?? 0);
const deco = Math.round(first?.costDecoration ?? 0);
...
@@ -81,7 +78,7 @@ export function SubmitConfirmCard({
...
@@ -81,7 +78,7 @@ export function SubmitConfirmCard({
const userName = currentUser.name ?? '管理员';
const userName = currentUser.name ?? '管理员';
const fallbackInfo: SubmitConfirmInfo = useMemo(
const fallbackInfo: SubmitConfirmInfo = useMemo(
() => buildInfoFromCheckResult(checkResult ?? ({} as StoreImportCheckVO)
, userName
),
() => buildInfoFromCheckResult(checkResult ?? ({} as StoreImportCheckVO)),
[checkResult, userName],
[checkResult, userName],
);
);
...
...
src/pages/TemplateImport/components/UploadCard.tsx
View file @
80880e3
...
@@ -142,7 +142,7 @@ export function UploadCard({
...
@@ -142,7 +142,7 @@ export function UploadCard({
name: f.name,
name: f.name,
size: f.size,
size: f.size,
type: f.type,
type: f.type,
originFileObj: f,
originFileObj: f
as RcFile
,
status: 'done',
status: 'done',
});
});
...
...
src/pages/TemplateImport/components/ValidationStats.tsx
View file @
80880e3
...
@@ -97,7 +97,6 @@ function buildStatsFromCheckResult(vo: StoreImportCheckVO): StatItem[] {
...
@@ -97,7 +97,6 @@ function buildStatsFromCheckResult(vo: StoreImportCheckVO): StatItem[] {
const rows = vo.productCategoryRowCount ?? vo.totalRows;
const rows = vo.productCategoryRowCount ?? vo.totalRows;
const storeCount = 1;
const storeCount = 1;
const sceneCount = vo.distinctBusinessSceneCount;
const sceneCount = vo.distinctBusinessSceneCount;
const categoryCount = vo.distinctProductCategoryCount;
const operating = calcOperatingCost(vo);
const operating = calcOperatingCost(vo);
const items: StatItem[] = [
const items: StatItem[] = [
...
...
src/pages/TemplateImport/index.tsx
View file @
80880e3
...
@@ -101,7 +101,6 @@ export default function TemplateImport() {
...
@@ -101,7 +101,6 @@ export default function TemplateImport() {
okButtonProps: { type: 'primary' },
okButtonProps: { type: 'primary' },
cancelText: '知道了',
cancelText: '知道了',
// 非阻塞(不强制跳转):「知道了」留在当前页
// 非阻塞(不强制跳转):「知道了」留在当前页
showCancel: true,
onOk: () => {
onOk: () => {
// 跳转门店审批页(对应路由:/store/approve)
// 跳转门店审批页(对应路由:/store/approve)
window.location.href = '/store/approve';
window.location.href = '/store/approve';
...
@@ -114,7 +113,7 @@ export default function TemplateImport() {
...
@@ -114,7 +113,7 @@ export default function TemplateImport() {
}
}
};
};
if (loading) return <Skeleton
variant="default"
/>;
if (loading) return <Skeleton />;
return (
return (
<div style={{ display: 'flex', flexDirection: 'column' }}>
<div style={{ display: 'flex', flexDirection: 'column' }}>
...
...
src/router/index.tsx
View file @
80880e3
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
*/
import { lazy, type ReactNode } from 'react';
import { lazy, type ReactNode } from 'react';
import { createBrowserRouter, Navigate
, useLocation
} from 'react-router-dom';
import { createBrowserRouter, Navigate } from 'react-router-dom';
import BasicLayout from '@/layouts/BasicLayout';
import BasicLayout from '@/layouts/BasicLayout';
import Login from '@/pages/Login';
import Login from '@/pages/Login';
import NotFound from '@/pages/NotFound';
import NotFound from '@/pages/NotFound';
...
@@ -28,12 +28,6 @@ function RequireAuth({ children }: { children: ReactNode }) {
...
@@ -28,12 +28,6 @@ function RequireAuth({ children }: { children: ReactNode }) {
return <>{children}</>;
return <>{children}</>;
}
}
// 兼容后端菜单中的 /store/approval,保留导入后跳转携带的 tab。
function ApprovalRouteAlias() {
const { search } = useLocation();
return <Navigate to={{ pathname: '/store/approve', search }} replace />;
}
// React Router 7 数据路由(SPA / 声明式)
// React Router 7 数据路由(SPA / 声明式)
// 路由 path 必须与后端 /system/menu/tree/current 下发的 node.route 严格一致,
// 路由 path 必须与后端 /system/menu/tree/current 下发的 node.route 严格一致,
// 否则点菜单会 404(src/config/menu.json 仅在菜单接口未就绪时作兜底,路径同样对齐后端)。
// 否则点菜单会 404(src/config/menu.json 仅在菜单接口未就绪时作兜底,路径同样对齐后端)。
...
...
src/store/useAppStore.ts
View file @
80880e3
...
@@ -6,16 +6,7 @@
...
@@ -6,16 +6,7 @@
* @FilePath: \uj-store\src\store\useAppStore.ts
* @FilePath: \uj-store\src\store\useAppStore.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
*/
/*
* @Author: liimin 17653212@qq.com
* @Date: 2026-09-29 18:09:33
* @LastEditors: liimin 17653212@qq.com
* @LastEditTime: 2026-10-10 11:06:06
* @FilePath: \uj-store\src\store\useAppStore.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import
{
create
}
from
'zustand'
;
import
{
create
}
from
'zustand'
;
import
{
getToken
,
clearToken
}
from
'@/api/core/token'
;
import
{
clearLoginSession
,
getLoginSession
}
from
'@/access/session'
;
import
{
clearLoginSession
,
getLoginSession
}
from
'@/access/session'
;
import
{
queryClient
}
from
'@/queryClient'
;
import
{
queryClient
}
from
'@/queryClient'
;
...
@@ -24,11 +15,12 @@ const savedSession = getLoginSession();
...
@@ -24,11 +15,12 @@ const savedSession = getLoginSession();
interface
AppState
{
interface
AppState
{
collapsed
:
boolean
;
collapsed
:
boolean
;
toggleCollapsed
:
()
=>
void
;
toggleCollapsed
:
()
=>
void
;
currentUser
:
{
name
:
string
;
account
:
string
};
/** account 可选:后端会话可能只有姓名与角色码(角色码映射为 role) */
setCurrentUser
:
(
u
:
{
name
:
string
;
account
:
string
})
=>
void
;
currentUser
:
{
name
:
string
;
account
?:
string
;
role
?:
string
};
setCurrentUser
:
(
u
:
{
name
:
string
;
account
?:
string
;
role
?:
string
})
=>
void
;
/** 登录态:初始值由本地令牌决定,刷新不丢登录 */
/** 登录态:初始值由本地令牌决定,刷新不丢登录 */
loggedIn
:
boolean
;
loggedIn
:
boolean
;
login
:
(
u
:
{
name
:
string
;
account
:
string
})
=>
void
;
login
:
(
u
:
{
name
:
string
;
account
?:
string
;
role
?
:
string
})
=>
void
;
logout
:
()
=>
void
;
logout
:
()
=>
void
;
}
}
...
@@ -37,6 +29,7 @@ export const useAppStore = create<AppState>((set) => ({
...
@@ -37,6 +29,7 @@ export const useAppStore = create<AppState>((set) => ({
toggleCollapsed
:
()
=>
set
((
s
)
=>
({
collapsed
:
!
s
.
collapsed
})),
toggleCollapsed
:
()
=>
set
((
s
)
=>
({
collapsed
:
!
s
.
collapsed
})),
currentUser
:
{
currentUser
:
{
name
:
savedSession
?.
name
||
savedSession
?.
account
||
'管理员'
,
name
:
savedSession
?.
name
||
savedSession
?.
account
||
'管理员'
,
account
:
savedSession
?.
account
||
''
,
role
:
savedSession
?.
roleCodes
?.[
0
]
||
'admin'
,
role
:
savedSession
?.
roleCodes
?.[
0
]
||
'admin'
,
},
},
setCurrentUser
:
(
u
)
=>
set
({
currentUser
:
u
}),
setCurrentUser
:
(
u
)
=>
set
({
currentUser
:
u
}),
...
...
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