用户二级评估-直接评估功能
This commit is contained in:
@@ -383,7 +383,18 @@ 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 = () => {
|
||||
|
||||
@@ -25,7 +25,11 @@
|
||||
<el-icon class="is-loading"><Loading /></el-icon>
|
||||
<span class="loading-text">加载中...</span>
|
||||
</div>
|
||||
<information v-show="!infoLoading" :node-id="currentNodeId" @data-loaded="() => infoLoading = false" />
|
||||
<information
|
||||
v-show="!infoLoading"
|
||||
:node-id="currentNodeId"
|
||||
@data-loaded="() => infoLoading = false"
|
||||
/>
|
||||
</div>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item title="评估结果信息" :name="2">
|
||||
@@ -34,7 +38,13 @@
|
||||
<el-icon class="is-loading"><Loading /></el-icon>
|
||||
<span class="loading-text">加载中...</span>
|
||||
</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>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
@@ -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<string | number | null>(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,6 +166,8 @@ const exportReport = () => {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//导入
|
||||
const handleImportClick = () => {
|
||||
if (!currentNodeId.value) {
|
||||
ElMessage.warning('请选择评估节点!')
|
||||
@@ -163,9 +177,8 @@ 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 () => {
|
||||
// 显示导出中提示
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '评估结果中...',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
});
|
||||
|
||||
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]
|
||||
collapseName.value = [2];
|
||||
// 更新评估状态
|
||||
result.value = true
|
||||
result.value = true;
|
||||
|
||||
const tempId = currentNodeId.value
|
||||
currentNodeId.value = null // 先置空
|
||||
const tempId = currentNodeId.value;
|
||||
currentNodeId.value = null; // 先置空
|
||||
setTimeout(() => {
|
||||
currentNodeId.value = tempId // 再恢复,触发 watch
|
||||
}, 0)
|
||||
|
||||
|
||||
}
|
||||
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')
|
||||
|
||||
Reference in New Issue
Block a user