From a4ded387f6476a350e61c09e178478570ae98656 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期一, 30 十二月 2024 09:21:08 +0800
Subject: [PATCH] test

---
 pages/modal/3018_2.vue |  264 +++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 227 insertions(+), 37 deletions(-)

diff --git a/pages/modal/3018_2.vue b/pages/modal/3018_2.vue
index f91a918..4c59b99 100644
--- a/pages/modal/3018_2.vue
+++ b/pages/modal/3018_2.vue
@@ -239,7 +239,7 @@
 										$this.onScanValue(ele, res.result)
 										break;
 									}
-								} else if (ele.name == "Layot") {
+								} else if (ele.name == "Layout") {
 									let curIndex = (ele.setting.colList || []).findIndex((col, index2,
 										arr) => {
 										return (col.name == 'Input' || col.name == 'InputNumber' || col
@@ -482,12 +482,19 @@
 					formItem.dict = list;
 				} catch (ex) {
 					// console.log(ex);
+					let exStr = JSON.stringify(ex)
+					if (exStr == "{}")
+						exStr = ex
+					let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr
+
 					uni.showModal({
 						title: this.translateSys("error") + "1.3",
-						content: ex.errMsg,
+						content: tip,
 						showCancel: false,
 						confirmText: this.translateSys("cancel")
 					});
+
+
 				}
 			},
 
@@ -546,11 +553,31 @@
 								if (action.action_type == 'set_dlg_attr') {
 									var result = action.value;
 									$this.setFormValues(result)
-								} else if (data.action[i].action_type == 'set_dlg_attr_show') {
+								} else if (action.action_type == 'set_dlg_attr_show') {
 									var result = action.value;
 									$this.hideFormItems(result)
-
 									// console.log($this.$data.head_styledef);
+								} else if (action.action_type ==
+									"set_dlg_current_edit_attr"
+								) {
+									if ($this
+										.focusOldFieldId ==
+										action.value) {
+										$this.setData({
+											focusFieldId: ""
+										})
+									} else {
+										$this.setData({
+											focusFieldId: $this
+												.focusOldFieldId
+										})
+									}
+									$this.$nextTick(() => {
+										$this.setData({
+											focusFieldId: action
+												.value
+										})
+									});
 								} else {
 									uni.showModal({
 										title: this.translateSys("tip"),
@@ -668,6 +695,66 @@
 						}
 						this.DataObjRunCustomEvent(info, '');
 					}
+					if (item.value) { //绗竴涓緭鍏ユ涓嶄负绌�+						//鍒濆鍖栵紝涓嬩釜杈撳叆妗唂ocus灞炴�
+						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
+										}
+									}
+								}
+
+							}
+						}
+					}
+
 				}
 			},
 			onClick(item) {
@@ -707,7 +794,7 @@
 
 			},
 			onchange(item) {
-				// console.log("onchange",item);
+				console.log("onchange", item);
 				if (item.oldvalue != item.value && item.value.trim() != "") {
 					item.oldvalue = item.value;
 					var attr = item.fieldId;
@@ -961,6 +1048,27 @@
 									// console.log($this.$data.head_styledef);
 								} else if (action.action_type == 'set_global_attr') {
 									$this.$data.global_attr = action.value || [];
+								} else if (action.action_type ==
+									"set_dlg_current_edit_attr"
+								) {
+									if ($this
+										.focusOldFieldId ==
+										action.value) {
+										$this.setData({
+											focusFieldId: ""
+										})
+									} else {
+										$this.setData({
+											focusFieldId: $this
+												.focusOldFieldId
+										})
+									}
+									$this.$nextTick(() => {
+										$this.setData({
+											focusFieldId: action
+												.value
+										})
+									});
 								} else {
 									uni.showModal({
 										title: this.translateSys("tip"),
@@ -1470,12 +1578,15 @@
 							showCancel: false,
 							confirmText: this.translateSys("cancel")
 						});
+						else {
 
-						uni.showToast({
-							title: this.translate('create_success'),
-							icon: "success",
-							duration: 3000
-						});
+							uni.showToast({
+								title: this.translate('create_success'),
+								icon: "success",
+								duration: 3000
+							});
+						}
+
 
 						if (!this.$data.param.After_Btn_Not_Refresh) {
 							//鍒锋柊
@@ -1492,28 +1603,50 @@
 									var action = actionlist[i];
 									if (action.action_type == 'set_dlg_attr') {
 										$this.setFormValues(action.value)
-									} else if (data.action[i].action_type == 'set_dlg_attr_show') {
+									} else if (action.action_type == 'set_dlg_attr_show') {
 										var result = action.value;
 										$this.hideFormItems(result)
+									} else if (action.action_type ==
+										"set_dlg_current_edit_attr"
+									) {
+										if ($this
+											.focusOldFieldId ==
+											action.value) {
+											$this.setData({
+												focusFieldId: ""
+											})
+										} else {
+											$this.setData({
+												focusFieldId: $this
+													.focusOldFieldId
+											})
+										}
+										$this.$nextTick(() => {
+											$this.setData({
+												focusFieldId: action
+													.value
+											})
+										});
 									}
 								}
 							}
 
 						}
 					}
-
-
 					// this.class_attr_init();
 
 					this.saving = false
 				}).catch(ex => {
-					console.log(ex);
 					this.saving = false
 
 					uni.hideLoading();
+					let exStr = JSON.stringify(ex)
+					if (exStr == "{}")
+						exStr = ex
+					let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr
 					uni.showModal({
 						title: this.translateSys("tip"),
-						content: ex.errMsg,
+						content: tip,
 						showCancel: false,
 						confirmText: this.translateSys("cancel")
 					});
@@ -1762,10 +1895,32 @@
 									var action = actionlist[i];
 									if (action.action_type == 'set_dlg_attr') {
 										$this.setFormValues(action.value)
-									} else if (data.action[i].action_type == 'set_dlg_attr_show') {
+									} else if (action.action_type == 'set_dlg_attr_show') {
 										var result = action.value;
 										$this.hideFormItems(result)
+									} else if (action.action_type ==
+										"set_dlg_current_edit_attr"
+									) {
+										if ($this
+											.focusOldFieldId ==
+											action.value) {
+											$this.setData({
+												focusFieldId: ""
+											})
+										} else {
+											$this.setData({
+												focusFieldId: $this
+													.focusOldFieldId
+											})
+										}
+										$this.$nextTick(() => {
+											$this.setData({
+												focusFieldId: action
+													.value
+											})
+										});
 									}
+
 								}
 							}
 						}
@@ -1775,9 +1930,13 @@
 				}).catch(ex => {
 					// console.log(ex);
 					this.saving = false
+					let exStr = JSON.stringify(ex)
+					if (exStr == "{}")
+						exStr = ex
+					let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr
 					uni.showModal({
 						title: this.translateSys('tip') + "7.1",
-						content: ex.errMsg,
+						content: tip,
 						showCancel: false,
 						confirmText: this.translateSys("cancel")
 					});
@@ -1893,28 +2052,61 @@
 							showCancel: false,
 							confirmText: this.translateSys("cancel")
 						});
+						if (!this.$data.param.After_Btn_Not_Refresh) {
+							//鍒锋柊
+							uni.redirectTo({
+								url: '../modal/3018_2?param=' + JSON.stringify(this.$data
+										.param) +
+									"&titlename=" + this.$data.title
+							});
+						} else {
+							var actionlist = data.action;
+							if (actionlist) {
+								console.log(actionlist);
+								for (var i = 0; i < actionlist.length; i++) {
+									var action = actionlist[i];
+									if (action.action_type == 'set_dlg_attr') {
+										$this.setFormValues(action.value)
+									} else if (action.action_type == 'set_dlg_attr_show') {
+										var result = action.value;
+										$this.hideFormItems(result)
+									} else if (action.action_type ==
+										"set_dlg_current_edit_attr"
+									) {
+										if ($this
+											.focusOldFieldId ==
+											action.value) {
+											$this.setData({
+												focusFieldId: ""
+											})
+										} else {
+											$this.setData({
+												focusFieldId: $this
+													.focusOldFieldId
+											})
+										}
+										$this.$nextTick(() => {
+											$this.setData({
+												focusFieldId: action
+													.value
+											})
+										});
+									}
 
-						var actionlist = data.action;
-						if (actionlist) {
-							console.log(actionlist);
-							for (var i = 0; i < actionlist.length; i++) {
-								var action = actionlist[i];
-								if (action.action_type == 'set_dlg_attr') {
-									$this.setFormValues(action.value)
-								} else if (data.action[i].action_type == 'set_dlg_attr_show') {
-									var result = action.value;
-									$this.hideFormItems(result)
 								}
 							}
 						}
-
 					}
 
 				}).catch(ex => {
 					// console.log(ex);
+					let exStr = JSON.stringify(ex)
+					if (exStr == "{}")
+						exStr = ex
+					let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr
 					uni.showModal({
 						title: this.translateSys('tip') + "7.1",
-						content: ex.errMsg,
+						content: tip,
 						showCancel: false,
 						confirmText: this.translateSys("cancel")
 					});
@@ -1933,7 +2125,6 @@
 				const url = '../modal/3018?param=' + JSON.stringify(data) + "&titlename=" + btn.Edit_dlg
 					.Name +
 					"&type=addDataObj"
-				console.log("showAddSmallDialog", url);
 				var $this = this;
 				uni.navigateTo({
 					url: url,
@@ -1942,13 +2133,12 @@
 						addDataObj: function(resData) {
 							console.log(resData);
 							//鍒锋柊
-							if (!this.$data.param.After_Btn_Not_Refresh) {
-								uni.redirectTo({
-									url: '../modal/3018_2?param=' + JSON.stringify(this
-											.$data.param) +
-										"&titlename=" + this.$data.title
-								});
-							}
+							uni.redirectTo({
+								url: '../modal/3018_2?param=' + JSON.stringify(this
+										.$data.param) +
+									"&titlename=" + this.$data.title
+							});
+
 						},
 					}
 				});

--
Gitblit v1.9.1