refactor(admin): split GoodsView into dialog components; fix(GoodsView): raw member names, no primary badges, member price grid; feat(tag): 光板 maps to 不打印

This commit is contained in:
yeuimu
2026-08-28 16:40:48 +08:00
parent 34d84a7a7c
commit 10197c47a8
14 changed files with 1719 additions and 1441 deletions
+28
View File
@@ -0,0 +1,28 @@
import type { CategoryTree } from '@/types'
/** 在分类树中找目标分类的祖先路径(含自身) */
export function findCategoryPath(nodes: CategoryTree[], targetId: string): string[] {
for (const n of nodes) {
if (n.id === targetId) return [n.id]
if (n.children?.length) {
const sub = findCategoryPath(n.children, targetId)
if (sub.length) return [n.id, ...sub]
}
}
return []
}
export interface CascadeNode {
value: string
label: string
children?: CascadeNode[]
}
/** 分类树 → el-cascader 选项 */
export function buildCascader(tree: CategoryTree[]): CascadeNode[] {
return tree.map((n) => ({
value: n.id,
label: n.categoryName,
children: n.children?.length ? buildCascader(n.children) : undefined,
}))
}