UPDATE: 优化bug

This commit is contained in:
贾同学
2025-10-16 13:12:47 +08:00
parent 0ae3047240
commit 13c5baa74f
2 changed files with 38 additions and 10 deletions

View File

@@ -104,12 +104,33 @@
<el-form ref="formRef" :rules="rules" :model="submitSourceData" label-width="120px" label-position="top">
<el-form-item label="选择次数:" prop="whichTime">
<el-select v-model="submitSourceData.whichTime" placeholder="请选择次数" @change="handleTimeChange">
<template #label="{ label }">
<div style="display: flex; align-items: center; justify-content: space-between">
<el-text>{{ label }}</el-text>
<el-tag
disable-transitions
v-if="currentWhichTimeData.checkResult === 1"
type="success"
>
符合
</el-tag>
<el-tag disable-transitions v-if="currentWhichTimeData.checkResult === 2" type="danger">
不符合
</el-tag>
</div>
</template>
<el-option
v-for="time in whichTimeData"
:key="time"
:label="`第${time}次`"
:value="time"
></el-option>
v-for="item in whichTimeData"
:key="item.time"
:label="`第${item.time}次`"
:value="item.time"
>
<div style="display: flex; align-items: center; justify-content: space-between">
<el-text>{{ '第' + item.time + '次' }}</el-text>
<el-tag v-if="item.checkResult === 1" type="success">符合</el-tag>
<el-tag v-if="item.checkResult === 2" type="danger">不符合</el-tag>
</div>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="数据源和检测结论:" prop="resultType">
@@ -167,7 +188,7 @@ const dialogSourceVisible = ref(false)
const devData = ref<any>()
const activeName = ref<number>(0)
const checkStore = useCheckStore()
const currentWhichTimeData = ref<any>({})
// 定义 emit 事件
const emit = defineEmits<{
(e: 'reportGenerated'): void
@@ -217,7 +238,12 @@ const handleChooseClick = async () => {
if (res.data) {
resultSourceData.value = res.data
// 选择第几次
whichTimeData.value = Object.keys(resultSourceData.value)
whichTimeData.value = Object.keys(resultSourceData.value).map(time => {
// 检测结果只要有一个合格就算合格
const checkResult = resultSourceData.value[time].find((item: any) => item.checkResult === 1)
return { time, checkResult: checkResult ? 1 : 2 }
})
currentWhichTimeData.value = whichTimeData.value[currentResult.whichTime]
sourceData.value = resultSourceData.value[currentResult.whichTime]
}
}
@@ -225,6 +251,7 @@ const handleChooseClick = async () => {
}
const handleTimeChange = (value: any) => {
sourceData.value = resultSourceData.value[value]
currentWhichTimeData.value = whichTimeData.value[value]
submitSourceData.resultType = ''
submitSourceData.checkResult = -1
}