系数校准

This commit is contained in:
sjl
2024-12-30 14:43:13 +08:00
parent 6ce58e86ad
commit d76b055730
13 changed files with 1208 additions and 424 deletions

View File

@@ -113,6 +113,7 @@
import { useDictStore, } from '@/stores/modules/dict'
import {CirclePlus, Delete, EditPen,CopyDocument} from '@element-plus/icons-vue'
import { type CascaderOption, type FormItemRule } from 'element-plus';
import { el } from 'element-plus/es/locale';
import { type PropType, type Ref, ref, watch } from 'vue';
import { defineEmits } from 'vue';
const emit = defineEmits(['updateTableData']);
@@ -138,15 +139,47 @@
});
// const aaa = 'Freq_Deviation_Freq''FREQ' -
// 定义一个 Map 来存储误差和脚本系统信息
const errSysAndScriptMap = new Map<string, string>([
['Freq_Deviation_Freq','FREQ'],//频率偏差/频率---频率
['Vol_Deviation_Vol','VRMS'],//电压偏差/电压---电压/相电压有效值
['MSQI_V','V_UNBAN'],//三相不平衡/电压---电压/三相电压负序不平衡度
['MSQI_CUR','I_UNBAN'],//三相不平衡/电流---电流/三相电流负序不平衡度
['Voltage Fluctuation_Voltage Amplitude',''],//电压波动/电压幅值---
['Voltage Fluctuation_Duration',''],//电压波动/持续时间---
['Short Time Flicker Item','PST'],//闪变/短时间闪变---闪变/短时间闪变
['Harmonic_Voltage','V2-50'],//谐波/电压---谐波/谐波电压含有率
['Harmonic_Current','I2-50'],//谐波/电流---谐波/谐波电流幅值
['Harmonic_Angle','VA2-50'],//谐波/相角---谐波/谐波电压相角
['Harmonic_Angle','IA2-50'],//谐波/相角---谐波/谐波电流相角
['Harmonic_Power','P2-50'],//谐波/功率---谐波/谐波有功功率
['Interharmonic_Voltage','SV_1-49'],//间谐波/电压---谐波/间谐波电压含有率
['Interharmonic_Current','SI_1-49'],//间谐波/电流---谐波/间谐波电流幅值
['High Frequency Harmonic_Voltage',''],//高频次谐波/电压
['High Frequency Harmonic_Current',''],//高频次谐波/电流
['Power Item','P'],//功率/功率---功率
['Current Item','IRMS'],//电流/电流---电流/电流有效值
['Dip & Swell & Short duration interruption_Voltage','MAG'],//暂态/电压幅值/电压---暂态/电压幅值
['Dip & Swell & Short duration interruption_Duration','DUR'],//暂态/持续时间/时间---暂态/持续时间
]);
const handleErrorTypeChange = (value: any, row: any) =>{
// 使用示例
const matchedRow = findRowById(row, props.errorOptions);
row.scriptType = value;
// const matchedRow = findRowById(row.errorType, props.errorOptions);//选中误差id找对应结构中的含chilren的code
// console.log('matchedRow.code',matchedRow.code)
// const code = errSysAndScriptMap.get(matchedRow?.code || '') || ''; // 确保 code 不为 undefined
// console.log('code',code)
// if (code) {
// const matchedRow2 = findRowByCode(code, props.scriptOptions);//误差code映射脚本code找对应脚本结构中含children的id
// console.log('matchedRow2',matchedRow2)
// if (matchedRow2) {
// row.scriptType = matchedRow2.value;
// }else{
// row.scriptType = '';//如果没有找到匹配的脚本,置空
// }
// }else{
// row.scriptType = '';//如果没有找到匹配的脚本,置空
// }
}
@@ -165,6 +198,23 @@ const findRowById = (id: string, options: any[]): any | null => {
}
return null;
};
// 假设 props.errorOptions 是一个数组,每个元素可能包含 children 属性
const findRowByCode = (code: string, options: any[]): any | null => {
for (const option of options) {
if (option.code === code) {
return option;
}
if (option.children && option.children.length > 0) {
const result = findRowByCode(code, option.children);
if (result) {
return result;
}
}
}
return null;
};
// 监听 props.tableData 的变化,确保每次数据变化时都重新设置 sort