This commit is contained in:
caozehui
2025-01-07 19:03:00 +08:00
parent b0a5329937
commit 5ac6bbf04b
2 changed files with 118 additions and 67 deletions

View File

@@ -12,18 +12,24 @@
:icon="VideoPause" :icon="VideoPause"
@click="emit('sendPause')">停止检测 @click="emit('sendPause')">停止检测
</el-button> </el-button>
<el-button <!-- <el-button-->
type="primary" <!-- type="primary"-->
v-if="testStatus=='preTest_process'" <!-- v-if="testStatus=='test_init'"-->
:icon="VideoPause" <!-- :icon="VideoPause"-->
disabled>预检测中 <!-- disabled>初始化中-->
</el-button> <!-- </el-button>-->
<el-button <!-- <el-button-->
type="danger" <!-- type="danger"-->
v-if="testStatus=='preTest_fail'" <!-- v-if="testStatus=='test_init_fail'"-->
:icon="Failed" <!-- :icon="Failed"-->
disabled>预检测失败 <!-- disabled>初始化失败-->
</el-button> <!-- </el-button>-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- v-if="testStatus=='connect_timeout'"-->
<!-- :icon="Failed"-->
<!-- disabled>连接超时-->
<!-- </el-button>-->
<el-button <el-button
type="primary" type="primary"
:icon="RefreshLeft" :icon="RefreshLeft"
@@ -113,9 +119,6 @@
</div> </div>
<div class="drawer-container"> <div class="drawer-container">
<el-drawer v-model="drawer" title="检测项进度"> <el-drawer v-model="drawer" title="检测项进度">
<!-- <template #header>-->
<!-- <div style="background: #003078 !important; color: #fff !important; font-size: 18px;">检测项进度</div>-->
<!-- </template>-->
<div ref="scrollContainerRef" style="height: 100%; overflow-y: auto;"> <div ref="scrollContainerRef" style="height: 100%; overflow-y: auto;">
<p v-for="(item, index) in testLogList" <p v-for="(item, index) in testLogList"
:key="index" :key="index"
@@ -284,7 +287,7 @@ const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(()
watch(testStatus, function (newValue, oldValue) { watch(testStatus, function (newValue, oldValue) {
if (newValue == 'start') { if (newValue == 'start') {
ElMessage.success('预检测开始!') ElMessage.success('初始化开始!')
if (oldValue == 'error') { if (oldValue == 'error') {
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:开始重新检测!`}) testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:开始重新检测!`})
@@ -293,29 +296,29 @@ watch(testStatus, function (newValue, oldValue) {
activeIndex = 0 activeIndex = 0
percentage.value = 0 percentage.value = 0
} }
emit('update:testStatus', 'preTest_process') emit('update:testStatus', 'test_init')
//startTimer() // todo 可移除 startTimer() // todo 可移除
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}预检测开始!`}) testLogList.push({type: 'info', log: `${new Date().toLocaleString()}初始化开始!`})
} }
}) })
watch(webMsgSend, function (newValue, oldValue) { watch(webMsgSend, function (newValue, oldValue) {
if (newValue.code == 10550) { if (newValue.code == 10550) {
ElMessageBox.alert(`${newValue.data}设备通讯失败,请检查设备连接情况!`, '预检测失败', { ElMessageBox.alert(`${newValue.data}设备通讯失败,请检查设备连接情况!`, '初始化失败', {
confirmButtonText: '确定', confirmButtonText: '确定',
type: 'error', type: 'error',
}) })
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}设备通讯中断!`}) testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}设备通讯中断!`})
emit('update:testStatus', 'preTest_fail') emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10551) { } else if (newValue.code == 10551) {
ElMessageBox.alert(`${newValue.data}设备触发报告异常!`, '预检测失败', { ElMessageBox.alert(`${newValue.data}设备触发报告异常!`, '初始化失败', {
confirmButtonText: '确定', confirmButtonText: '确定',
type: 'error', type: 'error',
}) })
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}设备触发报告异常!`}) testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}设备触发报告异常!`})
emit('update:testStatus', 'preTest_fail') emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10552) { //todo 10552之后还会发送消息吗 } else if (newValue.code == 10552) { //todo 10552之后还会发送消息吗
ElMessageBox.alert('存在已经初始化步骤,执行自动关闭,请重新发起检测', '预检测失败', { ElMessageBox.alert('存在已经初始化步骤,执行自动关闭,请重新发起检测', '初始化失败', {
confirmButtonText: '确定', confirmButtonText: '确定',
type: 'error', type: 'error',
}) })
@@ -326,34 +329,64 @@ watch(webMsgSend, function (newValue, oldValue) {
emit('update:testStatus', 'error') emit('update:testStatus', 'error')
} else { } else {
switch (newValue.requestId) { switch (newValue.requestId) {
case 'socket_timeout':
switch (newValue.operateCode) {
case "VOLTAGE":
ElMessageBox.alert('连接超时!', '连接超时', {
confirmButtonText: '确定',
type: 'error',
})
emit('update:testStatus', 'connect_timeout')
break;
}
break;
// case 'connect': // case 'connect':
// switch (newValue.operateCode) { // switch (newValue.operateCode) {
// case "Source": // case "Source":
// ElMessageBox.alert('源通讯失败,请检查源连接情况!', '预检测失败', { // ElMessageBox.alert('源通讯失败,请检查源连接情况!', '初始化失败', {
// confirmButtonText: '确定', // confirmButtonText: '确定',
// type: 'error', // type: 'error',
// }) // })
// testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源通讯失败!`}) // testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源通讯失败!`})
// break; // break;
// case "Dev": // case "Dev":
// ElMessageBox.alert('设备通讯失败,请检查设备连接情况!', '预检测失败', { // ElMessageBox.alert('设备通讯失败,请检查设备连接情况!', '初始化失败', {
// confirmButtonText: '确定', // confirmButtonText: '确定',
// type: 'error', // type: 'error',
// }) // })
// testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:设备通讯失败!`}) // testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:设备通讯失败!`})
// break; // break;
// } // }
// emit('update:testStatus', 'preTest_fail') // emit('update:testStatus', 'test_init_fail')
// break; // break;
case 'yjc_ytxjy':
switch (newValue.operateCode) {
case 'INIT_GATHER':
if (newValue.code == 10200) {
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:源初始化成功!`})
}
break;
}
break;
case 'yjc_sbtxjy':
switch (newValue.operateCode) {
case 'INIT_GATHER$01':
if (newValue.code == 25001) {
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:设备通讯校验成功!`})
}
break
}
break;
case 'yjc_xyjy': case 'yjc_xyjy':
switch (newValue.operateCode) { switch (newValue.operateCode) {
case 'INIT_GATHER$03': case 'INIT_GATHER$03':
if (newValue.code == 25001) { if (newValue.code == 25001) {
ElMessage.success('预检测成功!') ElMessage.success('初始化成功!')
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}预检测成功!`}) testLogList.push({type: 'info', log: `${new Date().toLocaleString()}协议校验成功!`})
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化成功!`})
activeIndex = getNextActiveIndex() + 2 activeIndex = getNextActiveIndex() + 2
//startTimer() startTimer()
emit('update:testStatus', 'process') emit('update:testStatus', 'process')
} }
@@ -386,7 +419,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('FREQ') activeIndex = getNextActiveIndex('FREQ')
//startTimer() startTimer()
} }
break; break;
case 'V_Start': case 'V_Start':
@@ -399,7 +432,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('V') activeIndex = getNextActiveIndex('V')
//startTimer() startTimer()
} }
break; break;
case 'HV_Start': case 'HV_Start':
@@ -412,7 +445,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HV') activeIndex = getNextActiveIndex('HV')
//startTimer() startTimer()
} }
break; break;
case 'HI_Start': case 'HI_Start':
@@ -425,7 +458,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HI') activeIndex = getNextActiveIndex('HI')
//startTimer() startTimer()
} }
break; break;
case 'HP_Start': case 'HP_Start':
@@ -438,7 +471,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HP') activeIndex = getNextActiveIndex('HP')
//startTimer() startTimer()
} }
break; break;
case 'HSV_Start': case 'HSV_Start':
@@ -451,7 +484,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HSV') activeIndex = getNextActiveIndex('HSV')
//startTimer() startTimer()
} }
break; break;
case 'HSI_Start': case 'HSI_Start':
@@ -464,7 +497,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HSI') activeIndex = getNextActiveIndex('HSI')
//startTimer() startTimer()
} }
break; break;
case 'VOLTAGE_Start': case 'VOLTAGE_Start':
@@ -477,7 +510,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('VOLTAGE') activeIndex = getNextActiveIndex('VOLTAGE')
//startTimer() startTimer()
} }
break; break;
case 'I_Start': case 'I_Start':
@@ -490,7 +523,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('I') activeIndex = getNextActiveIndex('I')
//startTimer() startTimer()
} }
break; break;
case 'IMBV_Start': case 'IMBV_Start':
@@ -503,7 +536,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('IMBV') activeIndex = getNextActiveIndex('IMBV')
//startTimer() startTimer()
} }
break; break;
case 'IMBA_Start': case 'IMBA_Start':
@@ -516,7 +549,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('IMBA') activeIndex = getNextActiveIndex('IMBA')
//startTimer() startTimer()
} }
break; break;
case 'F_Start': case 'F_Start':
@@ -529,7 +562,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('F') activeIndex = getNextActiveIndex('F')
//startTimer() startTimer()
} }
break; break;
case 'Quit': case 'Quit':
@@ -763,6 +796,11 @@ const setErrorCheckItem = (scriptType: string, devices: any) => {
const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: any = null) => { const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: any = null) => {
let scriptType = scriptData.filter(item => item.code === scriptCode)[0]?.id let scriptType = scriptData.filter(item => item.code === scriptCode)[0]?.id
devices = [{
chnResult: [2, 2],
deviceId: "80b4b4f52a4c4064a18319525f8ac13c",
deviceName: "240002"
}]
setErrorCheckItem(scriptType, devices) setErrorCheckItem(scriptType, devices)
let temp = null let temp = null
if (isStart) { if (isStart) {
@@ -770,7 +808,7 @@ const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: an
} else { } else {
temp = { temp = {
scriptType, scriptType,
devices, devices
} }
} }
updateCheckResult(temp) updateCheckResult(temp)
@@ -905,26 +943,31 @@ const startTimer = () => {
console.log('开始检测第' + activeIndex + '项') console.log('开始检测第' + activeIndex + '项')
switch (activeIndex) { switch (activeIndex) {
case 0: case 0:
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'socket_timeout',
// operateCode: "VOLTAGE",
// })
// }, 5000)
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'yjc_ytxjy', requestId: 'yjc_ytxjy',
operateCode: "INIT_GATHER", operateCode: "INIT_GATHER",
code: "2222" code: 10200
}) })
}, 2000) }, 2000)
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'yjc_sbtxjy', requestId: 'yjc_sbtxjy',
operateCode: "INIT_GATHER$01", operateCode: "INIT_GATHER$01",
code: "2222", code: 25001
data: '240003'
}) })
}, 4000); }, 4000);
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'yjc_xyjy', requestId: 'yjc_xyjy',
operateCode: "INIT_GATHER$03", operateCode: "INIT_GATHER$03",
code: "25001" code: 25001
}) })
}, 6000) }, 6000)
break; break;
@@ -1083,7 +1126,7 @@ const handleResumeTest = () => {
type: 'info', type: 'info',
log: `${new Date().toLocaleString()}:继续检测`, log: `${new Date().toLocaleString()}:继续检测`,
}) })
//startTimer() startTimer()
console.log('开始继续检测') console.log('开始继续检测')
}; };

View File

@@ -24,12 +24,12 @@
<!-- <el-button @click="handleCancel"> </el-button> --> <!-- <el-button @click="handleCancel"> </el-button> -->
<el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < 2 && ActiveStatue != 'success'" :disabled="skipDisabled" @click="nextStep">跳过</el-button> <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="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 === 'process'" @click="handleSubmit" disabled>检测中</el-button>
<el-button type="danger" :icon="Close" v-if="ActiveStatue === 'paused'" @click="handleSubmit">继续检测</el-button> <el-button type="danger" :icon="Close" v-if="ActiveStatue === 'paused'" @click="handleSubmit">继续检测</el-button>
<el-button type="primary" :icon="RefreshLeft" v-if="ActiveStatue === 'error'" @click="handleSubmit">重新检测</el-button> <el-button type="primary" :icon="RefreshLeft" v-if="ActiveStatue === 'error'" @click="handleSubmit">重新检测</el-button>
<el-button type="primary" :icon="Refresh" v-if="ActiveStatue === 'preTest_process'" disabled>预检测</el-button> <el-button type="primary" :icon="Refresh" v-if="ActiveStatue === 'test_init'" disabled>初始化</el-button>
<el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right" <el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right"
v-if="ActiveStatue === 'success'||ActiveStatue==='preTest_fail'" @click="nextStep"> v-if="ActiveStatue === 'success'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'" @click="nextStep">
{{ nextStepText }} {{ nextStepText }}
</el-button> </el-button>
</div> </div>
@@ -272,20 +272,22 @@ const detectionOptions = ref([
}*/ }*/
}) })
TestStatus.value = 'start' TestStatus.value = 'start'
} else if (TestStatus.value == 'process') { } else
// 发送暂停指令 // if (TestStatus.value == 'process') {
sendPause() // // 发送暂停指令
// pauseTest({deviceIds}).then(res => { // sendPause()
// console.log(res) // // pauseTest({deviceIds}).then(res => {
// if (res.code === 20000) { // // console.log(res)
// TestStatus.value = 'paused' // // if (res.code === 20000) {
// webMsgSend.value = '' // // TestStatus.value = 'paused'
// } else { // // webMsgSend.value = ''
// ElMessage.error(res.message) // // } else {
// } // // ElMessage.error(res.message)
// }) // // }
// // })
} else if (TestStatus.value == 'paused') { //
// } else
if (TestStatus.value == 'paused') {
// 发送继续指令 // 发送继续指令
sendResume() sendResume()
// resumeTest({deviceIds}).then(res => { // resumeTest({deviceIds}).then(res => {
@@ -348,11 +350,17 @@ const detectionOptions = ref([
stepsActiveIndex.value++; stepsActiveIndex.value++;
nextStepText.value = '检测完成' nextStepText.value = '检测完成'
} }
if(newValue === 'preTest_fail' && stepsActiveIndex.value === stepsTotalNum.value - 2) if(newValue === 'test_init_fail' && stepsActiveIndex.value === stepsTotalNum.value - 2)
{ {
stepsActiveIndex.value++; stepsActiveIndex.value++;
stepsActiveIndex.value++; stepsActiveIndex.value++;
nextStepText.value = '预检测失败' nextStepText.value = '初始化失败'
}
if(newValue === 'connect_timeout' && stepsActiveIndex.value === stepsTotalNum.value - 2)
{
stepsActiveIndex.value++;
stepsActiveIndex.value++;
nextStepText.value = '连接超时'
} }
}) })