|
|
@@ -1651,68 +1651,73 @@ const gd_lcdCancel = async () => {
|
|
|
console.log('接口调用异常:', e);
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- // 解析接口返回数据
|
|
|
- const decodedData = res.data.map(item => ({
|
|
|
- sczl_gxmc: item.sczl_gxmc,
|
|
|
- sczl_bzdh: item.sczl_bzdh,
|
|
|
- sczl_jtbbh: item.sczl_jtbh,
|
|
|
- sczl_bh1: item.sczl_bh1,
|
|
|
- name: item.name ? item.name.trim() : '', // 防止 name 为 null
|
|
|
- }));
|
|
|
-
|
|
|
- // 如果接口返回数据为空,直接返回
|
|
|
- if (decodedData.length === 0) {
|
|
|
- console.log('接口返回数据为空');
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- console.log('row:', row);
|
|
|
-
|
|
|
- // 匹配接口返回数据中的 sczl_gxmc
|
|
|
- const matchedItem = decodedData.find(item => {
|
|
|
- console.log('正在匹配:', item.sczl_gxmc, '与', row.fp_gxmc);
|
|
|
- return item.sczl_gxmc === row.fp_gxmc; // 直接全量匹配 row.fp_gxmc 和接口返回的 sczl_gxmc
|
|
|
- });
|
|
|
-
|
|
|
- console.log('匹配到的项:', matchedItem);
|
|
|
-
|
|
|
- if (matchedItem) {
|
|
|
- // 如果找到匹配的数据,更新当前行
|
|
|
- console.log('匹配成功,数据正确,不需要弹窗');
|
|
|
- detailData.table[index].fp_bz = matchedItem.sczl_bzdh;
|
|
|
- detailData.table[index].fp_bh = matchedItem.sczl_bh1;
|
|
|
- detailData.table[index].fp_name = matchedItem.name;
|
|
|
-
|
|
|
- // 跳转到下一个输入框
|
|
|
- let nextIndex = currentIndex + 1;
|
|
|
- let foundNext = false;
|
|
|
-
|
|
|
- while (nextIndex < inputs.length) {
|
|
|
- if (!inputs[nextIndex].disabled && !inputs[nextIndex].readOnly) {
|
|
|
- nextTick(() => {
|
|
|
- inputs[nextIndex].focus();
|
|
|
- inputs[nextIndex].select();
|
|
|
- });
|
|
|
- foundNext = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- nextIndex++;
|
|
|
- }
|
|
|
-
|
|
|
- if (!foundNext) {
|
|
|
- console.log('未找到下一个可用的输入框');
|
|
|
- dialogbutton.value = true;
|
|
|
- handleKeydown();
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 如果未找到匹配的数据,弹窗选择
|
|
|
- console.log('匹配失败,需要弹窗');
|
|
|
- selectData = decodedData;
|
|
|
- SLIndex.value = 0; // 初始化索引为第一个
|
|
|
- setCurrent(selectData[0]); // 设置当前选中为第一个
|
|
|
- dialogSelectVisible2.value = true; // 显示弹窗
|
|
|
- }
|
|
|
+
|
|
|
+ // 解析接口返回数据
|
|
|
+ const decodedData = res.data.map(item => ({
|
|
|
+ sczl_gxmc: item.sczl_gxmc,
|
|
|
+ sczl_bzdh: item.sczl_bzdh,
|
|
|
+ sczl_jtbbh: item.sczl_jtbh,
|
|
|
+ sczl_bh1: item.sczl_bh1,
|
|
|
+ name: item.name ? item.name.trim() : '', // 防止 name 为 null
|
|
|
+ }));
|
|
|
+
|
|
|
+ // 如果接口返回数据为空,直接返回
|
|
|
+ if (decodedData.length === 0) {
|
|
|
+ console.log('接口返回数据为空');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log('row:', row);
|
|
|
+
|
|
|
+ // 匹配接口返回数据中的 sczl_gxmc 和 name
|
|
|
+ const matchedItem = decodedData.find(item => {
|
|
|
+ // console.log('正在匹配:', item.sczl_gxmc, '与', row.fp_gxmc);
|
|
|
+ // return item.name === row.fp_name;
|
|
|
+ console.log('正在匹配工序名称:', `: ${item.sczl_gxmc} 与 ${row.fp_gxmc}`);
|
|
|
+ console.log('正在匹配名字:', `名字: ${item.name} 与 ${row.fp_name}`);
|
|
|
+ // 运行匹配不成功继续匹配,成功代表匹配成功
|
|
|
+ return item.sczl_gxmc === row.fp_gxmc && item.name === row.fp_name;
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ console.log('匹配到的项:', matchedItem);
|
|
|
+
|
|
|
+ if (matchedItem) {
|
|
|
+ // 如果找到匹配的数据,更新当前行
|
|
|
+ console.log('匹配成功,数据正确,不需要弹窗');
|
|
|
+ detailData.table[index].fp_bz = matchedItem.sczl_bzdh;
|
|
|
+ detailData.table[index].fp_bh = matchedItem.sczl_bh1;
|
|
|
+ detailData.table[index].fp_name = matchedItem.name;
|
|
|
+
|
|
|
+ // 跳转到下一个输入框
|
|
|
+ let nextIndex = currentIndex + 1;
|
|
|
+ let foundNext = false;
|
|
|
+
|
|
|
+ while (nextIndex < inputs.length) {
|
|
|
+ if (!inputs[nextIndex].disabled && !inputs[nextIndex].readOnly) {
|
|
|
+ nextTick(() => {
|
|
|
+ inputs[nextIndex].focus();
|
|
|
+ inputs[nextIndex].select();
|
|
|
+ });
|
|
|
+ foundNext = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ nextIndex++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!foundNext) {
|
|
|
+ console.log('未找到下一个可用的输入框');
|
|
|
+ dialogbutton.value = true;
|
|
|
+ handleKeydown();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 如果未找到匹配的数据,弹窗选择
|
|
|
+ console.log('匹配失败,需要弹窗');
|
|
|
+ selectData = decodedData;
|
|
|
+ SLIndex.value = 0; // 初始化索引为第一个
|
|
|
+ setCurrent(selectData[0]); // 设置当前选中为第一个
|
|
|
+ dialogSelectVisible2.value = true; // 显示弹窗
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
else if (event.keyCode === 13 || event.keyCode === 40 && title === '') {
|