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">

View File

@@ -25,6 +25,7 @@
<el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < 2 && ActiveStatue != 'success'" :disabled="skipDisabled" @click="nextStep">跳过</el-button>
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit">开始检测</el-button>
<el-button type="danger" :icon="Close" v-if="ActiveStatue === 'process'" @click="handleSubmit">停止检测</el-button>
<el-button type="danger" :icon="Close" v-if="ActiveStatue === 'paused'" @click="handleSubmit">继续检测</el-button>
<el-button type="primary" :icon="Refresh" v-if="ActiveStatue === 'error'" @click="handleSubmit">重新检测</el-button>
<el-button type="primary" :icon="Right" v-if="ActiveStatue === 'success'" @click="nextStep">{{nextStepText}}</el-button>
</div>
@@ -35,18 +36,26 @@
</template>
<script lang="tsx" setup name="testPopup">
import { h } from 'vue';
import {ElLoading, ElMessage, ElMessageBox, ElSelectV2, FormInstance, FormItemRule} from 'element-plus'
import { defineProps, defineEmits, reactive,watch,ref, Ref } from 'vue';
import { dialogBig,dialogMiddle} from '@/utils/elementBind'
import {h, reactive, ref, watch} from 'vue';
import {ElMessage, ElMessageBox} from 'element-plus'
//import IndicatorTypeDialog from "@/views/machine/errorSystem/components/IndicatorTypeDialog.vue"; // 导入子组件
import {CirclePlus, Delete, EditPen,FolderOpened,CopyDocument,Edit, Picture, UploadFilled, SuccessFilled,VideoPlay,Right,Refresh,Close, Odometer,Coin,Key, DArrowRight} from '@element-plus/icons-vue'
import { useDictStore } from '@/stores/modules/dict'
import {
Close,
Coin,
DArrowRight,
Edit,
Key,
Odometer,
Refresh,
Right,
SuccessFilled,
UploadFilled,
VideoPlay
} from '@element-plus/icons-vue'
import preTest from './preTest.vue'
import timeTest from './timeTest.vue'
import socketClient from '@/utils/webSocketClient';
import {startTest} from '@/api/socket/socket'
import channelsTest from './channelsTest.vue'
//import SvgIcon from '@/components/SvgIcon.vue';
// import preTestIcon from '@/assets/icons/preTest.svg'
@@ -215,7 +224,13 @@ const detectionOptions = ref([
// channelsTestStatus.value = 'start'
// break;
case 2:
if (TestStatus.value == "waiting") {
TestStatus.value = 'start'
} else if (TestStatus.value == 'process') {
TestStatus.value = 'paused'
} else if (TestStatus.value == 'paused') {
TestStatus.value = 'process'
}
break;
default:
break;