误差体系修改
This commit is contained in:
@@ -33,7 +33,9 @@ export namespace ErrorSystem {
|
|||||||
endFlag?:number;//是否包含结束值
|
endFlag?:number;//是否包含结束值
|
||||||
conditionType?:string;//判断条件值类型(包括值类型,绝对值、相对值)
|
conditionType?:string;//判断条件值类型(包括值类型,绝对值、相对值)
|
||||||
maxErrorValue:number;//误差最大值
|
maxErrorValue:number;//误差最大值
|
||||||
errorValueType:string;//误差值类型(包括值类型,绝对值、相对值1、相对值2)
|
errorValueType:any;//误差值类型(0标称值、1标准值、2值类型)
|
||||||
|
valueType:number;//值类型(1绝对值、2相对值)
|
||||||
|
errorUnit:string;//误差单位
|
||||||
}
|
}
|
||||||
|
|
||||||
//查看详细误差体系
|
//查看详细误差体系
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
v-model="row.scriptType"
|
v-model="row.scriptType"
|
||||||
:props="{ checkStrictly: false, emitPath: false }"
|
:props="{ checkStrictly: false, emitPath: false }"
|
||||||
placeholder="请选择脚本类型"
|
placeholder="请选择脚本类型"
|
||||||
/>
|
@change="handleScriptTypeChange(row)"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="起止范围">
|
<el-table-column label="起止范围">
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-select v-model="row.conditionType" placeholder="选择单位">
|
<el-select v-model="row.conditionType" placeholder="选择单位">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dictStore.getDictData('Condition_Type')"
|
v-for="item in conditionTypes"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="Number(item.value)"
|
:value="Number(item.value)"
|
||||||
@@ -85,16 +85,16 @@
|
|||||||
<el-input v-model="row.maxErrorValue" style="width: 70px;"/>
|
<el-input v-model="row.maxErrorValue" style="width: 70px;"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="误差类型" width="180">
|
<el-table-column label="误差类型" width="170">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-select v-model="row.errorValueType" placeholder="选择误差类型">
|
<el-cascader :options="errorValueTypeOptions"
|
||||||
<el-option
|
v-model="row.errorValueType"
|
||||||
v-for="item in dictStore.getDictData('Error_Value_Type')"
|
@change="handleErrorValueTypeChange(row)"/>
|
||||||
:key="item.id"
|
</template>
|
||||||
:label="item.name"
|
</el-table-column>
|
||||||
:value="Number(item.value)"
|
<el-table-column label="误差单位" width="100" prop="errorUnit">
|
||||||
/>
|
<template #default="{ row }">
|
||||||
</el-select>
|
<span>{{ row.errorUnit }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -111,11 +111,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {type ErrorSystem} from '@/api/device/interface/error';
|
import {type ErrorSystem} from '@/api/device/interface/error';
|
||||||
import {useDictStore,} from '@/stores/modules/dict'
|
import {useDictStore,} from '@/stores/modules/dict'
|
||||||
import {CirclePlus, Delete, EditPen,CopyDocument} from '@element-plus/icons-vue'
|
import {CirclePlus, CopyDocument, Delete} from '@element-plus/icons-vue'
|
||||||
import { type CascaderOption, type FormItemRule } from 'element-plus';
|
import {type CascaderOption} from 'element-plus';
|
||||||
import { el } from 'element-plus/es/locale';
|
import {defineEmits, type PropType, reactive, ref, watch} from 'vue';
|
||||||
import { type PropType, type Ref, ref, watch } from 'vue';
|
|
||||||
import { defineEmits } from 'vue';
|
|
||||||
const emit = defineEmits(['updateTableData']);
|
const emit = defineEmits(['updateTableData']);
|
||||||
const multipleSelection = ref<number[]>([])
|
const multipleSelection = ref<number[]>([])
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
@@ -138,31 +137,24 @@ import { el } from 'element-plus/es/locale';
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const errorValueTypeOptions = reactive<{ value: number, label: string, children: { value: number, label: string }[] }[]>([])
|
||||||
|
const conditionTypes = dictStore.getDictData('Condition_Type')
|
||||||
|
const errorValueTypes = dictStore.getDictData('Error_Value_Type')
|
||||||
|
const valueTypes = dictStore.getDictData('Script_Value_Type')
|
||||||
|
|
||||||
// 定义一个 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'],//暂态/持续时间/时间---暂态/持续时间
|
|
||||||
]);
|
|
||||||
|
|
||||||
|
onBeforeMount(() => {
|
||||||
|
valueTypes.forEach(item1 => {
|
||||||
|
let children = []
|
||||||
|
for (let i = 0; i < errorValueTypes.length; i++) {
|
||||||
|
if (item1.value === '2' && errorValueTypes[i].value === '2') {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
children.push({label: errorValueTypes[i].name, value: Number(errorValueTypes[i].value)})
|
||||||
|
}
|
||||||
|
errorValueTypeOptions.push({label: item1.name, value: Number(item1.value), children: children})
|
||||||
|
})
|
||||||
|
})
|
||||||
const handleErrorTypeChange = (value: any, row: any) => {
|
const handleErrorTypeChange = (value: any, row: any) => {
|
||||||
|
|
||||||
// const matchedRow = findRowById(row.errorType, props.errorOptions);//选中误差id找对应结构中的含chilren的code
|
// const matchedRow = findRowById(row.errorType, props.errorOptions);//选中误差id找对应结构中的含chilren的code
|
||||||
@@ -182,6 +174,31 @@ const handleErrorTypeChange = (value: any, row: any) =>{
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleScriptTypeChange = (row: any) => {
|
||||||
|
handleErrorValueTypeChange(row)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleErrorValueTypeChange = (row: any) => {
|
||||||
|
let scriptType = findRowById(row.scriptType, props.scriptOptions)
|
||||||
|
if (scriptType) {
|
||||||
|
const errorValueType = row.errorValueType
|
||||||
|
let level1 = errorValueType[0]
|
||||||
|
|
||||||
|
switch (level1) {
|
||||||
|
case 1: // 绝对值
|
||||||
|
row.valueType = 1
|
||||||
|
row.errorUnit = scriptType.remark
|
||||||
|
break;
|
||||||
|
case 2: // 相对值
|
||||||
|
row.valueType = 2
|
||||||
|
row.errorUnit = "%"
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 假设 props.errorOptions 是一个数组,每个元素可能包含 children 属性
|
// 假设 props.errorOptions 是一个数组,每个元素可能包含 children 属性
|
||||||
const findRowById = (id: string, options: any[]): any | null => {
|
const findRowById = (id: string, options: any[]): any | null => {
|
||||||
@@ -266,21 +283,23 @@ const handleEndFlagChange = (row: ErrorSystem.ErrorSystemDetail, value: number)
|
|||||||
//新增
|
//新增
|
||||||
const openAddDialog = () => {
|
const openAddDialog = () => {
|
||||||
// 获取字典数据
|
// 获取字典数据
|
||||||
const conditionTypes = dictStore.getDictData('Condition_Type');
|
|
||||||
const errorValueTypes = dictStore.getDictData('Error_Value_Type');
|
|
||||||
const newRow = {
|
const newRow = {
|
||||||
sort: props.tableData.length + 1,
|
sort: props.tableData.length + 1,
|
||||||
id: '',
|
id: '',
|
||||||
startFlag: 2,
|
startFlag: 2,
|
||||||
endFlag: 2,
|
endFlag: 2,
|
||||||
conditionType: conditionTypes.length > 0 ? Number(conditionTypes[3].value) : 0, // 设置默认值为第一个选项的值
|
conditionType: conditionTypes.length > 0 ? Number(conditionTypes[0].value) : 0, // 设置默认值为第一个选项的值
|
||||||
errorValueType:errorValueTypes.length > 0 ? Number(errorValueTypes[0].value) : 0, // 设置默认值为第一个选项的值
|
valueType: valueTypes.length > 0 ? Number(valueTypes[0].value) : 1,
|
||||||
|
errorValueType: [errorValueTypeOptions[0].value, errorValueTypeOptions[0].children[0].value],
|
||||||
errorSysId: "",
|
errorSysId: "",
|
||||||
errorType: "",
|
errorType: "",
|
||||||
scriptType: "",
|
scriptType: "",
|
||||||
maxErrorValue: 0
|
maxErrorValue: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
emit('updateTableData', [...props.tableData, newRow]);
|
emit('updateTableData', [...props.tableData, newRow]);
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -322,6 +341,7 @@ const deleteSelectedRows = () => {
|
|||||||
.el-table th, .el-table td {
|
.el-table th, .el-table td {
|
||||||
text-align: center; /* 所有单元格文字居中 */
|
text-align: center; /* 所有单元格文字居中 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-container {
|
.table-container {
|
||||||
max-height: 400px; /* 根据需要调整高度 */
|
max-height: 400px; /* 根据需要调整高度 */
|
||||||
overflow-y: auto; /* 允许垂直滚动 */
|
overflow-y: auto; /* 允许垂直滚动 */
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" width="1500px">
|
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" width="1660px">
|
||||||
<el-tabs type="border-card">
|
<el-tabs type="border-card">
|
||||||
<el-tab-pane label="基础信息">
|
<el-tab-pane label="基础信息">
|
||||||
<div>
|
<div>
|
||||||
@@ -137,6 +137,9 @@ const handleTableDataUpdate = (newTableData: ErrorSystem.ErrorSystemDetail[]) =>
|
|||||||
}
|
}
|
||||||
|
|
||||||
formContent.value.pqErrSysDtlsList = tableData.value
|
formContent.value.pqErrSysDtlsList = tableData.value
|
||||||
|
formContent.value.pqErrSysDtlsList.forEach((item) => {
|
||||||
|
item.errorValueType=item.errorValueType[1]
|
||||||
|
})
|
||||||
if (formContent.value.id) {
|
if (formContent.value.id) {
|
||||||
await updatePqErrSys(formContent.value);
|
await updatePqErrSys(formContent.value);
|
||||||
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
@@ -212,7 +215,8 @@ const loadSecondLevelOptions = async () => {
|
|||||||
value: item.id,
|
value: item.id,
|
||||||
label: item.name,
|
label: item.name,
|
||||||
code: item.code,
|
code: item.code,
|
||||||
children: item.children ? convertToOptions(item.children) : undefined
|
children: item.children ? convertToOptions(item.children) : undefined,
|
||||||
|
remark: item.remark
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -230,6 +234,9 @@ const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => {
|
|||||||
if (result && result.data) {
|
if (result && result.data) {
|
||||||
formContent.value = result.data as ErrorSystem.ErrorSystemList;
|
formContent.value = result.data as ErrorSystem.ErrorSystemList;
|
||||||
tableData.value = formContent.value.pqErrSysDtlsList || [];
|
tableData.value = formContent.value.pqErrSysDtlsList || [];
|
||||||
|
tableData.value.forEach((item) => {
|
||||||
|
item.errorValueType=[item.valueType,item.errorValueType]
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
resetFormContent();
|
resetFormContent();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user