From c6ef54f7d352666e8517142fdbb8db07b346aa31 Mon Sep 17 00:00:00 2001
From: caozehui <2427765068@qq.com>
Date: Mon, 20 Jan 2025 15:24:29 +0800
Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E5=BC=8F=E6=A3=80=E6=B5=8B-=E9=A2=84?=
=?UTF-8?q?=E6=A3=80=E6=B5=8B=E9=98=B6=E6=AE=B5=E9=94=99=E8=AF=AF=E7=A0=81?=
=?UTF-8?q?=E5=A4=84=E7=90=86=E3=80=81=E9=A2=91=E7=8E=87=E3=80=81=E4=B8=89?=
=?UTF-8?q?=E9=A1=B9=E7=94=B5=E5=8E=8B=E4=B8=8D=E5=B9=B3=E8=A1=A1=E8=A1=A8?=
=?UTF-8?q?=E5=A4=B4=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../home/components/dataCheckRawDataTable.vue | 12 +-
.../home/components/dataCheckResultTable.vue | 12 +-
.../dataCheckSingleChannelSingleTestPopup.vue | 18 +-
frontend/src/views/home/components/test.vue | 170 +++++++++---------
4 files changed, 112 insertions(+), 100 deletions(-)
diff --git a/frontend/src/views/home/components/dataCheckRawDataTable.vue b/frontend/src/views/home/components/dataCheckRawDataTable.vue
index de524a5..67ffe43 100644
--- a/frontend/src/views/home/components/dataCheckRawDataTable.vue
+++ b/frontend/src/views/home/components/dataCheckRawDataTable.vue
@@ -12,7 +12,7 @@
-
+
@@ -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')
}
diff --git a/frontend/src/views/home/components/dataCheckResultTable.vue b/frontend/src/views/home/components/dataCheckResultTable.vue
index 6651597..c2558ed 100644
--- a/frontend/src/views/home/components/dataCheckResultTable.vue
+++ b/frontend/src/views/home/components/dataCheckResultTable.vue
@@ -63,7 +63,7 @@
-
+
@@ -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('~');
diff --git a/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue b/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue
index e707547..fd48ab6 100644
--- a/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue
+++ b/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue
@@ -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
}
diff --git a/frontend/src/views/home/components/test.vue b/frontend/src/views/home/components/test.vue
index 2352d43..87fc69e 100644
--- a/frontend/src/views/home/components/test.vue
+++ b/frontend/src/views/home/components/test.vue
@@ -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: [{