From 17493f9c26f9a901dccbadb129f53e5f8d64509a Mon Sep 17 00:00:00 2001 From: sjl <1716605279@qq.com> Date: Wed, 27 Aug 2025 09:22:55 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BA=8C=E7=BA=A7=E8=AF=84?= =?UTF-8?q?=E4=BC=B0-=E7=9B=B4=E6=8E=A5=E8=AF=84=E4=BC=B0=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/advance-boot/assess.ts | 17 +++- .../assessment/components/assess/index.vue | 94 ++++++++++++++----- 2 files changed, 86 insertions(+), 25 deletions(-) diff --git a/src/api/advance-boot/assess.ts b/src/api/advance-boot/assess.ts index d42e73e9..1cb0eab5 100644 --- a/src/api/advance-boot/assess.ts +++ b/src/api/advance-boot/assess.ts @@ -383,10 +383,21 @@ export const evaluation = (assessId: string, file: File) => { } //直接评估 +export function assessResult(data: { + assessId: string | number, + endTime: string, + id: string | number, + startTime: string + }) { + return createAxios({ + url: `/advance-boot/secondaryEvaluation/lineEvaluation`, + method: 'post', + data + }); + } - - //下载模板 - export const downloadAssessTemplate = () => { +//下载模板 +export const downloadAssessTemplate = () => { return createAxios({ url: '/advance-boot/secondaryEvaluation/downTemplateAssessResult', method: 'get', diff --git a/src/views/pqs/runManage/assessment/components/assess/index.vue b/src/views/pqs/runManage/assessment/components/assess/index.vue index afce0af0..90847891 100644 --- a/src/views/pqs/runManage/assessment/components/assess/index.vue +++ b/src/views/pqs/runManage/assessment/components/assess/index.vue @@ -25,7 +25,11 @@ 加载中... - + @@ -34,7 +38,13 @@ 加载中... - + @@ -58,7 +68,7 @@ import TableHeader from '@/components/table/header/index.vue' import { mainHeight } from '@/utils/layout' import information from './information.vue' import Outcome from './outcome.vue' -import {exportResult,downloadAssessTemplate} from '@/api/advance-boot/assess' +import {exportResult,downloadAssessTemplate,assessResult,userGetInfo} from '@/api/advance-boot/assess' import { Loading } from '@element-plus/icons-vue' import AssessTemplate from './assessTemplate.vue' @@ -79,6 +89,7 @@ const assessTemplate = ref() const currentNodeId = ref(null) const currentNodeName = ref('') + const tableStore = new TableStore({ url: '', method: 'POST', @@ -118,6 +129,7 @@ const exportExcelTemplate = async () => { }, 0) } +//导出 const exportReport = () => { if (!result.value){ ElMessage.warning('请先评估!') @@ -154,18 +166,19 @@ const exportReport = () => { }) } + +//导入 const handleImportClick = () => { -if (!currentNodeId.value) { - ElMessage.warning('请选择评估节点!') - return -} -assessTemplate.value.open('导入背景数据', currentNodeId.value.toString()) + if (!currentNodeId.value) { + ElMessage.warning('请选择评估节点!') + return + } + assessTemplate.value.open('导入背景数据', currentNodeId.value.toString()) } -// 导入通知父组件更新 +// 导入弹窗关闭后通知父组件更新 const assess = async () => { - // 展开评估结果 collapseName.value = [2] // 更新评估状态 @@ -175,28 +188,65 @@ const assess = async () => { // 可以通过修改 currentNodeId 的值,或者重新赋值来触发 watch const tempId = currentNodeId.value currentNodeId.value = null // 先置空 + setTimeout(() => { currentNodeId.value = tempId // 再恢复,触发 watch }, 0) - - } //评估 const assess2 = async () => { -// 展开评估结果 -collapseName.value = [2] -// 更新评估状态 -result.value = true + // 显示导出中提示 + const loading = ElLoading.service({ + lock: true, + text: '评估结果中...', + background: 'rgba(0, 0, 0, 0.7)' + }); -const tempId = currentNodeId.value -currentNodeId.value = null // 先置空 -setTimeout(() => { - currentNodeId.value = tempId // 再恢复,触发 watch -}, 0) + userGetInfo({ assessId: currentNodeId.value }).then(res => { + // 获取昨天的日期 + const yesterday = new Date(); + yesterday.setDate(yesterday.getDate() - 1); + // 格式化为 yyyy-MM-dd + const yyyy = yesterday.getFullYear(); + const mm = String(yesterday.getMonth() + 1).padStart(2, '0'); + const dd = String(yesterday.getDate()).padStart(2, '0'); + const yesterdayStr = `${yyyy}-${mm}-${dd}`; -} + const assessData = { + assessId: currentNodeId.value, + endTime: `${yesterdayStr} 23:59:59`, // 使用动态的昨天日期 + id: res.data.lineId, + startTime: `${yesterdayStr} 00:00:00` // 使用动态的昨天日期 + }; + + assessResult(assessData).then(res => { + // 关闭加载提示并显示成功消息 + loading.close(); + ElMessage.success('评估成功!'); + + // 展开评估结果 + collapseName.value = [2]; + // 更新评估状态 + result.value = true; + + const tempId = currentNodeId.value; + currentNodeId.value = null; // 先置空 + setTimeout(() => { + currentNodeId.value = tempId; // 再恢复,触发 watch + }, 0); + }).catch(error => { + // 关闭加载提示并显示失败消息 + loading.close(); + ElMessage.error('评估失败'); + }); + }).catch(error => { + // 处理 userGetInfo 的错误 + loading.close(); + ElMessage.error('获取用户信息失败'); + }); +}; onMounted(() => { const dom = document.getElementById('navigation-splitpanes')