This commit is contained in:
caozehui
2024-12-20 20:20:08 +08:00
parent b63e8897f5
commit ff7084a332

View File

@@ -11,7 +11,7 @@
v-if="!isPause&&activeIndex < TEST_TOTAL"
:disabled="activeIndex===0"
:icon="VideoPause"
@click="ts = 'paused'">暂停检测
@click="emit('update:testStatus','paused')">暂停检测
</el-button>
<el-button type="success" v-if="activeIndex >= TEST_TOTAL" :icon="Check" disabled>检测完成</el-button>
@@ -20,7 +20,7 @@
type="warning"
v-if="isPause && activeIndex < TEST_TOTAL"
:icon="Refresh"
@click="ts='process'"
@click="emit('update:testStatus','process')"
>继续检测
</el-button>
<el-button type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
@@ -89,15 +89,15 @@
</el-table>
</div>
</div>
<el-drawer v-model="drawer" title="检测项进度" >
<!-- <div ref="scrollContainer" > -->
<p v-for="(item, index) in testLogList"
:key="index"
:style="{color:item.type==='error'?'#F56C6C':'var(--el-text-color-regular)'}">
{{ item.log }}<br/>
</p>
<!-- </div> -->
</div>
<el-drawer v-model="drawer" title="检测项进度">
<!-- <div ref="scrollContainer" > -->
<p v-for="(item, index) in testLogList"
:key="index"
:style="{color:item.type==='error'?'#F56C6C':'var(--el-text-color-regular)'}">
{{ item.log }}<br/>
</p>
<!-- </div> -->
</el-drawer>
<resultPopup
@@ -119,7 +119,7 @@ import {useCheckStore} from "@/stores/modules/check";
const checkStore = useCheckStore()
const drawer = ref(false)
const showTestLog = () =>{
const showTestLog = () => {
drawer.value = true
}
@@ -842,7 +842,7 @@ const handleReCheck = () => {
};
// 用来保存定时器
const timer:any = ref("");
const timer: any = ref("");
// 处理暂停、继续按钮点击事件
const handlePauseOrContinue = () => {
@@ -857,16 +857,13 @@ const handlePauseOrContinue = () => {
type: 'info',
log: currentTime.value + ':暂停检测',
})
pauseTimer()
} else {
startData.value = new Date();
testLogList.value.push({
type: 'info',
log: currentTime.value + ':继续检测',
})
resumeTimer()
}
isPause.value = !isPause.value;
@@ -2167,12 +2164,11 @@ const props = defineProps({
}
})
const testStatus = toRef(props, 'testStatus');
const ts = ref('');
//监听goods_sn的变化
watch(testStatus, function (newValue, oldValue) {
if (newValue == 'start') {
ts.value = 'process'
emit('update:testStatus', 'process')
startTimer()
}
if (newValue == 'paused' && oldValue == 'process') {
@@ -2187,11 +2183,6 @@ watch(testStatus, function (newValue, oldValue) {
const emit = defineEmits(['update:testStatus']);
//监听sn
watch(ts, function (newValue, oldValue) {
//修改父组件
emit('update:testStatus',ts.value)
})
const startTimer = () => {
//if (timer.value !== null) return; // 如果定时器已经启动,则不再重复启动
@@ -2249,7 +2240,7 @@ const startTimer = () => {
percentage.value = 100;
clearInterval(timer.value)
timer.value = null;
ts.value = 'success'
emit('update:testStatus', 'success')
ElMessageBox.alert('检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作', '检测完成', {
// if you want to disable its autofocus
@@ -2261,7 +2252,7 @@ const startTimer = () => {
} else {
clearInterval(timer.value)
timer.value = null;
ts.value = 'success'
emit('update:testStatus', 'success')
scrollToBottom();
}
}, 2000);