正式检测-预检测阶段错误码处理、频率、三项电压不平衡表头修改

This commit is contained in:
caozehui
2025-01-20 15:24:29 +08:00
parent 6f97c48226
commit c6ef54f7d3
4 changed files with 112 additions and 100 deletions

View File

@@ -12,7 +12,7 @@
<el-table-column prop="dataC" :label="'C相'+(unit==''?'':''+unit+'')"/>
</template>
<template v-if="phaseT === 1">
<el-table-column prop="dataT" :label="currentScriptTypeName+(unit==''?'':''+unit+'')"/>
<el-table-column prop="dataT" :label="tableHeader+(unit==''?'':''+unit+'')"/>
</template>
</el-table>
</div>
@@ -25,7 +25,7 @@ import { computed } from "vue";
import {useDownload} from "@/hooks/useDownload";
import {exportRawData} from "@/api/check/test"
const {tableData} = defineProps<{
const {tableData,currentScriptTypeName} = defineProps<{
tableData: CheckData.RawDataItem[]
currentScriptTypeName: string
}>()
@@ -38,6 +38,14 @@ const phaseT = computed(() => {
return tableData[0].dataT == '/' ? 0 : 1
})
const tableHeader = computed(() => {
if (phaseT.value === 1){
let index = currentScriptTypeName.indexOf('=');
return currentScriptTypeName.substring(0, index);
}
return currentScriptTypeName
})
const exportData = () => {
useDownload(exportRawData, '原始数据.xlsx', {}, false, '.xlsx')
}

View File

@@ -63,7 +63,7 @@
</template>
<template v-if="phaseT === 1">
<el-table-column :label="currentScriptTypeName">
<el-table-column :label="tableHeader">
<el-table-column prop="stdT" :label="'标准值'+(unit==''?'':''+unit+'')"/>
<el-table-column prop="dataT" :label="'被检值'+(unit==''?'':''+unit+'')"/>
<el-table-column prop="isDataT" label="检测结果">
@@ -99,7 +99,7 @@
import {defineProps} from 'vue';
import {CheckData} from "@/api/check/interface";
const {tableData} = defineProps<{
const {tableData, currentScriptTypeName} = defineProps<{
tableData: CheckData.CheckResult[],
currentScriptTypeName: string
}>();
@@ -113,6 +113,14 @@ const phaseT = computed(() => {
return tableData[0].dataT == null || tableData[0].dataT == undefined ? 0 : 1
})
const tableHeader = computed(() => {
if (phaseT.value === 1){
let index = currentScriptTypeName.indexOf('=');
return currentScriptTypeName.substring(0, index);
}
return currentScriptTypeName
})
// const maxErrorStr = computed((data) => {
// let result = tableData[0].maxError ?? '/'
// let idx = result.indexOf('~');

View File

@@ -205,7 +205,7 @@ watch(() => formContent.chnNum, async (newVal, oldVal) => {
scriptId: checkStore.scriptId,
devId: deviceId,
devNum: formContent.chnNum + '',
scriptType:originScriptType,
scriptType: originScriptType,
code: parseInt(checkStore.planCode)
})
updateTreeFly(resTreeDataTemp, 4)
@@ -361,7 +361,7 @@ const updateTableData = async () => {
let tempCheckList = []
for (let [key, value] of resTableData.resultData) {
let hum=formatHarmNum(key)
let hum = formatHarmNum(key)
tempCheckList.push({
value: key,
label: value.isData === 1 ? hum : value.isData === 4 ? `${hum}/` : `${hum}(不符合)`
@@ -386,7 +386,7 @@ const updateTableData = async () => {
}
}
const doCurrentCheckItemUpdate = (newVal: string)=>{
const doCurrentCheckItemUpdate = (newVal: string) => {
let resCheckResult: CheckData.ResCheckResult = resTableData.resultData.get(newVal)
setCheckResultData(resCheckResult)
@@ -456,8 +456,8 @@ const close = () => {
visible.value = false;
};
const setCheckResultData = (data: CheckData.ResCheckResult|null) => {
// console.log("检测结果", data);
const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
// console.log("检测结果", data);
let result: CheckData.CheckResult[] = []
if (data == null || data == undefined) {
Object.assign(checkResultData, [])
@@ -543,7 +543,7 @@ const stringToFixed = (str: string): string => {
let num = Number(str)
if (isNaN(num)) {
return '/'
}else{
} else {
let result = num.toFixed(fixed)
if (result === "-0.0000") {
return result.replace(/-/g, "")
@@ -564,7 +564,9 @@ const toMaxErrorStr = (oldMaxErroe: any, unit: any) => {
let result = oldMaxErroe ?? '/'
let idx = result.indexOf('~');
if (idx > 0) {
result = result.substring(0, idx) + unit + result.substring(idx, result.length) + unit;
let left = result.substring(0, idx)
let right = result.substring(idx, result.length)
result = left + unit + right + unit;
}
return result;
}
@@ -589,7 +591,7 @@ const getDefaultNode = (data: any[]) => {
const toAngleLast = (data: any[]) => {
let angleIndex = -1
for (let i = 0; i < data.length; i++) {
if(data[i].value.toString().includes('相角')){
if (data[i].value.toString().includes('相角')) {
angleIndex = i
break
}

View File

@@ -322,11 +322,70 @@ watch(testStatus, function (newValue, oldValue) {
})
watch(webMsgSend, function (newValue, oldValue) {
if (newValue.code == 10550) {
// ElMessageBox.alert(`${newValue.data}设备通讯失败,请检查设备连接情况!`, '初始化失败', {
// confirmButtonText: '确定',
// type: 'error',
// })
if (newValue.code == 10520) {
ElMessageBox.alert('报文解析异常!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}报文解析异常!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10521) {
ElMessageBox.alert('程控源參数有误!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}程控源參数有误!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10522) {
ElMessageBox.alert('测试项解析有误!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}测试项解析有误!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10523) {
ElMessageBox.alert('源连接失败!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}源连接失败!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10524) {
ElMessageBox.alert('获取源控制权失败!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}获取源控制权失败!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10525) {
ElMessageBox.alert('重置源失败!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}重置源失败!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10527) {
ElMessageBox.alert('源未进行初始化!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}源未进行初始化!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10528) {
ElMessageBox.alert('目标源有误(该用户已控制其他源,在关闭前无法操作新的源)', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}目标源有误(该用户已控制其他源,在关闭前无法操作新的源)`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10529) {
ElMessageBox.alert('源状态有误,无法响应报文(例如源处于输出状态,无法响应初始化报文)', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}源状态有误,无法响应报文(例如源处于输出状态,无法响应初始化报文)`})
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) {
@@ -431,7 +490,7 @@ watch(webMsgSend, function (newValue, oldValue) {
if (newValue.code == 25001) {
ElMessage.success('初始化成功!')
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:协议校验成功!`})
timeDifference.value = + new Date().getTime() - startData.value.getTime();
timeDifference.value = +new Date().getTime() - startData.value.getTime();
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化成功!`})
percentage.value = 3
@@ -445,7 +504,7 @@ watch(webMsgSend, function (newValue, oldValue) {
}
break;
case 'preStopTest':
if(newValue.operateCode == 'stop'){
if (newValue.operateCode == 'stop') {
ElMessage.success('暂停成功')
emit('update:testStatus', 'paused')
pauseSuccessCallback()
@@ -542,20 +601,20 @@ watch(webMsgSend, function (newValue, oldValue) {
}, {deep: true})
const handleStartItem = (code: string, desc: string|undefined) => {
const handleStartItem = (code: string, desc: string | undefined) => {
if (desc === undefined) {
activeIndex = getActiveIndex(code)
updateCheckResultView(code, true)
updateLog(true)
} else {
if(desc.length>60){
desc = desc.substring(0,60) + '...'
if (desc.length > 60) {
desc = desc.substring(0, 60) + '...'
}
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}${desc}准确度检测:开始`})
}
}
const handleEndItem = (code: string, desc: string|undefined, devices: CheckData.DeviceCheckResult[] = []) => {
const handleEndItem = (code: string, desc: string | undefined, devices: CheckData.DeviceCheckResult[] = []) => {
if (desc === undefined) {
updatePercentage()
updateCheckResultView(code, false, devices)
@@ -566,16 +625,16 @@ const handleEndItem = (code: string, desc: string|undefined, devices: CheckData.
}
} else {
let result = getResult(devices)
if(desc.length>60){
desc = desc.substring(0,60) + '...'
if (desc.length > 60) {
desc = desc.substring(0, 60) + '...'
}
if(result === 1){
if (result === 1) {
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}${desc}检测结束:符合`})
}
if(result === 2){
if (result === 2) {
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${desc}检测结束:不符合`})
}
if(result === 4){
if (result === 4) {
testLogList.push({type: 'warning', log: `${new Date().toLocaleString()}${desc}检测结束:数据异常`})
}
}
@@ -719,6 +778,7 @@ function getTimeDifference(timeDifference: number): string {
return `: ${minutes} 分钟, ${seconds}`
}
}
watch(testLogList, () => {
scrollToBottom();
}, {deep: true})
@@ -957,7 +1017,7 @@ const getCheckResult = (scriptType: string) => {
return tempScriptChnItem
}
const getResult=(devices: CheckData.DeviceCheckResult[] = [])=>{
const getResult = (devices: CheckData.DeviceCheckResult[] = []) => {
let type = 1
let tempChnResult: CheckData.ChnCheckResultEnum[] = []
for (let i = 0; i < devices.length; i++) {
@@ -1062,93 +1122,27 @@ const startTimer = () => {
break;
case 1:
todoItem('V')
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'FREQ_Start'
// })
// }, 1000)
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'FREQ_End'
// })
// }, 2000);
break;
case 2:
todoItem('I')
// emit('update:webMsgSend', {
// requestId: 'V_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'V_End'
// })
// }, 2000);
break;
case 3:
todoItem('IMBV')
// emit('update:webMsgSend', {
// requestId: 'HV_Start',
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'HV_End'
// })
// }, 2000)
break;
case 4:
todoItem('FREQ')
// emit('update:webMsgSend', {
// requestId: 'HI_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'HI_End'
// })
// }, 2000)
break;
case 5:
todoItem('HV')
// emit('update:webMsgSend', {
// requestId: 'HP_Start',
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'HP_End'
// })
// }, 2000)
break;
case 6:
todoItem('HI')
// emit('update:webMsgSend', {
// requestId: 'HSV_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'HSV_End'
// })
// }, 2000)
break;
case 7:
todoItem('HSV')
// emit('update:webMsgSend', {
// requestId: 'HSI_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'HSI_End'
// })
// }, 2000)
break;
case 8:
todoItem('HSI')
// emit('update:webMsgSend', {
// requestId: 'VOLTAGE_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'VOLTAGE_End'
// })
// }, 2000)
break;
// case 9:
// emit('update:webMsgSend', {
@@ -1214,12 +1208,12 @@ const pauseSuccessCallback = () => {
console.log('暂停中')
};
const todoItem = (code:string) => {
const todoItem = (code: string) => {
emit('update:webMsgSend', {
requestId: `${code}_Start`
})
setTimeout(() => {
if(testStatus.value !== 'paused'){
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° '
@@ -1261,7 +1255,7 @@ const todoItem = (code:string) => {
}
}, 5000)
setTimeout(() => {
if(testStatus.value !== 'paused'){
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° '
@@ -1269,7 +1263,7 @@ const todoItem = (code:string) => {
}
}, 6000)
setTimeout(() => {
if(testStatus.value !== 'paused'){
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° ',
@@ -1282,7 +1276,7 @@ const todoItem = (code:string) => {
}
}, 8000)
setTimeout(() => {
if(testStatus.value !== 'paused'){
if (testStatus.value !== 'paused') {
emit('update:webMsgSend', {
requestId: `${code}_End`,
data: [{