数模没有标准设备

This commit is contained in:
sjl
2025-08-15 08:37:35 +08:00
parent 83c8dc5f19
commit 61b87304e6
9 changed files with 56 additions and 230 deletions

View File

@@ -35,9 +35,9 @@
: row.devices[index1].chnResult[index2].icon==='WarnTriangleFilled' ? '数据异常'
: row.devices[index1].chnResult[index2].icon==='Loading'? '检测中':'连接中断'"
placement="right">
<!-- :disabled="row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.INFO || row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.LOADING" -->
<el-button
:disabled="row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.INFO || row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.LOADING"
:color="row.devices[index1].chnResult[index2].color"
size="small"
@click="handleClick(item,chnItem,row.scriptType)"
@@ -87,10 +87,12 @@ import {ElMessage, ElMessageBox} from "element-plus";
import {getBigTestItem} from "@/api/check/test";
import {getAutoGenerate} from "@/api/user/login";
import {generateDevReport} from "@/api/plan/plan";
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
import { useDictStore } from '@/stores/modules/dict'
const checkStore = useCheckStore()
const modeStore = useModeStore()
const dictStore = useDictStore()
// 最大通道数
const MAX_CHN_SUM = 12
@@ -158,7 +160,6 @@ const chnSum = computed(() => {
// 用来展示的检测结果
const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(() => {
let result: CheckData.ScriptChnViewItem[] = checkResult.map(item => {
let temp: CheckData.ScriptChnViewItem = {
scriptType: item.scriptType,
@@ -238,95 +239,8 @@ let count = 0
watch(webMsgSend, function (newValue, oldValue) {
console.log('webMsgSend', newValue)
if (testStatus.value !== 'waiting') {
handleStartItem('V', 'newValue.desc')
if (props.stepsActive === 4) {
if (newValue.code == 10520) {
ElMessageBox.alert('报文解析异常!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:报文解析异常!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10521) {
ElMessageBox.alert('程控源參数有误!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:程控源參数有误!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10522) {
ElMessageBox.alert('测试项解析有误!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:测试项解析有误!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10523) {
if (count === 0) {
ElMessageBox.alert('源连接失败!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源连接失败!`})
emit('update:testStatus', 'test_init_fail')
count++
}
} else if (newValue.code == 10524) {
ElMessageBox.alert('获取源控制权失败!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:获取源控制权失败!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10525) {
ElMessageBox.alert('重置源失败!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:重置源失败!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10527) {
ElMessageBox.alert('源未进行初始化!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源未进行初始化!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10528) {
ElMessageBox.alert('目标源有误(该用户已控制其他源,在关闭前无法操作新的源)', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:目标源有误(该用户已控制其他源,在关闭前无法操作新的源)`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10529) {
ElMessageBox.alert('源状态有误,无法响应报文(例如源处于输出状态,无法响应初始化报文)', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源状态有误,无法响应报文(例如源处于输出状态,无法响应初始化报文)`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10550) {
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}设备连接异常!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10551) {
ElMessageBox.alert(`${newValue.data}设备触发报告异常!`, '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}设备触发报告异常!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10552) { //todo 10552之后还会发送消息吗
ElMessageBox.alert('存在已经初始化步骤,执行自动关闭,请重新发起检测', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({
type: 'error',
log: `${new Date().toLocaleString()}:存在已经初始化步骤,执行自动关闭,请重新发起检测!`
})
// emit('update:testStatus', 'recheck')
emit('update:testStatus', 'test_init_fail')
} else {
switch (newValue.requestId) {
case 'server_error':
if (newValue.operateCode === 'server_error' && count === 0) {
@@ -473,17 +387,11 @@ watch(webMsgSend, function (newValue, oldValue) {
pauseSuccessCallback()
}
break;
// case 'Pause_Fail':
// ElMessage.error('暂停失败')
// break;
case 'Resume_Success':
ElMessage.success('开始继续检测')
emit('update:testStatus', 'process')
handleResumeTest()
break;
// case 'Resume_Fail':
// ElMessage.error('无法继续检测')
// break;
case 'FREQ_Start':
handleStartItem('FREQ', newValue.desc)
break;
@@ -561,12 +469,17 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
}
}
}
}
}, {deep: true})
const handleStartItem = (code: string, desc: string | undefined) => {
if (desc === undefined) {
console.log('开始检测项:', code)
updateCheckResultView(code, true) // 更新界面为加载状态
} else {
// 子测试项开始
testLogList.push({ type: 'info', log: `${new Date().toLocaleString()}${desc}准确度检测:开始` })
}
}
const handleEndItem = (code: string, desc: string | undefined, devices: CheckData.DeviceCheckResult[] = []) => {
@@ -639,15 +552,26 @@ const showTestLog = () => {
// 初始化检测脚本数据
const initScriptData = async () => {
let temp = checkStore.compareTestItem.map(item => {
const pattern = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '';
let response: any = await getBigTestItem({
reCheckType: checkStore.reCheckType,
planId: checkStore.plan.id,
devIds: checkStore.devices.map(item => item.deviceId),
patternId: pattern
})
// 格式化脚本数据
let temp = response.data.map((item: any) => {
return {
id: item.id,
code: '',
scriptName: item.name
...item,
scriptName: item.scriptName,
}
})
scriptData.push(...temp)
checkTotal = scriptData.length
// 保存脚本数据并设置总数
scriptData.push(...temp)
checkTotal = scriptData.length
}
// 初始化设备列表
const initDeviceList = () => {
@@ -861,86 +785,6 @@ const pauseSuccessCallback = () => {
console.log('暂停中')
};
const todoItem = (code: string) => {
emit('update:webMsgSend', {
requestId: `${code}_Start`
})
setTimeout(() => {
if (testStatus.value !== 'paused') {
emit('update:webMsgSend', {
requestId: `${code}_Start`,
desc: '输入频率t=42.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
})
}
}, 1000)
setTimeout(() => {
if (testStatus.value !== 'paused') {
emit('update:webMsgSend', {
requestId: `${code}_End`,
desc: '输入频率t=42.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
data: [{
chnResult: [1, 1, 1, 1],
deviceId: "e90c09c0905248ad912e19e17a8672aa",
deviceName: "250226001"
}]
})
}
}, 2000)
setTimeout(() => {
if (testStatus.value !== 'paused') {
emit('update:webMsgSend', {
requestId: `${code}_Start`,
desc: '输入频率t=45.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
})
}
}, 3000)
setTimeout(() => {
if (testStatus.value !== 'paused') {
emit('update:webMsgSend', {
requestId: `${code}_End`,
desc: '输入频率t=45.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
data: [{
chnResult: [1, 1, 1, 1],
deviceId: "e90c09c0905248ad912e19e17a8672aa",
deviceName: "250226001"
}]
})
}
}, 5000)
setTimeout(() => {
if (testStatus.value !== 'paused') {
emit('update:webMsgSend', {
requestId: `${code}_Start`,
desc: '输入频率t=50.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
})
}
}, 6000)
setTimeout(() => {
if (testStatus.value !== 'paused') {
emit('update:webMsgSend', {
requestId: `${code}_End`,
desc: '输入频率t=50.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0°,Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
data: [{
chnResult: [1, 1, 1, 1],
deviceId: "e90c09c0905248ad912e19e17a8672aa",
deviceName: "250226001"
}]
})
}
}, 8000)
setTimeout(() => {
if (testStatus.value !== 'paused') {
emit('update:webMsgSend', {
requestId: `${code}_End`,
data: [{
chnResult: [1, 2, 1, 1],
deviceId: "e90c09c0905248ad912e19e17a8672aa",
deviceName: "250226001"
}]
})
}
}, 9000)
}
const handleResumeTest = () => {
//activeIndex++
@@ -951,11 +795,6 @@ const handleResumeTest = () => {
console.log('开始继续检测')
};
defineExpose({
handlePause
})