微调
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
|
||||
<el-tabs type="border-card">
|
||||
<div v-if="activeIndex > 0">
|
||||
<el-tab-pane v-for="(device, index) in name.slice(0, activeIndex + 1)" :key="index" :label="device">
|
||||
<el-tab-pane v-for="(device, index) in name.slice(0, activeIndex )" :key="index" :label="device">
|
||||
<template #label>
|
||||
<span class="custom-tabs-label">
|
||||
<span>{{ device }}</span>
|
||||
@@ -102,9 +102,10 @@
|
||||
</template>
|
||||
<script lang="tsx" setup name="channelsTest">
|
||||
import { type Device } from '@/api/device/interface/device';
|
||||
import { SuccessFilled, Failed } from '@element-plus/icons-vue'
|
||||
import { SuccessFilled, Failed, Message, MessageBox } from '@element-plus/icons-vue'
|
||||
import { type Ref, ref, toRef, watch } from 'vue'
|
||||
import {dialogBig} from '@/utils/elementBind'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
const activeIndex = ref(0)
|
||||
const activeTotalNum = ref(4)
|
||||
const qualified = ref(0)
|
||||
@@ -118,6 +119,28 @@ let intervalId: NodeJS.Timeout | null = null;
|
||||
// 在 setup 函数中
|
||||
const errorStates = ref(new Array(name.value.length).fill(false));
|
||||
|
||||
|
||||
// 定义 TableDataItem 接口
|
||||
interface TableDataItem {
|
||||
id: string;
|
||||
deviceName: string;
|
||||
MonitorIdx: number;
|
||||
UaData?: number | string;
|
||||
UaChannel?: number | string;
|
||||
UbData?: number | string;
|
||||
UbChannel?: number | string;
|
||||
UcData?: number | string;
|
||||
UcChannel?: number | string;
|
||||
IaData?: number | string;
|
||||
IaChannel?: number | string;
|
||||
IbData?: number | string;
|
||||
IbChannel?: number | string;
|
||||
IcData?: number | string;
|
||||
IcChannel?: number | string;
|
||||
Result?: string | string;
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
// 更新错误状态的方法
|
||||
const updateErrorState = (index: number, hasError: boolean) => {
|
||||
errorStates.value[index] = hasError;
|
||||
@@ -361,7 +384,7 @@ const tableData2 = ref<TableDataItem[]>([
|
||||
},
|
||||
])
|
||||
const tableData3 = ref<TableDataItem[]>([
|
||||
{
|
||||
{
|
||||
id: '1',
|
||||
updateTime: '2024-10-10 10:30:00',
|
||||
deviceName: '大电压大电流',
|
||||
@@ -413,7 +436,7 @@ const tableData3 = ref<TableDataItem[]>([
|
||||
IaData: 5,
|
||||
IaChannel: '合格',
|
||||
IbData: 5,
|
||||
IbChannel: 1.0001,
|
||||
IbChannel: '合格',
|
||||
IcData: 5,
|
||||
IcChannel: '合格',
|
||||
Result: '合格',
|
||||
@@ -439,10 +462,38 @@ const tableData3 = ref<TableDataItem[]>([
|
||||
},
|
||||
])
|
||||
|
||||
|
||||
const tableDataMap = new Map<number, Ref<TableDataItem[]>>([
|
||||
[0, tableData1],
|
||||
[1, tableData2],
|
||||
[2, tableData3],
|
||||
[3, tableData1],
|
||||
[4, tableData1],
|
||||
[5, tableData1],
|
||||
]);
|
||||
|
||||
|
||||
const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish');
|
||||
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = (selection: Device.ResPqDev[]) => {
|
||||
|
||||
const checkStates = selection.map(item => item.checkState);
|
||||
const allCheckStatesEqual = new Set(checkStates).size <= 1;
|
||||
|
||||
if (!allCheckStatesEqual) {
|
||||
ElMessageBox.confirm(
|
||||
'所勾选设备检测状态不一致,请重新选择',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
name.value = selection.map(item => item.name)
|
||||
channel.value = selection.map(item => item.devChns)
|
||||
dialogVisible.value = true;
|
||||
@@ -460,35 +511,6 @@ const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process
|
||||
dialogVisible.value = false
|
||||
}
|
||||
|
||||
|
||||
// 定义 TableDataItem 接口
|
||||
interface TableDataItem {
|
||||
id: string;
|
||||
deviceName: string;
|
||||
MonitorIdx: number;
|
||||
UaData?: number;
|
||||
UaChannel?: number | string;
|
||||
UbData?: number;
|
||||
UbChannel?: number | string;
|
||||
UcData?: number;
|
||||
UcChannel?: number | string;
|
||||
IaData?: number;
|
||||
IaChannel?: number | string;
|
||||
IbData?: number;
|
||||
IbChannel?: number | string;
|
||||
IcData?: number;
|
||||
IcChannel?: number | string;
|
||||
Result?: string;
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
|
||||
const tableDataMap = new Map<number, Ref<TableDataItem[]>>([
|
||||
[0, tableData1],
|
||||
[1, tableData2],
|
||||
[2, tableData3],
|
||||
]);
|
||||
|
||||
const getTableDataForChannel = (index: number): any[] => {
|
||||
const data = tableDataMap.get(index);
|
||||
return data ? data.value : [];
|
||||
@@ -566,28 +588,26 @@ const handleSubmit = () => {
|
||||
clearInterval(intervalId);
|
||||
}
|
||||
intervalId = setInterval(() => {
|
||||
console.log('开始')
|
||||
if (activeIndex.value < name.value.length) {
|
||||
activeIndex.value++;
|
||||
console.log('active index',activeIndex.value)
|
||||
// 获取当前活动索引对应的 tableData
|
||||
const currentDataRef = tableDataMap.get(activeIndex.value);
|
||||
const currentDataRef = tableDataMap.get(activeIndex.value - 1);
|
||||
if (currentDataRef) {
|
||||
const currentData = currentDataRef.value;
|
||||
// 检查当前数据中有无不合格字段
|
||||
const hasError = checkForErrors(currentData);
|
||||
if (hasError) {
|
||||
}else{
|
||||
qualified.value++;
|
||||
}
|
||||
updateErrorState(activeIndex.value, hasError);
|
||||
updateErrorState(activeIndex.value - 1, hasError);
|
||||
}
|
||||
} else {
|
||||
console.log('停')
|
||||
clearInterval(intervalId!); // 停止定时器
|
||||
}
|
||||
|
||||
|
||||
}, 3000); // 每隔3秒显示下一个tab
|
||||
}, 1000); // 每隔3秒显示下一个tab
|
||||
|
||||
// let timer = setInterval(() => {
|
||||
// if (activeIndex.value < activeTotalNum.value) {
|
||||
|
||||
@@ -781,19 +781,19 @@ const handleTest = async (val:string) => {
|
||||
.then(() => {
|
||||
ElMessage.success('不合格项复检');
|
||||
dialogTitle.value = val;
|
||||
testPopup.value?.open(dialogTitle.value,props.isTimeCheck)// 打开对话框
|
||||
testPopup.value?.open(channelsSelection.value,dialogTitle.value,props.isTimeCheck)// 打开对话框
|
||||
})
|
||||
.catch((action: Action) => {
|
||||
ElMessage.success('全部复检');
|
||||
dialogTitle.value = val;
|
||||
testPopup.value?.open(dialogTitle.value,props.isTimeCheck) // 打开对话框
|
||||
testPopup.value?.open(channelsSelection.value,dialogTitle.value,props.isTimeCheck) // 打开对话框
|
||||
})
|
||||
}
|
||||
else
|
||||
{
|
||||
ElMessage.success(val);
|
||||
//ElMessage.success(val);
|
||||
dialogTitle.value = val;
|
||||
testPopup.value?.open(dialogTitle.value,props.isTimeCheck)
|
||||
testPopup.value?.open(channelsSelection.value,dialogTitle.value,props.isTimeCheck)
|
||||
}
|
||||
return
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
import preTest from './preTest.vue'
|
||||
import timeTest from './timeTest.vue'
|
||||
import channelsTest from './channelsTest.vue'
|
||||
import { Device } from '@/api/device/interface/device';
|
||||
//import SvgIcon from '@/components/SvgIcon.vue';
|
||||
|
||||
// import preTestIcon from '@/assets/icons/preTest.svg'
|
||||
@@ -129,7 +130,23 @@ const detectionOptions = ref([
|
||||
const isTimeCheck = ref(false)
|
||||
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = (title: string,time:boolean) => {
|
||||
const open = (selection: Device.ResPqDev[],title: string,time:boolean) => {
|
||||
const checkStates = selection.map(item => item.checkState);
|
||||
const allCheckStatesEqual = new Set(checkStates).size <= 1;
|
||||
|
||||
if (!allCheckStatesEqual) {
|
||||
ElMessageBox.confirm(
|
||||
'所勾选设备检测状态不一致,请重新选择',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
dialogTitle.value = title;
|
||||
dialogVisible.value = true;
|
||||
isTimeCheck.value = time
|
||||
|
||||
Reference in New Issue
Block a user