diff --git a/apps/admin/src/views/goods/GoodsView.vue b/apps/admin/src/views/goods/GoodsView.vue index 8456469..02d462d 100644 --- a/apps/admin/src/views/goods/GoodsView.vue +++ b/apps/admin/src/views/goods/GoodsView.vue @@ -406,7 +406,7 @@ function collectSiblings(ogNode: any): any[] { } function openConfigModal(og: any, dropTarget: any) { - configOG.value = og + configOG.value = { ...og, familyId: og.familyId ?? findOgNodeById(og.rawId)?.familyId ?? null } configDropTarget.value = dropTarget const ogNode = findOgNodeById(og.rawId) const siblings = ogNode ? collectSiblings(ogNode) : [] @@ -729,7 +729,11 @@ async function openEdit(g: Good) { countryId: g.countryId, cascaderCategory: findCategoryPath(allCategories.value, g.categoryId), categoryId: g.categoryId, - tagIds: (g.tags || []).map(t => t.id), + // 有族时:自动组(物流/工艺/位置)标签为派生数据,不进入可编辑选择 + tagIds: (g.tags || []).filter((t: any) => { + const og = (g as any).originGood?.family + return !og || !t.tagGroupId || !autoTagGroupIds.value.has(t.tagGroupId) + }).map((t: any) => t.id), positionId: g.positionId || '', } initEditFamily((g as any).originGood?.family ?? null) @@ -1289,6 +1293,29 @@ const groupedTagOptions = computed(() => { return groups }) +// ─── 族派生标签:物流/工艺/位置组由族自动同步,表单中只读 ─── +const isAutoTagGroup = (name: string) => /物流|工艺|位置/.test(name) +const autoTagGroupIds = computed(() => + new Set(allTagGroups.value.filter((g) => isAutoTagGroup(g.groupName)).map((g) => g.id)), +) +const configHasFamily = computed(() => Boolean((configOG.value as any)?.familyId)) +const configTagOptions = computed(() => + configHasFamily.value + ? groupedTagOptions.value.filter((g) => g.id === 'ungrouped' || !autoTagGroupIds.value.has(g.id as any)) + : groupedTagOptions.value, +) +const editTagOptions = computed(() => + editFamilyId.value + ? groupedTagOptions.value.filter((g) => g.id === 'ungrouped' || !autoTagGroupIds.value.has(g.id as any)) + : groupedTagOptions.value, +) +/** 当前商品的自动组标签(只读展示) */ +const editDerivedTags = computed(() => + editFamilyId.value + ? ((editGood.value as any)?.tags ?? []).filter((t: any) => autoTagGroupIds.value.has(t.tagGroupId)) + : [], +) + function toggleTagInSelection(tagId: string): void { const idx = selectedTagIds.value.indexOf(tagId) if (idx >= 0) selectedTagIds.value.splice(idx, 1) @@ -1922,12 +1949,15 @@ onMounted(() => loadAll())
- +
+
+ 物流 / 工艺 / 印刷位置标签由族成员自动生成,无需手动选择 +