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" v-if="!isPause&&activeIndex < TEST_TOTAL"
:disabled="activeIndex===0" :disabled="activeIndex===0"
:icon="VideoPause" :icon="VideoPause"
@click="ts = 'paused'">暂停检测 @click="emit('update:testStatus','paused')">暂停检测
</el-button> </el-button>
<el-button type="success" v-if="activeIndex >= TEST_TOTAL" :icon="Check" disabled>检测完成</el-button> <el-button type="success" v-if="activeIndex >= TEST_TOTAL" :icon="Check" disabled>检测完成</el-button>
@@ -20,7 +20,7 @@
type="warning" type="warning"
v-if="isPause && activeIndex < TEST_TOTAL" v-if="isPause && activeIndex < TEST_TOTAL"
:icon="Refresh" :icon="Refresh"
@click="ts='process'" @click="emit('update:testStatus','process')"
>继续检测 >继续检测
</el-button> </el-button>
<el-button type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button> <el-button type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
@@ -857,16 +857,13 @@ const handlePauseOrContinue = () => {
type: 'info', type: 'info',
log: currentTime.value + ':暂停检测', log: currentTime.value + ':暂停检测',
}) })
pauseTimer() pauseTimer()
} else { } else {
startData.value = new Date(); startData.value = new Date();
testLogList.value.push({ testLogList.value.push({
type: 'info', type: 'info',
log: currentTime.value + ':继续检测', log: currentTime.value + ':继续检测',
}) })
resumeTimer() resumeTimer()
} }
isPause.value = !isPause.value; isPause.value = !isPause.value;
@@ -2167,12 +2164,11 @@ const props = defineProps({
} }
}) })
const testStatus = toRef(props, 'testStatus'); const testStatus = toRef(props, 'testStatus');
const ts = ref('');
//监听goods_sn的变化 //监听goods_sn的变化
watch(testStatus, function (newValue, oldValue) { watch(testStatus, function (newValue, oldValue) {
if (newValue == 'start') { if (newValue == 'start') {
ts.value = 'process' emit('update:testStatus', 'process')
startTimer() startTimer()
} }
if (newValue == 'paused' && oldValue == 'process') { if (newValue == 'paused' && oldValue == 'process') {
@@ -2187,11 +2183,6 @@ watch(testStatus, function (newValue, oldValue) {
const emit = defineEmits(['update:testStatus']); const emit = defineEmits(['update:testStatus']);
//监听sn
watch(ts, function (newValue, oldValue) {
//修改父组件
emit('update:testStatus',ts.value)
})
const startTimer = () => { const startTimer = () => {
//if (timer.value !== null) return; // 如果定时器已经启动,则不再重复启动 //if (timer.value !== null) return; // 如果定时器已经启动,则不再重复启动
@@ -2249,7 +2240,7 @@ const startTimer = () => {
percentage.value = 100; percentage.value = 100;
clearInterval(timer.value) clearInterval(timer.value)
timer.value = null; timer.value = null;
ts.value = 'success' emit('update:testStatus', 'success')
ElMessageBox.alert('检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作', '检测完成', { ElMessageBox.alert('检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作', '检测完成', {
// if you want to disable its autofocus // if you want to disable its autofocus
@@ -2261,7 +2252,7 @@ const startTimer = () => {
} else { } else {
clearInterval(timer.value) clearInterval(timer.value)
timer.value = null; timer.value = null;
ts.value = 'success' emit('update:testStatus', 'success')
scrollToBottom(); scrollToBottom();
} }
}, 2000); }, 2000);