Files
crawler-plugin/admin-frontend-vue/src/pages/jd/JdBatchAssignDialog.vue
T
huangzd1997 10dec12ec0 refactor(前端): 前后台界面小字全面精简——删技术ID括号/页头操作提示条/机制解释句(2026-11-28 客户口径「这些小字都不需要多余,还有shopId啥的…除了必须要的比如任务ID密钥,其他精简一些」)
用户端 frontend-vue:
- jd-publish-shop.ts:shopLabel 只出店名(缺名兜底「店铺 N」),跨店/多店琥珀文案压成一两句,判据逻辑零改动
- JdPublishTab:删工具头/分类解释/品牌句后半,默认店铺/选品/collect-hint/中断回执/加价规则各压一句
- JdCollectTab:删工具头 desc、分类机制句、断点游标行,「页面筛选未生效兜底翻页中」从任务卡撤下
- jd-on-shelf 空态一句、JdConsolePage hero-sub 整段删(含过时的「正在建设中」)
- 品牌 10 个 tab:输入/筛选/加载长句压一句或删,任务卡删「结果ID/店铺ID/平台」技术行(店名已显形)
- 保留:错误出口、额度「当前在架X/Y」、GROUPS_EMPTY 空态动作句、检测按钮与店铺显形

后管 admin-frontend-vue:
- 每页顶部「当前页面操作提示」条整条下线(删 OperationGuide.vue+operation-guides.ts)
- 撞款/任务中心/关键词用量/密钥用量/客户端包/教程/软件版本/数字人/菜单/店铺密钥/登录页逐页删说明小字(保留:踢线警示、「留空=永不过期」、「不要带v前缀」、「仅支持.zip」、草稿需手动发布、已授权人数、安全提示)
- 编辑/建号弹窗 label 括号收短;代理弹窗/设备日志(删 pywebview/kk-browser 进程名)/密钥 pill title/授权弹窗 dim/品牌门控空态收短

测试同步(16 支改反钉或同步断言,全部当场绿):
- align-operation-guide 整份重写为反钉(组件与文案表不得回流)
- source-pin 台账 task-center-board 条目手工点名 7/3/5→24/14/28:旧值是切分器把正则字面量内裸引号当字符串开关吞掉 18 支用例的误量(stripNonCode 不识别 regex literal),本次改写恰好移除该文件最后两处带引号正则后测出真值;真实用例数反而 25→24(删 1 支 guide 用例),非真实增长

门禁:后管 node --test 1965/1965+vitest 253/253+vue-tsc rc=0;用户端 node 1150/mount 149/vue-tsc rc=0;ops 快检 --fast overall=pass(后端9.5/后管8.8/客户端9.8/用户端9.6)。本窗不发版;app_client/jar/后端零改动。
2026-11-28 01:14:51 +08:00

286 lines
7.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
/** 批量编辑分类对话框(2026-11-17 用户口径「店铺分类弹窗删了,加个批量编辑分类」):
* 京东数据库页勾选商品(翻页累计,由页面持有勾选集)→ 本对话框选目标分类或移出分类 →
* 一次批量归类。归属写「本组」的归属行(biz_jd_product_group_assign,V203 一组一商品一行),
* 归类不置人工编辑锁(采集照常更新价格/库存)。本组无分类时只有提示不给提交
* (移出对未分类行是无谓操作),引导去工具栏「分类管理」新建(2026-11-17 独立页并回本页)。 */
import { computed, ref, watch } from 'vue'
import { batchAssignJdProductGroup, type JdProductGroup } from './jd-product-api.ts'
import { requestErrorMessage } from '../../api/envelope.ts'
const props = defineProps<{
visible: boolean
/** 当前数据权限分组(归类的落点组;V203 同一商品在其他组可另归一类)。 */
ownerGroupId: number
ownerGroupName: string
/** 当前分组的分类选项(含商品数徽标;由页面在打开时刷新)。 */
categories: JdProductGroup[]
/** 页面持有的勾选集(跨页累计),展开成 id 数组传入。 */
selectedIds: number[]
}>()
const emit = defineEmits<{ (event: 'close'): void; (event: 'done', updated: number, targetName: string | null): void }>()
/** 选中的目标分类 id;0=移出分类(回到未分类)。 */
const pickedId = ref(0)
const assigning = ref(false)
const errorText = ref('')
const picked = computed(() => props.categories.find((group) => group.id === pickedId.value) || null)
const confirmText = computed(() => (picked.value ? `归入「${picked.value.name}」` : '移出分类'))
/** 提交条件:有勾选、未在提交中,且选了目标分类(pickedId>0)或选了移出(pickedId=0,
* 但本组得有分类可移——全组无分类时移出是无谓操作,整对话框只留提示)。 */
const canSubmit = computed(() => props.selectedIds.length > 0 && !assigning.value
&& (picked.value ? true : props.categories.length > 0))
watch(
() => props.visible,
(visible) => {
if (visible) {
pickedId.value = 0
errorText.value = ''
}
},
)
async function submit(): Promise<void> {
if (!canSubmit.value) return
const target = picked.value
assigning.value = true
errorText.value = ''
try {
// target null=移出分类(groupId 传 null,后端只解挂本组归属行)。
const updated = await batchAssignJdProductGroup(
props.selectedIds,
target ? target.id : null,
props.ownerGroupId,
)
emit('done', updated, target ? target.name : null)
emit('close')
} catch (error) {
errorText.value = requestErrorMessage(error) || '批量归类失败'
} finally {
assigning.value = false
}
}
</script>
<template>
<div v-if="visible" class="modal-mask" @click.self="emit('close')">
<div class="batch-modal">
<div class="modal-head">
<h3>批量编辑分类<span v-if="ownerGroupName" class="modal-sub">· {{ ownerGroupName }}</span></h3>
<button class="modal-close" type="button" aria-label="关闭" @click="emit('close')">×</button>
</div>
<p class="modal-tip">已勾选 {{ selectedIds.length }} 个商品(翻页累计)。</p>
<p v-if="errorText" class="group-error">{{ errorText }}</p>
<div v-if="!categories.length" class="batch-empty">本组暂无分类,先用工具栏「分类管理」新建一个</div>
<ul v-else class="option-list">
<li
v-for="group in categories"
:key="group.id"
class="option-row"
:class="{ active: pickedId === group.id }"
@click="pickedId = group.id"
>
<span class="option-radio" aria-hidden="true"></span>
<span class="option-name" :title="group.name">{{ group.name }}</span>
<span class="option-meta">{{ group.productCount }}</span>
</li>
<li class="option-row option-detach" :class="{ active: pickedId === 0 }" @click="pickedId = 0">
<span class="option-radio" aria-hidden="true"></span>
<span class="option-name">移出分类</span>
<span class="option-meta">回到未分类</span>
</li>
</ul>
<div class="modal-foot">
<button class="btn btn-secondary" type="button" @click="emit('close')">取消</button>
<button class="btn" type="button" :disabled="!canSubmit" @click="submit">
{{ assigning ? '提交中...' : confirmText }}
</button>
</div>
</div>
</div>
</template>
<style scoped>
.modal-mask {
position: fixed;
inset: 0;
z-index: 2800;
display: flex;
align-items: center;
justify-content: center;
padding: 40px 20px;
background: rgba(45, 66, 86, 0.36);
backdrop-filter: blur(6px);
}
.batch-modal {
display: flex;
flex-direction: column;
width: min(430px, 100%);
max-height: 80vh;
padding: 18px 20px 20px;
border: 1px solid #c7d7e5;
border-radius: 14px;
background: #ffffff;
box-shadow: 0 22px 60px rgba(39, 67, 94, 0.2);
}
.modal-head {
display: flex;
align-items: center;
justify-content: space-between;
}
.modal-head h3 {
margin: 0;
font-size: 15px;
font-weight: 650;
color: #24384d;
}
.modal-sub {
margin-left: 6px;
color: #5b6f83;
font-size: 13px;
font-weight: 500;
}
.modal-close {
width: 30px;
height: 30px;
border: 1px solid transparent;
border-radius: 9px;
background: none;
color: #5b6f83;
font-size: 20px;
line-height: 1;
cursor: pointer;
}
.modal-close:hover {
border-color: #cbd9e6;
background: #eef4fa;
color: #24384d;
}
.modal-tip {
margin: 8px 0 10px;
color: #8293a5;
font-size: 12.5px;
line-height: 1.5;
}
.group-error {
margin: 0 0 8px;
padding: 10px 12px;
border: 1px solid #f0c9c2;
border-radius: 10px;
background: #fdf1ef;
color: #a04432;
font-size: 13px;
}
.batch-empty {
padding: 26px 12px;
border: 1px dashed #cbd9e6;
border-radius: 10px;
color: #8293a5;
font-size: 13px;
text-align: center;
}
.option-list {
flex: 1;
min-height: 0;
overflow-y: auto;
margin: 0;
padding: 0;
list-style: none;
border-top: 1px solid #e7eef5;
}
.option-row {
display: flex;
align-items: center;
gap: 10px;
padding: 10px 8px;
border-bottom: 1px solid #e7eef5;
font-size: 13.5px;
cursor: pointer;
}
.option-row:hover {
background: #f1f7fb;
}
/* 点亮=归类目标:与旧弹窗左栏同款左缘蓝条。 */
.option-row.active {
background: #e8f1fa;
box-shadow: inset 3px 0 0 #4f78a5;
}
.option-radio {
flex: none;
width: 14px;
height: 14px;
border: 1.6px solid #9fb7cd;
border-radius: 50%;
background: #ffffff;
}
.option-row.active .option-radio {
border-color: #4f78a5;
background: radial-gradient(circle, #4f78a5 0 4px, #ffffff 4.6px);
}
.option-name {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: #24384d;
}
.option-detach .option-name {
color: #a04432;
}
.option-meta {
flex: none;
min-width: 22px;
padding: 1px 7px;
border-radius: 9px;
background: #eef4fa;
color: #4e6479;
font-size: 12px;
text-align: center;
white-space: nowrap;
}
.option-detach .option-meta {
background: transparent;
color: #8293a5;
}
.modal-foot {
display: flex;
justify-content: flex-end;
gap: 10px;
margin-top: 14px;
}
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
min-height: 38px;
padding: 7px 16px;
border: 1px solid #4f78a5;
border-radius: 9px;
background: linear-gradient(135deg, #5f85ad, #4f78a5);
color: #ffffff;
font-family: inherit;
font-size: 13px;
cursor: pointer;
}
.btn:disabled {
cursor: not-allowed;
opacity: 0.6;
}
.btn-secondary {
background: #ffffff;
color: #5b6f83;
border-color: #c7d7e5;
}
.btn-secondary:hover:not(:disabled) {
color: #2f5d8b;
border-color: #95b1cb;
background: #edf5fb;
}
</style>