微调
This commit is contained in:
@@ -1,63 +1,62 @@
|
||||
<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">
|
||||
<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">注1:UN:测量的标称电压;IN:测量仪器的标称电流;Uh和Ih:测量值,h表示谐波次数。</label>
|
||||
</div>
|
||||
<div>
|
||||
<label class="left-align-label">注2:对于数字式接入监测终端,与电能质量信号采集单元联合准确度需满足本表要求。</label>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<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">注1:UN:测量的标称电压;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'
|
||||
<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 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()
|
||||
const {dialogVisible, formContent} = useMetaInfo()
|
||||
|
||||
interface SpanMethodProps {
|
||||
row: ErrorSystem.ErrorSystemDetail
|
||||
@@ -66,14 +65,14 @@ interface SpanMethodProps {
|
||||
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 = {
|
||||
textAlign: 'center' as CSSProperties['textAlign'],
|
||||
backgroundColor: 'var(--el-color-primary)',
|
||||
color: '#fff'
|
||||
}
|
||||
if (rowIndex === 1) {
|
||||
res = { ...res, display: 'none' }
|
||||
res = {...res, display: 'none'}
|
||||
}
|
||||
return res
|
||||
}
|
||||
@@ -84,11 +83,11 @@ const spanMethod = computed(() => {
|
||||
})
|
||||
|
||||
const spanAMethod = ({
|
||||
row,
|
||||
column,
|
||||
rowIndex,
|
||||
columnIndex,
|
||||
}: SpanMethodProps) => {
|
||||
row,
|
||||
column,
|
||||
rowIndex,
|
||||
columnIndex,
|
||||
}: SpanMethodProps) => {
|
||||
if (columnIndex === 0) {
|
||||
if (rowIndex <= 1 || rowIndex === 7 || rowIndex == 20) {//0电压偏差,1频率偏差,7闪变,20功率,简单的跨两列
|
||||
return {
|
||||
@@ -166,11 +165,11 @@ const spanAMethod = ({
|
||||
|
||||
|
||||
const spanSMethod = ({
|
||||
row,
|
||||
column,
|
||||
rowIndex,
|
||||
columnIndex,
|
||||
}: SpanMethodProps) => {
|
||||
row,
|
||||
column,
|
||||
rowIndex,
|
||||
columnIndex,
|
||||
}: SpanMethodProps) => {
|
||||
if (columnIndex === 0) {
|
||||
if (rowIndex <= 1 || rowIndex === 8 || rowIndex == 17) {//0电压偏差,1频率偏差,7闪变,20功率,简单的跨两列
|
||||
return {
|
||||
@@ -205,7 +204,7 @@ const spanSMethod = ({
|
||||
colspan: 2,
|
||||
}
|
||||
}
|
||||
if (rowIndex === 18 ) {//电流跨两行两列
|
||||
if (rowIndex === 18) {//电流跨两行两列
|
||||
return {
|
||||
rowspan: 2,
|
||||
colspan: 2,
|
||||
@@ -235,9 +234,9 @@ const spanSMethod = ({
|
||||
colspan: 1,
|
||||
}
|
||||
}
|
||||
if (rowIndex === 3 || rowIndex === 7 ||
|
||||
rowIndex === 10 || rowIndex === 12 ||
|
||||
rowIndex === 14 || rowIndex === 16 ||
|
||||
if (rowIndex === 3 || rowIndex === 7 ||
|
||||
rowIndex === 10 || rowIndex === 12 ||
|
||||
rowIndex === 14 || rowIndex === 16 ||
|
||||
rowIndex === 19 || rowIndex === 22) {
|
||||
return {
|
||||
rowspan: 0,
|
||||
@@ -245,18 +244,18 @@ const spanSMethod = ({
|
||||
}
|
||||
}
|
||||
}
|
||||
if(columnIndex === 3){
|
||||
if (columnIndex === 3) {
|
||||
if (rowIndex === 2 || rowIndex === 6 || rowIndex === 9 ||
|
||||
rowIndex === 11 || rowIndex === 13 ||rowIndex === 15 ||
|
||||
rowIndex === 18 || rowIndex === 21){
|
||||
rowIndex === 11 || rowIndex === 13 || rowIndex === 15 ||
|
||||
rowIndex === 18 || rowIndex === 21) {
|
||||
return {
|
||||
rowspan: 2,
|
||||
colspan: 1,
|
||||
}
|
||||
}
|
||||
if (rowIndex === 3 || rowIndex === 7 || rowIndex === 10 ||
|
||||
rowIndex === 12 || rowIndex === 14 ||rowIndex === 16 ||
|
||||
rowIndex === 19 || rowIndex === 22){
|
||||
rowIndex === 12 || rowIndex === 14 || rowIndex === 16 ||
|
||||
rowIndex === 19 || rowIndex === 22) {
|
||||
return {
|
||||
rowspan: 0,
|
||||
colspan: 0,
|
||||
@@ -267,34 +266,34 @@ const spanSMethod = ({
|
||||
|
||||
// 关闭弹窗
|
||||
const close = () => {
|
||||
dialogVisible.value = false
|
||||
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;
|
||||
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级'){
|
||||
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级' || data.devLevel === '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<{
|
||||
refreshTable: (() => Promise<void>) | undefined;
|
||||
}>()
|
||||
</script>
|
||||
<style>
|
||||
</script>
|
||||
<style>
|
||||
.table-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -316,4 +315,4 @@ const props = defineProps<{
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -219,9 +219,7 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
||||
width: 360,
|
||||
render: scope => {
|
||||
return (
|
||||
<el-link type='primary' link onClick={() => showTestScript(scope.row.scriptId)}>
|
||||
{scope.row.scriptName}
|
||||
</el-link>
|
||||
<span>{scope.row.scriptName}</span>
|
||||
)
|
||||
},
|
||||
},
|
||||
@@ -231,7 +229,7 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
||||
width: 200,
|
||||
render: scope => {
|
||||
return (
|
||||
<el-link type='primary' link onClick={() => showData(scope.row.errorSysName || '')}>
|
||||
<el-link type='primary' link onClick={() => showData(scope.row)}>
|
||||
{scope.row.errorSysName}
|
||||
</el-link>
|
||||
)
|
||||
@@ -282,8 +280,9 @@ function isVisible(row: Plan.ReqPlan) {
|
||||
}
|
||||
|
||||
|
||||
function showData(row: string) {
|
||||
errorStandardPopup.value?.open(row, row)
|
||||
function showData(row: any) {
|
||||
let split = row.errorSysName.split('-')
|
||||
errorStandardPopup.value?.open(row.errorSysName, {id:row.errorSysId,devLevel:split[split.length-1]})
|
||||
}
|
||||
|
||||
async function showTestSource(row:string) {
|
||||
|
||||
Reference in New Issue
Block a user