修改正式检测推送逻辑
This commit is contained in:
@@ -114,7 +114,10 @@
|
|||||||
</el-drawer>
|
</el-drawer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<CompareDataCheckSingleChannelSingleTestPopup ref="dataCheckSingleChannelSingleTestPopupRef" />
|
<CompareDataCheckSingleChannelSingleTestPopup
|
||||||
|
ref="dataCheckSingleChannelSingleTestPopupRef"
|
||||||
|
:append-to-body="true"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="tsx" setup name="test">
|
<script lang="tsx" setup name="test">
|
||||||
@@ -297,11 +300,44 @@ let count = 0
|
|||||||
watch(
|
watch(
|
||||||
webMsgSend,
|
webMsgSend,
|
||||||
function (newValue, oldValue) {
|
function (newValue, oldValue) {
|
||||||
if (testStatus.value == 'test_init') {
|
console.log('🚀 ~ newValue:', newValue)
|
||||||
// 正式检测
|
|
||||||
} else {
|
if (checkStore.selectTestItems.preTest == false && newValue.requestId != 'formal_real') {
|
||||||
|
if (testLogList[0].log == '正在检测,请稍等...' || testLogList[0].log == '暂无数据,等待检测开始') {
|
||||||
|
testLogList.shift()
|
||||||
|
setLogList('info', '初始化开始!')
|
||||||
|
}
|
||||||
|
let str =
|
||||||
|
newValue.requestId == 'yjc_sbtxjy'
|
||||||
|
? '设备通讯校验'
|
||||||
|
: newValue.requestId == 'yjc_mxyzxjy'
|
||||||
|
? '模型一致性检验'
|
||||||
|
: newValue.requestId == 'yjc_align'
|
||||||
|
? '实时数据对齐检验'
|
||||||
|
: newValue.requestId == 'YJC_xujy'
|
||||||
|
? '相序校验'
|
||||||
|
: ''
|
||||||
|
// 预检测处理
|
||||||
|
switch (newValue.code) {
|
||||||
|
case 25001:
|
||||||
|
// 成功
|
||||||
|
if (newValue.data != undefined) return
|
||||||
|
setLogList('info', str + '成功!')
|
||||||
|
if (newValue.requestId == 'YJC_xujy') setLogList('info', '初始化成功!')
|
||||||
|
break
|
||||||
|
case 25003:
|
||||||
|
// 失败
|
||||||
|
if (newValue.data != undefined) return
|
||||||
|
setLogList('error', str + '失败!')
|
||||||
|
if (newValue.requestId == 'YJC_xujy') setLogList('info', '初始化失败!')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
// 预监测 正式检测
|
// 预监测 正式检测
|
||||||
if (newValue.requestId == 'formal_real') {
|
else if (newValue.requestId == 'formal_real') {
|
||||||
|
if (testLogList[0].log == '正在检测,请稍等...' || testLogList[0].log == '暂无数据,等待检测开始') {
|
||||||
|
testLogList.shift()
|
||||||
|
}
|
||||||
switch (newValue.code) {
|
switch (newValue.code) {
|
||||||
case 25001:
|
case 25001:
|
||||||
let result: CheckData.ScriptChnItem[] = []
|
let result: CheckData.ScriptChnItem[] = []
|
||||||
@@ -323,32 +359,17 @@ watch(
|
|||||||
result.push(temp)
|
result.push(temp)
|
||||||
})
|
})
|
||||||
Object.assign(checkResult, result)
|
Object.assign(checkResult, result)
|
||||||
testLogList.push({
|
setLogList('info', '检测完成!')
|
||||||
type: 'info',
|
|
||||||
log: `${new Date().toLocaleString()}:` + '检测完成!'
|
|
||||||
})
|
|
||||||
if(testLogList[0].log === '正在检测,请稍等...'){
|
|
||||||
testLogList.shift()
|
|
||||||
}
|
|
||||||
stopTimeCount()
|
stopTimeCount()
|
||||||
break
|
break
|
||||||
case 25003:
|
case 25003:
|
||||||
|
setLogList('error', '检测失败!')
|
||||||
|
|
||||||
testLogList.push({
|
|
||||||
type: 'error',
|
|
||||||
log: `${new Date().toLocaleString()}:` + '检测失败!'
|
|
||||||
})
|
|
||||||
if(testLogList[0].log === '正在检测,请稍等...'){
|
|
||||||
testLogList.shift()
|
|
||||||
}
|
|
||||||
stopTimeCount()
|
stopTimeCount()
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
if (newValue.code != 10201) {
|
if (newValue.code != 10201) {
|
||||||
testLogList.push({
|
setLogList(newValue.code == 10200 ? 'info' : 'error', newValue.data)
|
||||||
type: newValue.code == 10200 ? 'info' : 'error',
|
|
||||||
log: `${new Date().toLocaleString()}:` + newValue.data
|
|
||||||
})
|
|
||||||
|
|
||||||
updatePercentage()
|
updatePercentage()
|
||||||
}
|
}
|
||||||
@@ -356,10 +377,54 @@ watch(
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
switch (newValue.requestId) {
|
||||||
|
case 'connect':
|
||||||
|
switch (newValue.operateCode) {
|
||||||
|
case 'Contrast_Dev':
|
||||||
|
setLogList('error', '设备服务端连接失败!')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'unknown_operate':
|
||||||
|
break
|
||||||
|
case 'error_flow_end':
|
||||||
|
ElMessageBox.alert(`当前流程存在异常结束!`, '检测失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
setLogList('error', '当前流程存在异常结束!')
|
||||||
|
break
|
||||||
|
case 'socket_timeout':
|
||||||
|
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
setLogList('error', '设备连接异常,请检查设备连接情况!')
|
||||||
|
break
|
||||||
|
case 'server_error':
|
||||||
|
ElMessageBox.alert('服务端主动关闭连接!', '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
setLogList('error', '服务端主动关闭连接!')
|
||||||
|
break
|
||||||
|
case 'device_error':
|
||||||
|
ElMessageBox.alert('设备主动关闭连接!', '初始化失败', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
setLogList('error', '设备主动关闭连接!')
|
||||||
|
break
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ deep: true }
|
{ deep: true }
|
||||||
)
|
)
|
||||||
|
const setLogList = (state: 'error' | 'info' | 'warning', text: string) => {
|
||||||
|
testLogList.push({
|
||||||
|
type: state,
|
||||||
|
log: `${new Date().toLocaleString()}:` + text
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 更新进度条
|
// 更新进度条
|
||||||
const updatePercentage = async () => {
|
const updatePercentage = async () => {
|
||||||
@@ -428,11 +493,7 @@ const secondToTime = (second: number) => {
|
|||||||
return h + ':' + m + ':' + s
|
return h + ':' + m + ':' + s
|
||||||
}
|
}
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {})
|
||||||
await initScriptData()
|
|
||||||
initDeviceList()
|
|
||||||
initCheckResult()
|
|
||||||
})
|
|
||||||
|
|
||||||
const showTestLog = () => {
|
const showTestLog = () => {
|
||||||
drawer.value = true
|
drawer.value = true
|
||||||
@@ -658,9 +719,17 @@ const handlePause = () => {
|
|||||||
log: `${new Date().toLocaleString()}:当前测试小项正在执行中,将在该小项执行结束后暂停...`
|
log: `${new Date().toLocaleString()}:当前测试小项正在执行中,将在该小项执行结束后暂停...`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const initializeParameters = () => {
|
const initializeParameters = async () => {
|
||||||
|
await initScriptData()
|
||||||
|
initDeviceList()
|
||||||
|
initCheckResult()
|
||||||
|
|
||||||
percentage.value = 0
|
percentage.value = 0
|
||||||
testLogList.splice(0, testLogList.length, { type: 'info', log: '正在检测,请稍等...' })
|
|
||||||
|
testLogList.splice(0, testLogList.length, {
|
||||||
|
type: 'info',
|
||||||
|
log: checkStore.selectTestItems.preTest ? '正在检测,请稍等...' : '暂无数据,等待检测开始'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const pauseSuccessCallback = () => {
|
const pauseSuccessCallback = () => {
|
||||||
@@ -685,7 +754,7 @@ const handleResumeTest = () => {
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
console.log(123123);
|
console.log(123123)
|
||||||
|
|
||||||
initializeParameters()
|
initializeParameters()
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user