|
|
@@ -47,9 +47,10 @@
|
|
|
</div>
|
|
|
|
|
|
<!-- 弹出框 -->
|
|
|
- <el-dialog v-model="dialogFormVisible" :before-close="closeDialog" :title="type" destroy-on-close
|
|
|
- width="1200px" style="margin-top: 5%;height: 80%;">
|
|
|
-
|
|
|
+ <!-- <el-dialog v-model="dialogFormVisible" :before-close="closeDialog" :title="type" destroy-on-close
|
|
|
+ width="1200px" style="margin-top: 0%;height: 100%;;"> -->
|
|
|
+ <el-dialog v-model="dialogFormVisible" :before-close="closeDialog" :title="type" destroy-on-close
|
|
|
+ width="1200px" style="margin-top: 2%;height: 80%;">
|
|
|
<el-form ref="elFormRef" :model="detailData" inline label-position="right" :rules="rule"
|
|
|
id="detail-form" label-width="70px">
|
|
|
<el-row :gutter="24">
|
|
|
@@ -268,7 +269,6 @@
|
|
|
<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>
|
|
|
|
|
|
@@ -306,9 +306,7 @@
|
|
|
import {useUserStore} from '@/pinia/modules/user'
|
|
|
const userStore = useUserStore()
|
|
|
const sys_id = '[' + userStore.userInfo.userName + '/' + userStore.userInfo.nickName + ']'
|
|
|
- defineOptions({
|
|
|
- name: '06PackingDocuments'
|
|
|
- })
|
|
|
+ defineOptions({name: '06PackingDocuments'})
|
|
|
|
|
|
// 侧边栏数据请求
|
|
|
const treeData = reactive([])
|
|
|
@@ -328,7 +326,6 @@
|
|
|
treeData.splice(0, treeData.length, ...transformedData)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
getSideData()
|
|
|
|
|
|
// 验证规则
|
|
|
@@ -345,15 +342,15 @@
|
|
|
{label: '流程单号', prop: 'qczl_num', width: '100'},
|
|
|
{label: '流程单备注', prop: 'qczl_NumDesc', width: '120'},
|
|
|
{label: '总废品', prop: 'qczl_fp', width: '100'},
|
|
|
- {label: '废品1', prop: 'sl_lb1', width: '250'},
|
|
|
- {label: '废品2', prop: 'sl_lb2', width: '250'},
|
|
|
- {label: '废品3', prop: 'sl_lb3', width: '250'},
|
|
|
- {label: '废品4', prop: 'sl_lb4', width: '250'},
|
|
|
- {label: '废品5', prop: 'sl_lb5', width: '250'},
|
|
|
- {label: '废品6', prop: 'sl_lb6', width: '250'},
|
|
|
- {label: '废品7', prop: 'sl_lb7', width: '250'},
|
|
|
- {label: '废品8', prop: 'sl_lb8', width: '250'},
|
|
|
- {label: '废品9', prop: 'sl_lb9', width: '250'},
|
|
|
+ {label: '废品1', prop: 'sl_lb1', width: '250'},
|
|
|
+ {label: '废品2', prop: 'sl_lb2', width: '250'},
|
|
|
+ {label: '废品3', prop: 'sl_lb3', width: '250'},
|
|
|
+ {label: '废品4', prop: 'sl_lb4', width: '250'},
|
|
|
+ {label: '废品5', prop: 'sl_lb5', width: '250'},
|
|
|
+ {label: '废品6', prop: 'sl_lb6', width: '250'},
|
|
|
+ {label: '废品7', prop: 'sl_lb7', width: '250'},
|
|
|
+ {label: '废品8', prop: 'sl_lb8', width: '250'},
|
|
|
+ {label: '废品9', prop: 'sl_lb9', width: '250'},
|
|
|
{label: '废品10', prop: 'sl_lb10', width: '250'},
|
|
|
{label: '废品11', prop: 'sl_lb11', width: '250'},
|
|
|
{label: '废品12', prop: 'sl_lb12', width: '250'},
|
|
|
@@ -377,7 +374,7 @@
|
|
|
limit: limit.value.toString(),
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ // 工序弹窗选择控制
|
|
|
const dialogSelectVisible_gx = ref(false)
|
|
|
const selectData_gx = reactive([])
|
|
|
const handleSelectClick_gx = (row, column, event) => {
|
|
|
@@ -412,10 +409,10 @@
|
|
|
if (inputElement) {
|
|
|
inputElement.focus();
|
|
|
}
|
|
|
- }, 100);
|
|
|
- // 获取工序
|
|
|
+ }, 100);
|
|
|
+
|
|
|
+ // 获取工序
|
|
|
const getgxsubmit = () => {
|
|
|
-
|
|
|
if(!detailData.qczl_gdbh || !detailData.qczl_yjno){
|
|
|
return
|
|
|
}
|
|
|
@@ -1192,9 +1189,6 @@ const gd_lcdCancel = async () => {
|
|
|
dialogFormVisible.value = true
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
const dialogSelectVisible1 = ref(false); // 控制对话框显示
|
|
|
const selecTreeData = ref([]); // 树形数据
|
|
|
const table_fplb = ref(null); // el-tree 的 ref
|
|
|
@@ -1293,7 +1287,7 @@ const gd_lcdCancel = async () => {
|
|
|
return result; // 确保返回的总是数组
|
|
|
};
|
|
|
|
|
|
-
|
|
|
+ //废品类别分类点击事件
|
|
|
const handleFplbClick = (node) => {
|
|
|
const tree = table_fplb.value; // 获取树实例
|
|
|
if (!tree) {
|
|
|
@@ -1311,7 +1305,7 @@ const gd_lcdCancel = async () => {
|
|
|
};
|
|
|
|
|
|
|
|
|
- // 树形键盘事件
|
|
|
+ // 废品类别分类键盘事件
|
|
|
const handleTreeKeydown = (event) => {
|
|
|
if (event.keyCode === 13) { // 判断是否是回车键
|
|
|
const tree = table_fplb.value; // 获取树实例
|
|
|
@@ -1357,7 +1351,7 @@ const gd_lcdCancel = async () => {
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
- console.log("当前节点没有子节点:", currentNode.label);
|
|
|
+ console.log("当前子节点:", currentNode.label);
|
|
|
detailData.table[selectIndex.value].fp_lb = currentNode.label; // 更新数据
|
|
|
dialogSelectVisible1.value = false; // 关闭对话框
|
|
|
}
|
|
|
@@ -1366,7 +1360,7 @@ const gd_lcdCancel = async () => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- // 对话框键盘事件
|
|
|
+ //工序弹出框键盘事件
|
|
|
const ent = (event) => {
|
|
|
if (document.activeElement.id === "tableFplb") {
|
|
|
if (table_fplb.value) {
|
|
|
@@ -1386,8 +1380,19 @@ const gd_lcdCancel = async () => {
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ //键盘事件监听逻辑确认
|
|
|
+ const handleKeydown = (event) => {
|
|
|
+ if (dialogbutton.value && event.key === "Enter") {
|
|
|
+ ElMessage({
|
|
|
+ type: 'warning',
|
|
|
+ message: '正在保存数据中'
|
|
|
+ })
|
|
|
+ enterDialog(); // 调用确认按钮逻辑
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
// 获取工序
|
|
|
const getgxsubmit = () => {
|
|
|
console.log("获取工序")
|
|
|
@@ -1415,304 +1420,275 @@ 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 lastFpSl = null; // 记录上一次输入的数量
|
|
|
- const dialogbutton = ref(false); // 控制对话框显示
|
|
|
- let enterCount = 0; // 记录回车键按下的次数
|
|
|
|
|
|
-
|
|
|
- //新增回车事件
|
|
|
- const ent1 = async(event,index,row,title) => {
|
|
|
- const inputs = document.getElementsByTagName('input');
|
|
|
- const currentIndex = Array.from(inputs).indexOf(event.target);
|
|
|
-
|
|
|
- if (event.keyCode === 13 && title === '工序') {
|
|
|
- getgxsubmit()
|
|
|
-
|
|
|
- }else if (event.keyCode === 13 && title === '流程单号') {
|
|
|
- console.log("流程单号");
|
|
|
- // 获取所有相关的输入框值
|
|
|
- const allValues = [
|
|
|
- detailData.qczl_num,
|
|
|
- detailData.qczl_NumDesc1,
|
|
|
- detailData.qczl_NumDesc2,
|
|
|
- detailData.qczl_NumDesc3,
|
|
|
- detailData.qczl_NumDesc4,
|
|
|
- detailData.qczl_NumDesc5,
|
|
|
- detailData.qczl_NumDesc6,
|
|
|
- detailData.qczl_NumDesc7,
|
|
|
- detailData.qczl_NumDesc8,
|
|
|
- ];
|
|
|
-
|
|
|
- // 获取当前输入框的值
|
|
|
- const currentValue = event.target.value;
|
|
|
+ let isProcessing = false; // 标志位
|
|
|
+ let lastFpSl = null; // 记录上一次输入的数量
|
|
|
+ const dialogbutton = ref(false); // 控制对话框显示
|
|
|
+ let enterCount = 0; // 记录回车键按下的次数
|
|
|
+
|
|
|
+ //新增回车事件
|
|
|
+ const ent1 = async(event,index,row,title) => {
|
|
|
+ const inputs = document.getElementsByTagName('input');
|
|
|
+ const currentIndex = Array.from(inputs).indexOf(event.target);
|
|
|
+ if (event.keyCode === 13 && title === '工序') {
|
|
|
+ getgxsubmit()
|
|
|
+ }else if (event.keyCode === 13 && title === '流程单号') {
|
|
|
+ // 获取所有相关的输入框值
|
|
|
+ const allValues = [
|
|
|
+ detailData.qczl_num,
|
|
|
+ detailData.qczl_NumDesc1,
|
|
|
+ detailData.qczl_NumDesc2,
|
|
|
+ detailData.qczl_NumDesc3,
|
|
|
+ detailData.qczl_NumDesc4,
|
|
|
+ detailData.qczl_NumDesc5,
|
|
|
+ detailData.qczl_NumDesc6,
|
|
|
+ detailData.qczl_NumDesc7,
|
|
|
+ detailData.qczl_NumDesc8,
|
|
|
+ ];
|
|
|
+ // 获取当前输入框的值
|
|
|
+ const currentValue = event.target.value;
|
|
|
|
|
|
- // 如果当前值为 0,不进行校验,直接跳转到下一个输入框
|
|
|
- if (currentValue === "0") {
|
|
|
- console.log("输入值为 0,无需校验");
|
|
|
+ // 如果当前值为 0,不进行校验,直接跳转到下一个输入框
|
|
|
+ if (currentValue === "0") {
|
|
|
+ console.log("输入值为 0,无需校验");
|
|
|
|
|
|
- // 跳转到下一个输入框
|
|
|
- let nextIndex = currentIndex + 1;
|
|
|
- let foundNext = false; // 标记是否找到下一个可用输入框
|
|
|
- while (nextIndex < inputs.length) {
|
|
|
- if (inputs[nextIndex].disabled) {
|
|
|
- console.log("当前输入框为 disabled,跳过");
|
|
|
- nextIndex++; // 跳过 disabled 的输入框
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (!inputs[nextIndex].readOnly) {
|
|
|
- nextTick(() => {
|
|
|
- inputs[nextIndex].focus();
|
|
|
- inputs[nextIndex].select();
|
|
|
- });
|
|
|
- foundNext = true; // 找到下一个可用输入框
|
|
|
- break;
|
|
|
- }
|
|
|
- nextIndex++;
|
|
|
- }
|
|
|
- if (!foundNext) {
|
|
|
- console.log("没有更多可用的输入框");
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // 检查是否有重复的值
|
|
|
- const isDuplicate = allValues.filter((val) => val === currentValue).length > 1;
|
|
|
-
|
|
|
- if (isDuplicate) {
|
|
|
- // 如果有重复值,提示用户并清空当前输入框
|
|
|
- event.target.value = 0;
|
|
|
- ElMessage({
|
|
|
- type: 'error',
|
|
|
- message: '输入的值已存在,请重新输入'
|
|
|
- });
|
|
|
- } else {
|
|
|
- console.log('输入值无重复');
|
|
|
+ // 跳转到下一个输入框
|
|
|
+ let nextIndex = currentIndex + 1;
|
|
|
+ let foundNext = false; // 标记是否找到下一个可用输入框
|
|
|
+ while (nextIndex < inputs.length) {
|
|
|
+ if (inputs[nextIndex].disabled) {
|
|
|
+ console.log("当前输入框为 disabled,跳过");
|
|
|
+ nextIndex++; // 跳过 disabled 的输入框
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (!inputs[nextIndex].readOnly) {
|
|
|
+ nextTick(() => {
|
|
|
+ inputs[nextIndex].focus();
|
|
|
+ inputs[nextIndex].select();
|
|
|
+ });
|
|
|
+ foundNext = true; // 找到下一个可用输入框
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ nextIndex++;
|
|
|
+ }
|
|
|
+ if (!foundNext) {
|
|
|
+ console.log("没有更多可用的输入框");
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- // 跳转到下一个输入框
|
|
|
- let nextIndex = currentIndex + 1;
|
|
|
- let foundNext = false; // 标记是否找到下一个可用输入框
|
|
|
- while (nextIndex < inputs.length) {
|
|
|
- if (inputs[nextIndex].disabled) {
|
|
|
- console.log("当前输入框为 disabled,跳过");
|
|
|
- nextIndex++; // 跳过 disabled 的输入框
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (!inputs[nextIndex].readOnly) {
|
|
|
- nextTick(() => {
|
|
|
- inputs[nextIndex].focus();
|
|
|
- inputs[nextIndex].select();
|
|
|
- });
|
|
|
- foundNext = true; // 找到下一个可用输入框
|
|
|
- break;
|
|
|
- }
|
|
|
- nextIndex++;
|
|
|
- }
|
|
|
- if (!foundNext) {
|
|
|
- console.log("没有更多可用的输入框");
|
|
|
- }
|
|
|
- }
|
|
|
-}else if (event.keyCode === 13 && title === '废品类别') {
|
|
|
- handleFplbEnter(event,index,row,title)
|
|
|
- let nextIndex = currentIndex + 1;
|
|
|
- let foundNext = false; // 标记是否找到下一个可用的输入框
|
|
|
- while (nextIndex < inputs.length) {
|
|
|
- if (inputs[nextIndex].disabled) {
|
|
|
- console.log("当前输入框为disabled,跳过");
|
|
|
- nextIndex++; // 跳过disabled的输入框
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (!inputs[nextIndex].readOnly) {
|
|
|
- nextTick(() => {
|
|
|
- inputs[nextIndex].focus();
|
|
|
- inputs[nextIndex].select();
|
|
|
- });
|
|
|
- foundNext = true; // 找到下一个可用输入框
|
|
|
- break;
|
|
|
- }
|
|
|
- nextIndex++;
|
|
|
- }
|
|
|
- }else if (event.keyCode === 13 && title === '数量') {
|
|
|
- if (isProcessing) {
|
|
|
- console.log("当前正在处理回车事件,忽略重复触发");
|
|
|
- return; // 如果正在处理,直接返回
|
|
|
- }
|
|
|
+ // 检查是否有重复的值
|
|
|
+ const isDuplicate = allValues.filter((val) => val === currentValue).length > 1;
|
|
|
|
|
|
- isProcessing = true; // 标志正在处理
|
|
|
- event.preventDefault(); // 阻止默认行为
|
|
|
+ if (isDuplicate) {
|
|
|
+ // 如果有重复值,提示用户并清空当前输入框
|
|
|
+ event.target.value = 0;
|
|
|
+ ElMessage({
|
|
|
+ type: 'error',
|
|
|
+ message: '输入的值已存在,请重新输入'
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ console.log('输入值无重复');
|
|
|
+ // 跳转到下一个输入框
|
|
|
+ let nextIndex = currentIndex + 1;
|
|
|
+ let foundNext = false; // 标记是否找到下一个可用输入框
|
|
|
+ while (nextIndex < inputs.length) {
|
|
|
+ if (inputs[nextIndex].disabled) {
|
|
|
+ console.log("当前输入框为 disabled,跳过");
|
|
|
+ nextIndex++; // 跳过 disabled 的输入框
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (!inputs[nextIndex].readOnly) {
|
|
|
+ nextTick(() => {
|
|
|
+ inputs[nextIndex].focus();
|
|
|
+ inputs[nextIndex].select();
|
|
|
+ });
|
|
|
+ foundNext = true; // 找到下一个可用输入框
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ nextIndex++;
|
|
|
+ }
|
|
|
+ if (!foundNext) {
|
|
|
+ console.log("没有更多可用的输入框");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if (event.keyCode === 13 && title === '废品类别') {
|
|
|
+ handleFplbEnter(event,index,row,title)
|
|
|
+ let nextIndex = currentIndex + 1;
|
|
|
+ let foundNext = false; // 标记是否找到下一个可用的输入框
|
|
|
+ while (nextIndex < inputs.length) {
|
|
|
+ if (inputs[nextIndex].disabled) {
|
|
|
+ console.log("当前输入框为disabled,跳过");
|
|
|
+ nextIndex++; // 跳过disabled的输入框
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (!inputs[nextIndex].readOnly) {
|
|
|
+ nextTick(() => {
|
|
|
+ inputs[nextIndex].focus();
|
|
|
+ inputs[nextIndex].select();
|
|
|
+ });
|
|
|
+ foundNext = true; // 找到下一个可用输入框
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ nextIndex++;
|
|
|
+ }
|
|
|
+ }else if (event.keyCode === 13 && title === '数量') {
|
|
|
+ if (isProcessing) {
|
|
|
+ console.log("当前正在处理回车事件,忽略重复触发");
|
|
|
+ return; // 如果正在处理,直接返回
|
|
|
+ }
|
|
|
|
|
|
- console.log("数量回车");
|
|
|
+ isProcessing = true; // 标志正在处理
|
|
|
+ event.preventDefault(); // 阻止默认行为
|
|
|
|
|
|
- // 去掉数量前导的0
|
|
|
- if (typeof row.fp_sl === 'string') {
|
|
|
- row.fp_sl = row.fp_sl.replace(/^0+(?=\d)/, '');
|
|
|
- }
|
|
|
+ // 去掉数量前导的0
|
|
|
+ if (typeof row.fp_sl === 'string') {
|
|
|
+ row.fp_sl = row.fp_sl.replace(/^0+(?=\d)/, '');
|
|
|
+ }
|
|
|
|
|
|
- // 判断数量是否为 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] = '';
|
|
|
- });
|
|
|
- } else {
|
|
|
- // 检查数量是否与上一次相同
|
|
|
- if (row.fp_sl !== lastFpSl) {
|
|
|
- // 异步调用 handleFpslEnter
|
|
|
- await handleFpslEnter(event, index, row, title);
|
|
|
- lastFpSl = 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] = '';
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 检查数量是否与上一次相同
|
|
|
+ if (row.fp_sl !== lastFpSl) {
|
|
|
+ // 异步调用 handleFpslEnter
|
|
|
+ await handleFpslEnter(event, index, row, title);
|
|
|
+ lastFpSl = row.fp_sl; // 更新记录的数量
|
|
|
|
|
|
- if (!detailData.table[index].fp_gxmc) {
|
|
|
- console.log("字段 fp_gxmc 为空,不能跳转到下一个输入框");
|
|
|
- isProcessing = false; // 重置标志
|
|
|
- return; // 阻止跳转
|
|
|
- }
|
|
|
- } else {
|
|
|
- console.log("数量未变化,跳过 handleFpslEnter 调用");
|
|
|
- }
|
|
|
- }
|
|
|
+ if (!detailData.table[index].fp_gxmc) {
|
|
|
+ console.log("字段 fp_gxmc 为空,不能跳转到下一个输入框");
|
|
|
+ isProcessing = false; // 重置标志
|
|
|
+ return; // 阻止跳转
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log("数量未变化,跳过 handleFpslEnter 调用");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- // 焦点跳转逻辑
|
|
|
- let nextIndex = currentIndex + 1;
|
|
|
- let foundNext = false;
|
|
|
+ // 焦点跳转逻辑
|
|
|
+ let nextIndex = currentIndex + 1;
|
|
|
+ let foundNext = false;
|
|
|
|
|
|
- while (nextIndex < inputs.length) {
|
|
|
- const nextInput = inputs[nextIndex];
|
|
|
- if (!nextInput.disabled && !nextInput.readOnly) {
|
|
|
- nextInput.focus();
|
|
|
- nextInput.select();
|
|
|
- foundNext = true;
|
|
|
- console.log(`焦点已跳转到输入框索引: ${nextIndex}`);
|
|
|
- break;
|
|
|
- }
|
|
|
- nextIndex++;
|
|
|
- }
|
|
|
+ while (nextIndex < inputs.length) {
|
|
|
+ const nextInput = inputs[nextIndex];
|
|
|
+ if (!nextInput.disabled && !nextInput.readOnly) {
|
|
|
+ nextInput.focus();
|
|
|
+ nextInput.select();
|
|
|
+ foundNext = true;
|
|
|
+ console.log(`焦点已跳转到输入框索引: ${nextIndex}`);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ nextIndex++;
|
|
|
+ }
|
|
|
|
|
|
- if (!foundNext) {
|
|
|
- console.log("未找到下一个可用的输入框");
|
|
|
+ if (!foundNext) {
|
|
|
+ console.log("未找到下一个可用的输入框");
|
|
|
|
|
|
- enterCount++; // 增加回车键按下的次数
|
|
|
+ enterCount++; // 增加回车键按下的次数
|
|
|
|
|
|
- if (enterCount === 2) {
|
|
|
- dialogbutton.value = true; // 第二次按下回车键时弹出弹窗
|
|
|
- enterCount = 0; // 重置计数器
|
|
|
- }
|
|
|
- }
|
|
|
+ if (enterCount === 2) {
|
|
|
+ dialogbutton.value = true; // 第二次按下回车键时弹出弹窗
|
|
|
+ enterCount = 0; // 重置计数器
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- isProcessing = false; // 标志位重置,允许下一次回车处理
|
|
|
- }else if (event.keyCode === 13 || event.keyCode === 40 && title === '') {
|
|
|
- console.log('其他')
|
|
|
- let nextIndex = currentIndex + 1;
|
|
|
- let foundNext = false; // 标记是否找到下一个可用的输入框
|
|
|
- while (nextIndex < inputs.length) {
|
|
|
- if (inputs[nextIndex].disabled) {
|
|
|
- // console.log("当前输入框为disabled,跳过");
|
|
|
- nextIndex++; // 跳过disabled的输入框
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (!inputs[nextIndex].readOnly) {
|
|
|
- nextTick(() => {
|
|
|
- inputs[nextIndex].focus();
|
|
|
- inputs[nextIndex].select();
|
|
|
- });
|
|
|
- foundNext = true; // 找到下一个可用输入框
|
|
|
- break;
|
|
|
- }
|
|
|
- nextIndex++;
|
|
|
- }
|
|
|
- // 如果没有找到下一个可用输入框,提示用户
|
|
|
- if (!foundNext) {
|
|
|
- console.log("已经是最后一个输入框");
|
|
|
- }
|
|
|
- }
|
|
|
- else if (event.keyCode === 38) { // 向上箭头
|
|
|
- for (let i = currentIndex - 1; i >= 0; i--) {
|
|
|
- if (!inputs[i].readOnly) {
|
|
|
- nextTick(()=>{
|
|
|
- inputs[i].focus();
|
|
|
- inputs[i].select();
|
|
|
- })
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- } else if (event.keyCode === 37) { // 向左箭头
|
|
|
- if (event.target.selectionStart === 0) {
|
|
|
- for (let i = currentIndex - 1; i >= 0; i--) {
|
|
|
- if (!inputs[i].readOnly) {
|
|
|
- nextTick(()=>{
|
|
|
- inputs[i].focus();
|
|
|
- inputs[i].select();
|
|
|
- })
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } else if (event.keyCode === 39) { // 向右箭头
|
|
|
- if (event.target.selectionStart === event.target.value.length) {
|
|
|
- for (let i = currentIndex + 1; i < inputs.length; i++) {
|
|
|
- if (!inputs[i].readOnly) {
|
|
|
- nextTick(()=>{
|
|
|
- inputs[i].focus();
|
|
|
- inputs[i].select();
|
|
|
- })
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ isProcessing = false; // 标志位重置,允许下一次回车处理
|
|
|
+ }else if (event.keyCode === 13 || event.keyCode === 40 && title === '') {
|
|
|
+ console.log('其他')
|
|
|
+ let nextIndex = currentIndex + 1;
|
|
|
+ let foundNext = false; // 标记是否找到下一个可用的输入框
|
|
|
+ while (nextIndex < inputs.length) {
|
|
|
+ if (inputs[nextIndex].disabled) {
|
|
|
+ nextIndex++; // 跳过disabled的输入框
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (!inputs[nextIndex].readOnly) {
|
|
|
+ nextTick(() => {
|
|
|
+ inputs[nextIndex].focus();
|
|
|
+ inputs[nextIndex].select();
|
|
|
+ });
|
|
|
+ foundNext = true; // 找到下一个可用输入框
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ nextIndex++;
|
|
|
+ }
|
|
|
+ // 如果没有找到下一个可用输入框,提示用户
|
|
|
+ if (!foundNext) {
|
|
|
+ console.log("已经是最后一个输入框");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (event.keyCode === 38) { // 向上箭头
|
|
|
+ for (let i = currentIndex - 1; i >= 0; i--) {
|
|
|
+ if (!inputs[i].readOnly) {
|
|
|
+ nextTick(()=>{
|
|
|
+ inputs[i].focus();
|
|
|
+ inputs[i].select();
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (event.keyCode === 37) { // 向左箭头
|
|
|
+ if (event.target.selectionStart === 0) {
|
|
|
+ for (let i = currentIndex - 1; i >= 0; i--) {
|
|
|
+ if (!inputs[i].readOnly) {
|
|
|
+ nextTick(()=>{
|
|
|
+ inputs[i].focus();
|
|
|
+ inputs[i].select();
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (event.keyCode === 39) { // 向右箭头
|
|
|
+ if (event.target.selectionStart === event.target.value.length) {
|
|
|
+ for (let i = currentIndex + 1; i < inputs.length; i++) {
|
|
|
+ if (!inputs[i].readOnly) {
|
|
|
+ nextTick(()=>{
|
|
|
+ inputs[i].focus();
|
|
|
+ inputs[i].select();
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
-
|
|
|
- //删除按钮
|
|
|
- const handleDelete = () => {
|
|
|
- if (currentRow.value == undefined) {
|
|
|
- ElMessage({type: 'warning',message: '未选中记录',})
|
|
|
- return
|
|
|
- }
|
|
|
- ElMessageBox.confirm(`确认删除这条数据么?`,'警告', {
|
|
|
- confirmButtonText: '确认',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning',
|
|
|
+//删除按钮
|
|
|
+const handleDelete = () => {
|
|
|
+ if (currentRow.value == undefined) {
|
|
|
+ ElMessage({type: 'warning',message: '未选中记录',})
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ElMessageBox.confirm(`确认删除这条数据么?`,'警告', {
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ }
|
|
|
+ ).then(() => {
|
|
|
+ del({'UniqId': currentRow.value}).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ ElMessage({
|
|
|
+ type: 'success',
|
|
|
+ message: '删除成功',
|
|
|
+ })
|
|
|
+ currentRow.value = undefined
|
|
|
+ getSideData()
|
|
|
+ getTableData()
|
|
|
}
|
|
|
- ).then(() => {
|
|
|
- del({'UniqId': currentRow.value}).then(res => {
|
|
|
- if (res.code === 0) {
|
|
|
- ElMessage({
|
|
|
- type: 'success',
|
|
|
- message: '删除成功',
|
|
|
- })
|
|
|
- currentRow.value = undefined
|
|
|
- getSideData()
|
|
|
- getTableData()
|
|
|
- }
|
|
|
- })
|
|
|
- }).catch(() => {
|
|
|
- ElMessage({
|
|
|
- type: 'info',
|
|
|
- message: '取消删除',
|
|
|
- })
|
|
|
})
|
|
|
- }
|
|
|
+ }).catch(() => {
|
|
|
+ ElMessage({
|
|
|
+ type: 'info',
|
|
|
+ message: '取消删除',
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|