From 49dfdd3bf265db28d38167f34e9aabfdd3e8e5db Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期五, 17 十月 2025 10:16:58 +0800
Subject: [PATCH] imagebutton

---
 pages/modal/3018_2.vue | 1708 ++++++++++++++++++++++++++++------------------------------
 1 files changed, 827 insertions(+), 881 deletions(-)

diff --git a/pages/modal/3018_2.vue b/pages/modal/3018_2.vue
index cb8a253..0511d95 100644
--- a/pages/modal/3018_2.vue
+++ b/pages/modal/3018_2.vue
@@ -1,8 +1,9 @@
 <template>
-	<view class="uni-page-modal-3018-2">
+	<view class="uni-page-modal-3018-2" :class="largeMode?'large-mode':''">
 		<view class="view-content">
 			<!-- 琛ㄥご鏍峰紡 -->
-			<OIForm ref="refBaseForm" class="v-headStyle" :form="head_styledef.form" :focusId="focusFieldId"
+			<OIForm ref="refBaseForm" class="v-headStyle" :form="head_styledef.form"
+				:hiddenIds="head_styledef.hiddenIds ?head_styledef.hiddenIds :[] " :focusId="focusFieldId"
 				@on-click="onClick" @on-focus="ontap" @on-change="onEnterChange" @on-click-prefix="classAttr_extButton"
 				@on-click-suffix="classAttr_extButton"></OIForm>
 
@@ -55,6 +56,12 @@
 		Base64
 	} from '@/js/Base64.js';
 	import utils from "@/js/utils.js"
+	import {
+		showInfo,
+		showError,
+		showLoading,
+		hideLoading
+	} from "@/js/Page.js"
 	import dayjs from "dayjs";
 	import OIForm from '@/components/oi-form/index.vue'
 	import {
@@ -75,6 +82,7 @@
 		},
 		data() {
 			return {
+				largeMode: getApp().globalData.largeMode || false,
 				title: this.translateSys('add2'),
 				btnName: "",
 				param: {},
@@ -106,7 +114,7 @@
 			if (e.index == 0) {
 				const $this = this
 				uni.scanCode({
-					scanType: ["qrCode"],
+					scanType: ["qrCode", 'barCode'],
 					success: function(res) {
 
 						if ($this.focusFieldId) {
@@ -178,12 +186,20 @@
 			this.title = this.param.Add_BtnName ? this.param.Add_BtnName : options
 				.titlename; //璁剧疆鎸夐挳鏂囧瓧
 			this.btnName = this.param.Add_BtnName || ""
-			this.loadData(options.paramValue)
+			const paramValue = options.paramValue ? JSON.parse(options.paramValue) : undefined
+			this.loadData(paramValue)
 		},
 		computed: {
 			dropdownBtns() {
 				const btns = this.head_styledef.button || [];
 				return btns
+			},
+			initialEvent() {
+				let event = (this.head_styledef.event || []).find((e) => e.event_id == "initial");
+				return {
+					id: event?.scrip_id || "",
+					name: event?.scrip_name || "",
+				};
 			},
 		},
 
@@ -211,35 +227,57 @@
 				});
 			},
 			async loadData(paramValue) {
+				try {
+					showLoading("loading...")
+					//鑾峰彇鏁版嵁绫荤殑鑷畾涔夎〃鍗曞弬鏁�+					await this.Head_UIStyleGetInfo(this.param.DataCls?.id, this.param.UI_Style?.ID);
+					//浼犲叆鍙傛暟鍊�+					if (paramValue) {
 
-				//鑾峰彇鏁版嵁绫荤殑鑷畾涔夎〃鍗曞弬鏁�-				await this.Head_UIStyleGetInfo(this.param.DataCls?.id, this.param.UI_Style?.ID);
-				//浼犲叆鍙傛暟鍊�-				if (paramValue) {
-					const attrs = paramValue.attrs || [];
-					(this.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;
-										}
-									});
-								}
-							});
-						}
-					})
+						this.setFormValues(paramValue)
+					}
+					await this.loadInitialEvent();
+					hideLoading()
+				} catch (ex) {
+					hideLoading()
+					showError(ex, this.translateSys("error"));
 				}
 
+			},
+			async loadInitialEvent() {
+				try {
+					var eventid = this.initialEvent?.id; //鍐呭鍙樺寲鍚庝簨浠�+					if (eventid) {
+						// self.event_no_sub = 1;
+						let obj_attr = this.head_styledef.form.model;
+						let req = {
+							id: "",
+							attrs: Object.keys(obj_attr).map((a) => ({
+								attr: a,
+								value: obj_attr[a],
+							})),
+						};
 
+						var info = {
+							eventid: eventid,
+							edtype: "0",
+							projectid: '',
+							rclsid: '',
+							robjid: '',
+							userlogin: '',
+							clsid: this.param.DataCls.id,
+							objid: "",
+							attr: req,
+							dataJson: []
+						}
+						this.DataObjRunCustomEvent(info);
+					}
+
+				} catch (ex) {
+					showError(ex, this.translateSys("error"))
+
+
+				}
 			},
 			async Head_UIStyleGetInfo(class_id, style_id) { //鑾峰彇鑷畾涔夎〃鍗曟牱寮� 				var $this = this;
@@ -275,7 +313,7 @@
 										if (itemName) {
 											styledefHead.form.model[ele.fieldId] = itemName;
 										}
-										ele.dict = selections.map((a) => {
+										ele.selections = selections.map((a) => {
 											return {
 												value: a.value,
 												text: a.label
@@ -311,7 +349,7 @@
 													styledefHead.form
 														.model[col.fieldId] = itemName;
 												}
-												col.dict = selections.map((a) => {
+												col.selections = selections.map((a) => {
 													return {
 														value: a.value,
 														text: a.label
@@ -333,6 +371,25 @@
 								}
 							}
 						}
+						const app = getApp()
+						if (app.globalData.bindClasses) {
+							styledefHead.form.items.push({
+								name: "Input",
+								label: this.translate("classes"),
+								labelWidth: 100,
+								disabled: true,
+								value: app.globalData.classes,
+								setting: {
+									width: 100,
+									height: 50,
+								},
+								bind: {
+									attr: "",
+								},
+								fieldId: "S_CLASSES",
+							})
+							styledefHead.form.model["S_CLASSES"] = app.globalData.classes
+						}
 
 					}
 					$this.setData({
@@ -352,17 +409,7 @@
 					}
 				} catch (ex) {
 					// console.log(ex);
-					console.log(JSON.stringify(ex), 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.1",
-						content: tip,
-						showCancel: false,
-						confirmText: this.translateSys('close')
-					});
+					showError(ex, this.translateSys("error") + " 1.1")
 				}
 			},
 			async DictGetInfo(dict, formModel, formItem) { //Mobox3寰楀埌寰楀埌瀛楀吀淇℃伅瀛楀吀椤瑰垪琛�@@ -391,18 +438,7 @@
 					}
 					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: tip,
-						showCancel: false,
-						confirmText: this.translateSys('close')
-					});
+					showError(ex, this.translateSys("error") + " 1.3")
 
 
 				}
@@ -420,78 +456,72 @@
 					};
 					console.log(dataInfo);
 					var data = await runCustomEvent(dataInfo)
-					if (data.ret != 0) {
-						var tip = data.err_info ? typeof data.err_info == 'string' ? data
-							.err_info : data
-							.err_info.join('<br/>') : '';
+					if (data.ret != 0 && data.ret != 1) {
+						let cls_name = data.event_info?.cls_name
+						let event_name = data.event_info?.event_name
+						tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data.err_info.join(
+							'\n') : ''
 						if (data.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('close')
-							});
-						} else uni.showModal({
-							title: this.translateSys("tip"),
-							content: tip + ',' + this.translateSys('tip') + ':' + data
-								.ret,
-							showCancel: false,
-							confirmText: this.translateSys('close')
-						});
+						}
+						if (cls_name && event_name) tip = `鎵ц鈥�{cls_name}鈥濇暟鎹被鐨勨�${event_name}鈥濊剼鏈椂杩斿洖閿欒锛�{tip}`
+						if (data.ret == 801) showInfo(tip)
+						else showError(`${tip}锛屾彁绀猴細${data.ret}`, this.translateSys('tip'))
+						this.saving = false
 						return false
 					} else {
-						var tip = data.info ? typeof data.info == 'string' ? data.info : data
-							.info
-							.join(
-								'<br/>') : '';
-						if (tip) uni.showModal({
-							title: this.translateSys("tip"),
-							content: tip,
-							showCancel: false,
-							confirmText: this.translateSys('close')
-						});
+						var tip = data.info ? typeof data.info == 'string' ? data.info :
+							data.info.join('\n') : '';
+						tip = tip || data.err_info
+						let time = data.info_time || 0
+						if (time)
+							showError(tip, this.translateSys('tip'))
+						else
+							showInfo(tip)
+						if ([0, 2, 3, 4, -1].includes(data.result_type)) {
 
-						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') {
-									var result = action.value;
-									$this.setFormValues(result)
-								} else if (action.action_type == 'set_dlg_attr_show') {
-									var result = action.value;
-									$this.hideFormItems(result)
-									// console.log($this.head_styledef);
-								} else if (action.action_type ==
-									"set_dlg_current_edit_attr"
-								) {
-									if ($this
-										.focusOldFieldId ==
-										action.value) {
-										$this.setData({
-											focusFieldId: ""
-										})
+							if (data.result_type == 2) {
+
+							} else if (typeof data.result == 'string') {
+								if (data.result) {
+									showInfo(data.result)
+								}
+							}
+							try {
+								var actionlist = data.action || []
+								for (var i = 0; i < actionlist.length; i++) {
+									var action = actionlist[i];
+									if (action.action_type == 'set_dlg_attr') {
+										var result = action.value;
+										$this.setFormValues(result)
+									} else if (action.action_type == 'set_dlg_attr_show') {
+										var result = action.value;
+										$this.hideFormItems(result)
+										// console.log($this.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 {
-										$this.setData({
-											focusFieldId: $this
-												.focusOldFieldId
-										})
-									}
-									$this.$nextTick(() => {
-										$this.setData({
-											focusFieldId: action
-												.value
-										})
-									});
-								} else {
-									uni.showModal({
-										title: this.translateSys("tip"),
-										content: this.translate(
+										showInfo(this.translate(
 												'execute_init_event_failed') +
 											this.translateSys("full_stop") +
 											this.translate('reason') + this
@@ -501,77 +531,34 @@
 											action
 											.action_type + this.translateSys(
 												"quotation_mark_right") + this
-											.translate('tip_action_unprocessed'),
-										showCancel: false,
-										confirmText: this.translateSys('close')
-									});
+											.translate('tip_action_unprocessed'))
+
+									}
 								}
+
+							} catch (ex) {
+								let actionList = (data.action || []).map(a => a.action_type).join(';')
+								let tip = typeof ex == 'string' ? ex : ex.message
+								tip = `鎵ц鑴氭湰杩斿洖鐨�{actionList}鏃跺嚭鐜板紓甯革紝璇锋鏌ヨ剼鏈繑鍥炵殑鏁版嵁鏍煎紡鏄惁姝g‘銆�{tip}`
+								showError(tip, this.translateSys('tip'))
+								return
 							}
 						}
 					}
 				} 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") + "3",
-						content: this.translate('execute_init_event_failed') +
-							this.translateSys("full_stop") +
-							this.translate('reason') + this.translateSys("colon") + tip,
-						showCancel: false,
-						confirmText: this.translateSys('close')
-					});
+					showError(ex, this.translateSys("error") + " 3")
+
 				}
 			},
 
 
 			ontap(item) { //鎵爜鍔熻兘
-				// console.log("ontap",item);
-				// 鎵撳紑钃濈墮閫傞厤鍣�-				// uni.openBluetoothAdapter({
-				//   success: function() {
-				// 	// 寮�鎼滅储钃濈墮璁惧
-				// 	uni.startBluetoothDevicesDiscovery({
-				// 	  success: function() {
-				// 		// 鐩戝惉鎵惧埌鏂拌澶囩殑浜嬩欢
-				// 		uni.onBluetoothDeviceFound(function(devices) {
-				// 		  // 杩欓噷鍙互杩囨护鍑篟FID鑺墖锛岃繛鎺ュ苟璇诲彇鏁版嵁
-				// 		  console.log(devices[0].deviceId);
-				// 		})
-				// 	  }
-				// 	})
-				//   }
-				// });
-				// 鐩戝惉NFC鍔熻兘鏄惁鍙敤
-				// uni.getNFCAdapterState({
-				//   success: function(res) {
-				// 	console.log(res);
-				//     if (res.errCode === 0) {
-				//       // NFC鍔熻兘鍙敤锛屽紑濮嬬洃鍚�-				//       uni.onNFCStart((res) => {
-				//         if (res.errCode === 0) {
-				//           // 寮�NFC鏍囩妫�祴
-				//           uni.makeNFCReaderStart({
-				//             success: function() {
-				//               // 鐩戝惉NFC鏍囩
-				//               uni.onNFCTagDiscovered(function(res) {
-				// 										  console.log(res);
-				//                 // 杩欓噷鍙互澶勭悊NFC鏍囩鏁版嵁
-				//               })
-				//             }
-				//           })
-				//         }
-				//       })
-				//     }
-				//   }
-				// })
+
 				this.focusOldFieldId = item.fieldId
 				getApp().onScan((result) => {
 					console.log(result);
 					// uni.hideKeyboard();
-					this.onScanValue(item, result.decodedata)
+					this.onScanValue(item, result)
 				})
 			},
 			onScanValue(item, value) {
@@ -670,7 +657,18 @@
 			},
 			onClick(item) {
 				// console.log("onClick",item);
-				this.focusFieldId = item.fieldId
+				if (item.name == "Input" || item.name == "InputNumber" || item.name == "Textarea") {
+					this.focusFieldId = item.fieldId
+				} else if (item.name == "ImageButton") {
+					
+					var onClickEvent = item.bind.onClickEvent; //鍚庡浘鏍囩偣鍑诲洖璋�+					
+					if (!onClickEvent.id) {
+						showInfo(this.translate('icon_click_event_empty'))
+						return;
+					}
+					this.onChange(onClickEvent);
+				}
 			},
 			onEnterChange(item) {
 				let newVal = item.value
@@ -722,34 +720,299 @@
 				}
 
 			},
+			async onFormEventResult(data, callbackEventId, item) {
+				try {
+					const $this = this
+					var enviroment = {
+						'function': '3000', // 鍔熻兘鐐圭紪鍙�+						cls_id: $this.param.DataCls.id, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�+						'button': 'top', // top/bottom
+						button_name: $this.translateSys('add2'),
+						master: {
+							cls_id: $this.param.DataCls.id, // button=bottom鏃�master鐨刢ls_id
+							//obj_id: ''  // button=bottom鏃�master鐨刼bj_id
+						}
+					};
+					if (data.ret != 0 && data.ret != 1) {
 
+						let cls_name = data.event_info?.cls_name
+						let event_name = data.event_info?.event_name
+						tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data
+							.err_info
+							.join('\n') : ''
+						if (data.ret == 801) {
+							if (this.param.Only_Script_Error) {
+								let pos = tip.indexOf("锛�);
+								if (pos > -1) tip = tip.substring(pos + 1);
+							}
+						}
+						if (cls_name && event_name) tip =
+							`鎵ц鈥�{cls_name}鈥濇暟鎹被鐨勨�${event_name}鈥濊剼鏈椂杩斿洖閿欒锛�{tip}`
+						if (data.ret == 801) showInfo(tip)
+						else showError(`${tip}锛屾彁绀猴細${data.ret}`, this.translateSys('tip'))
+						this.saving = false
+						return false
+					} else {
+						var tip = data.info ? typeof data.info == 'string' ? data.info :
+							data.info.join('\n') : '';
+						tip = tip || data.err_info
+						let time = data.info_time || 0
+						if (time)
+							showError(tip, this.translateSys('tip'))
+						else
+							showInfo(tip)
+						if ([0, 2, 3, 4, -1].includes(data.result_type)) {
+							if (data.result_type == 2) {
+								$this.setFormValues(data.result || [])
+							} else if (typeof data.result == 'string') {
+								if (data.result) {
+									showInfo(data.result)
+								}
+							}
+							try {
+								var actionlist = data.action || []
+								var enviroment = JSON.stringify(enviroment);
+								for (var i = 0; i < actionlist.length; i++) {
+									var action = actionlist[i];
+									if (action.action_type == 'set_dlg_attr') {
+										var result = action.value;
+										$this.setFormValues(result)
+									} else if (action.action_type == 'set_dlg_attr_show') {
+										var result = action.value;
+										$this.hideFormItems(result)
+										// console.log($this.head_styledef);
+									} else if (action.action_type == 'set_global_attr') {
+										$this.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 if (action.action_type == 'open_panel') {
+										var d = dialog({
+											title: '<i class="ace-icon fa fa-info-circle"></i> ' +
+												$this.translateSys("tip"),
+											content: $this.translateSys(
+													"quotation_mark_left") +
+												action.action_type + $this
+												.translateSys(
+													"quotation_mark_right") +
+												$this.translate(
+													"tip_action_unprocessed")
+										});
+										d.show();
+									} else if (action.action_type ==
+										'open_select_userdlg') {
+										var style = val.style;
+										// style == 'user' ? '閫夋嫨浜哄憳' : style == 'department' ? '閫夋嫨閮ㄩ棬' : style == 'role' ? '閫夋嫨瑙掕壊' : ''
+										var param = {
+											item: item,
+											button_callback: button_callback,
+											req: req,
+											data_attr: data_attr
+										}
+										uni.navigateTo({
+											url: '../selpsn/index?mulit=false&param=' +
+												JSON
+												.stringify(
+													param),
+											events: {
+												AddPer(data, param) {
+													// console.log(param);
+													console.log(data);
+													var callback_eventid = param
+														.button_callback
+														.trim();
+													var info = {
+														eventid: callback_eventid,
+														edtype: "0",
+														projectid: '',
+														rclsid: '',
+														robjid: '',
+														userlogin: '',
+														clsid: $this.param
+															.DataCls
+															.id,
+														objid: "",
+														attr: param.req,
+														inputparameter: data,
+														dataJson: [],
+													}
+													$this.DataObjRunCustomEvent(
+														info,
+														param
+														.data_attr);
+												}
+											}
+										});
+									} else if (action.action_type ==
+										'open_data_query_dlg') {
+										var d = dialog({
+											title: '<i class="ace-icon fa fa-info-circle"></i> ' +
+												$this.translateSys("tip"),
+											content: $this.translateSys(
+													"quotation_mark_left") +
+												action
+												.action_type + $this.translateSys(
+													"quotation_mark_right") + $this
+												.translate(
+													"tip_action_unprocessed")
+										});
+										d.show();
+									} else if (action.action_type == 'open_common_dlg') {
+
+										if (val.common_dlg_id == 'check_list') {
+
+											$this.setData({
+												check_list: val.config
+											})
+											if (val.config.appear_style ==
+												'sideslip') //鍒ゆ柇鏄惁鏄晶婊�+												$this.setData({
+													popupType: "right"
+												})
+											else
+												$this.setData({
+													popupType: "center"
+												})
+											// open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴�
+											$this.$refs.popup.open($this.popupType);
+											var popupParam = {
+												item: item,
+												button_callback: button_callback,
+												req: req,
+												data_attr: data_attr
+											}
+											$this.setData({
+												popupParam: popupParam
+											})
+										}
+									} else if (action.action_type ==
+										'open_project_query_dlg') {
+										//console.log(action.value.select_range);
+										//console.log(action.value.mulit_select);
+										var priRel = '-1';
+										if (action.value.select_range == '鍏ㄩ儴鐩稿叧')
+											priRel = '0';
+										else if (action.value.select_range == '鎴戣礋璐g殑椤圭洰')
+											priRel = '1';
+										else if (action.value.select_range == '鎴戝垱寤虹殑')
+											priRel = '2';
+										else if (action.value.select_range == '鎴戝弬涓庣殑' ||
+											action
+											.value
+											.select_range == '鎴戝弬鍔犵殑')
+											priRel = '3';
+										else if (action.value.select_range == '鎴戝叧娉ㄧ殑')
+											priRel = '4';
+										else if (action.value.select_range == '鎴戜笅灞炵殑椤圭洰')
+											priRel = '5';
+										var param_ = {
+											item: item,
+											button_callback: button_callback,
+											req: req
+										}
+										uni.navigateTo({
+											url: '../selPrj/index?relation=' +
+												priRel +
+												'&param=' +
+												JSON.stringify(param_),
+											events: {
+												AddPer(data, param) {
+													var attr = param.item.fieldId;
+													$this.head_styledef.form.model[
+															attr] =
+														data[0].ID +
+														';' + data[0].Name;
+
+													// $this.classAttrList[param.index].Attr[param.iindex].Value=data[0].Name;
+													// $this.classAttrList[param.index].Attr[param.iindex].ValID=data[0].ID+';'+data[0].Name;
+													var callback_eventid = param
+														.button_callback
+														.trim();
+													if (callback_eventid) {
+														var info = {
+															eventid: callback_eventid,
+															edtype: "2",
+															projectid: data[0]
+																.ID,
+															rclsid: "",
+															robjid: "",
+															userlogin: "",
+															clsid: $this.$data
+																.param
+																.DataCls.id,
+															objid: "",
+															attr: param.req,
+															dataJson: [],
+														}
+
+														$this
+															.DataObjRunCustomEvent(
+																info);
+													}
+												}
+											}
+										});
+									} else {
+										showInfo(this.translateSys(
+												"quotation_mark_left") +
+											action
+											.action_type + this.translateSys(
+												"quotation_mark_right") + this
+											.translate(
+												"tip_action_unprocessed"))
+
+									}
+								}
+							} catch (ex) {
+								let actionList = (data.action || []).map(a => a.action_type).join(';')
+								let tip = typeof ex == 'string' ? ex : ex.message
+								tip = `鎵ц鑴氭湰杩斿洖鐨�{actionList}鏃跺嚭鐜板紓甯革紝璇锋鏌ヨ剼鏈繑鍥炵殑鏁版嵁鏍煎紡鏄惁姝g‘銆�{tip}`
+								showError(tip, this.translateSys('tip'))
+								return
+							}
+
+						}
+					}
+
+				} catch (ex) {
+					showError(ex, this.translateSys("error") + "10.1")
+				}
+			},
 			classAttr_extButton(item) {
 				var onSuffixClickCallbackEvent = item.bind.onSuffixClickCallbackEvent; //鍚庡浘鏍囩偣鍑讳簨浠� 				var onSuffixClickEvent = item.bind.onSuffixClickEvent; //鍚庡浘鏍囩偣鍑诲洖璋� 
 				if (!onSuffixClickCallbackEvent.id) {
-					uni.showModal({
-						title: this.translateSys("tip"),
-						content: this.translate('icon_click_callback_empty'),
-						showCancel: false,
-						confirmText: this.translateSys('close')
-					});
+					showInfo(this.translate('icon_click_callback_empty'))
+
 					return;
 				}
 				if (!onSuffixClickEvent.id) {
-					uni.showModal({
-						title: this.translateSys("tip"),
-						content: this.translate('icon_click_event_empty'),
-						showCancel: false,
-						confirmText: this.translateSys('close')
-					});
+					showInfo(this.translate('icon_click_event_empty'))
+
 					return;
 				}
 				this.popupType = 'right'
 				// open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴�
 				this.$refs.popup.open(this.popupType);
 
-				this.dataObjRunCustomEvent_Return(onSuffixClickEvent.id, '', onSuffixClickCallbackEvent.id,
+				this.dataObjRunCustomEvent_Return(onSuffixClickEvent.id, onSuffixClickCallbackEvent
+					.id,
 					item);
 			},
 			popupChange(e) {
@@ -790,21 +1053,13 @@
 					}
 				}
 				if (!$this.popupParam) {
-					uni.showModal({
-						title: this.translateSys("tip"),
-						content: "popupParam涓虹┖锛�,
-						showCancel: false,
-						confirmText: this.translateSys('close')
-					});
+					showInfo("popupParam涓虹┖锛�)
+
 					return;
 				}
 				if (data.length == 0) {
-					uni.showModal({
-						title: this.translateSys("tip"),
-						content: this.translate("tip_no_select_data"),
-						showCancel: false,
-						confirmText: this.translateSys('close')
-					});
+					showInfo(this.translate("tip_no_select_data"))
+
 					return;
 				}
 				var callback_eventid = $this.popupParam.button_callback.trim();
@@ -825,182 +1080,88 @@
 			},
 
 			async DataObjRunCustomEvent(info, data_attr) {
-				var $this = this;
-				var enviroment = {
-					'function': '3000', // 鍔熻兘鐐圭紪鍙�-					cls_id: this.param.DataCls.id, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�-					'button': 'top', // top/bottom
-					button_name: this.translateSys('add2'),
-					master: {
-						cls_id: this.param.DataCls.id, // button=bottom鏃�master鐨刢ls_id
-						//obj_id: ''  // button=bottom鏃�master鐨刼bj_id
-					}
-				};
-				if (data_attr) {
-					enviroment.edit_dlg = {
-						type: 'small', //灏忕獥鍙�-						class_id: this.param.DataCls.id, //褰撳墠鏁版嵁绫籭d
-					}
+				try {
+					var $this = this;
+					if (!info.eventid)
+						return
+					showLoading("loading...")
+					var enviroment = {
+						'function': '3000', // 鍔熻兘鐐圭紪鍙�+						cls_id: this.param.DataCls.id, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�+						'button': 'top', // top/bottom
+						button_name: this.translateSys('add2'),
+						master: {
+							cls_id: this.param.DataCls.id, // button=bottom鏃�master鐨刢ls_id
+							//obj_id: ''  // button=bottom鏃�master鐨刼bj_id
+						}
+					};
 					if (data_attr) {
-						enviroment.edit_dlg.form_control = { //鎵�睘鐨勮〃鍗曟帶浠�-							name: data_attr.Name, //瀛楁灞炴�
-							text: data_attr.DispName, //鏄剧ず鏂囨湰
-							group_name: data_attr.GroupName, //灞炴�缁�-							type: data_attr.Type, //瀛楁绫诲瀷
-							readonly: data_attr.ReadOnly, //鏄惁鍙
-							button_img: data_attr.button_img, //寮曠敤鎸夐挳鐨勫浘鏍�-							button_tooltip: data_attr.button_tooltip //寮曠敤鎸夐挳鐨則ooltip
+						enviroment.edit_dlg = {
+							type: 'small', //灏忕獥鍙�+							class_id: this.param.DataCls.id, //褰撳墠鏁版嵁绫籭d
+						}
+						if (data_attr) {
+							enviroment.edit_dlg.form_control = { //鎵�睘鐨勮〃鍗曟帶浠�+								name: data_attr.Name, //瀛楁灞炴�
+								text: data_attr.DispName, //鏄剧ず鏂囨湰
+								group_name: data_attr.GroupName, //灞炴�缁�+								type: data_attr.Type, //瀛楁绫诲瀷
+								readonly: data_attr.ReadOnly, //鏄惁鍙
+								button_img: data_attr.button_img, //寮曠敤鎸夐挳鐨勫浘鏍�+								button_tooltip: data_attr.button_tooltip //寮曠敤鎸夐挳鐨則ooltip
+							}
 						}
 					}
+					enviroment = Base64.encode(JSON.stringify(enviroment)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
+					var input_param = Base64.encode(JSON.stringify(info.attr)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
+					var global_attr = Base64.encode(JSON.stringify(this
+						.global_attr)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
+					if (info.dataJson)
+						info.dataJson = Base64.encode(JSON.stringify(info.dataJson)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
+					var obj_attr = {};
+					info.attr.forEach(item => {
+						obj_attr[item.attr] = item.value;
+					});
+					if (!info.eventid.includes('{')) info.eventid = '{' + info.eventid + '}';
+					var dataInfo = {
+						ed_type: info.edtype,
+						start_transaction: true,
+						class_id: info.clsid,
+						class_name: '',
+						event_id: info.eventid,
+						event_name: '',
+						data_obj_id: info.objid,
+						obj_attr: obj_attr,
+						prj_id: info.projectid,
+						ref_cls_id: info.rclsid,
+						rel_obj_id: info.robjid,
+						user_login: info.userlogin,
+						data_json: info.dataJson,
+						compose_info: '',
+						ext_info: enviroment,
+						global_attr: global_attr,
+						input_param: input_param,
+					};
+					console.log(dataInfo);
+					// return;
+					runCustomEvent(dataInfo).then(data => {
+						hideLoading()
+						$this.onFormEventResult(data, "")
+
+					}).catch(ex => {
+						// console.log(ex);
+						showError(ex, this.translateSys("error") + " 3.1")
+
+					});
+				} catch (ex) {
+					hideLoading()
+					showError(ex, this.translateSys("error"));
 				}
 
-				// var dataInfo = {
-				//     edtype: info.edtype, eventid: info.eventid, projectid: info.projectid.replace('{','').replace('}',''),
-				//     rclsid: info.rclsid, robjid: info.robjid, userlogin: info.userlogin, clsid: info.clsid, objid: info.objid,
-				//     attr: JSON.stringify(info.attr), extinfo: JSON.stringify(enviroment), inputparameter: "",
-				// 	global_attr: JSON.stringify(this.global_attr), dataJson:JSON.stringify(info.dataJson)
-				// }
-				enviroment = Base64.encode(JSON.stringify(enviroment)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
-				var input_param = Base64.encode(JSON.stringify(info.attr)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
-				var global_attr = Base64.encode(JSON.stringify(this.global_attr)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
-				if (info.dataJson)
-					info.dataJson = Base64.encode(JSON.stringify(info.dataJson)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
-				var obj_attr = {};
-				info.attr.forEach(item => {
-					obj_attr[item.attr] = item.value;
-				});
-				if (!info.eventid.includes('{')) info.eventid = '{' + info.eventid + '}';
-				var dataInfo = {
-					ed_type: info.edtype,
-					start_transaction: true,
-					class_id: info.clsid,
-					class_name: '',
-					event_id: info.eventid,
-					event_name: '',
-					data_obj_id: info.objid,
-					obj_attr: obj_attr,
-					prj_id: info.projectid,
-					ref_cls_id: info.rclsid,
-					rel_obj_id: info.robjid,
-					user_login: info.userlogin,
-					data_json: info.dataJson,
-					compose_info: '',
-					ext_info: enviroment,
-					global_attr: global_attr,
-					input_param: input_param,
-				};
-				console.log(dataInfo);
-				// return;
-				runCustomEvent(dataInfo).then(data => {
-					if (data.ret != 0) {
-						var tip = data.err_info ? typeof data.err_info == 'string' ? data
-							.err_info :
-							data
-							.err_info.join('<br/>') : '';
-						if (data.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('close')
-							});
-						} else uni.showModal({
-							title: this.translateSys("tip"),
-							content: tip + ',' + this.translateSys('tip') + ':' + data
-								.ret,
-							showCancel: false,
-							confirmText: this.translateSys('close')
-						});
-						return false
-					} else {
-						var tip = data.info ? typeof data.info == 'string' ? data.info : data
-							.info
-							.join(
-								'<br/>') : '';
-						if (tip) uni.showModal({
-							title: this.translateSys("tip"),
-							content: tip,
-							showCancel: false,
-							confirmText: this.translateSys('close')
-						});
-
-						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') {
-									var result = action.value;
-									$this.setFormValues(result)
-								} else if (action.action_type == 'set_dlg_attr_show') {
-									var result = action.value;
-									$this.hideFormItems(result)
-									// console.log($this.head_styledef);
-								} else if (action.action_type == 'set_global_attr') {
-									$this.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"),
-										content: this.translateSys(
-												"quotation_mark_left") +
-											action
-											.action_type + this.translateSys(
-												"quotation_mark_right") + this
-											.translate(
-												"tip_action_unprocessed"),
-										showCancel: false,
-										confirmText: this.translateSys('close')
-									});
-								}
-							}
-						}
-						// var head_styledef = JSON.parse(JSON.stringify($this.head_styledef));
-						// $this.head_styledef=[];
-						// $this.head_styledef = head_styledef;
-						console.log($this.head_styledef);
-
-						if (data.result) {
-							$this.setFormValues(data.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("error") + "3.1",
-						content: exStr,
-						showCancel: false,
-						confirmText: this.translateSys('close')
-					});
-				});
 			},
-			dataObjRunCustomEvent_Return(eventid, data_attr, button_callback, item) {
+			dataObjRunCustomEvent_Return(eventid, button_callback, item) {
 				const $this = this
+				showLoading("loading...")
 				var enviroment = {
 					'function': '3000', // 鍔熻兘鐐圭紪鍙� 					cls_id: $this.param.DataCls.id, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�@@ -1024,7 +1185,8 @@
 					class_id: $this.param.DataCls.id, //褰撳墠鏁版嵁绫籭d
 				}
 				extinfo = Base64.encode(JSON.stringify(extinfo)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
-				var global_attr = Base64.encode(JSON.stringify($this.global_attr)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
+				var global_attr = Base64.encode(JSON.stringify($this
+					.global_attr)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
 				var obj_attr = {};
 				req.forEach(item2 => {
 					obj_attr[item2.attr] = item2.value;
@@ -1061,245 +1223,14 @@
 				console.log(dataInfo);
 				// return;
 				runCustomEvent(dataInfo).then(data => {
-					if (data.ret != 0) {
-						var tip = data.err_info ? typeof data.err_info == 'string' ? data
-							.err_info :
-							data
-							.err_info.join('<br/>') : '';
-						if (data.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('close')
-							});
-						} else uni.showModal({
-							title: $this.translateSys("tip"),
-							content: tip + ',' + $this.translateSys('tip') + ':' + data
-								.ret,
-							showCancel: false,
-							confirmText: $this.translateSys('close')
-						});
-						return false
-					} else {
-						var tip = data.info ? typeof data.info == 'string' ? data.info : data
-							.info
-							.join(
-								'<br/>') : '';
-						if (tip) uni.showModal({
-							title: $this.translateSys("tip"),
-							content: tip,
-							showCancel: false,
-							confirmText: $this.translateSys('close')
-						});
-
-						if (data != "") {
-							var actions = data.action;
-							if (actions) {
-								for (var i = 0; i < actions.length; i++) {
-									var action = actions[i];
-									console.log(action)
-									var val = action.value;
-									var enviroment = JSON.stringify(enviroment);
-
-									if (action.action_type == 'open_panel') {
-										var d = dialog({
-											title: '<i class="ace-icon fa fa-info-circle"></i> ' +
-												$this.translateSys("tip"),
-											content: $this.translateSys("quotation_mark_left") +
-												action.action_type + $this.translateSys(
-													"quotation_mark_right") +
-												$this.translate("tip_action_unprocessed")
-										});
-										d.show();
-									} else if (action.action_type == 'open_select_userdlg') {
-										var style = val.style;
-										// style == 'user' ? '閫夋嫨浜哄憳' : style == 'department' ? '閫夋嫨閮ㄩ棬' : style == 'role' ? '閫夋嫨瑙掕壊' : ''
-										var param = {
-											item: item,
-											button_callback: button_callback,
-											req: req,
-											data_attr: data_attr
-										}
-										uni.navigateTo({
-											url: '../selpsn/index?mulit=false&param=' +
-												JSON
-												.stringify(
-													param),
-											events: {
-												AddPer(data, param) {
-													// console.log(param);
-													console.log(data);
-													var callback_eventid = param
-														.button_callback
-														.trim();
-													var info = {
-														eventid: callback_eventid,
-														edtype: "0",
-														projectid: '',
-														rclsid: '',
-														robjid: '',
-														userlogin: '',
-														clsid: $this.param
-															.DataCls
-															.id,
-														objid: "",
-														attr: param.req,
-														inputparameter: data,
-														dataJson: [],
-													}
-													$this.DataObjRunCustomEvent(info,
-														param
-														.data_attr);
-												}
-											}
-										});
-									} else if (action.action_type == 'open_data_query_dlg') {
-										var d = dialog({
-											title: '<i class="ace-icon fa fa-info-circle"></i> ' +
-												$this.translateSys("tip"),
-											content: $this.translateSys(
-													"quotation_mark_left") +
-												action
-												.action_type + $this.translateSys(
-													"quotation_mark_right") + $this
-												.translate(
-													"tip_action_unprocessed")
-										});
-										d.show();
-									} else if (action.action_type == 'open_common_dlg') {
-
-										if (val.common_dlg_id == 'check_list') {
-
-											$this.setData({
-												check_list: val.config
-											})
-											if (val.config.appear_style == 'sideslip') //鍒ゆ柇鏄惁鏄晶婊�-												$this.setData({
-													popupType: "right"
-												})
-											else
-												$this.setData({
-													popupType: "center"
-												})
-											// open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴�
-											$this.$refs.popup.open($this.popupType);
-											var popupParam = {
-												item: item,
-												button_callback: button_callback,
-												req: req,
-												data_attr: data_attr
-											}
-											$this.setData({
-												popupParam: popupParam
-											})
-										}
-									} else if (action.action_type == 'open_project_query_dlg') {
-										//console.log(action.value.select_range);
-										//console.log(action.value.mulit_select);
-										var priRel = '-1';
-										if (action.value.select_range == '鍏ㄩ儴鐩稿叧')
-											priRel = '0';
-										else if (action.value.select_range == '鎴戣礋璐g殑椤圭洰')
-											priRel = '1';
-										else if (action.value.select_range == '鎴戝垱寤虹殑')
-											priRel = '2';
-										else if (action.value.select_range == '鎴戝弬涓庣殑' || action
-											.value
-											.select_range == '鎴戝弬鍔犵殑')
-											priRel = '3';
-										else if (action.value.select_range == '鎴戝叧娉ㄧ殑')
-											priRel = '4';
-										else if (action.value.select_range == '鎴戜笅灞炵殑椤圭洰')
-											priRel = '5';
-										var param_ = {
-											item: item,
-											button_callback: button_callback,
-											req: req
-										}
-										uni.navigateTo({
-											url: '../selPrj/index?relation=' + priRel +
-												'&param=' +
-												JSON.stringify(param_),
-											events: {
-												AddPer(data, param) {
-													var attr = param.item.fieldId;
-													$this.head_styledef.form.model[
-															attr] =
-														data[0].ID +
-														';' + data[0].Name;
-
-													// $this.classAttrList[param.index].Attr[param.iindex].Value=data[0].Name;
-													// $this.classAttrList[param.index].Attr[param.iindex].ValID=data[0].ID+';'+data[0].Name;
-													var callback_eventid = param
-														.button_callback
-														.trim();
-													if (callback_eventid) {
-														var info = {
-															eventid: callback_eventid,
-															edtype: "2",
-															projectid: data[0].ID,
-															rclsid: "",
-															robjid: "",
-															userlogin: "",
-															clsid: $this.$data
-																.param
-																.DataCls.id,
-															objid: "",
-															attr: param.req,
-															dataJson: [],
-														}
-
-														$this.DataObjRunCustomEvent(
-															info);
-													}
-												}
-											}
-										});
-									} else {
-										uni.showModal({
-											title: $this.translateSys("tip"),
-											content: $this.translateSys(
-													"quotation_mark_left") +
-												action.action_type + $this.translateSys(
-													"quotation_mark_right") + $this
-												.translate(
-													"tip_action_unprocessed"),
-											showCancel: false,
-											confirmText: $this.translateSys('close')
-										});
-									}
-								}
-							}
-						} else {
-							uni.showModal({
-								title: $this.translateSys('tip') + "5.2",
-								content: $this.translateSys("quotation_mark_left") +
-									"before_click_button" + $this.translateSys(
-										"quotation_mark_right") + $this.translateSys(
-										"comma") + 'event_id' + eventid,
-								showCancel: false,
-								confirmText: $this.translateSys('close')
-							});
-						}
-					}
+					hideLoading()
+					$this.onFormEventResult(data, button_callback, item)
 
 				}).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') + "5.1",
-						content: exStr,
-						showCancel: false,
-						confirmText: $this.translateSys('close')
-					});
+					hideLoading()
+					showError(ex, this.translateSys("error") + " 5.1")
+
 				});
 			},
 
@@ -1356,121 +1287,117 @@
 				dataObjCreate(dataInfo).then(res => {
 					uni.hideLoading();
 					let data = res.lua_result
-					if (data.ret != 0) {
-						var tip = data.err_info ? typeof data.err_info == 'string' ? data
-							.err_info :
-							data
-							.err_info.join('<br/>') : '';
-						if (data.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('close')
-							});
-						} else uni.showModal({
-							title: this.translateSys("tip"),
-							content: tip + ',' + this.translateSys('tip') + ':' + data
-								.ret,
-							showCancel: false,
-							confirmText: this.translateSys('close')
-						});
-						this.saving = false
-						return false
-					} else {
-						var tip = data.info ? typeof data.info == 'string' ? data.info : data
-							.info
-							.join(
-								'<br/>') : '';
-						if (tip) uni.showModal({
-							title: this.translateSys("tip"),
-							content: tip,
-							showCancel: false,
-							confirmText: this.translateSys('close')
-						});
-						else {
-
-							uni.showToast({
-								title: this.translate('create_success'),
-								icon: "success",
-								duration: 3000
-							});
-						}
-
-
-						if (!this.param.After_Btn_Not_Refresh) {
-							//鍒锋柊
-							uni.redirectTo({
-								url: '../modal/3018_2?param=' + JSON.stringify(this.$data
-										.param) +
-									"&titlename=" + this.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
-											})
-										});
-									}
+					if (data) {
+						if (data.ret != 0 && data.ret != 1) {
+							let cls_name = data.event_info?.cls_name
+							let event_name = data.event_info?.event_name
+							tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data.err_info
+								.join('\n') : ''
+							if (data.ret == 801) {
+								if (this.param.Only_Script_Error) {
+									let pos = tip.indexOf("锛�);
+									if (pos > -1) tip = tip.substring(pos + 1);
 								}
 							}
+							if (cls_name && event_name) tip = `鎵ц鈥�{cls_name}鈥濇暟鎹被鐨勨�${event_name}鈥濊剼鏈椂杩斿洖閿欒锛�{tip}`
+							if (data.ret == 801) showInfo(tip)
+							else showError(`${tip}锛屾彁绀猴細${data.ret}`, this.translateSys('tip'))
+							this.saving = false
+							return false
+						} else {
+							var tip = data.info ? typeof data.info == 'string' ? data.info :
+								data.info.join('\n') : '';
+							tip = tip || data.err_info
+							if (tip) {
+								let time = data.info_time || 0
+								if (time)
+									showError(tip, this.translateSys('tip'))
+								elseshowInfo(tip)
+							} else {
+								showInfo(this.translate('create_success'));
+							}
+							if (!this.param.After_Btn_Not_Refresh) {
+								//鍒锋柊
+								uni.redirectTo({
+									url: '../modal/3018_2?param=' + JSON.stringify(this
+											.$data
+											.param) +
+										"&titlename=" + this.title
+								});
+							} else {
+								if ([0, 2, 3, 4, -1].includes(data.result_type)) {
+									if (data.result_type == 2) {
+										$this.setFormValues(data.result || [])
+									} else if (typeof data.result == 'string') {
+										if (data.result) {
+											showInfo(data.result)
 
+										}
+									}
+									try {
+										var actionlist = data.action || []
+										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
+													})
+												});
+											}
+										}
+
+									} catch (ex) {
+										let actionList = (data.action || []).map(a => a.action_type).join(';')
+										let tip = typeof ex == 'string' ? ex : ex.message
+										tip = `鎵ц鑴氭湰杩斿洖鐨�{actionList}鏃跺嚭鐜板紓甯革紝璇锋鏌ヨ剼鏈繑鍥炵殑鏁版嵁鏍煎紡鏄惁姝g‘銆�{tip}`
+										showError(tip, this.translateSys('tip'))
+										return
+									}
+								}
+
+							}
 						}
+						// this.class_attr_init();
 					}
-					// this.class_attr_init();
-
 					this.saving = false
 				}).catch(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: tip,
-						showCancel: false,
-						confirmText: this.translateSys('close')
-					});
+					showError(ex, this.translateSys("tip"))
+
+
 				});
 			},
 			setFormValues(data) {
 				const $this = this
 				const head_styledef = this.head_styledef
+				if (!Array.isArray(data)) {
+					return
+				}
 				for (var i = 0; i < data.length; i++) {
-					const attr = attr
+					const attr = data[i]
 					if (attr.choice_list) {
 						for (var c = 0; c < head_styledef.form.items.length; c++) {
 							const item = head_styledef.form.items[c];
@@ -1486,7 +1413,11 @@
 											"value": val
 										});
 									}
-									item.dict = dictItemList;
+									if (item.useDict) {
+										item.dict = dictItemList;
+									} else {
+										item.selections = dictItemList;
+									}
 								}
 							} else if (item.name == 'Layout') {
 								item.setting.colList.forEach(col => {
@@ -1502,7 +1433,11 @@
 													"value": val
 												});
 											}
-											col.dict = dictItemList;
+											if (col.useDict) {
+												col.dict = dictItemList;
+											} else {
+												col.selections = dictItemList;
+											}
 										}
 									}
 								});
@@ -1556,31 +1491,32 @@
 				}
 
 			},
-			hideFormItems(data) {
-				const $this = this
+			hideFormItems(attrs) {
+				if (!Array.isArray(attrs)) {
+					return
+				}
 				const head_styledef = this.head_styledef
-				data.forEach(async (attr, key) => {
-					head_styledef.form.items.forEach(async (ele, index) => {
-						//鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�-						if (ele.name != 'Layout') {
-							if (ele.fieldId == attr.attr) {
-								ele.show = attr.show;
-							}
-						} else if (ele.name == 'Layout') {
-							ele.setting.colList.forEach((col) => {
-								if (col) {
-									if (col.fieldId == attr.attr) {
-										col.show = attr.show;
-									}
-								}
-							});
-						}
-					});
+				if (!head_styledef.hiddenIds) {
+					head_styledef.hiddenIds = []
+				}
+				attrs.forEach((attr) => {
+					let index = head_styledef.hiddenIds.findIndex((id) => id == attr.attr);
+					if (attr.show) {
+						if (index > -1) head_styledef.hiddenIds.splice(index, 1);
+					} else {
+						if (index == -1) head_styledef.hiddenIds.push(attr.attr);
+					}
 				});
+
+				this.setData({
+					head_styledef: head_styledef
+				})
 			},
+
 			afterOK() {
 				this.saving = true
 				const $this = this
+				showLoading("loading...")
 				var obj_attr = this.head_styledef.form.model;
 				// console.log(obj_attr);
 				var input_param = {
@@ -1590,7 +1526,8 @@
 						value: obj_attr[a],
 					})),
 				};
-				if (!this.after_ok.id.includes('{')) this.after_ok.id = '{' + this.after_ok.id + '}';
+				if (!this.after_ok.id.includes('{')) this.after_ok.id = '{' + this.after_ok.id +
+					'}';
 				var dataInfo = {
 					ed_type: "0",
 					start_transaction: true,
@@ -1611,103 +1548,100 @@
 				console.log(dataInfo);
 				// return;
 				runCustomEvent(dataInfo).then(data => {
+					hideLoading()
+					if (data.ret != 0 && data.ret != 1) {
 
-					if (data.ret != 0) {
-						var tip = data.err_info ? typeof data.err_info == 'string' ? data
-							.err_info :
-							data
-							.err_info.join('<br/>') : '';
+						let cls_name = data.event_info?.cls_name
+						let event_name = data.event_info?.event_name
+						tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data.err_info
+							.join('\n') : ''
 						if (data.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('close')
-							});
-						} else uni.showModal({
-							title: this.translateSys("tip"),
-							content: tip + ',' + this.translateSys('tip') + ':' + data
-								.ret,
-							showCancel: false,
-							confirmText: this.translateSys('close')
-						});
+						}
+						if (cls_name && event_name) tip = `鎵ц鈥�{cls_name}鈥濇暟鎹被鐨勨�${event_name}鈥濊剼鏈椂杩斿洖閿欒锛�{tip}`
+						if (data.ret == 801) showInfo(tip)
+						else showError(`${tip}锛屾彁绀猴細${data.ret}`, this.translateSys('tip'))
 						this.saving = false
 						return false
 					} else {
-						var tip = data.info ? typeof data.info == 'string' ? data.info : data
-							.info
-							.join(
-								'<br/>') : '';
-						if (tip) uni.showModal({
-							title: this.translateSys("tip"),
-							content: tip,
-							showCancel: false,
-							confirmText: this.translateSys('close')
-						});
+						var tip = data.info ? typeof data.info == 'string' ? data.info :
+							data.info.join('\n') : '';
+						tip = tip || data.err_info
+						let time = data.info_time || 0
+						if (time)
+							showError(tip, this.translateSys('tip'))
+						else
+							showInfo(tip)
 						if (!this.param.After_Btn_Not_Refresh) {
 							//鍒锋柊
 							uni.redirectTo({
-								url: '../modal/3018_2?param=' + JSON.stringify(this.$data
+								url: '../modal/3018_2?param=' + JSON.stringify(this
+										.$data
 										.param) +
 									"&titlename=" + this.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
-											})
-										});
-									}
+							if ([0, 2, 3, 4, -1].includes(data.result_type)) {
+								if (data.result_type == 2) {
+
+								} else if (typeof data.result == 'string') {
+
+									showInfo(data.result)
+
 
 								}
+								try {
+									var actionlist = data.action || []
+									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
+												})
+											});
+										}
+
+									}
+								} catch (ex) {
+									let actionList = (data.action || []).map(a => a.action_type).join(';')
+									let tip = typeof ex == 'string' ? ex : ex.message
+									tip = `鎵ц鑴氭湰杩斿洖鐨�{actionList}鏃跺嚭鐜板紓甯革紝璇锋鏌ヨ剼鏈繑鍥炵殑鏁版嵁鏍煎紡鏄惁姝g‘銆�{tip}`
+									showError(tip, this.translateSys('tip'))
+									return
+								}
 							}
+
 						}
 					}
-
 					this.saving = false
 				}).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: tip,
-						showCancel: false,
-						confirmText: this.translateSys('close')
-					});
+					hideLoading()
+					showError(ex, this.translateSys("tip") + " 7.1")
+
 				});
 			},
 			//鐐瑰嚮鎸夐挳鍒楄〃
@@ -1740,12 +1674,8 @@
 					if (btn.Edit_dlg.Model == "small") {
 						this.showAddSmallDialog(btn, enviroment);
 					} else {
-						uni.showModal({
-							title: this.translateSys("tip"),
-							content: this.translateSys("unrealized"),
-							showCancel: false,
-							confirmText: this.translateSys('close')
-						});
+						showInfo(this.translateSys("unrealized"))
+
 					}
 				} else if (btn.FunCode == "TriggerEvent") {
 					this.onTriggerEvent(btn, enviroment);
@@ -1755,6 +1685,7 @@
 			},
 			onTriggerEvent(btn, enviroment) {
 				const $this = this
+				showLoading("loading...")
 				var obj_attr = this.head_styledef.form.model;
 				// console.log(obj_attr);
 				var input_param = {
@@ -1785,99 +1716,112 @@
 				console.log(dataInfo);
 				// return;
 				runCustomEvent(dataInfo).then(data => {
-					if (data.ret != 0) {
-						var tip = data.err_info ? typeof data.err_info == 'string' ? data
-							.err_info :
-							data
-							.err_info.join('<br/>') : '';
+					hideLoading()
+					if (data.ret != 0 && data.ret != 1) {
+						let cls_name = data.event_info?.cls_name
+						let event_name = data.event_info?.event_name
+						tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data.err_info
+							.join('\n') : ''
 						if (data.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('close')
-							});
-						} else uni.showModal({
-							title: this.translateSys("tip"),
-							content: tip + ',' + this.translateSys('tip') + ':' + data
-								.ret,
-							showCancel: false,
-							confirmText: this.translateSys('close')
-						});
+						}
+						if (cls_name && event_name) tip = `鎵ц鈥�{cls_name}鈥濇暟鎹被鐨勨�${event_name}鈥濊剼鏈椂杩斿洖閿欒锛�{tip}`
+						if (data.ret == 801) showInfo(tip)
+						else showError(`${tip}锛屾彁绀猴細${data.ret}`, this.translateSys('tip'))
+						this.saving = false
 						return false
 					} else {
-						var tip = data.info ? typeof data.info == 'string' ? data.info : data
-							.info
-							.join(
-								'<br/>') : '';
-						if (tip) uni.showModal({
-							title: this.translateSys("tip"),
-							content: tip,
-							showCancel: false,
-							confirmText: this.translateSys('close')
-						});
+
+						var tip = data.info ? typeof data.info == 'string' ? data.info :
+							data.info.join('\n') : '';
+						tip = tip || data.err_info
+						let time = data.info_time || 0
+						if (time)
+							showError(tip, this.translateSys('tip'))
+						else
+							showInfo(tip)
 						if (!this.param.After_Btn_Not_Refresh) {
 							//鍒锋柊
+
 							uni.redirectTo({
-								url: '../modal/3018_2?param=' + JSON.stringify(this.$data
+								url: '../modal/3018_2?param=' + JSON.stringify(this
+										.$data
 										.param) +
 									"&titlename=" + this.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
-											})
-										});
-									}
+							if ([0, 2, 3, 4, -1].includes(data.result_type)) {
+								if (data.result_type == 2) {
+
+								} else if (typeof data.result == 'string') {
+									showInfo(data.result)
 
 								}
+								try {
+									var actionlist = data.action || []
+									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
+												})
+											});
+										} else if (action.action_type == 'get_pre_page_subtable_next_row') {
+											var value = action.value;
+											const eventChannel = this.getOpenerEventChannel();
+											eventChannel.emit('get_pre_page_subtable_next_row', value);
+										} else if (action.action_type == 'remove_pre_page_subtable_row') {
+											var value = action.value;
+											const eventChannel = this.getOpenerEventChannel();
+											eventChannel.emit('remove_pre_page_subtable_row', value);
+										} else if (action.action_type == "goback_to_pre_page") {
+											//杩斿洖涓婁竴椤�+											uni.navigateBack({
+												delta: 1, //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
+											});
+										}
+									}
+
+
+								} catch (ex) {
+									let actionList = (data.action || []).map(a => a.action_type).join(';')
+									let tip = typeof ex == 'string' ? ex : ex.message
+									tip = `鎵ц鑴氭湰杩斿洖鐨�{actionList}鏃跺嚭鐜板紓甯革紝璇锋鏌ヨ剼鏈繑鍥炵殑鏁版嵁鏍煎紡鏄惁姝g‘銆�{tip}`
+									showError(tip, this.translateSys('tip'))
+									return
+								}
 							}
+
 						}
 					}
 
 				}).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: tip,
-						showCancel: false,
-						confirmText: this.translateSys("close")
-					});
+					showError(ex, this.translateSys("tip") + " 7.1")
+
 				});
 
 			},
@@ -1890,7 +1834,8 @@
 					cls_name: btn.Cls_Name,
 					Edit_dlg: btn.Edit_dlg
 				};
-				const url = '../modal/3018?param=' + JSON.stringify(data) + "&titlename=" + btn.Edit_dlg
+				const url = '../modal/3018?param=' + JSON.stringify(data) + "&titlename=" + btn
+					.Edit_dlg
 					.Name +
 					"&type=addDataObj"
 				var $this = this;
@@ -1902,7 +1847,8 @@
 							console.log(resData);
 							//鍒锋柊
 							uni.redirectTo({
-								url: '../modal/3018_2?param=' + JSON.stringify(this
+								url: '../modal/3018_2?param=' + JSON.stringify(
+										this
 										.$data.param) +
 									"&titlename=" + this.title
 							});

--
Gitblit v1.9.1