diff --git a/frontend/src/views/home/components/test.vue b/frontend/src/views/home/components/test.vue index 3d45024..390ece9 100644 --- a/frontend/src/views/home/components/test.vue +++ b/frontend/src/views/home/components/test.vue @@ -11,7 +11,7 @@ v-if="!isPause&&activeIndex < TEST_TOTAL" :disabled="activeIndex===0" :icon="VideoPause" - @click="ts = 'paused'">暂停检测 + @click="emit('update:testStatus','paused')">暂停检测 检测完成 @@ -20,7 +20,7 @@ type="warning" v-if="isPause && activeIndex < TEST_TOTAL" :icon="Refresh" - @click="ts='process'" + @click="emit('update:testStatus','process')" >继续检测 检测项进度 @@ -89,15 +89,15 @@ - - - -

- {{ item.log }}
-

- + + + +

+ {{ item.log }}
+

+
{ +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);