From 9ae83a12c2b9c764e28760fb9c3c09fe697c8990 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期一, 22 七月 2024 14:56:00 +0800
Subject: [PATCH] 3018 按钮修改

---
 pages/modal/5600.vue |  171 ++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 126 insertions(+), 45 deletions(-)

diff --git a/pages/modal/5600.vue b/pages/modal/5600.vue
index b73e1f3..042ff3e 100644
--- a/pages/modal/5600.vue
+++ b/pages/modal/5600.vue
@@ -18,7 +18,7 @@
 						:type="item.name=='Input'?'text':'number'" v-model="item.value" :disabled="item.disabled"
 						:placeholder="item.placeholder"
 						:style="{'width':item.setting.prefix && item.setting.suffix?'78%':item.setting.prefix || item.setting.suffix?'87%':'96%'}"
-						:focus="focusFieldId == item.fieldId" @focus="ontap(index,item)"
+						:focus="focusFieldId == item.fieldId" @focus="ontap(index,item)" @click="onClick(item)"
 						@keyup.enter="onEnterChange(item)" @blur="onEnterChange(item)" />
 					<text v-if="item.setting.suffix" class="uni-icon" :class="[item.setting.suffix]"
 						@click="onEnterChange(item)">&#xe568;</text>
@@ -216,22 +216,7 @@
 			this.$data.title = options.titlename;
 			this.$data.param = JSON.parse(options.param);
 			// console.log(this.$data.param);
-			//鑾峰彇鏁版嵁绫荤殑鑷畾涔夎〃鍗曞弬鏁�-			this.Head_UIStyleGetInfo(this.$data.ClsID, this.$data.param.Input_UI_Style.ID);
-
-			//鍔犺浇鍒濆鐣岄潰
-			if (this.$data.param.Show_Welcom_Page) {
-				this.$data.param.Welcome_Page.Img = this.$data.param.Welcome_Page.Img.replace(/ /g, '+');
-				this.$data.param.Welcome_Page.Width = parseInt(this.$data.param.Welcome_Page.Width);
-				this.$data.param.Welcome_Page.Height = parseInt(this.$data.param.Welcome_Page.Height);
-			}
-			//鍔犺浇Tab椤电
-			this.$data.items.push(this.$data.param.Sub_Page[0].Name);
-			this.$data.items.push(this.$data.param.Sub_Page[1].Name);
-			this.Detail1_UIstyleGetInfo(this.ClsID, this.$data.param.Sub_Page[0].UI_Style.ID);
-			this.Detail2_UIstyleGetInfo(this.ClsID, this.$data.param.Sub_Page[1].UI_Style.ID);
-
-			console.log(this.$data.param);
+			this.loadData(options.paramValue)
 		},
 		//椤甸潰鍒濆鍖栬幏鍙栫劍鐐� 		methods: {
@@ -255,6 +240,47 @@
 						data = data[key2];
 					});
 				});
+			},
+			async loadData(paramValue) {
+				//鑾峰彇鏁版嵁绫荤殑鑷畾涔夎〃鍗曞弬鏁�+				await this.Head_UIStyleGetInfo(this.$data.ClsID, this.$data.param.Input_UI_Style.ID);
+				//浼犲叆鍙傛暟鍊�+				if (paramValue) {
+					const attrs = paramValue.attrs || [];
+					(this.$data.head_styledef?.form?.items || []).forEach(async (ele, index) => {
+						if (ele.name != "Layout") {
+							attrs.forEach(async (ele2, index2) => {
+								if (ele.fieldId == ele2.name) {
+									ele.value = ele2.value;
+								}
+							});
+						} else {
+							ele.setting.colList.forEach(async (col) => {
+								if (col) {
+									attrs.forEach(async (ele2,
+										index2) => {
+										if (col.fieldId == ele2.name) {
+											col.value = ele2.value;
+										}
+									});
+								}
+							});
+						}
+					})
+				}
+
+				//鍔犺浇鍒濆鐣岄潰
+				if (this.$data.param.Show_Welcom_Page) {
+					this.$data.param.Welcome_Page.Img = this.$data.param.Welcome_Page.Img.replace(/ /g, '+');
+					this.$data.param.Welcome_Page.Width = parseInt(this.$data.param.Welcome_Page.Width);
+					this.$data.param.Welcome_Page.Height = parseInt(this.$data.param.Welcome_Page.Height);
+				}
+				//鍔犺浇Tab椤电
+				this.$data.items.push(this.$data.param.Sub_Page[0].Name);
+				this.$data.items.push(this.$data.param.Sub_Page[1].Name);
+				await this.Detail1_UIstyleGetInfo(this.ClsID, this.$data.param.Sub_Page[0].UI_Style.ID);
+				await this.Detail2_UIstyleGetInfo(this.ClsID, this.$data.param.Sub_Page[1].UI_Style.ID);
+				console.log(this.$data.param);
 			},
 			changeSwiper(evt) {
 				let index = evt.target.current || evt.detail.current;
@@ -490,7 +516,9 @@
 					});
 				});
 			},
-
+			onClick(item) {
+				this.focusFieldId = item.fieldId
+			},
 			ontap(index, item) { //鎵爜鍔熻兘
 				// var $ele = e;
 				//console.log(e.target)
@@ -533,19 +561,62 @@
 						}
 						if (item.value) { //绗竴涓緭鍏ユ涓嶄负绌� 							//鍒濆鍖栵紝涓嬩釜杈撳叆妗唂ocus灞炴�
-							const curIndex = $this.head_styledef.form.items.findIndex((ele, index2, arr) => {
-								return (ele.name == 'Input' || ele.name == 'InputNumber') && index2 >
-									index;
-							})
-							if (curIndex > -1) {
-								$this.setData({
-									focusFieldId: $this.head_styledef.form.items[curIndex].fieldId
-								})
-							}
-							// setTimeout(function() {
-							// 	uni.hideKeyboard();
-							// }, 1000);
+							var findd = false
+							for (let i in $this.head_styledef.form.items) {
+								const ele = $this.head_styledef.form.items[i]
 
+								if (ele.name != "Layout") {
+									if (ele.name == 'Input' || ele.name == 'InputNumber') {
+										if (attr == ele.fieldId) {
+											findd = true
+										} else {
+											if (findd) {
+												$this.setData({
+													focusFieldId: ele.fieldId
+												})
+												break
+											}
+
+										}
+
+									}
+								} else {
+									if (findd) {
+										let curIndex = ele.setting.colList.findIndex((col, index2, arr) => {
+											return (col.name == 'Input' || col.name == 'InputNumber');
+										})
+										if (curIndex > -1) {
+											$this.setData({
+												focusFieldId: ele.setting.colList[curIndex]
+													.fieldId
+											})
+											break
+										}
+
+									} else {
+										let curIndex = ele.setting.colList.findIndex((col, index2, arr) => {
+											return attr == col.fieldId;
+										})
+										if (curIndex > -1) {
+											findd = true
+											let curIndex2 = ele.setting.colList.findIndex((col, index2, arr) => {
+												return (col.name == 'Input' || col.name ==
+														'InputNumber') &&
+													index2 >
+													curIndex;
+											})
+											if (curIndex2 > -1) {
+												$this.setData({
+													focusFieldId: ele.setting.colList[curIndex]
+														.fieldId
+												})
+												break
+											}
+										}
+									}
+
+								}
+							}
 						}
 						// if(onSuffixClickCallbackEvent.id){   //鍚庡浘鏍囩偣鍑讳簨浠� 						//   this.onSuffixClick(onSuffixClickCallbackEvent);
@@ -696,13 +767,18 @@
 								if (result.ret != 0) {
 									var tip = result.err_info ? typeof result.err_info == 'string' ? result
 										.err_info : result.err_info.join('<br/>') : '';
-									if (result.ret == 801) uni.showModal({
-										title: this.translateSys("tip"),
-										content: tip,
-										showCancel: false,
-										confirmText: this.translateSys("cancel")
-									});
-									else uni.showModal({
+									if (result.ret == 801) {
+										if (this.param.Only_Script_Error) {
+											let pos = tip.indexOf("锛�);
+											if (pos > -1) tip = tip.substring(pos + 1);
+										}
+										uni.showModal({
+											title: this.translateSys("tip"),
+											content: tip,
+											showCancel: false,
+											confirmText: this.translateSys("cancel")
+										});
+									} else uni.showModal({
 										title: this.translateSys("tip"),
 										content: tip + ',' + this.translateSys('tip') + ':' + result
 											.ret,
@@ -1516,7 +1592,7 @@
 					item_list: jsonlist,
 					ext_data: $this.detail1ExtData
 				})
-				
+
 				// console.log(jsonlist);
 				$this.runCustomEvent(event, input_param, list, '1');
 				// jsonlist.forEach(async (json,key)=>{
@@ -1670,13 +1746,18 @@
 						if (result.ret != 0) {
 							var tip = result.err_info ? typeof result.err_info == 'string' ? result.err_info :
 								result.err_info.join('<br/>') : '';
-							if (result.ret == 801) uni.showModal({
-								title: this.translateSys("tip"),
-								content: tip,
-								showCancel: false,
-								confirmText: this.translateSys("cancel")
-							});
-							else uni.showModal({
+							if (result.ret == 801) {
+								if (this.param.Only_Script_Error) {
+									let pos = tip.indexOf("锛�);
+									if (pos > -1) tip = tip.substring(pos + 1);
+								}
+								uni.showModal({
+									title: this.translateSys("tip"),
+									content: tip,
+									showCancel: false,
+									confirmText: this.translateSys("cancel")
+								});
+							} else uni.showModal({
 								title: this.translateSys("tip"),
 								content: tip + ',' + this.translateSys('tip') + ':' + result.ret,
 								showCancel: false,

--
Gitblit v1.9.1