diff --git a/frontend/src/api/device/error/errorData.ts b/frontend/src/api/device/error/errorData.ts index b8e9c43..180303b 100644 --- a/frontend/src/api/device/error/errorData.ts +++ b/frontend/src/api/device/error/errorData.ts @@ -30,7 +30,7 @@ const errordata = ref([ }, ]) - const errordetail = ref([ + const errorADetail = ref([ { col1: '电压偏差', col2: '', @@ -233,5 +233,191 @@ const errordata = ref([ }, ]) + const errorSDetail = ref([ + { + col1: '电压偏差', + col2: '', + deviceLevel: 'S', + measurementType:'电压', + condition: '20%~120%标称电压', + maxErrorValue: '±0.5%' + }, + { + col1:'频率偏差', + col2: '', + deviceLevel: 'S', + measurementType:'频率', + condition: '42.5~57.5 Hz', + maxErrorValue: '±0.05Hz' + }, + { + col1:'三相不平衡度', + col2: '', + deviceLevel: 'S', + measurementType:'电压', + condition: '1%~5%', + maxErrorValue: '±0.2%' + }, + { + col1:'三相不平衡度', + col2: '', + deviceLevel: 'S', + measurementType:'电压', + condition: '5%(不包含)~ 40%', + maxErrorValue: '±0.6%' + }, + { + col1:'三相不平衡度', + col2: '', + deviceLevel: 'S', + measurementType:'电流', + condition: '', + maxErrorValue: '±1%' + }, + { + col1:'电压波动', + col2: '电压幅值', + deviceLevel: 'S', + measurementType:'电压', + condition: '', + maxErrorValue: '±1.0%Un' + }, + { + col1:'电压波动', + col2: '持续时间', + deviceLevel: 'S', + measurementType:'时间', + condition: '使用半波刷新方均根值', + maxErrorValue: '±1周波' + }, + { + col1:'电压波动', + col2: '持续时间', + deviceLevel: 'S', + measurementType:'时间', + condition: '使用全波刷新方均根值', + maxErrorValue: '±2周波' + }, + { + col1:'闪变', + col2: '', + deviceLevel: 'S', + measurementType:'短时间闪变', + condition: 'Pst:0.4~4', + maxErrorValue: '±10%' + }, + { + col1:'谐波和间谐波', + col2: '', + deviceLevel: 'S', + measurementType:'电压', + condition: 'Uh≥3%Un', + maxErrorValue: '±5%Uh' + }, + { + col1:'谐波和间谐波', + col2: '', + deviceLevel: 'S', + measurementType:'电压', + condition: 'Uh<3%Un', + maxErrorValue: '±0.15%Un' + }, + { + col1:'谐波和间谐波', + col2: '', + deviceLevel: 'S', + measurementType:'电流', + condition: 'In≥10%In', + maxErrorValue: '±5%Ih' + }, + { + col1:'谐波和间谐波', + col2: '', + deviceLevel: 'S', + measurementType:'电流', + condition: 'In<10%In', + maxErrorValue: '±0.5%In' + }, + { + col1:'高频次谐波', + col2: '', + deviceLevel: 'S', + measurementType:'电压', + condition: 'Uh≥3%Un', + maxErrorValue: '±5%Uh' + }, + { + col1:'高频次谐波', + col2: '', + deviceLevel: 'S', + measurementType:'电压', + condition: 'Uh<3%Un', + maxErrorValue: '±0.15%Un' + }, + { + col1:'高频次谐波', + col2: '', + deviceLevel: 'S', + measurementType:'电流', + condition: 'In≥10%In', + maxErrorValue: '±5%Ih' + }, + { + col1:'高频次谐波', + col2: '', + deviceLevel: 'S', + measurementType:'电流', + condition: 'In<10%In', + maxErrorValue: '±0.5%In' + }, + { + col1:'功率', + col2: '', + deviceLevel: 'S', + measurementType:'功率', + condition: '', + maxErrorValue: '±0.5%' + }, + { + col1:'电流', + col2: '', + deviceLevel: 'S', + measurementType:'电流', + condition: 'I≥0.05In', + maxErrorValue: '±0.5%' + }, + { + col1:'电流', + col2: '', + deviceLevel: 'S', + measurementType:'电流', + condition: '0.01In≤I<0.05In', + maxErrorValue: '±1%' + }, + { + col1: '电压暂降、电压暂升和短时中断', + col2: '电压幅值', + deviceLevel: 'S', + measurementType:'电压', + condition: '', + maxErrorValue: '±1.0%Un' + }, + { + col1: '电压暂降、电压暂升和短时中断', + col2: '持续时间', + deviceLevel: 'S', + measurementType:'时间', + condition: '使用半波刷新方均根值', + maxErrorValue: '±1周波' + }, + { + col1: '电压暂降、电压暂升和短时中断', + col2: '持续时间', + deviceLevel: 'S', + measurementType:'时间', + condition: '使用全波刷新方均根值', + maxErrorValue: '±2周波' + }, + ]) - export default {errordata,errordetail} \ No newline at end of file + export default {errordata,errorADetail,errorSDetail} \ No newline at end of file diff --git a/frontend/src/api/device/interface/error.ts b/frontend/src/api/device/interface/error.ts index 24eaef7..114e548 100644 --- a/frontend/src/api/device/interface/error.ts +++ b/frontend/src/api/device/interface/error.ts @@ -36,12 +36,13 @@ export namespace ErrorSystem { errorValueType:string;//误差值类型(包括值类型,绝对值、相对值1、相对值2) } - // 查看详细误差体系 - // export interface Error_detail { - // measured: string; - // deviceLevel: string; - // measurementType:string; - // condition: string; - // maxErrorValue: string; - // } + //查看详细误差体系 + export interface Error_detail { + col1: string; + col2: string; + deviceLevel: string; + measurementType:string; + condition: string; + maxErrorValue: string; + } } \ No newline at end of file diff --git a/frontend/src/views/home/components/channelsTest.vue b/frontend/src/views/home/components/channelsTest.vue index 576f478..50b2a1d 100644 --- a/frontend/src/views/home/components/channelsTest.vue +++ b/frontend/src/views/home/components/channelsTest.vue @@ -598,7 +598,6 @@ for (let i = 0; i < channel.value.length; i++) { // 重置状态变量 active.value = 0;activeIndex.value = 0; - console.log('activeIndex', activeIndex.value); const currentTableData = ref([]); const selectedTemplates = dataTemplates4; @@ -615,13 +614,11 @@ for (let i = 0; i < channel.value.length; i++) { tableDataMap.set(i, currentTableData); activeIndex.value++; - console.log('activeIndex', activeIndex.value); // 清除之前的 timer1 clearInterval(timer1); // 启动 timer1 timer1 = setInterval(() => { active.value++; - console.log('active', active.value); if (active.value > 5) { clearInterval(timer1); } @@ -660,15 +657,11 @@ for (let i = 0; i < channel.value.length; i++) { } } - console.log('currentTableData', currentTableData); tableDataMap.set(i, currentTableData); activeIndex.value++; + clearInterval(timer2); - console.log('activeIndex', activeIndex.value); - console.log('tableDataMap', tableDataMap); const currentDataRef = tableDataMap.get(i); - console.log('activeIndex.value - 2',activeIndex.value) - console.log('currentDataRef',currentDataRef) if (currentDataRef) { const currentData = currentDataRef.value; // 检查当前数据中有无不合格字段 diff --git a/frontend/src/views/home/components/table.vue b/frontend/src/views/home/components/table.vue index b62fad6..492d01d 100644 --- a/frontend/src/views/home/components/table.vue +++ b/frontend/src/views/home/components/table.vue @@ -258,6 +258,7 @@ import ChannelsTest from './channelsTest.vue' import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store import {useCheckStore} from '@/stores/modules/check' import {CheckData} from '@/api/check/interface' +import socketClient from '@/utils/webSocketClient'; const dictStore = useDictStore() const checkStore = useCheckStore() @@ -302,6 +303,7 @@ const operationMinWidth = ref(200); const selectionShow = ref(true); const channelsTest = ref() const testPopup = ref() + const channelsSelection = ref([]) const props = defineProps({ id: { diff --git a/frontend/src/views/home/components/test.vue b/frontend/src/views/home/components/test.vue index 1fa518d..c360edd 100644 --- a/frontend/src/views/home/components/test.vue +++ b/frontend/src/views/home/components/test.vue @@ -141,7 +141,7 @@ import { } from '@element-plus/icons-vue' import resultPopup from './resultPopup.vue' import dataCheckSingleChannelSingleTestPopup from './dataCheckSingleChannelSingleTestPopup.vue' -import {reactive, ref, watch} from "vue"; +import {computed, reactive, ref, toRef, watch} from "vue"; import {dialogBig} from "@/utils/elementBind"; import {CheckData} from "@/api/check/interface" import {useCheckStore} from "@/stores/modules/check"; diff --git a/frontend/src/views/machine/errorSystem/components/errorStandardPopup.vue b/frontend/src/views/machine/errorSystem/components/errorStandardPopup.vue index 34e74d8..3c7e12e 100644 --- a/frontend/src/views/machine/errorSystem/components/errorStandardPopup.vue +++ b/frontend/src/views/machine/errorSystem/components/errorStandardPopup.vue @@ -2,7 +2,7 @@
- ([]); const dialogTitle = ref() - + const devLevelName = ref('') // 假设 devLevelName 是一个 ref function useMetaInfo() { const dialogVisible = ref(false) const formContent = ref({ @@ -76,50 +78,58 @@ const rowClass = ({ row, column, rowIndex, columnIndex }: { row: any; column: an return res } -const spanMethod = ({ + +const spanMethod = computed(() => { + return devLevelName.value === 'A级' ? spanAMethod : spanSMethod +}) + +const spanAMethod = ({ row, column, rowIndex, columnIndex, }: SpanMethodProps) => { if (columnIndex === 0) { - if (rowIndex <= 1 || rowIndex === 7 || rowIndex == 20) { + if (rowIndex <= 1 || rowIndex === 7 || rowIndex == 20) {//0电压偏差,1频率偏差,7闪变,20功率,简单的跨两列 return { rowspan: 1, colspan: 2, } } - if (rowIndex === 2) { + if (rowIndex === 2) {//2三相不平衡跨三行两列 return { - rowspan: 3, // 不显示该单元格 + rowspan: 3, colspan: 2, } } - if (rowIndex === 3 || rowIndex === 4 || rowIndex === 6 || rowIndex >= 9 && rowIndex <= 15 || rowIndex >= 17 && rowIndex <= 19 || rowIndex === 22 || rowIndex === 24) { + if (rowIndex === 3 || rowIndex === 4 || rowIndex === 6 || + rowIndex >= 9 && rowIndex <= 15 || + rowIndex >= 17 && rowIndex <= 19 || + rowIndex === 22 || rowIndex === 24) {//这些行不显示 return { - rowspan: 0, // 不显示该单元格 + rowspan: 0, colspan: 0, } } - if (rowIndex === 5 || rowIndex === 23) { + if (rowIndex === 5 || rowIndex === 23) {//5电压波动,23电压暂降暂升中断跨两列 return { rowspan: 2, colspan: 1, } } - if (rowIndex === 8) { + if (rowIndex === 8) {//谐波和间谐波跨八行两列 return { rowspan: 8, colspan: 2, } } - if (rowIndex === 16) { + if (rowIndex === 16) {//高频次谐波跨八行两列 return { rowspan: 4, colspan: 2, } } - if (rowIndex === 21 || rowIndex === 22) { + if (rowIndex === 21 || rowIndex === 22) {//电流跨两行两列 return { rowspan: 2, colspan: 2, @@ -134,28 +144,18 @@ const spanMethod = ({ } } } - if (columnIndex === 2) { - if (rowIndex === 2 || rowIndex === 8 || rowIndex === 10 || rowIndex === 12 || rowIndex === 14 || rowIndex === 16 || rowIndex === 18 || rowIndex === 21) { + if (columnIndex === 2 || columnIndex === 3) { + if (rowIndex === 2 || rowIndex === 8 || rowIndex === 10 || + rowIndex === 12 || rowIndex === 14 || rowIndex === 16 || + rowIndex === 18 || rowIndex === 21) { return { rowspan: 2, colspan: 1, } } - if (rowIndex === 3 || rowIndex === 9 || rowIndex === 11 || rowIndex === 13 || rowIndex === 15 || rowIndex === 17 || rowIndex === 19 || rowIndex === 22) { - return { - rowspan: 0, - colspan: 0, - } - } - } - if (columnIndex === 3) { - if (rowIndex === 2 || rowIndex === 8 || rowIndex === 10 || rowIndex === 12 || rowIndex === 14 || rowIndex === 16 || rowIndex === 18 || rowIndex === 21) { - return { - rowspan: 2, - colspan: 1, - } - } - if (rowIndex === 3 || rowIndex === 9 || rowIndex === 11 || rowIndex === 13 || rowIndex === 15 || rowIndex === 17 || rowIndex === 19 || rowIndex === 22) { + if (rowIndex === 3 || rowIndex === 9 || rowIndex === 11 || + rowIndex === 13 || rowIndex === 15 || rowIndex === 17 || + rowIndex === 19 || rowIndex === 22) { return { rowspan: 0, colspan: 0, @@ -164,10 +164,111 @@ const spanMethod = ({ } }; - // 关闭弹窗 - const close = () => { - dialogVisible.value = false + +const spanSMethod = ({ + row, + column, + rowIndex, + columnIndex, +}: SpanMethodProps) => { + if (columnIndex === 0) { + if (rowIndex <= 1 || rowIndex === 8 || rowIndex == 17) {//0电压偏差,1频率偏差,7闪变,20功率,简单的跨两列 + return { + rowspan: 1, + colspan: 2, + } } + if (rowIndex === 2) {//2三相不平衡跨三行两列 + return { + rowspan: 3, + colspan: 2, + } + } + if (rowIndex === 3 || rowIndex === 4 || rowIndex === 6 || rowIndex === 7 || + rowIndex >= 10 && rowIndex <= 12 || + rowIndex >= 14 && rowIndex <= 16 || + rowIndex === 19 || rowIndex === 21 || rowIndex === 22) {//这些行不显示 + return { + rowspan: 0, + colspan: 0, + } + } + if (rowIndex === 5 || rowIndex === 20) {//5电压波动,23电压暂降暂升中断跨两行 + return { + rowspan: 3, + colspan: 1, + } + } + if (rowIndex === 9 || rowIndex === 13) {//谐波和间谐波跨八行两列 + return { + rowspan: 4, + colspan: 2, + } + } + if (rowIndex === 18 ) {//电流跨两行两列 + return { + rowspan: 2, + colspan: 2, + } + } + } + if (columnIndex === 1) { + if (rowIndex === 6 || rowIndex === 21) { + return { + rowspan: 2, + colspan: 1, + } + } + if (rowIndex <= 4 || rowIndex >= 7 && rowIndex <= 19 || rowIndex === 22) { + return { + rowspan: 0, + colspan: 0, + } + } + } + if (columnIndex === 2) { + if (rowIndex === 2 || rowIndex === 6 || rowIndex === 9 || + 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) { + return { + rowspan: 0, + colspan: 0, + } + } + } + if(columnIndex === 3){ + if (rowIndex === 2 || rowIndex === 6 || rowIndex === 9 || + 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){ + return { + rowspan: 0, + colspan: 0, + } + } + } +}; + +// 关闭弹窗 +const close = () => { + dialogVisible.value = false +} // 打开弹窗,可能是新增,也可能是编辑 const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => { @@ -175,6 +276,15 @@ const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => { dialogVisible.value = true if (data.id) { formContent.value = data as ErrorSystem.ErrorSystemList; + + 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[]; + } + } } diff --git a/frontend/src/views/machine/errorSystem/components/errorSystemPopup.vue b/frontend/src/views/machine/errorSystem/components/errorSystemPopup.vue index 1d9ebc1..a1e29b2 100644 --- a/frontend/src/views/machine/errorSystem/components/errorSystemPopup.vue +++ b/frontend/src/views/machine/errorSystem/components/errorSystemPopup.vue @@ -155,55 +155,55 @@ const handleTableDataUpdate = (newTableData: ErrorSystem.ErrorSystemDetail[]) => } } // 封装提取第二层节点的逻辑 - const loadSecondLevelOptions = async () => { - const dictCode = '误差体系指标项'; // 替换为实际需要的字典代码 - const resDictTree: Dict.ResDictTree = { - name: dictCode, - id: '', - pid: '', - pids: '', - code: '', - sort: 0 - }; - const result = await getDictTreeList(resDictTree); - const allOptions = convertToOptions(result.data as Dict.ResDictTree[]); +const loadSecondLevelOptions = async () => { + const dictCode = '误差体系指标项'; // 替换为实际需要的字典代码 + const dictCode2 = '脚本-误差'; // 替换为实际需要的字典代码 - // 提取第二层节点 - const secondLevelOptions: any[] = []; - allOptions.forEach(option => { - if (option.children && option.children.length > 0) { - secondLevelOptions.push(...option.children); - } - }); - // 将第二层节点赋值给 options.value - errorOptions.value = secondLevelOptions; + const resDictTree: Dict.ResDictTree = { + name: dictCode, + id: '', + pid: '', + pids: '', + code: '', + sort: 0 + }; + const resDictTree2: Dict.ResDictTree = { + name: dictCode2, + id: '', + pid: '', + pids: '', + code: '', + sort: 0 + }; + // 并行请求两个字典树列表 + const [result, result2] = await Promise.all([ + getDictTreeList(resDictTree), + getDictTreeList(resDictTree2) + ]); + const allOptions = convertToOptions(result.data as Dict.ResDictTree[]); + const allOptions2 = convertToOptions(result2.data as Dict.ResDictTree[]); + // 提取第二层节点 + const secondLevelOptions: any[] = []; + allOptions.forEach(option => { + if (option.children && option.children.length > 0) { + secondLevelOptions.push(...option.children); + } + }); + const secondLevelOptions2: any[] = []; + allOptions2.forEach(option => { + if (option.children && option.children.length > 0) { + secondLevelOptions2.push(...option.children); + } + }); - const dictCode2 = '脚本-误差'; // 替换为实际需要的字典代码 - const resDictTree2: Dict.ResDictTree = { - name: dictCode2, - id: '', - pid: '', - pids: '', - code: '', - sort: 0 - }; - const result2 = await getDictTreeList(resDictTree2); - const allOptions2 = convertToOptions(result2.data as Dict.ResDictTree[]); - - // 提取第二层节点 - const secondLevelOptions2: any[] = []; - allOptions2.forEach(option => { - if (option.children && option.children.length > 0) { - secondLevelOptions2.push(...option.children); - } - }); - // 将第二层节点赋值给 options.value - scriptOptions.value = secondLevelOptions2; + // 将第二层节点赋值给 options.value + errorOptions.value = secondLevelOptions; + scriptOptions.value = secondLevelOptions2; }; // 转换函数 @@ -216,26 +216,28 @@ const handleTableDataUpdate = (newTableData: ErrorSystem.ErrorSystemDetail[]) => })); }; -// 打开弹窗,可能是新增,也可能是编辑 + + // 打开弹窗,可能是新增,也可能是编辑 const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => { - titleType.value = sign - // 确保每次打开弹窗时都重新加载数据 - await loadSecondLevelOptions(); - if (data.id) { - const result = await getPqErrSysListById(data); - if (result && result.data) { - formContent.value = result.data as ErrorSystem.ErrorSystemList; - - tableData.value = formContent.value.pqErrSysDtlsList || [] - } - } else { + titleType.value = sign; - resetFormContent() + // 并行执行两个异步操作 + const loadOptionsPromise = loadSecondLevelOptions(); + const fetchDataPromise = data.id ? getPqErrSysListById(data) : Promise.resolve(null); + + const [_, result] = await Promise.all([loadOptionsPromise, fetchDataPromise]); + + if (result && result.data) { + formContent.value = result.data as ErrorSystem.ErrorSystemList; + tableData.value = formContent.value.pqErrSysDtlsList || []; + } else { + resetFormContent(); } + // 重置表单 - dialogFormRef.value?.resetFields() - dialogVisible.value = true -} + dialogFormRef.value?.resetFields(); + dialogVisible.value = true; +}; // 对外映射