This commit is contained in:
sjl
2025-01-02 09:02:46 +08:00
parent 0fd6ebf810
commit cbe6c4a98d
7 changed files with 404 additions and 110 deletions

View File

@@ -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<TableDataItem[]>([]);
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;
// 检查当前数据中有无不合格字段

View File

@@ -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<Device.ResPqDev[]>([])
const props = defineProps({
id: {

View File

@@ -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";

View File

@@ -2,7 +2,7 @@
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig">
<div class="table-container">
<el-table :data="errorData"
<el-table :data="errorData.value"
height="500"
:header-cell-style="rowClass"
:cell-style="{ textAlign: 'center' }"
@@ -37,10 +37,12 @@
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 errorData = errorDataList.errordetail
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>({
@@ -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[];
}
}
}

View File

@@ -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;
};
// 对外映射