diff --git a/frontend-vue/src/pages/jd/JdCollectTab.vue b/frontend-vue/src/pages/jd/JdCollectTab.vue index 978d69a46..cd21b6dad 100644 --- a/frontend-vue/src/pages/jd/JdCollectTab.vue +++ b/frontend-vue/src/pages/jd/JdCollectTab.vue @@ -21,7 +21,7 @@ import { userNotice } from '@/shared/utils/user-notice' import { formatDateTime } from '@/shared/utils/datetime' import { useLiveTaskBoard } from '@/shared/composables/useLiveTaskBoard' import NotificationBell from '@/shared/components/NotificationBell.vue' -import { JD_SHOP_CATEGORY_SNAPSHOT, type JdShopCategory } from './jd-shop-category.ts' +import { JD_SHOP_CATEGORY_SNAPSHOT } from './jd-shop-category.ts' /** 京东「获取店铺数据」(v1.5):一键建单 → 推送本机客户端 → 右侧任务面板实时进度。 * @@ -55,23 +55,23 @@ const submitting = ref(false) const errorMessage = ref('') const successMessage = ref('') -// ---- 采集分类(可选,多选;空=全店采集)---- +// ---- 采集分类(可选,下拉多选;空=全店采集)---- /** 选项集=京麦「店内分类」快照(getShopCategoryList,2026-11-16 真机取证 9 个; - * 京麦侧改分类后按取证路重抓,见 jd-shop-category.ts 头注释——快照不会自动过期告警)。 */ + * 京麦侧改分类后按取证路重抓,见 jd-shop-category.ts 头注释——快照不会自动过期告警)。 + * 2026-11-17 客户口径「不要全展示出来,弄个下拉式多选」:复选列表换 el-select 多选 + * (collapse-tags 折叠成「+N」徽标),选择模型改存分类 id 数组,label/id 双键从快照反查。 */ const shopCategoryOptions = JD_SHOP_CATEGORY_SNAPSHOT -const selectedShopCategories = ref([]) - -function toggleShopCategory(category: JdShopCategory) { - const hit = selectedShopCategories.value.find((item) => item.value === category.value) - selectedShopCategories.value = hit - ? selectedShopCategories.value.filter((item) => item.value !== category.value) - : [...selectedShopCategories.value, category] -} +const selectedShopCategoryValues = ref([]) function clearShopCategories() { - selectedShopCategories.value = [] + selectedShopCategoryValues.value = [] } +/** 选中项按快照原序反查回对象(下拉里点选的先后不进请求体——双键顺序恒等于快照序)。 */ +const selectedShopCategories = computed(() => + shopCategoryOptions.filter((item) => selectedShopCategoryValues.value.includes(item.value)), +) + /** 建单/推送载荷的选中值:label 与 id 双键同发(行级填充形状未取证,任一键命中即命中)。 */ const selectedShopCategoryNames = computed(() => selectedShopCategories.value.map((item) => item.label)) const selectedShopCategoryIds = computed(() => selectedShopCategories.value.map((item) => item.value)) @@ -413,22 +413,17 @@ onUnmounted(() => {