This commit is contained in:
caozehui
2024-12-20 19:14:07 +08:00
parent 9b8765f001
commit dc3976f525
2 changed files with 57 additions and 18 deletions

View File

@@ -115,6 +115,7 @@ import {dialogBig} from "@/utils/elementBind";
import {CheckData} from "@/api/check/interface"
import {useCheckStore} from "@/stores/modules/check";
const checkStore = useCheckStore()
const drawer = ref(false)
@@ -122,7 +123,6 @@ const showTestLog = () =>{
drawer.value = true
}
// 总测试项数
const TEST_TOTAL = 12
// 最大通道数
@@ -859,6 +859,7 @@ const handlePauseOrContinue = () => {
})
pauseTimer()
ts.value = "paused"
} else {
startData.value = new Date();
@@ -868,6 +869,7 @@ const handlePauseOrContinue = () => {
})
resumeTimer()
ts.value = "process"
}
isPause.value = !isPause.value;
};
@@ -2160,15 +2162,41 @@ const handleClick = (deviceItem: any, chnNum: number) => {
// },
// ])
const {testStatus} = defineProps({
const props = defineProps({
testStatus: {
type: ref<string>,
default: ref('waiting')
type: String,
default: 'wait'
}
})
const testStatus = toRef(props, 'testStatus');
const ts = ref('');
//监听goods_sn的变化
watch(testStatus, function (newValue, oldValue) {
console.log('testStatus', newValue, oldValue)
// ts.value = props.testStatus;
if (newValue == 'start') {
ts.value = 'process'
startTimer()
}
if (newValue == 'paused' && oldValue == 'process') {
isPause.value = false
handlePauseOrContinue()
}
if (newValue === 'process' && oldValue == 'paused') {
isPause.value = true
handlePauseOrContinue()
}
})
const emit = defineEmits(['update:testStatus']);
//监听sn
watch(ts, function (newValue, oldValue) {
//修改父组件
emit('update:testStatus',ts.value)
})
const startTimer = () => {
//if (timer.value !== null) return; // 如果定时器已经启动,则不再重复启动
timer.value = setInterval(() => {
@@ -2225,7 +2253,7 @@ const startTimer = () => {
percentage.value = 100;
clearInterval(timer.value)
timer.value = null;
emit('update:testStatus', 'success')
ts.value = 'success'
ElMessageBox.alert('检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作', '检测完成', {
// if you want to disable its autofocus
@@ -2237,7 +2265,7 @@ const startTimer = () => {
} else {
clearInterval(timer.value)
timer.value = null;
emit('update:testStatus', 'success')
ts.value = 'success'
scrollToBottom();
}
}, 2000);
@@ -2258,10 +2286,6 @@ const resumeTimer = () => {
console.log('开始继续检测')
};
watch(() => testStatus, function (newValue, oldValue) {
startTimer()
})
</script>
<style scoped lang="scss">