fix(calibration): 优化电流显示和日志功能

- 修复了电流显示错误的问题,增加了对漏电流的特殊处理
- 扩大了设备日志窗口的大小,提高了可读性
- 优化了参数误差的计算和显示逻辑
- 增加了对方案列表获取逻辑的改进,确保选中方案与实际方案一致
- 提升了日志缓存的长度,从800增加到2000
This commit is contained in:
fhysy 2025-07-10 10:09:38 +08:00
parent a9a580ad29
commit 27ce508fc2
2 changed files with 26 additions and 15 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "calibration-pc", "name": "calibration-pc",
"version": "1.0.2", "version": "1.0.4",
"description": "谷云开发部开发的断路器标定软件", "description": "谷云开发部开发的断路器标定软件",
"main": "./out/main/index.js", "main": "./out/main/index.js",
"author": "example.com", "author": "example.com",

View File

@ -264,7 +264,8 @@
</el-table-column> </el-table-column>
<el-table-column prop="current" align="center" label="电流Ib(%)"> <el-table-column prop="current" align="center" label="电流Ib(%)">
<template #default="scope"> <template #default="scope">
<el-input-number v-model="scope.row.current" :min="0" :precision="1" /> <el-input-number v-if="!scope.row.isILeak" v-model="scope.row.current" :min="0" :precision="1" />
<span v-else>{{ currentScheme.configParam.format[5].value + currentScheme.configParam.format[5].unit }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="powerFactor" align="center" label="功率因数"> <el-table-column prop="powerFactor" align="center" label="功率因数">
@ -325,7 +326,7 @@
</el-dialog> </el-dialog>
<!-- 方案配置抽屉 --> <!-- 方案配置抽屉 -->
<el-drawer v-model="logVisible" title="设备日志" size="80%" :destroy-on-close="true"> <el-drawer v-model="logVisible" title="设备日志" size="90%" :destroy-on-close="true">
<div class="scheme-drawer-content log-content"> <div class="scheme-drawer-content log-content">
<div class="device-info"> <div class="device-info">
<div class="device-info-item">设备: {{ activeDeviceInfo.id || '-' }}</div> <div class="device-info-item">设备: {{ activeDeviceInfo.id || '-' }}</div>
@ -362,14 +363,14 @@
'源输出值: ' + '源输出值: ' +
(scope.row.paramMap[col.valueKey]?.outputValue ?? '') + (scope.row.paramMap[col.valueKey]?.outputValue ?? '') +
'\n' + '\n' +
'读取值: ' +
(scope.row.paramMap[col.valueKey]?.actualValue ?? '') +
'\n' +
'范围最小值: ' + '范围最小值: ' +
(scope.row.paramMap[col.valueKey]?.ExpectedMin ?? '') + (scope.row.paramMap[col.valueKey]?.ExpectedMin ?? '') +
'\n' + '\n' +
'范围最大值: ' + '范围最大值: ' +
(scope.row.paramMap[col.valueKey]?.expectedMax ?? '') + (scope.row.paramMap[col.valueKey]?.expectedMax ?? '')
'\n' +
'读取值: ' +
(scope.row.paramMap[col.valueKey]?.actualValue ?? '')
" "
placement="top" placement="top"
> >
@ -379,9 +380,9 @@
? Number(scope.row.paramMap[col.valueKey].actualError.toFixed(6)).toString() ? Number(scope.row.paramMap[col.valueKey].actualError.toFixed(6)).toString()
: scope.row.paramMap[col.valueKey]?.actualError : scope.row.paramMap[col.valueKey]?.actualError
}}<span v-if="scope.row.paramMap[col.valueKey]">%</span> }}<span v-if="scope.row.paramMap[col.valueKey]">%</span>
<template v-if="scope.row.paramMap[col.valueKey]"> <template v-if="scope.row.paramMap[col.valueKey]" :style="{ color: scope.row.paramMap[col.valueKey]?.result === 1 ? 'green' : 'red' }">
<el-icon v-if="scope.row.paramMap[col.valueKey].actualValue > scope.row.paramMap[col.valueKey].expectedMax" style="color: red"><Top /></el-icon> <el-icon v-if="scope.row.paramMap[col.valueKey].actualValue > scope.row.paramMap[col.valueKey].outputValue"><Top /></el-icon>
<el-icon v-else-if="scope.row.paramMap[col.valueKey].actualValue < scope.row.paramMap[col.valueKey].ExpectedMin" style="color: red"><Bottom /></el-icon> <el-icon v-else-if="scope.row.paramMap[col.valueKey].actualValue < scope.row.paramMap[col.valueKey].outputValue"><Bottom /></el-icon>
</template> </template>
</span> </span>
</el-tooltip> </el-tooltip>
@ -471,7 +472,7 @@ const logList = ref([]);
const logLoading = ref(false); const logLoading = ref(false);
const logBoxRef = ref(null); const logBoxRef = ref(null);
const MAX_LOG_LENGTH = 800; const MAX_LOG_LENGTH = 2000;
const activeDeviceIndex = ref(0); const activeDeviceIndex = ref(0);
@ -654,7 +655,7 @@ const setDeviceInfo = msg => {
}; };
const getSocketMeassage = message => { const getSocketMeassage = message => {
// message = {data:{"msgType":"calibrate_result","data":"{\"id\":1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"devicePort\":\"com3\",\"cpuId\":\"SN\",\"connectStatus\":1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"resultTxt\":\"\"}"}}; // message = {data:{"msgType":"calibrate_result","data":"{\"id\":1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"switch\":0,\"result\":-1,\"resultTxt\":\"\"}"}};
const msg = tryParseJSON(message.data); const msg = tryParseJSON(message.data);
console.log('msg', msg); console.log('msg', msg);
const newLog = { const newLog = {
@ -820,9 +821,19 @@ const loadSchemes = async () => {
const response = await axios.get(config.url + '/master/scheme/query'); const response = await axios.get(config.url + '/master/scheme/query');
if (response.data.code === 0) { if (response.data.code === 0) {
schemeList.value = response.data.data.schemes || []; schemeList.value = response.data.data.schemes || [];
if (!selectedScheme.value && schemeList.value.length > 0) { // activeSchemeselectedScheme
selectedScheme.value = schemeList.value[0].id; let found = null;
activeScheme.value = schemeList.value[0]; if (selectedScheme.value) {
found = schemeList.value.find(item => item.id === selectedScheme.value);
}
if (found) {
activeScheme.value = found;
} else if (schemeList.value.length > 0) {
selectedScheme.value = schemeList.value[0].id;
activeScheme.value = schemeList.value[0];
} else {
selectedScheme.value = '';
activeScheme.value = {};
} }
ElMessage.success('获取方案列表成功'); ElMessage.success('获取方案列表成功');
} else { } else {