微调
This commit is contained in:
@@ -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 close = () => {
|
||||
dialogVisible.value = false
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean;
|
||||
dialogTitle: string;
|
||||
|
||||
formData: {
|
||||
measured: string,
|
||||
deviceLevel: string,
|
||||
condition: string,
|
||||
maxErrorValue: string
|
||||
};
|
||||
}>();
|
||||
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => {
|
||||
dialogTitle.value = sign + ' 误差体系'
|
||||
dialogVisible.value = true
|
||||
if (data.id) {
|
||||
formContent.value = data as ErrorSystem.ErrorSystemList;
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
// 这里可以重置表单数据,如果需要的话
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
// 对外映射
|
||||
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>
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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> = {}) => {
|
||||
errorSystemPopup.value?.open(titleType, row)
|
||||
if(titleType == 'view'){
|
||||
errorStandardPopup.value?.open(row.name, row)
|
||||
}else{
|
||||
errorSystemPopup.value?.open(titleType, row)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user