误差体系

This commit is contained in:
sjl
2024-12-23 16:12:46 +08:00
parent 99877b1c98
commit f17f5c9925
2 changed files with 24 additions and 20 deletions

View File

@@ -9,13 +9,17 @@
:cell-style="{ textAlign: 'center' }"
style="width: 100%"
:style="{ height: '250px',maxHeight: '400px',overflow:'hidden'}"
@selection-change="handleSelectionChange" >
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column prop="nextId" label="序号" width="60" />
<el-table-column prop="type" label="电能质量检测指标类型" min-width="200">
<el-table-column prop="type" label="电能质量检测指标类型" min-width="340">
<template #default="{ row }">
<el-cascader :options="options" v-model="row.type" :props="{ checkStrictly: false, emitPath: false }"/>
</template>
<el-cascader style="min-width: 350px;"
:options="options"
v-model="row.type"
:props="{ checkStrictly: false, emitPath: false }"
placeholder="请选择指标类型"/>
</template>
</el-table-column>
<el-table-column label="起止范围" >
<el-table-column label="起始" width="150">
@@ -51,7 +55,7 @@
</el-row>
</template>
</el-table-column>
<el-table-column label="单位" width="115">
<el-table-column label="单位" width="130">
<template #default="{ row }">
<el-select v-model="row.conditionType" placeholder="选择单位">
<el-option
@@ -70,7 +74,7 @@
<el-input v-model= "row.maxErrorValue" style="width: 70px;"/>
</template>
</el-table-column>
<el-table-column label="误差类型" width="160">
<el-table-column label="误差类型" width="180">
<template #default="{ row }">
<el-select v-model="row.errorValueType" placeholder="选择误差类型">
<el-option
@@ -83,7 +87,7 @@
</template>
</el-table-column>
</el-table-column>
<el-table-column label="操作" width="150">
<el-table-column label="操作" min-width="150">
<template #default="{ row }">
<el-button type="primary" link :icon='CopyDocument' @click="copyRow(row)">复制</el-button>
<el-button type='primary' link :icon='Delete' @click="deleteRow(row)">删除</el-button>
@@ -121,12 +125,7 @@ watch(() => props.tableData, async (newTableData) => {
newTableData[i].nextId = i + 1;
}
}, { immediate: true });
// 定义规则
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
type: [{ required: true, message: '误差体系名称必填!', trigger: 'blur' }],
});
//选中
const handleSelectionChange = (selection: ErrorSystem.ErrorSystemDetail[]) => {
@@ -134,13 +133,19 @@ watch(() => props.tableData, async (newTableData) => {
};
//新增
const openAddDialog = () => {
// 获取字典数据
const conditionTypes = dictStore.getDictData('Condition_Type');
const errorValueTypes = dictStore.getDictData('Error_Value_Type');
const newRow = {
nextId: props.tableData.length + 1,
id: '',
startFlag:2,
endFlag:2,
conditionType: conditionTypes.length > 0 ? Number(conditionTypes[3].value) : 0, // 设置默认值为第一个选项的值
errorValueType:errorValueTypes.length > 0 ? Number(errorValueTypes[0].value) : 0, // 设置默认值为第一个选项的值
errorSysId: "",
type: "",
maxErrorValue: 0,
errorValueType: ""
maxErrorValue: 0
};
emit('updateTableData', [...props.tableData, newRow]);

View File

@@ -1,5 +1,5 @@
<template>
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" >
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" width="1400px">
<el-tabs type="border-card">
<el-tab-pane label="基础信息">
<div >
@@ -98,6 +98,7 @@ const handleTableDataUpdate = (newTableData: ErrorSystem.ErrorSystemDetail[]) =>
state:1,
pqErrSysDtlsList:[]
}
tableData.value =[]
}
let dialogTitle = computed(() => {
@@ -176,8 +177,7 @@ const handleTableDataUpdate = (newTableData: ErrorSystem.ErrorSystemDetail[]) =>
// 将第二层节点赋值给 options.value
options.value = secondLevelOptions;
};
};
// 转换函数
const convertToOptions = (dictTree: Dict.ResDictTree[]): CascaderOption[] => {
@@ -201,13 +201,12 @@ const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => {
tableData.value = formContent.value.pqErrSysDtlsList || []
}
} else {
resetFormContent()
}
// 重置表单
dialogFormRef.value?.resetFields()
dialogVisible.value = true
}