用户二级评估-直接评估功能

This commit is contained in:
sjl
2025-08-27 09:22:55 +08:00
parent cf91f53b45
commit 17493f9c26
2 changed files with 86 additions and 25 deletions

View File

@@ -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({ return createAxios({
url: '/advance-boot/secondaryEvaluation/downTemplateAssessResult', url: '/advance-boot/secondaryEvaluation/downTemplateAssessResult',
method: 'get', method: 'get',

View File

@@ -25,7 +25,11 @@
<el-icon class="is-loading"><Loading /></el-icon> <el-icon class="is-loading"><Loading /></el-icon>
<span class="loading-text">加载中...</span> <span class="loading-text">加载中...</span>
</div> </div>
<information v-show="!infoLoading" :node-id="currentNodeId" @data-loaded="() => infoLoading = false" /> <information
v-show="!infoLoading"
:node-id="currentNodeId"
@data-loaded="() => infoLoading = false"
/>
</div> </div>
</el-collapse-item> </el-collapse-item>
<el-collapse-item title="评估结果信息" :name="2"> <el-collapse-item title="评估结果信息" :name="2">
@@ -34,7 +38,13 @@
<el-icon class="is-loading"><Loading /></el-icon> <el-icon class="is-loading"><Loading /></el-icon>
<span class="loading-text">加载中...</span> <span class="loading-text">加载中...</span>
</div> </div>
<Outcome v-show="!outcomeLoading" :node-id="currentNodeId" @data-status="handleDataStatus" @data-loaded="() => outcomeLoading = false" /> <Outcome
v-show="!outcomeLoading"
:node-id="currentNodeId"
@data-status="handleDataStatus"
@data-loaded="() => outcomeLoading = false"
/>
</div> </div>
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
@@ -58,7 +68,7 @@ import TableHeader from '@/components/table/header/index.vue'
import { mainHeight } from '@/utils/layout' import { mainHeight } from '@/utils/layout'
import information from './information.vue' import information from './information.vue'
import Outcome from './outcome.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 { Loading } from '@element-plus/icons-vue'
import AssessTemplate from './assessTemplate.vue' import AssessTemplate from './assessTemplate.vue'
@@ -79,6 +89,7 @@ const assessTemplate = ref()
const currentNodeId = ref<string | number | null>(null) const currentNodeId = ref<string | number | null>(null)
const currentNodeName = ref('') const currentNodeName = ref('')
const tableStore = new TableStore({ const tableStore = new TableStore({
url: '', url: '',
method: 'POST', method: 'POST',
@@ -118,6 +129,7 @@ const exportExcelTemplate = async () => {
}, 0) }, 0)
} }
//导出
const exportReport = () => { const exportReport = () => {
if (!result.value){ if (!result.value){
ElMessage.warning('请先评估!') ElMessage.warning('请先评估!')
@@ -154,18 +166,19 @@ const exportReport = () => {
}) })
} }
//导入
const handleImportClick = () => { const handleImportClick = () => {
if (!currentNodeId.value) { if (!currentNodeId.value) {
ElMessage.warning('请选择评估节点!') ElMessage.warning('请选择评估节点!')
return return
} }
assessTemplate.value.open('导入背景数据', currentNodeId.value.toString()) assessTemplate.value.open('导入背景数据', currentNodeId.value.toString())
} }
// 导入通知父组件更新 // 导入弹窗关闭后通知父组件更新
const assess = async () => { const assess = async () => {
// 展开评估结果 // 展开评估结果
collapseName.value = [2] collapseName.value = [2]
// 更新评估状态 // 更新评估状态
@@ -175,28 +188,65 @@ const assess = async () => {
// 可以通过修改 currentNodeId 的值,或者重新赋值来触发 watch // 可以通过修改 currentNodeId 的值,或者重新赋值来触发 watch
const tempId = currentNodeId.value const tempId = currentNodeId.value
currentNodeId.value = null // 先置空 currentNodeId.value = null // 先置空
setTimeout(() => { setTimeout(() => {
currentNodeId.value = tempId // 再恢复,触发 watch currentNodeId.value = tempId // 再恢复,触发 watch
}, 0) }, 0)
} }
//评估 //评估
const assess2 = async () => { const assess2 = async () => {
// 展开评估结果 // 显示导出中提示
collapseName.value = [2] const loading = ElLoading.service({
// 更新评估状态 lock: true,
result.value = true text: '评估结果中...',
background: 'rgba(0, 0, 0, 0.7)'
});
const tempId = currentNodeId.value userGetInfo({ assessId: currentNodeId.value }).then(res => {
currentNodeId.value = null // 先置空 // 获取昨天的日期
setTimeout(() => { const yesterday = new Date();
currentNodeId.value = tempId // 再恢复,触发 watch yesterday.setDate(yesterday.getDate() - 1);
}, 0)
// 格式化为 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(() => { onMounted(() => {
const dom = document.getElementById('navigation-splitpanes') const dom = document.getElementById('navigation-splitpanes')