|
@@ -258,6 +258,21 @@
|
|
|
<el-table-column prop="gxmc" label="工序名称" width="460" />
|
|
<el-table-column prop="gxmc" label="工序名称" width="460" />
|
|
|
</el-table>
|
|
</el-table>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ <el-dialog v-model="dialogbutton" title="是否确认"
|
|
|
|
|
+ @keydown="handleKeydown ($event)"
|
|
|
|
|
+ destroy-on-close width="300px" style="height: 140px; margin-top: 20%;">
|
|
|
|
|
+ <br>
|
|
|
|
|
+ <span slot="footer" class="dialog-footer" style="display: flex; justify-content: space-between; align-items: center; padding: 0 20px;">
|
|
|
|
|
+ <el-button @click="dialogbutton = false">取消</el-button>
|
|
|
|
|
+ <el-button type="primary" @click="enterDialog">确 定
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ <!-- <el-button type="primary" @click="handleConfirm">确认</el-button> -->
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
<!-- 废品日统计 -->
|
|
<!-- 废品日统计 -->
|
|
|
<Meirihejiantongji v-if="dialogMrhjtj" v-model="dialogMrhjtj" />
|
|
<Meirihejiantongji v-if="dialogMrhjtj" v-model="dialogMrhjtj" />
|
|
@@ -892,6 +907,7 @@ const gd_lcdCancel = async () => {
|
|
|
};
|
|
};
|
|
|
// 弹窗确定
|
|
// 弹窗确定
|
|
|
const enterDialog = async () => {
|
|
const enterDialog = async () => {
|
|
|
|
|
+ console.log(type.value)
|
|
|
if (type.value === '修改工单核验单维护') {
|
|
if (type.value === '修改工单核验单维护') {
|
|
|
updateDetailData()
|
|
updateDetailData()
|
|
|
} else if (type.value === '新增工单核验单维护') {
|
|
} else if (type.value === '新增工单核验单维护') {
|
|
@@ -937,14 +953,13 @@ const gd_lcdCancel = async () => {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
console.log(restoredData);
|
|
console.log(restoredData);
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
const inputElement = document.getElementById('qczl_num');
|
|
const inputElement = document.getElementById('qczl_num');
|
|
|
if (inputElement) {
|
|
if (inputElement) {
|
|
|
inputElement.focus();
|
|
inputElement.focus();
|
|
|
}
|
|
}
|
|
|
}, 100);
|
|
}, 100);
|
|
|
|
|
+ dialogbutton.value = false;
|
|
|
// return;
|
|
// return;
|
|
|
const res = await add(restoredData)
|
|
const res = await add(restoredData)
|
|
|
console.log(res)
|
|
console.log(res)
|
|
@@ -964,7 +979,7 @@ const gd_lcdCancel = async () => {
|
|
|
};
|
|
};
|
|
|
// 修改
|
|
// 修改
|
|
|
const updateDetailData = async () => {
|
|
const updateDetailData = async () => {
|
|
|
-
|
|
|
|
|
|
|
+ // console.log("确认")
|
|
|
const formatDate = (date) => {
|
|
const formatDate = (date) => {
|
|
|
const year = date.getFullYear();
|
|
const year = date.getFullYear();
|
|
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
@@ -1400,8 +1415,32 @@ const gd_lcdCancel = async () => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // 确认按钮的逻辑
|
|
|
|
|
+ const handleConfirm = async () => {
|
|
|
|
|
+ console.log(112); // 确认按钮的逻辑
|
|
|
|
|
+ dialogbutton.value = false; // 关闭弹窗
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // 键盘事件监听逻辑
|
|
|
|
|
+ const handleKeydown = (event) => {
|
|
|
|
|
+ if (dialogbutton.value && event.key === "Enter") {
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ type: 'warning',
|
|
|
|
|
+ message: '正在保存数据中'
|
|
|
|
|
+ })
|
|
|
|
|
+ enterDialog(); // 调用确认按钮逻辑
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
|
|
|
let isProcessing = false; // 标志位
|
|
let isProcessing = false; // 标志位
|
|
|
|
|
+ let lastFpSl = null; // 记录上一次输入的数量
|
|
|
|
|
+ const dialogbutton = ref(false); // 控制对话框显示
|
|
|
|
|
+ let enterCount = 0; // 记录回车键按下的次数
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
//新增回车事件
|
|
//新增回车事件
|
|
|
const ent1 = async(event,index,row,title) => {
|
|
const ent1 = async(event,index,row,title) => {
|
|
|
const inputs = document.getElementsByTagName('input');
|
|
const inputs = document.getElementsByTagName('input');
|
|
@@ -1452,7 +1491,7 @@ const gd_lcdCancel = async () => {
|
|
|
nextIndex++;
|
|
nextIndex++;
|
|
|
}
|
|
}
|
|
|
if (!foundNext) {
|
|
if (!foundNext) {
|
|
|
- console.log("没有更多可用的输入框");
|
|
|
|
|
|
|
+ console.log("没有更多可用的输入框");
|
|
|
}
|
|
}
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -1515,8 +1554,8 @@ const gd_lcdCancel = async () => {
|
|
|
}
|
|
}
|
|
|
}else if (event.keyCode === 13 && title === '数量') {
|
|
}else if (event.keyCode === 13 && title === '数量') {
|
|
|
if (isProcessing) {
|
|
if (isProcessing) {
|
|
|
- console.log("当前正在处理回车事件,忽略重复触发");
|
|
|
|
|
- return; // 如果正在处理,直接返回
|
|
|
|
|
|
|
+ console.log("当前正在处理回车事件,忽略重复触发");
|
|
|
|
|
+ return; // 如果正在处理,直接返回
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
isProcessing = true; // 标志正在处理
|
|
isProcessing = true; // 标志正在处理
|
|
@@ -1526,24 +1565,30 @@ const gd_lcdCancel = async () => {
|
|
|
|
|
|
|
|
// 去掉数量前导的0
|
|
// 去掉数量前导的0
|
|
|
if (typeof row.fp_sl === 'string') {
|
|
if (typeof row.fp_sl === 'string') {
|
|
|
- row.fp_sl = row.fp_sl.replace(/^0+(?=\d)/, '');
|
|
|
|
|
|
|
+ row.fp_sl = row.fp_sl.replace(/^0+(?=\d)/, '');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 判断数量是否为 0 或为空
|
|
// 判断数量是否为 0 或为空
|
|
|
if (row.fp_sl === '0' || row.fp_sl === '' || row.fp_sl === 0) {
|
|
if (row.fp_sl === '0' || row.fp_sl === '' || row.fp_sl === 0) {
|
|
|
- console.log("数量为 0,清空对应字段");
|
|
|
|
|
- ['fp_gxmc', 'fp_bz', 'fp_bh', 'fp_name'].forEach(field => {
|
|
|
|
|
- detailData.table[index][field] = '';
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ console.log("数量为 0,清空对应字段");
|
|
|
|
|
+ ['fp_gxmc', 'fp_bz', 'fp_bh', 'fp_name'].forEach(field => {
|
|
|
|
|
+ detailData.table[index][field] = '';
|
|
|
|
|
+ });
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ // 检查数量是否与上一次相同
|
|
|
|
|
+ if (row.fp_sl !== lastFpSl) {
|
|
|
// 异步调用 handleFpslEnter
|
|
// 异步调用 handleFpslEnter
|
|
|
await handleFpslEnter(event, index, row, title);
|
|
await handleFpslEnter(event, index, row, title);
|
|
|
|
|
+ lastFpSl = row.fp_sl; // 更新记录的数量
|
|
|
|
|
|
|
|
if (!detailData.table[index].fp_gxmc) {
|
|
if (!detailData.table[index].fp_gxmc) {
|
|
|
- console.log("字段 fp_gxmc 为空,不能跳转到下一个输入框");
|
|
|
|
|
- isProcessing = false; // 重置标志
|
|
|
|
|
- return; // 阻止跳转
|
|
|
|
|
|
|
+ console.log("字段 fp_gxmc 为空,不能跳转到下一个输入框");
|
|
|
|
|
+ isProcessing = false; // 重置标志
|
|
|
|
|
+ return; // 阻止跳转
|
|
|
}
|
|
}
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.log("数量未变化,跳过 handleFpslEnter 调用");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 焦点跳转逻辑
|
|
// 焦点跳转逻辑
|
|
@@ -1551,24 +1596,30 @@ const gd_lcdCancel = async () => {
|
|
|
let foundNext = false;
|
|
let foundNext = false;
|
|
|
|
|
|
|
|
while (nextIndex < inputs.length) {
|
|
while (nextIndex < inputs.length) {
|
|
|
- const nextInput = inputs[nextIndex];
|
|
|
|
|
- if (!nextInput.disabled && !nextInput.readOnly) {
|
|
|
|
|
- nextInput.focus();
|
|
|
|
|
- nextInput.select();
|
|
|
|
|
- foundNext = true;
|
|
|
|
|
- console.log(`焦点已跳转到输入框索引: ${nextIndex}`);
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- nextIndex++;
|
|
|
|
|
|
|
+ const nextInput = inputs[nextIndex];
|
|
|
|
|
+ if (!nextInput.disabled && !nextInput.readOnly) {
|
|
|
|
|
+ nextInput.focus();
|
|
|
|
|
+ nextInput.select();
|
|
|
|
|
+ foundNext = true;
|
|
|
|
|
+ console.log(`焦点已跳转到输入框索引: ${nextIndex}`);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ nextIndex++;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (!foundNext) {
|
|
if (!foundNext) {
|
|
|
- console.log("未找到下一个可用的输入框");
|
|
|
|
|
|
|
+ console.log("未找到下一个可用的输入框");
|
|
|
|
|
+
|
|
|
|
|
+ enterCount++; // 增加回车键按下的次数
|
|
|
|
|
+
|
|
|
|
|
+ if (enterCount === 2) {
|
|
|
|
|
+ dialogbutton.value = true; // 第二次按下回车键时弹出弹窗
|
|
|
|
|
+ enterCount = 0; // 重置计数器
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
isProcessing = false; // 标志位重置,允许下一次回车处理
|
|
isProcessing = false; // 标志位重置,允许下一次回车处理
|
|
|
-}
|
|
|
|
|
-else if (event.keyCode === 13 || event.keyCode === 40 && title === '') {
|
|
|
|
|
|
|
+ }else if (event.keyCode === 13 || event.keyCode === 40 && title === '') {
|
|
|
console.log('其他')
|
|
console.log('其他')
|
|
|
let nextIndex = currentIndex + 1;
|
|
let nextIndex = currentIndex + 1;
|
|
|
let foundNext = false; // 标记是否找到下一个可用的输入框
|
|
let foundNext = false; // 标记是否找到下一个可用的输入框
|