系数校准调整
This commit is contained in:
@@ -55,7 +55,6 @@
|
|||||||
</el-steps>
|
</el-steps>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-content">
|
<div class="right-content">
|
||||||
|
|
||||||
<el-tabs type="border-card">
|
<el-tabs type="border-card">
|
||||||
<div >
|
<div >
|
||||||
<el-tab-pane v-for="(device, index) in name" :key="index" :label="device">
|
<el-tab-pane v-for="(device, index) in name" :key="index" :label="device">
|
||||||
@@ -122,7 +121,6 @@ import { SuccessFilled, Failed, Message, MessageBox } from '@element-plus/icons-
|
|||||||
import { type Ref, ref, toRef, watch } from 'vue'
|
import { type Ref, ref, toRef, watch } from 'vue'
|
||||||
import {dialogBig} from '@/utils/elementBind'
|
import {dialogBig} from '@/utils/elementBind'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||||
import { el } from 'element-plus/es/locale';
|
|
||||||
const activeIndex = ref(0)
|
const activeIndex = ref(0)
|
||||||
const activeTotalNum = ref(4)
|
const activeTotalNum = ref(4)
|
||||||
const qualified = ref(0)
|
const qualified = ref(0)
|
||||||
@@ -161,7 +159,6 @@ interface TableDataItem {
|
|||||||
updateTime?: string;
|
updateTime?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const dataTemplates3 = [
|
const dataTemplates3 = [
|
||||||
{
|
{
|
||||||
deviceName: '系数下装',
|
deviceName: '系数下装',
|
||||||
@@ -227,7 +224,6 @@ const dataTemplates3 = [
|
|||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
const dataTemplates4 = [
|
const dataTemplates4 = [
|
||||||
{
|
{
|
||||||
deviceName: '系数下装',
|
deviceName: '系数下装',
|
||||||
@@ -452,17 +448,7 @@ const activities = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const tableDataMap = new Map<number, 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 currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish');
|
||||||
|
|
||||||
@@ -529,8 +515,6 @@ const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process
|
|||||||
|
|
||||||
const getTableDataForChannel = (index: number): any[] => {
|
const getTableDataForChannel = (index: number): any[] => {
|
||||||
const data = tableDataMap.get(index);
|
const data = tableDataMap.get(index);
|
||||||
// console.log('index',index)
|
|
||||||
// console.log('data',data)
|
|
||||||
return data ? data.value : [];
|
return data ? data.value : [];
|
||||||
}
|
}
|
||||||
// const props = defineProps({
|
// const props = defineProps({
|
||||||
@@ -587,7 +571,6 @@ watch(activeIndex, function (newValue, oldValue) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
// 示例的 checkForErrors 函数,根据实际需求进行调整
|
// 示例的 checkForErrors 函数,根据实际需求进行调整
|
||||||
const checkForErrors = (data: TableDataItem[]): boolean => {
|
const checkForErrors = (data: TableDataItem[]): boolean => {
|
||||||
// 这里假设不合格字段的标准是 status 为 '不合格' 或 isValid 为 false
|
// 这里假设不合格字段的标准是 status 为 '不合格' 或 isValid 为 false
|
||||||
@@ -601,13 +584,11 @@ const checkForErrors = (data: TableDataItem[]): boolean => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
if (intervalId !== null) {
|
if (intervalId !== null) {
|
||||||
clearInterval(intervalId);
|
clearInterval(intervalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 初始化 currentTableData
|
// 初始化 currentTableData
|
||||||
let isTimer2Completed = false;
|
let isTimer2Completed = false;
|
||||||
// 初始化 loadingStates 为 true
|
// 初始化 loadingStates 为 true
|
||||||
@@ -615,9 +596,9 @@ const handleSubmit = async () => {
|
|||||||
|
|
||||||
for (let i = 0; i < channel.value.length; i++) {
|
for (let i = 0; i < channel.value.length; i++) {
|
||||||
|
|
||||||
|
// 重置状态变量
|
||||||
// 完成所有步骤后重置状态变量
|
active.value = 0;activeIndex.value = 0;
|
||||||
active.value = 0;
|
console.log('activeIndex', activeIndex.value);
|
||||||
const currentTableData = ref<TableDataItem[]>([]);
|
const currentTableData = ref<TableDataItem[]>([]);
|
||||||
const selectedTemplates = dataTemplates4;
|
const selectedTemplates = dataTemplates4;
|
||||||
|
|
||||||
@@ -634,7 +615,7 @@ for (let i = 0; i < channel.value.length; i++) {
|
|||||||
|
|
||||||
tableDataMap.set(i, currentTableData);
|
tableDataMap.set(i, currentTableData);
|
||||||
activeIndex.value++;
|
activeIndex.value++;
|
||||||
|
console.log('activeIndex', activeIndex.value);
|
||||||
// 清除之前的 timer1
|
// 清除之前的 timer1
|
||||||
clearInterval(timer1);
|
clearInterval(timer1);
|
||||||
// 启动 timer1
|
// 启动 timer1
|
||||||
@@ -654,18 +635,6 @@ clearInterval(timer2);
|
|||||||
const currentTableData = ref<TableDataItem[]>([]);
|
const currentTableData = ref<TableDataItem[]>([]);
|
||||||
|
|
||||||
if(i > 0){
|
if(i > 0){
|
||||||
const selectedTemplates = dataTemplates6;
|
|
||||||
for (let j = 0; j < channel.value[i]; j++) {
|
|
||||||
const id = (j + 1).toString();
|
|
||||||
selectedTemplates.forEach((template) => {
|
|
||||||
currentTableData.value.push({
|
|
||||||
id: id,
|
|
||||||
MonitorIdx: j + 1,
|
|
||||||
...template,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
const selectedTemplates = dataTemplates5;
|
const selectedTemplates = dataTemplates5;
|
||||||
for (let j = 0; j < channel.value[i]; j++) {
|
for (let j = 0; j < channel.value[i]; j++) {
|
||||||
const id = (j + 1).toString();
|
const id = (j + 1).toString();
|
||||||
@@ -677,13 +646,28 @@ clearInterval(timer2);
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
const selectedTemplates = dataTemplates6;
|
||||||
|
for (let j = 0; j < channel.value[i]; j++) {
|
||||||
|
const id = (j + 1).toString();
|
||||||
|
selectedTemplates.forEach((template) => {
|
||||||
|
currentTableData.value.push({
|
||||||
|
id: id,
|
||||||
|
MonitorIdx: j + 1,
|
||||||
|
...template,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('currentTableData', currentTableData);
|
||||||
tableDataMap.set(i, currentTableData);
|
tableDataMap.set(i, currentTableData);
|
||||||
|
activeIndex.value++;
|
||||||
clearInterval(timer2);
|
clearInterval(timer2);
|
||||||
|
console.log('activeIndex', activeIndex.value);
|
||||||
const currentDataRef = tableDataMap.get(activeIndex.value - 1);
|
console.log('tableDataMap', tableDataMap);
|
||||||
|
const currentDataRef = tableDataMap.get(i);
|
||||||
|
console.log('activeIndex.value - 2',activeIndex.value)
|
||||||
console.log('currentDataRef',currentDataRef)
|
console.log('currentDataRef',currentDataRef)
|
||||||
if (currentDataRef) {
|
if (currentDataRef) {
|
||||||
const currentData = currentDataRef.value;
|
const currentData = currentDataRef.value;
|
||||||
@@ -693,7 +677,7 @@ clearInterval(timer2);
|
|||||||
} else {
|
} else {
|
||||||
qualified.value++;
|
qualified.value++;
|
||||||
}
|
}
|
||||||
updateErrorState(activeIndex.value - 1, hasError);
|
updateErrorState(i, hasError);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置标志变量为 true,表示 timer2 已经完成
|
// 设置标志变量为 true,表示 timer2 已经完成
|
||||||
@@ -712,67 +696,10 @@ clearInterval(timer2);
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const handleSubmit2 = () => {
|
|
||||||
if (intervalId !== null) {
|
|
||||||
clearInterval(intervalId);
|
|
||||||
}
|
|
||||||
intervalId = setInterval(() => {
|
|
||||||
if (activeIndex.value < name.value.length) {
|
|
||||||
activeIndex.value++;
|
|
||||||
// 获取当前活动索引对应的 tableData
|
|
||||||
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 - 1, hasError);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
clearInterval(intervalId!); // 停止定时器
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}, 1000); // 每隔3秒显示下一个tab
|
|
||||||
|
|
||||||
// let timer = setInterval(() => {
|
|
||||||
// if (activeIndex.value < activeTotalNum.value) {
|
|
||||||
// activeIndex.value++
|
|
||||||
// if(activeIndex.value > 1)
|
|
||||||
// qualified.value = activeIndex.value -1;//演示效果,实际运行时使用后端传来的真实数据即可
|
|
||||||
// else
|
|
||||||
// qualified.value = activeIndex.value;
|
|
||||||
// }
|
|
||||||
// else if (activeIndex.value === activeTotalNum.value) {
|
|
||||||
// clearInterval(timer)
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// clearInterval(timer)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// total.value = activeTotalNum.value
|
|
||||||
// }, 1000);
|
|
||||||
|
|
||||||
|
|
||||||
let timer2 = setInterval(() => {
|
|
||||||
active.value++
|
|
||||||
if (active.value++ > 5) {
|
|
||||||
clearInterval(timer2)
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 对外映射
|
// 对外映射
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.right-title {
|
.right-title {
|
||||||
|
|||||||
Reference in New Issue
Block a user