This commit is contained in:
sjl
2024-12-03 09:50:15 +08:00
parent c086a4d161
commit a91367a16e
8 changed files with 97 additions and 83 deletions

View File

@@ -14,5 +14,5 @@ export const dialogBig = {
width:'1200px',
closeOnClickModal:false,
draggable:true,
class:'dialog-big'
class:'dialog-big',
}

View File

@@ -1,12 +1,26 @@
<template>
<el-dialog :title="dialogTitle" :model-value="visible" @close="handleCancel" v-bind="dialogBig">
<el-table :data="errorData" :header-cell-style="{ textAlign: 'center' } " :cell-style="{ textAlign: 'center' }" style="width: 100%" :span-method="spanMethod" border class="custom-table">
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig">
<div class="table-container">
<el-table :data="errorData"
height="500"
:header-cell-style="{ textAlign: 'center',backgroundColor: '#003078',color: '#fff' } "
:cell-style="{ textAlign: 'center' }"
style="width: 100%"
:span-method="spanMethod"
border
class="custom-table">
<el-table-column prop="measured" label="被测量" />
<el-table-column prop="deviceLevel" label="检测装置级别" />
<el-table-column prop="measurementType" label="测量类型" />
<el-table-column prop="condition" label="测量条件" />
<el-table-column prop="maxErrorValue" label="最大误差" />
</el-table>
<div class="notes-container">
<label>注1:UN:测量的标称电压;IN:测量仪器的标称电流;Uh和Ih:测量值,h表示谐波次数</label>
<label>注2:对于数字式接入监测终端与电能质量信号采集单元联合准确度需满足本表要求</label>
</div>
</div>
</el-dialog>
</template>
@@ -17,37 +31,30 @@
import type { ErrorSystem } from '@/api/device/interface/error'
import errorDataList from '@/api/device/error/errorData'
import type { TableColumnCtx } from 'element-plus'
import { da } from 'element-plus/es/locale';
const errorData = errorDataList.errordetail
const dialogTitle = ref()
// 表格配置项
const columns = reactive<ColumnProps<ErrorSystem.Error_detail>[]>([
{
prop: 'measured',
label: '被测量',
},
{
prop: 'deviceLevel',
label: '检测装置级别',
},
{
prop: 'condition',
label: '测量条件',
},
{
prop: 'measurementType',
label: '测量类型',
},
{
prop: 'maxErrorValue',
label: '最大误差',
},
])
function useMetaInfo() {
const dialogVisible = ref(false)
const formContent = ref<ErrorSystem.ErrorSystemList>({
id: '',
name: '',
standardName:'',
standardTime:'',
devLevel:'',
enable:1,
state:1,
})
return { dialogVisible, formContent }
}
const { dialogVisible, formContent } = useMetaInfo()
interface SpanMethodProps {
row: ErrorSystem.Error_detail
column: TableColumnCtx<ErrorSystem.Error_detail>
row: ErrorSystem.ErrorSystemDetail
column: TableColumnCtx<ErrorSystem.ErrorSystemDetail>
rowIndex: number
columnIndex: number
}
@@ -110,41 +117,38 @@ const spanMethod = ({
};
const props = defineProps<{
visible: boolean;
dialogTitle: string;
formData: {
measured: string,
deviceLevel: string,
condition: string,
maxErrorValue: string
};
}>();
const emit = defineEmits<{
(e: 'update:visible', value: boolean): void;
(e: 'submit', data: any): void;
}>();
const handleCancel = () => {
emit('update:visible', false); // 关闭对话框
};
// 当 props.visible 改变时,更新 formData
watch(() => props.visible, (newVal) => {
if (!newVal) {
// 这里可以重置表单数据,如果需要的话
// 关闭弹窗
const close = () => {
dialogVisible.value = false
}
});
// 打开弹窗,可能是新增,也可能是编辑
const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => {
dialogTitle.value = sign + ' 误差体系'
dialogVisible.value = true
if (data.id) {
formContent.value = data as ErrorSystem.ErrorSystemList;
}
}
// 对外映射
defineExpose({ open })
const props = defineProps<{
refreshTable: (() => Promise<void>) | undefined;
}>()
</script>
<style>
.table-container {
display: flex;
flex-direction: column;
align-items: center;
}
.custom-table {
margin-bottom: 20px; /* 调整表格和注释之间的间距 */
}
.notes-container {
text-align: center;
}
</style>

View File

@@ -101,10 +101,10 @@
import { type ErrorSystem } from '@/api/device/interface/error';
import { useDictStore, } from '@/stores/modules/dict'
import {CirclePlus, Delete, EditPen,CopyDocument} from '@element-plus/icons-vue'
import { FormItemRule } from 'element-plus';
import { FormItemRule } from 'element-plus';
import { onMounted, type PropType, Ref, ref, watch } from 'vue';
import { defineEmits } from 'vue';
import ProTable from '@/components/ProTable/index.vue'
import ProTable from '@/components/ProTable/index.vue'
const emit = defineEmits(['updateTableData']);
const multipleSelection = ref<number[]>([])
const dictStore = useDictStore()

View File

@@ -15,7 +15,7 @@
</template>
<!-- 表格操作 -->
<template #operation='scope'>
<el-button type='primary' link :icon='View'>查看</el-button>
<el-button type='primary' link :icon='View' @click="openDialog('view', scope.row)">查看</el-button>
<el-button type='primary' link :icon='EditPen' @click="openDialog('edit', scope.row)">编辑</el-button>
<el-button type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
</template>
@@ -73,7 +73,13 @@ const columns = ref<ColumnProps<ErrorSystem.ErrorSystemList>[]>([
// 打开 drawer(新增、编辑)
const openDialog = (titleType: string, row: Partial<ErrorSystem.ErrorSystemList> = {}) => {
if(titleType == 'view'){
errorStandardPopup.value?.open(row.name, row)
}else{
errorSystemPopup.value?.open(titleType, row)
}
}

View File

@@ -21,7 +21,7 @@
<el-form-item label="源参数类型" :label-width="100" prop="sourceParamType">
<el-input v-model="formContent.sourceParamType" autocomplete="off"/>
</el-form-item>
<el-form-item v-show="displayPid && displayPid!== '0'" label="源参数值" :label-width="100"
<el-form-item label="源参数值" :label-width="100"
prop="sourceParamValue">
<el-input v-model="formContent.sourceParamValue" autocomplete="off"/>
</el-form-item>
@@ -42,7 +42,7 @@
</template>
<script setup lang="ts">
import {defineEmits, reactive, watch} from 'vue'
import {computed, defineEmits, reactive, watch} from 'vue'
import {dialogSmall} from "@/utils/elementBind"
import {TestSource} from "@/api/device/interface/testSource"
import {ElMessage, FormItemRule} from "element-plus"
@@ -56,11 +56,14 @@ const emit = defineEmits(['get-parameter'])
// 计算属性,用于控制显示的 pid
const displayPid = computed({
get: () => {
return formContent.pId === '0' ? '' : formContent.pId;
},
set: (value) => {
formContent.pId = value;
}
});
// 树形节点配置
@@ -95,13 +98,14 @@ const rules: reactive<Record<string, Array<FormItemRule>>> = reactive({
sort: [{required: true, message: '排序必填!', trigger: 'blur'}]
})
watch(() => formContent.pId, (newVal, oldVal) => {
if (newVal !== '0') {
rules.sourceParamValue = [{required: true, message: '源参数值必填!', trigger: 'blur'}]
} else {
rules.sourceParamValue = []
}
})
// watch(() => formContent.pId, (newVal, oldVal) => {
// if (newVal !== '0') {
// rules.sourceParamValue = [{required: true, message: '源参数值必填!', trigger: 'blur'}]
// } else {
// rules.sourceParamValue = []
// }
// })
let dialogTitle = computed(() => {
return titleType.value === 'add' ? '新增源参数' : '编辑源参数'

View File

@@ -1,16 +1,16 @@
<template>
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig">
<div class="form-grid">
<el-form :model="formContent" ref='dialogFormRef' :rules='rules'>
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig" >
<div height="800">
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' >
<el-row :gutter="24">
<el-col :span="8">
<el-form-item label="检测源名称" prop="name" :label-width="100">
<el-form-item label="检测源名称" prop="name" >
<el-input v-model='formContent.name' placeholder="检测源类型+设备类型简称+数字"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="设备类型" prop="devType" :label-width="100">
<el-select v-model='formContent.devType' placeholder="请选择设备类型">
<el-form-item label="源型号" prop="devType" >
<el-select v-model='formContent.devType' placeholder="请选择源型号">
<el-option
v-for="item in dictStore.getDictData(dictTypeCode)"
:key="item.id"
@@ -21,7 +21,7 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="标准源" prop="type" :label-width="100">
<el-form-item label="标准源" prop="type">
<el-select v-model='formContent.type' placeholder="请选择检测源类型">
<el-option
v-for="item in dictStore.getDictData('Pq_Source_Type')"

View File

@@ -67,7 +67,7 @@
},
{
prop: 'devType',
label: '设备类型',
label: '源型号',
enum: dictStore.getDictData('S_Dev_Type_'+dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.code),
fieldNames: { label: 'name', value: 'id' },
search: { el: 'select' },

View File

@@ -2,7 +2,7 @@
<div class='table-box' >
<el-tabs type="border-card">
<el-tab-pane label="检测相关配置">
<div class="form-grid">
<div >
<el-divider >检测配置</el-divider>
<el-row :gutter="24" >
<el-col :span="8">