Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d4856d4c2 | ||
|
|
fb67f3dbd7 | ||
|
|
38bad4232a | ||
|
|
e396b1a6eb | ||
|
|
7640052c96 |
No files matched your search
+24
-23
@@ -1235,6 +1235,29 @@ async def list_qc_tasks(
|
||||
return error_response(400, str(e))
|
||||
|
||||
|
||||
@router.get("/qc-tasks/result-change-logs")
|
||||
async def list_qc_task_result_change_logs_batch(
|
||||
taskIds: str = Query("", description="逗号分隔的任务ID"),
|
||||
db: Session = Depends(get_db),
|
||||
user: dict = Depends(require_any_menu_code(*QC_TASK_READONLY_MENU_CODES)),
|
||||
):
|
||||
"""批量查询检测结果修改记录。须注册在 /qc-tasks/{task_id} 之前,避免被当成任务 ID。"""
|
||||
try:
|
||||
tenant_no = _get_tenant_no(db, user)
|
||||
ids = [x.strip() for x in (taskIds or "").split(",") if x.strip()]
|
||||
if not ids:
|
||||
return success_response([])
|
||||
return success_response(
|
||||
result_change_log_svc.list_task_result_change_logs_by_task_ids(
|
||||
db, task_ids=ids, tenant_no=tenant_no
|
||||
)
|
||||
)
|
||||
except PermissionError as e:
|
||||
return error_response(403, str(e))
|
||||
except Exception as e:
|
||||
return error_response(400, str(e))
|
||||
|
||||
|
||||
@router.get("/qc-tasks/{task_id}")
|
||||
async def get_qc_task_detail(
|
||||
task_id: str,
|
||||
@@ -1350,26 +1373,6 @@ async def get_task_material_usages(
|
||||
return error_response(400, str(e))
|
||||
|
||||
|
||||
@router.get("/qc-tasks/result-change-logs")
|
||||
async def list_qc_task_result_change_logs_batch(
|
||||
taskIds: str = Query(..., description="逗号分隔的任务ID"),
|
||||
db: Session = Depends(get_db),
|
||||
user: dict = Depends(require_any_menu_code(*QC_TASK_READONLY_MENU_CODES)),
|
||||
):
|
||||
try:
|
||||
tenant_no = _get_tenant_no(db, user)
|
||||
ids = [x.strip() for x in (taskIds or "").split(",") if x.strip()]
|
||||
return success_response(
|
||||
result_change_log_svc.list_task_result_change_logs_by_task_ids(
|
||||
db, task_ids=ids, tenant_no=tenant_no
|
||||
)
|
||||
)
|
||||
except PermissionError as e:
|
||||
return error_response(403, str(e))
|
||||
except Exception as e:
|
||||
return error_response(400, str(e))
|
||||
|
||||
|
||||
@router.get("/qc-tasks/{task_id}/result-change-logs")
|
||||
async def list_qc_task_result_change_logs(
|
||||
task_id: str,
|
||||
@@ -1378,9 +1381,7 @@ async def list_qc_task_result_change_logs(
|
||||
):
|
||||
try:
|
||||
tenant_no = _get_tenant_no(db, user)
|
||||
t = task_svc.get_task(db, task_id, tenant_no=tenant_no)
|
||||
if not t:
|
||||
return error_response(404, "任务不存在")
|
||||
# 无任务或无留痕均返回空列表,避免前端把“暂无记录”当成错误
|
||||
return success_response(
|
||||
result_change_log_svc.list_task_result_change_logs(
|
||||
db, task_id=task_id, tenant_no=tenant_no
|
||||
|
||||
+15
-11
@@ -3,7 +3,7 @@
|
||||
<el-dialog
|
||||
:model-value="visible"
|
||||
:title="dialogTitle"
|
||||
width="560px"
|
||||
width="800px"
|
||||
class="dialog-form-layout qc-task-result-change-log-dialog"
|
||||
align-center
|
||||
modal-class="protocol-dialog-mask"
|
||||
@@ -12,11 +12,11 @@
|
||||
:close-on-click-modal="false"
|
||||
@update:model-value="onVisibleChange"
|
||||
>
|
||||
<DialogFormBody :loading="loading">
|
||||
<DialogFormBody :loading="loading" body-class="qc-result-chg-body">
|
||||
<el-empty
|
||||
v-if="!loading && !entries.length"
|
||||
description="暂无修改记录"
|
||||
:image-size="56"
|
||||
:image-size="72"
|
||||
/>
|
||||
<div v-else class="qc-result-chg-tl">
|
||||
<div v-for="(entry, idx) in entries" :key="entry.id" class="qc-result-chg-tl__item">
|
||||
@@ -67,7 +67,6 @@
|
||||
import { Close } from '@element-plus/icons-vue'
|
||||
import DialogFormBody from '@/components/business/dialog-form-body/index.vue'
|
||||
import {
|
||||
fetchQcTaskResultChangeLogs,
|
||||
fetchQcTaskResultChangeLogsBatch,
|
||||
type QcTaskResultChangeLog
|
||||
} from '@/api/qc-task-result'
|
||||
@@ -114,14 +113,12 @@
|
||||
loading.value = true
|
||||
entries.value = []
|
||||
try {
|
||||
const list =
|
||||
ids.length > 1
|
||||
? await fetchQcTaskResultChangeLogsBatch(ids)
|
||||
: ids.length === 1
|
||||
? await fetchQcTaskResultChangeLogs(ids[0])
|
||||
: []
|
||||
// 多任务统一走批量接口,避免路径被 /qc-tasks/{id} 误匹配
|
||||
const list = ids.length
|
||||
? await fetchQcTaskResultChangeLogsBatch(ids)
|
||||
: []
|
||||
if (seq !== loadSeq) return
|
||||
entries.value = list || []
|
||||
entries.value = Array.isArray(list) ? list : []
|
||||
} catch {
|
||||
if (seq !== loadSeq) return
|
||||
entries.value = []
|
||||
@@ -140,11 +137,18 @@
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
:deep(.qc-result-chg-body) {
|
||||
min-height: 480px;
|
||||
max-height: min(70vh, 640px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.qc-result-chg-tl {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
padding: 4px 0 8px;
|
||||
min-height: 420px;
|
||||
}
|
||||
|
||||
.qc-result-chg-tl__item {
|
||||
|
||||
@@ -33,6 +33,16 @@
|
||||
@click="openAllThirdResult(item)"
|
||||
@dblclick="openAllThirdResult(item)"
|
||||
>
|
||||
<el-button
|
||||
class="qc-task-card__history-icon"
|
||||
link
|
||||
type="primary"
|
||||
title="修改记录"
|
||||
aria-label="修改记录"
|
||||
@click.stop="openChangeLogForTasks(item.tasks, ALL_THIRD_PARTY_CARD_TITLE)"
|
||||
>
|
||||
<el-icon><Clock /></el-icon>
|
||||
</el-button>
|
||||
<div class="qc-task-card__line qc-task-card__line--top">
|
||||
<span class="qc-task-card__name">{{ ALL_THIRD_PARTY_CARD_TITLE }}</span>
|
||||
<div class="qc-task-card__sub">
|
||||
@@ -50,13 +60,6 @@
|
||||
uniqueAssigneeNames(item.tasks)
|
||||
}}</span>
|
||||
<div class="qc-work-order-task-sublist__ops">
|
||||
<el-button
|
||||
class="btn-op-item"
|
||||
size="small"
|
||||
@click.stop="openChangeLogForTasks(item.tasks, ALL_THIRD_PARTY_CARD_TITLE)"
|
||||
>
|
||||
<el-icon><Clock /></el-icon>修改记录
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="canFillAllThird(item)"
|
||||
class="btn-op-item primary"
|
||||
@@ -84,6 +87,16 @@
|
||||
class="qc-task-card qc-task-card--compact"
|
||||
@dblclick="handleView(item.task)"
|
||||
>
|
||||
<el-button
|
||||
class="qc-task-card__history-icon"
|
||||
link
|
||||
type="primary"
|
||||
title="修改记录"
|
||||
aria-label="修改记录"
|
||||
@click.stop="openChangeLogForTask(item.task)"
|
||||
>
|
||||
<el-icon><Clock /></el-icon>
|
||||
</el-button>
|
||||
<div class="qc-task-card__line qc-task-card__line--top">
|
||||
<span class="qc-task-card__name">{{ item.task.itemName || '—' }}</span>
|
||||
<div class="qc-task-card__tags">
|
||||
@@ -109,13 +122,6 @@
|
||||
item.task.assigneeUserNames || '—'
|
||||
}}</span>
|
||||
<div class="qc-work-order-task-sublist__ops">
|
||||
<el-button
|
||||
class="btn-op-item"
|
||||
size="small"
|
||||
@click.stop="openChangeLogForTask(item.task)"
|
||||
>
|
||||
<el-icon><Clock /></el-icon>修改记录
|
||||
</el-button>
|
||||
<template v-if="hasPrimaryTaskActions(item.task)">
|
||||
<el-button
|
||||
v-if="canStartTask(item.task)"
|
||||
@@ -1719,6 +1725,7 @@
|
||||
}
|
||||
|
||||
.qc-task-card {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
@@ -1746,7 +1753,7 @@
|
||||
width: 100%;
|
||||
max-width: 220px;
|
||||
gap: 4px;
|
||||
padding: 6px 8px;
|
||||
padding: 6px 28px 6px 8px;
|
||||
}
|
||||
|
||||
&--company {
|
||||
@@ -1761,6 +1768,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
.qc-task-card__history-icon {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 4px;
|
||||
z-index: 1;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: var(--mint-primary-dark, #059669);
|
||||
|
||||
:deep(.el-icon) {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: var(--mint-primary, #10b981);
|
||||
}
|
||||
}
|
||||
|
||||
.qc-task-card__sub {
|
||||
width: 100%;
|
||||
font-size: 11px;
|
||||
|
||||
Reference in new issue
Block a user