From d370e786bc369c3b161b20a4027ef989fa133208 Mon Sep 17 00:00:00 2001
From: cyy <cuiqian2004@163.com>
Date: 星期一, 17 六月 2024 22:11:36 +0800
Subject: [PATCH] 多次设置焦点问题

---
 pages/modal/5600.vue |   30 ++++++++++++++++++++++--------
 1 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/pages/modal/5600.vue b/pages/modal/5600.vue
index 50001b7..813e6c4 100644
--- a/pages/modal/5600.vue
+++ b/pages/modal/5600.vue
@@ -479,6 +479,7 @@
 			ClsID: 'CG_Detail',
 			param: {},
 			focusFieldId: "",
+			focusOldFieldId: "",
 			head_styledef: {
 				form: {
 					items: []
@@ -757,6 +758,7 @@
 		ontap(index,item) { //鎵爜鍔熻兘
 			// var $ele = e;
 			//console.log(e.target)
+			this.focusOldFieldId = item.fieldId
 			getApp().onScan((result) => {
 				console.log(result.decodedata);
 				item.value = result.decodedata;
@@ -780,7 +782,7 @@
 				// 	    })
 				// 	    .exec();
 				// }
-				console.log(item);
+				//console.log(item);
 				if (item.oldvalue != item.value) {
 					item.oldvalue = item.value;
 					var attr = item.fieldId;
@@ -977,9 +979,9 @@
 											"set_subtable_page_content") { //宸茬爜鐩� 											$this.$data.param.Show_Welcom_Page = false;
 											var value = item.value;
-											if (value.clear == true && $this.$data
-												.detail1StyleDefList.length > 0 && value
-												.page_name == $this.$data.param.Sub_Page[0].Name
+											if (value.clear_confirm != false && value.clear == true 
+												&& $this.$data.detail1StyleDefList.length > 0 
+												&& value.page_name == $this.$data.param.Sub_Page[0].Name
 												) { //鍒ゆ柇鏄惁娓呯┖椤电鍐呭,姝e湪鐮佺洏鏄惁鏈夋暟鎹� 												uni.showModal({
 													title: '鎻愮ず',
@@ -1072,9 +1074,16 @@
 											}
 										}
 										else if (item.action_type == "set_dlg_current_edit_attr") {
-											if($this.focusFieldId == item.value)
+											if($this.focusOldFieldId == item.value)
+											{
 												$this.setData({focusFieldId: ""})
-											$this.setData({focusFieldId:item.value})
+											}
+											else{
+												$this.setData({focusFieldId:$this.focusOldFieldId})	
+											}
+											$this.$nextTick(()=> {
+												$this.setData({focusFieldId:item.value})
+											});
 										}
 										else if (item.action_type == "set_dlg_attr") {
 											// value = {"attr":"xxx", "value":"xxx"}
@@ -1921,9 +1930,14 @@
 										}
 									}
 									else if (item.action_type == "set_dlg_current_edit_attr") {
-										if($this.focusFieldId == item.value)
+										if($this.focusOldFieldId == item.value)
 											$this.setData({focusFieldId: ""})
-										$this.setData({focusFieldId:item.value})
+										else{
+											$this.setData({focusFieldId:$this.focusOldFieldId})	
+										}
+										$this.$nextTick(()=> {
+											$this.setData({focusFieldId:item.value})
+										});
 									}
 								});
 							} else {

--
Gitblit v1.9.1