This commit is contained in:
caozehui
2025-03-24 19:56:11 +08:00
parent d7df999cf2
commit 312490ce59
2 changed files with 116 additions and 118 deletions

View File

@@ -1,63 +1,62 @@
<template> <template>
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig">
<div class="table-container">
<el-table :data="errorData.value"
height="500"
:header-cell-style="rowClass"
:cell-style="{ textAlign: 'center' }"
style="width: 100%"
:span-method="spanMethod"
:border="true"
class="custom-table"
>
<el-table-column label="被测量">
<el-table-column prop="col1" width="150"/>
<el-table-column prop="col2" width="120" />
</el-table-column>
<el-table-column prop="deviceLevel" label="检测装置级别" width="120"/>
<el-table-column prop="measurementType" label="测量类型" />
<el-table-column prop="condition" label="测量条件" />
<el-table-column prop="maxErrorValue" label="最大误差" />
</el-table>
</div>
<div>
<label class="left-align-label">注1UN测量的标称电压IN测量仪器的标称电流Uh和Ih测量值h表示谐波次数</label>
</div>
<div>
<label class="left-align-label">注2对于数字式接入监测终端与电能质量信号采集单元联合准确度需满足本表要求</label>
</div>
</el-dialog>
</template>
<script lang="ts" setup name="IndicatorTypeDialog">
import { defineProps, defineEmits, reactive,watch,ref,computed, type CSSProperties } from 'vue';
import { dialogBig} from '@/utils/elementBind'
import type { ColumnProps } from '@/components/ProTable/interface'
import type { ErrorSystem } from '@/api/device/interface/error'
import errorDataList from '@/api/device/error/errorData'
import type { TableColumnCtx } from 'element-plus'
import { useDictStore } from '@/stores/modules/dict'
const dictStore = useDictStore() <el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig">
const errorData = ref<ErrorSystem.Error_detail[]>([]); <div class="table-container">
const dialogTitle = ref() <el-table :data="errorData.value"
const devLevelName = ref<string>('') // 假设 devLevelName 是一个 ref height="500"
function useMetaInfo() { :header-cell-style="rowClass"
const dialogVisible = ref(false) :cell-style="{ textAlign: 'center' }"
const formContent = ref<ErrorSystem.ErrorSystemList>({ style="width: 100%"
id: '', :span-method="spanMethod"
name: '', :border="true"
standardName:'', class="custom-table"
standardTime:'', >
devLevel:'', <el-table-column label="被测量">
enable:1, <el-table-column prop="col1" width="150"/>
state:1, <el-table-column prop="col2" width="120"/>
}) </el-table-column>
return { dialogVisible, formContent } <el-table-column prop="deviceLevel" label="检测装置级别" width="120"/>
} <el-table-column prop="measurementType" label="测量类型"/>
<el-table-column prop="condition" label="测量条件"/>
const { dialogVisible, formContent } = useMetaInfo() <el-table-column prop="maxErrorValue" label="最大误差"/>
</el-table>
</div>
<div>
<label class="left-align-label">注1UN测量的标称电压IN测量仪器的标称电流Uh和Ih测量值h表示谐波次数</label>
</div>
<div>
<label class="left-align-label">注2对于数字式接入监测终端与电能质量信号采集单元联合准确度需满足本表要求</label>
</div>
</el-dialog>
</template>
<script lang="ts" setup name="IndicatorTypeDialog">
import {computed, type CSSProperties, defineProps, ref} from 'vue';
import {dialogBig} from '@/utils/elementBind'
import type {ErrorSystem} from '@/api/device/interface/error'
import errorDataList from '@/api/device/error/errorData'
import type {TableColumnCtx} from 'element-plus'
import {useDictStore} from '@/stores/modules/dict'
const dictStore = useDictStore()
const errorData = ref<ErrorSystem.Error_detail[]>([]);
const dialogTitle = ref()
const devLevelName = ref<string>('') // 假设 devLevelName 是一个 ref
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 { interface SpanMethodProps {
row: ErrorSystem.ErrorSystemDetail row: ErrorSystem.ErrorSystemDetail
@@ -66,14 +65,14 @@ interface SpanMethodProps {
columnIndex: number columnIndex: number
} }
const rowClass = ({ row, column, rowIndex, columnIndex }: { row: any; column: any; rowIndex: number; columnIndex: number }): CSSProperties => { const rowClass = ({row, column, rowIndex, columnIndex}: { row: any; column: any; rowIndex: number; columnIndex: number }): CSSProperties => {
let res: CSSProperties = { let res: CSSProperties = {
textAlign: 'center' as CSSProperties['textAlign'], textAlign: 'center' as CSSProperties['textAlign'],
backgroundColor: 'var(--el-color-primary)', backgroundColor: 'var(--el-color-primary)',
color: '#fff' color: '#fff'
} }
if (rowIndex === 1) { if (rowIndex === 1) {
res = { ...res, display: 'none' } res = {...res, display: 'none'}
} }
return res return res
} }
@@ -84,11 +83,11 @@ const spanMethod = computed(() => {
}) })
const spanAMethod = ({ const spanAMethod = ({
row, row,
column, column,
rowIndex, rowIndex,
columnIndex, columnIndex,
}: SpanMethodProps) => { }: SpanMethodProps) => {
if (columnIndex === 0) { if (columnIndex === 0) {
if (rowIndex <= 1 || rowIndex === 7 || rowIndex == 20) {//0电压偏差1频率偏差7闪变20功率简单的跨两列 if (rowIndex <= 1 || rowIndex === 7 || rowIndex == 20) {//0电压偏差1频率偏差7闪变20功率简单的跨两列
return { return {
@@ -98,16 +97,16 @@ const spanAMethod = ({
} }
if (rowIndex === 2) {//2三相不平衡跨三行两列 if (rowIndex === 2) {//2三相不平衡跨三行两列
return { return {
rowspan: 3, rowspan: 3,
colspan: 2, colspan: 2,
} }
} }
if (rowIndex === 3 || rowIndex === 4 || rowIndex === 6 || if (rowIndex === 3 || rowIndex === 4 || rowIndex === 6 ||
rowIndex >= 9 && rowIndex <= 15 || rowIndex >= 9 && rowIndex <= 15 ||
rowIndex >= 17 && rowIndex <= 19 || rowIndex >= 17 && rowIndex <= 19 ||
rowIndex === 22 || rowIndex === 24) {//这些行不显示 rowIndex === 22 || rowIndex === 24) {//这些行不显示
return { return {
rowspan: 0, rowspan: 0,
colspan: 0, colspan: 0,
} }
} }
@@ -145,16 +144,16 @@ const spanAMethod = ({
} }
} }
if (columnIndex === 2 || columnIndex === 3) { if (columnIndex === 2 || columnIndex === 3) {
if (rowIndex === 2 || rowIndex === 8 || rowIndex === 10 || if (rowIndex === 2 || rowIndex === 8 || rowIndex === 10 ||
rowIndex === 12 || rowIndex === 14 || rowIndex === 16 || rowIndex === 12 || rowIndex === 14 || rowIndex === 16 ||
rowIndex === 18 || rowIndex === 21) { rowIndex === 18 || rowIndex === 21) {
return { return {
rowspan: 2, rowspan: 2,
colspan: 1, colspan: 1,
} }
} }
if (rowIndex === 3 || rowIndex === 9 || rowIndex === 11 || if (rowIndex === 3 || rowIndex === 9 || rowIndex === 11 ||
rowIndex === 13 || rowIndex === 15 || rowIndex === 17 || rowIndex === 13 || rowIndex === 15 || rowIndex === 17 ||
rowIndex === 19 || rowIndex === 22) { rowIndex === 19 || rowIndex === 22) {
return { return {
rowspan: 0, rowspan: 0,
@@ -166,11 +165,11 @@ const spanAMethod = ({
const spanSMethod = ({ const spanSMethod = ({
row, row,
column, column,
rowIndex, rowIndex,
columnIndex, columnIndex,
}: SpanMethodProps) => { }: SpanMethodProps) => {
if (columnIndex === 0) { if (columnIndex === 0) {
if (rowIndex <= 1 || rowIndex === 8 || rowIndex == 17) {//0电压偏差1频率偏差7闪变20功率简单的跨两列 if (rowIndex <= 1 || rowIndex === 8 || rowIndex == 17) {//0电压偏差1频率偏差7闪变20功率简单的跨两列
return { return {
@@ -180,16 +179,16 @@ const spanSMethod = ({
} }
if (rowIndex === 2) {//2三相不平衡跨三行两列 if (rowIndex === 2) {//2三相不平衡跨三行两列
return { return {
rowspan: 3, rowspan: 3,
colspan: 2, colspan: 2,
} }
} }
if (rowIndex === 3 || rowIndex === 4 || rowIndex === 6 || rowIndex === 7 || if (rowIndex === 3 || rowIndex === 4 || rowIndex === 6 || rowIndex === 7 ||
rowIndex >= 10 && rowIndex <= 12 || rowIndex >= 10 && rowIndex <= 12 ||
rowIndex >= 14 && rowIndex <= 16 || rowIndex >= 14 && rowIndex <= 16 ||
rowIndex === 19 || rowIndex === 21 || rowIndex === 22) {//这些行不显示 rowIndex === 19 || rowIndex === 21 || rowIndex === 22) {//这些行不显示
return { return {
rowspan: 0, rowspan: 0,
colspan: 0, colspan: 0,
} }
} }
@@ -205,7 +204,7 @@ const spanSMethod = ({
colspan: 2, colspan: 2,
} }
} }
if (rowIndex === 18 ) {//电流跨两行两列 if (rowIndex === 18) {//电流跨两行两列
return { return {
rowspan: 2, rowspan: 2,
colspan: 2, colspan: 2,
@@ -227,17 +226,17 @@ const spanSMethod = ({
} }
} }
if (columnIndex === 2) { if (columnIndex === 2) {
if (rowIndex === 2 || rowIndex === 6 || rowIndex === 9 || if (rowIndex === 2 || rowIndex === 6 || rowIndex === 9 ||
rowIndex === 11 || rowIndex === 13 || rowIndex === 15 || rowIndex === 11 || rowIndex === 13 || rowIndex === 15 ||
rowIndex === 18 || rowIndex === 21) { rowIndex === 18 || rowIndex === 21) {
return { return {
rowspan: 2, rowspan: 2,
colspan: 1, colspan: 1,
} }
} }
if (rowIndex === 3 || rowIndex === 7 || if (rowIndex === 3 || rowIndex === 7 ||
rowIndex === 10 || rowIndex === 12 || rowIndex === 10 || rowIndex === 12 ||
rowIndex === 14 || rowIndex === 16 || rowIndex === 14 || rowIndex === 16 ||
rowIndex === 19 || rowIndex === 22) { rowIndex === 19 || rowIndex === 22) {
return { return {
rowspan: 0, rowspan: 0,
@@ -245,18 +244,18 @@ const spanSMethod = ({
} }
} }
} }
if(columnIndex === 3){ if (columnIndex === 3) {
if (rowIndex === 2 || rowIndex === 6 || rowIndex === 9 || if (rowIndex === 2 || rowIndex === 6 || rowIndex === 9 ||
rowIndex === 11 || rowIndex === 13 ||rowIndex === 15 || rowIndex === 11 || rowIndex === 13 || rowIndex === 15 ||
rowIndex === 18 || rowIndex === 21){ rowIndex === 18 || rowIndex === 21) {
return { return {
rowspan: 2, rowspan: 2,
colspan: 1, colspan: 1,
} }
} }
if (rowIndex === 3 || rowIndex === 7 || rowIndex === 10 || if (rowIndex === 3 || rowIndex === 7 || rowIndex === 10 ||
rowIndex === 12 || rowIndex === 14 ||rowIndex === 16 || rowIndex === 12 || rowIndex === 14 || rowIndex === 16 ||
rowIndex === 19 || rowIndex === 22){ rowIndex === 19 || rowIndex === 22) {
return { return {
rowspan: 0, rowspan: 0,
colspan: 0, colspan: 0,
@@ -267,34 +266,34 @@ const spanSMethod = ({
// 关闭弹窗 // 关闭弹窗
const close = () => { const close = () => {
dialogVisible.value = false dialogVisible.value = false
} }
// 打开弹窗,可能是新增,也可能是编辑 // 打开弹窗,可能是新增,也可能是编辑
const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => { const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => {
dialogTitle.value = sign + ' 误差体系' dialogTitle.value = sign + ' 误差体系'
dialogVisible.value = true dialogVisible.value = true
if (data.id) { if (data.id) {
formContent.value = data as ErrorSystem.ErrorSystemList; formContent.value = data as ErrorSystem.ErrorSystemList;
devLevelName.value = dictStore.getDictData('Dev_Level').find(item => item.id === data.devLevel)?.name || '';
devLevelName.value = dictStore.getDictData('Dev_Level').find(item => item.id === data.devLevel)?.name || '';; if (devLevelName.value === 'A级' || data.devLevel === 'A级') {
errorData.value = errorDataList.errorADetail as unknown as ErrorSystem.Error_detail[];
} else {
errorData.value = errorDataList.errorSDetail as unknown as ErrorSystem.Error_detail[];
}
if(devLevelName.value === 'A级'){ }
errorData.value = errorDataList.errorADetail as unknown as ErrorSystem.Error_detail[];
}else{
errorData.value = errorDataList.errorSDetail as unknown as ErrorSystem.Error_detail[];
}
}
} }
// 对外映射 // 对外映射
defineExpose({ open }) defineExpose({open})
const props = defineProps<{ const props = defineProps<{
refreshTable: (() => Promise<void>) | undefined; refreshTable: (() => Promise<void>) | undefined;
}>() }>()
</script> </script>
<style> <style>
.table-container { .table-container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -316,4 +315,4 @@ const props = defineProps<{
} }
</style> </style>

View File

@@ -219,9 +219,7 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
width: 360, width: 360,
render: scope => { render: scope => {
return ( return (
<el-link type='primary' link onClick={() => showTestScript(scope.row.scriptId)}> <span>{scope.row.scriptName}</span>
{scope.row.scriptName}
</el-link>
) )
}, },
}, },
@@ -231,7 +229,7 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
width: 200, width: 200,
render: scope => { render: scope => {
return ( return (
<el-link type='primary' link onClick={() => showData(scope.row.errorSysName || '')}> <el-link type='primary' link onClick={() => showData(scope.row)}>
{scope.row.errorSysName} {scope.row.errorSysName}
</el-link> </el-link>
) )
@@ -282,8 +280,9 @@ function isVisible(row: Plan.ReqPlan) {
} }
function showData(row: string) { function showData(row: any) {
errorStandardPopup.value?.open(row, row) let split = row.errorSysName.split('-')
errorStandardPopup.value?.open(row.errorSysName, {id:row.errorSysId,devLevel:split[split.length-1]})
} }
async function showTestSource(row:string) { async function showTestSource(row:string) {