系数校准二次确认,输入框长度限值

This commit is contained in:
sjl
2025-05-26 15:36:06 +08:00
parent 9989cc98cb
commit 6ef2a6049b
20 changed files with 122 additions and 103 deletions

View File

@@ -1,5 +1,5 @@
<template>
<el-dialog v-model='dialogVisible' title="系数校准" v-bind="dialogBig" width="1550px" @close="handleCancel">
<el-dialog v-model='dialogVisible' title="系数校准" v-bind="dialogBig" width="1550px" @close="handleCancel" :before-close="beforeClose">
<div class="test-dialog">
<div class="dialog-content">
<div class="right-title">
@@ -763,19 +763,34 @@ const emit = defineEmits<{
}>();
const handleCancel = () => {
//dataSocket.socketServe.closeWs()
// 清空 name, channel, total
name.value = [];
channel.value = [];
total.value = 0;
activeIndex.value = 0
qualified.value = 0
active.value = 0
dialogVisible.value = false
editableTabsValue.value = '0'
emit('quitClicked'); // 触发事件
const beforeClose = (done: () => void) => {
ElMessageBox.confirm('是否退出系数校准?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
).then(() => {
handleCancel()
})
}
const handleCancel = () => {
//dataSocket.socketServe.closeWs()
// 清空 name, channel, total
name.value = [];
channel.value = [];
total.value = 0;
activeIndex.value = 0
qualified.value = 0
active.value = 0
dialogVisible.value = false
editableTabsValue.value = '0'
emit('quitClicked'); // 触发事件
}
const getTableDataForChannel = (index: number): any[] => {
@@ -832,65 +847,65 @@ const handleSubmit = async () => {
return;
// 初始化 currentTableData
let isTimer2Completed = false;
// let isTimer2Completed = false;
//"80b4b4f52a4c4064a18319525f8ac13c",
for (let i = 0; i < channel.value.length; i++) {
// 重置状态变量
active.value = 0;
//activeIndex.value = 0;
editableTabsValue.value = i.toString();
// 初始化并填充 currentTableData
const currentTableData = initializeTableData(dataTemplates2, i);
tableDataMap.set(i, currentTableData);
//activeIndex.value++;
// //"80b4b4f52a4c4064a18319525f8ac13c",
// for (let i = 0; i < channel.value.length; i++) {
// // 重置状态变量
// active.value = 0;
// //activeIndex.value = 0;
// editableTabsValue.value = i.toString();
// // 初始化并填充 currentTableData
// const currentTableData = initializeTableData(dataTemplates2, i);
// tableDataMap.set(i, currentTableData);
// //activeIndex.value++;
// 清除之前的 timer1
clearInterval(timer1);
// 启动 timer1
timer1 = setInterval(() => {
active.value++;
if (active.value > 5) {
clearInterval(timer1);
}
}, 3000);
// // 清除之前的 timer1
// clearInterval(timer1);
// // 启动 timer1
// timer1 = setInterval(() => {
// active.value++;
// if (active.value > 5) {
// clearInterval(timer1);
// }
// }, 3000);
// 清除之前的 timer2
clearInterval(timer2);
// 启动 timer2
timer2 = setInterval(() => {
// 初始化并填充 currentTableData
const currentTableData = initializeTableData(i > 0 ? dataTemplates2 : dataTemplates2, i);
tableDataMap.set(i, currentTableData);
activeIndex.value++;
// // 清除之前的 timer2
// clearInterval(timer2);
// // 启动 timer2
// timer2 = setInterval(() => {
// // 初始化并填充 currentTableData
// const currentTableData = initializeTableData(i > 0 ? dataTemplates2 : dataTemplates2, i);
// tableDataMap.set(i, currentTableData);
// activeIndex.value++;
clearInterval(timer2);
const currentDataRef = tableDataMap.get(i);
if (currentDataRef) {
const currentData = currentDataRef.value;
// 检查当前数据中有无不合格字段
const hasError = checkForErrors(currentData);
if (hasError) {
} else {
qualified.value++;
}
updateErrorState(i, hasError);
}
// clearInterval(timer2);
// const currentDataRef = tableDataMap.get(i);
// if (currentDataRef) {
// const currentData = currentDataRef.value;
// // 检查当前数据中有无不合格字段
// const hasError = checkForErrors(currentData);
// if (hasError) {
// } else {
// qualified.value++;
// }
// updateErrorState(i, hasError);
// }
// 设置标志变量为 true表示 timer2 已经完成
isTimer2Completed = true;
}, 3000);
// // 设置标志变量为 true表示 timer2 已经完成
// isTimer2Completed = true;
// }, 3000);
// 等待 timer2 完成
while (!isTimer2Completed) {
// 这里可以添加一个短暂的等待,避免死循环
await new Promise(resolve => setTimeout(resolve, 100));
}
// // 等待 timer2 完成
// while (!isTimer2Completed) {
// // 这里可以添加一个短暂的等待,避免死循环
// await new Promise(resolve => setTimeout(resolve, 100));
// }
// 重置标志变量
isTimer2Completed = false;
}
// // 重置标志变量
// isTimer2Completed = false;
// }
};
// 提取初始化并填充 currentTableData 的函数

View File

@@ -1,12 +1,12 @@
<template>
<el-dialog title="填写环境条件" v-model='dialogVisible' @close="handleClose" v-bind="dialogSmall" >
<el-dialog title="填写实验室环境" v-model='dialogVisible' @close="handleClose" v-bind="dialogSmall" >
<div>
<el-form ref="dialogFormRef" :model="formContent" :rules='rules'>
<el-form-item label="温度(℃)" prop="temperature">
<el-input v-model="formContent.temperature" placeholder="请输入温度"/>
<el-form ref="dialogFormRef" :model="formContent" :rules='rules' >
<el-form-item label="温度(℃)" prop="temperature" :label-width="110">
<el-input v-model="formContent.temperature" placeholder="请输入温度" maxlength="32" show-word-limit/>
</el-form-item>
<el-form-item label="相对湿度(%)" prop="humidity">
<el-input v-model="formContent.humidity" placeholder="请输入湿度"/>
<el-form-item label="相对湿度(%)" prop="humidity" :label-width="110">
<el-input v-model="formContent.humidity" placeholder="请输入湿度" maxlength="32" show-word-limit/>
</el-form-item>
</el-form>
</div>