feat(前端): 10 个工具页删除任务补二次确认;外观专利上传时拦截分组塌陷
删除走服务端物理删除——任务记录连同 MinIO 上的结果文件一并回收,此前除品牌档案外 11 个工具页都是点击即发车,一次误点就没了。统一抽到 shared/task-delete-confirm.ts, 只在各页 deleteTaskRecord 开头插一行守卫(纯新增,未改各页原有删除逻辑)。 外观专利另加一道上传前拦截:本模块按 id 列分组、同组只检测 1 次把结论复制到组内其它行, 生产任务 28805 的源表 id 列 904 行全填 "1",整表塌成 1 组、105 秒就"完成"了。 解析后按 分组数/行数 比例提醒(行数 <20 或分组数正常时不打扰),用户可选返回改表。
This commit is contained in:
@@ -75,7 +75,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import AmazonToolPageShell from '@/pages/amazon/components/AmazonToolPageShell.vue';
|
||||
import ModuleTemplateDownload from '@/shared/components/ModuleTemplateDownload.vue'
|
||||
import TaskCenterPanel from '@/shared/components/tasks/TaskCenterPanel.vue'
|
||||
@@ -115,6 +115,7 @@ import { uploadPathsToJava } from '@/shared/utils/upload-to-java'
|
||||
import { runBatchDelete } from '@/shared/utils/batch-delete'
|
||||
import { getModuleProgressLight } from '@/shared/api/progress-light.ts'
|
||||
import { createRowsVersionTracker } from '@/shared/api/task-progress-polling.ts'
|
||||
import { confirmTaskDeletion } from '@/shared/task-delete-confirm'
|
||||
|
||||
const selectedFileNames = ref<string[]>([])
|
||||
const uploadedFiles = ref<UploadFileVo[]>([])
|
||||
@@ -355,6 +356,30 @@ async function selectFolder() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 本模块按 id 列分组,同组只检测 1 次并把结论复制给组内其它行。
|
||||
* 生产事故(任务 28805):源表 id 列 904 行全填 "1",整表塌成 1 组,105 秒就"完成"了。
|
||||
* 这里在解析后按组/行比例提醒用户确认,返回 true 表示用户选择回去改表。
|
||||
*/
|
||||
async function abortOnCollapsedGroups(res: { acceptedRows?: number; groupCount?: number }): Promise<boolean> {
|
||||
const rows = res.acceptedRows || 0
|
||||
const groups = res.groupCount || 0
|
||||
if (rows < 20 || groups * 3 >= rows) {
|
||||
return false
|
||||
}
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`本次共 ${rows} 行,只识别出 ${groups} 个检测分组(平均每组 ${(rows / Math.max(groups, 1)).toFixed(1)} 行)。`
|
||||
+ '同组只会检测 1 次,结论复制到组内其它行。若 id 列是整表同一个值,请改为每个商品一个 id 后重新上传。',
|
||||
'分组数异常',
|
||||
{ confirmButtonText: '按当前分组继续', cancelButtonText: '返回改表', type: 'warning', distinguishCancelAndClose: true },
|
||||
)
|
||||
return false
|
||||
} catch {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
async function parseFiles() {
|
||||
if (!uploadedFiles.value.length) {
|
||||
ElMessage.warning('请先选择 Excel')
|
||||
@@ -383,6 +408,13 @@ async function parseFiles() {
|
||||
queuePayloadText.value = ''
|
||||
return
|
||||
}
|
||||
if (await abortOnCollapsedGroups(res)) {
|
||||
parseResult.value = null
|
||||
queuedTaskSummary.value = null
|
||||
queuePayloadText.value = ''
|
||||
ElMessage.info('已取消,修正 id 列后重新解析')
|
||||
return
|
||||
}
|
||||
parseResult.value = res
|
||||
queuedTaskSummary.value = null
|
||||
queuePayloadText.value = ''
|
||||
@@ -911,6 +943,7 @@ async function downloadResult(item: AppearancePatentHistoryItem) {
|
||||
}
|
||||
|
||||
async function deleteTaskRecord(item: AppearancePatentHistoryItem) {
|
||||
if (!(await confirmTaskDeletion(item))) return
|
||||
try {
|
||||
if (item.taskStatus === 'RUNNING' && item.taskId) {
|
||||
await deleteAppearancePatentTask(item.taskId)
|
||||
|
||||
Reference in New Issue
Block a user