From 9b6f00a2dcccdb9f42b8994a820df23fc4d5ebfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E8=87=AA=E8=BE=BE?= <980324341@qq.com> Date: Mon, 16 Nov 2026 02:44:27 +0800 Subject: [PATCH] =?UTF-8?q?feat(jd):=20=E4=BA=AC=E4=B8=9C=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E5=B7=A5=E5=85=B7=E6=A0=8F=E5=8A=A0=E3=80=8C?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=88=86=E7=B1=BB=E3=80=8D=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E6=8C=89=E9=92=AE=EF=BC=882026-11-16=20=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=88=AA=E5=9B=BE=E5=8F=8D=E9=A6=88=EF=BC=89=E2=80=94=E2=80=94?= =?UTF-8?q?=E8=B5=B0=20batch-assign-group=20=E7=9A=84=20groupId=3Dnull=20?= =?UTF-8?q?=E5=87=BA=E5=8F=A3=EF=BC=88=E4=B8=8E=E5=BA=97=E9=93=BA=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E5=BC=B9=E7=AA=97=E3=80=8C=E7=A7=BB=E5=87=BA=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E3=80=8D=E5=90=8C=E4=B8=80=E5=90=8E=E7=AB=AF=E8=AF=AD?= =?UTF-8?q?=E4=B9=89=EF=BC=8C=E5=90=8C=E7=BD=AE=E4=BA=BA=E5=B7=A5=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E9=94=81=EF=BC=89=EF=BC=9B=E5=8B=BE=E9=80=89=E9=87=8C?= =?UTF-8?q?=E5=8F=AA=E7=AE=97=E5=B7=B2=E5=88=86=E7=B1=BB=E8=A1=8C=EF=BC=88?= =?UTF-8?q?=E6=9C=AA=E5=88=86=E7=B1=BB=E8=A1=8C=E6=B2=A1=E6=9C=89=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E5=8F=AF=E7=A7=BB=EF=BC=8C=E4=B8=8D=E7=99=BD=E5=90=83?= =?UTF-8?q?=E4=BA=BA=E5=B7=A5=E9=94=81=EF=BC=89=EF=BC=8C=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=B8=B8=E6=98=BE=E3=80=81=E5=85=A8=E6=9C=AA=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E6=97=B6=E7=BD=AE=E7=81=B0=E5=B8=A6=E6=8F=90=E7=A4=BA=EF=BC=9B?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E5=BC=B9=E7=AA=97=E7=82=B9=E5=90=8D=E6=95=B0?= =?UTF-8?q?=E9=87=8F=E4=B8=8E=E4=BA=BA=E5=B7=A5=E9=94=81=E5=90=8E=E6=9E=9C?= =?UTF-8?q?=E3=80=81danger:false=EF=BC=88=E5=8F=AF=E6=81=A2=E5=A4=8D?= =?UTF-8?q?=E5=8A=A8=E4=BD=9C=EF=BC=89=EF=BC=9B=E5=88=A0=E9=99=A4/?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E4=B8=A4=E6=B5=81=E7=A8=8B=E4=BA=92=E6=96=A5?= =?UTF-8?q?=EF=BC=88deleting/removingGroup=20=E4=BA=A4=E5=8F=89=E9=97=B8?= =?UTF-8?q?=EF=BC=89=E3=80=82=E7=BA=AF=E9=80=BB=E8=BE=91=E6=8A=BD=20jd-gro?= =?UTF-8?q?up-remove.ts=EF=BC=88removableGroupPicks/removeGroupConfirmMess?= =?UTF-8?q?age=EF=BC=8Cnode=20--test=20=E5=8F=AF=E7=9B=B4=E6=B5=8B?= =?UTF-8?q?=EF=BC=89=E4=BF=9D=20JdDatabasePage.vue=20798<800=20=E5=8F=AF?= =?UTF-8?q?=E8=AF=BB=E6=A3=98=E8=BD=AE=E7=BA=BF=E3=80=82=E5=88=A4=E6=8D=AE?= =?UTF-8?q?=EF=BC=9Avue-tsc=20=E9=9B=B6=E9=94=99=E3=80=81vitest=20?= =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E9=A1=B5=2029=20=E4=BE=8B=E5=85=A8=E7=BB=BF?= =?UTF-8?q?=EF=BC=88+3=EF=BC=9A=E8=AE=A1=E6=95=B0=E5=8F=AA=E7=AE=97?= =?UTF-8?q?=E5=B7=B2=E5=88=86=E7=B1=BB/=E5=8F=96=E6=B6=88=E4=B8=8D?= =?UTF-8?q?=E5=8F=91/=E5=A4=B1=E8=B4=A5=E6=96=87=E6=A1=88=E9=80=8F?= =?UTF-8?q?=E5=87=BA=EF=BC=8Bdanger:false=20=E9=92=89=EF=BC=89=E3=80=81nod?= =?UTF-8?q?e=20--test=208=20=E4=BE=8B=E5=85=A8=E7=BB=BF=EF=BC=88+2?= =?UTF-8?q?=EF=BC=89=E3=80=81confirm-exit-ledger=205/5=EF=BC=88danger=20?= =?UTF-8?q?=E9=94=AE=E6=98=BE=E5=BC=8F=EF=BC=89=E3=80=81=E5=8F=AF=E8=AF=BB?= =?UTF-8?q?=E6=A3=98=E8=BD=AE=2010=20passed=E3=80=81fast=20=E9=97=B8?= =?UTF-8?q?=E9=97=A8=20overall=3Dpass=20=E5=9B=9B=E9=9D=A2=E7=BB=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/jd/JdDatabasePage.vue | 42 ++++++++++-- .../src/pages/jd/jd-group-remove.ts | 16 +++++ .../src/pages/jd/jd-product-api.ts | 3 +- .../tests/jd-group-remove.test.ts | 25 ++++++++ .../mount/jd-database-page.mount.test.ts | 64 +++++++++++++++++++ 5 files changed, 145 insertions(+), 5 deletions(-) create mode 100644 admin-frontend-vue/src/pages/jd/jd-group-remove.ts create mode 100644 admin-frontend-vue/tests/jd-group-remove.test.ts diff --git a/admin-frontend-vue/src/pages/jd/JdDatabasePage.vue b/admin-frontend-vue/src/pages/jd/JdDatabasePage.vue index 2b77d4532..7dac5387c 100644 --- a/admin-frontend-vue/src/pages/jd/JdDatabasePage.vue +++ b/admin-frontend-vue/src/pages/jd/JdDatabasePage.vue @@ -15,7 +15,8 @@ * 的 JSON number 形状(生产库 273/273 行 price_min 全有值,jd-product-model.ts decimalText 收口); * ③ 「上架时间 / 商品状态」合并列整列下线(「不需要采集」口径,jd_online_at/sale_status 仍收 * 详情抽屉),操作列随 2026-11-16「操作放最后一列」口径置末;④ 创建/修改两列同口径「不要」 - * 下线(jd_created_at/jd_updated_at 仍收详情抽屉),列表时间列只剩同步时间收尾。 + * 下线(jd_created_at/jd_updated_at 仍收详情抽屉),列表时间列只剩同步时间收尾; + * ⑤ 工具栏加「移除分类」批量按钮(batch-assign-group 的 groupId=null 口径,勾选里只算已分类行)。 * 骨架像素复刻「外观专利数据库」页(panel-box + LoadFailureBar + 自绘 table + 旧式分页); * 超管切公司 tab = 清筛选重取(watch 体照外观专利页逐字形状);日期对护栏:起侧 max=止侧、 * 止侧 min=起侧、两侧 @change 用 orderedPair 把倒挂交换回来(clampJdSyncedRange 照 clampDatePair)。 @@ -23,6 +24,7 @@ * (date-filter-default-today 护栏 EXEMPT 口径,外观专利页同款)。 */ import { computed, onMounted, reactive, ref, watch } from 'vue' import { + batchAssignJdProductGroup, deleteJdProducts, fetchJdProductCategories, fetchJdProductGroups, @@ -33,6 +35,7 @@ import { import type { JdProductItem } from './jd-product-model.ts' import { jdPriceRange } from './jd-product-model.ts' import { createJdProductFilterState } from './jd-product-filter.ts' +import { removableGroupPicks, removeGroupConfirmMessage } from './jd-group-remove.ts' import JdProductDetailDrawer from './JdProductDetailDrawer.vue' import JdProductEditDrawer from './JdProductEditDrawer.vue' import JdProductGroupDialog from './JdProductGroupDialog.vue' @@ -233,7 +236,7 @@ async function removeSelected(): Promise { /** 删除主流程:二次确认 → 先删桶、全成功才删库行(后端保证)→ 刷新列表并清勾选。 */ async function removeMany(picked: JdProductItem[], message: string): Promise { - if (!picked.length || deleting.value) return + if (!picked.length || deleting.value || removingGroup.value) return const ok = await openAdminConfirm({ title: '删除京东商品', message: `${message}删除后该商品的 SKU、图片登记与 jd-products 桶内图片文件一并删除(被其他商品共用的图片会保留);此操作不可恢复。`, confirmText: '确认删除', danger: true }) if (!ok) return deleting.value = true @@ -252,6 +255,29 @@ async function removeMany(picked: JdProductItem[], message: string): Promise removableGroupPicks(rows.value, selectedIds.value)) +/** 移除主流程:二次确认点名数量与人工锁后果 → (ids, null) → 刷新列表并清勾选。 */ +async function removeSelectedGroup(): Promise { + const picked = removablePicked.value + if (!picked.length || removingGroup.value || deleting.value) return + const ok = await openAdminConfirm({ title: '移除分类', message: removeGroupConfirmMessage(picked.length), confirmText: '确认移除', danger: false }) + if (!ok) return + removingGroup.value = true + try { + const updated = await batchAssignJdProductGroup(picked.map((row) => row.id), null) + showAdminFeedback(`已把 ${updated} 个商品移出分类`, 'success') + selectedIds.value = new Set() + await load() + } catch (error) { + const text = error instanceof Error && error.message ? error.message : '移除分类失败,请稍后重试' + showAdminFeedback(text, 'error') + } finally { + removingGroup.value = false + } +} + // 超管切公司 tab = 重新取数:编码/关键字/类目/日期是按行集筛的自由值,在另一家的 // 行集里筛不出东西,必须一起清(分组与分类状态全平台一份,groupId/groupScope 与公司维度 // 正交、不清);类目选项与行集同源,按新 tab 重取;分组选项是全局的、进页取一次即可。 @@ -328,6 +354,14 @@ onMounted(() => {
共 {{ total }} 条京东商品 +