Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5260f05522 |
No files matched your search
+23
-24
@@ -1235,29 +1235,6 @@ 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,
|
||||
@@ -1373,6 +1350,26 @@ 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,
|
||||
@@ -1381,7 +1378,9 @@ 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
|
||||
|
||||
+11
-15
@@ -3,7 +3,7 @@
|
||||
<el-dialog
|
||||
:model-value="visible"
|
||||
:title="dialogTitle"
|
||||
width="800px"
|
||||
width="560px"
|
||||
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" body-class="qc-result-chg-body">
|
||||
<DialogFormBody :loading="loading">
|
||||
<el-empty
|
||||
v-if="!loading && !entries.length"
|
||||
description="暂无修改记录"
|
||||
:image-size="72"
|
||||
:image-size="56"
|
||||
/>
|
||||
<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,6 +67,7 @@
|
||||
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'
|
||||
@@ -113,12 +114,14 @@
|
||||
loading.value = true
|
||||
entries.value = []
|
||||
try {
|
||||
// 多任务统一走批量接口,避免路径被 /qc-tasks/{id} 误匹配
|
||||
const list = ids.length
|
||||
? await fetchQcTaskResultChangeLogsBatch(ids)
|
||||
: []
|
||||
const list =
|
||||
ids.length > 1
|
||||
? await fetchQcTaskResultChangeLogsBatch(ids)
|
||||
: ids.length === 1
|
||||
? await fetchQcTaskResultChangeLogs(ids[0])
|
||||
: []
|
||||
if (seq !== loadSeq) return
|
||||
entries.value = Array.isArray(list) ? list : []
|
||||
entries.value = list || []
|
||||
} catch {
|
||||
if (seq !== loadSeq) return
|
||||
entries.value = []
|
||||
@@ -137,18 +140,11 @@
|
||||
</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 {
|
||||
|
||||
Reference in new issue
Block a user