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

View File

@@ -24,12 +24,12 @@
<!-- <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="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="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"
v-if="ActiveStatue === 'success'||ActiveStatue==='preTest_fail'" @click="nextStep">
v-if="ActiveStatue === 'success'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'" @click="nextStep">
{{ nextStepText }}
</el-button>
</div>
@@ -272,20 +272,22 @@ const detectionOptions = ref([
}*/
})
TestStatus.value = 'start'
} else if (TestStatus.value == 'process') {
// 发送暂停指令
sendPause()
// pauseTest({deviceIds}).then(res => {
// console.log(res)
// if (res.code === 20000) {
// TestStatus.value = 'paused'
// webMsgSend.value = ''
// } else {
// ElMessage.error(res.message)
// }
// })
} else if (TestStatus.value == 'paused') {
} else
// if (TestStatus.value == 'process') {
// // 发送暂停指令
// sendPause()
// // pauseTest({deviceIds}).then(res => {
// // console.log(res)
// // if (res.code === 20000) {
// // TestStatus.value = 'paused'
// // webMsgSend.value = ''
// // } else {
// // ElMessage.error(res.message)
// // }
// // })
//
// } else
if (TestStatus.value == 'paused') {
// 发送继续指令
sendResume()
// resumeTest({deviceIds}).then(res => {
@@ -348,11 +350,17 @@ const detectionOptions = ref([
stepsActiveIndex.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++;
nextStepText.value = '预检测失败'
nextStepText.value = '初始化失败'
}
if(newValue === 'connect_timeout' && stepsActiveIndex.value === stepsTotalNum.value - 2)
{
stepsActiveIndex.value++;
stepsActiveIndex.value++;
nextStepText.value = '连接超时'
}
})