From 0ecc402885f332b21923bb12183dc072306f2b39 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期五, 21 三月 2025 18:36:15 +0800
Subject: [PATCH] vue3

---
 pages/modal/small-wnd/ext-button.vue |  594 ++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 301 insertions(+), 293 deletions(-)

diff --git a/pages/modal/small-wnd/ext-button.vue b/pages/modal/small-wnd/ext-button.vue
index 19c2191..d73c6b3 100644
--- a/pages/modal/small-wnd/ext-button.vue
+++ b/pages/modal/small-wnd/ext-button.vue
@@ -11,11 +11,15 @@
 <script>
 	import {
 		Base64
-	} from "js-base64";
+	} from  '@/js/Base64.js';
 	import lua from "@/lua";
 	import {
 		showError
 	} from "@/libs/util";
+	import {
+		runCustomEvent,
+	} from "@/api/data.js"
+
 	export default {
 		name: "OIDataSmallDialogRefExtButton",
 		components: {
@@ -86,6 +90,28 @@
 			},
 		},
 		methods: {
+			setData(obj) {
+				let that = this;
+				let keys = [];
+				let val, data;
+			
+				Object.keys(obj).forEach(function(key) {
+					keys = key.split(".");
+					val = obj[key];
+					data = that.$data;
+					keys.forEach(function(key2, index) {
+						if (index + 1 == keys.length) {
+							that.$set(data, key2, val);
+						} else {
+							if (!data[key2]) {
+								that.$set(data, key2, {});
+							}
+						}
+						data = data[key2];
+					});
+				});
+			},
+			
 			async onClick() {
 				try {
 					if (!this.beforeClickEventId)
@@ -167,140 +193,131 @@
 				};
 				console.log(dataInfo);
 				// return;
-				this.$store.dispatch('runCustomEvent', dataInfo).then(success => {
-					console.log(success);
-					if (success.err_code == 0) {
-						var data = success.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) uni.showModal({
-								title: this.translateSys('tip'),
-								content: tip,
-								showCancel: false,
-								confirmText: this.translateSys('cancel')
-							});
-							else uni.showModal({
-								title: this.translateSys('tip'),
-								content: tip + ',鎻愮ず:' + data.ret,
-								showCancel: false,
-								confirmText: this.translateSys('cancel')
-							});
-							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('cancel')
-							});
+				runCustomEvent(dataInfo).then(data => {
+					console.log(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) uni.showModal({
+							title: this.translateSys('tip'),
+							content: tip,
+							showCancel: false,
+							confirmText: this.translateSys('cancel')
+						});
+						else uni.showModal({
+							title: this.translateSys('tip'),
+							content: tip + ',鎻愮ず:' + data.ret,
+							showCancel: false,
+							confirmText: this.translateSys('cancel')
+						});
+						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('cancel')
+						});
 
-							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;
-										for (var i = 0; i < result.length; i++) {
-											if (result[i].choice_list) {
-												for (var c = 0; c < $this.$data.classAttrList
-													.length; c++) {
-													var attr = $this.$data.classAttrList[c].Attr;
-													for (var j = 0; j < attr.length; j++) {
-														if (attr[j].Name == result[i].attr) {
-															if (utils.classUtils.attrTypeIsDict(attr[j]
-																	.Type)) {
-																var dictItemList = [];
-																for (var d in result[i].choice_list) {
-																	var val = result[i].choice_list[d];
-																	dictItemList.push({
-																		"CN_S_NAME": val,
-																		"Name": val,
-																		"label": val,
-																		"value": val
-																	});
-																}
-																attr[j].dictitem = dictItemList;
-																// attr[j].dictitem = result[i].choice_list;
+						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;
+									for (var i = 0; i < result.length; i++) {
+										if (result[i].choice_list) {
+											for (var c = 0; c < $this.$data.classAttrList
+												.length; c++) {
+												var attr = $this.$data.classAttrList[c].Attr;
+												for (var j = 0; j < attr.length; j++) {
+													if (attr[j].Name == result[i].attr) {
+														if (utils.classUtils.attrTypeIsDict(attr[j]
+																.Type)) {
+															var dictItemList = [];
+															for (var d in result[i].choice_list) {
+																var val = result[i].choice_list[d];
+																dictItemList.push({
+																	"CN_S_NAME": val,
+																	"Name": val,
+																	"label": val,
+																	"value": val
+																});
 															}
+															attr[j].dictitem = dictItemList;
+															// attr[j].dictitem = result[i].choice_list;
 														}
 													}
 												}
 											}
-											for (var c = 0; c < $this.$data.classAttrList.length; c++) {
-												var attr = $this.$data.classAttrList[c].Attr;
-												for (var j = 0; j < attr.length; j++) {
-													console.log(attr[j].Name + '==' + result[i].attr);
-													if (attr[j].Name == result[i].attr) {
-														attr[j].Value = result[i].value;
-													}
-												}
-											}
-											var length = 0;
-											if (!$this.$data.refdatastore.filter(function(s) {
-													return result[i].attr == s.attr
-												}).length) {
-												length = 1;
-												$this.$data.refdatastore.push(result[i]);
-											}
-											if (length == 0) {
-												for (var j = 0; j < $this.$data.refdatastore.length; j++) {
-													if ($this.$data.refdatastore[j].attr == result[i]
-														.attr) {
-														$this.$data.refdatastore[j].value = result[i]
-															.value;
-													}
+										}
+										for (var c = 0; c < $this.$data.classAttrList.length; c++) {
+											var attr = $this.$data.classAttrList[c].Attr;
+											for (var j = 0; j < attr.length; j++) {
+												console.log(attr[j].Name + '==' + result[i].attr);
+												if (attr[j].Name == result[i].attr) {
+													attr[j].Value = result[i].value;
 												}
 											}
 										}
-									} else if (data.action[i].action_type == 'set_global_attr') {
-										$this.$data.global_attr = data.action[i].value || [];
+										var length = 0;
+										if (!$this.$data.refdatastore.filter(function(s) {
+												return result[i].attr == s.attr
+											}).length) {
+											length = 1;
+											$this.$data.refdatastore.push(result[i]);
+										}
+										if (length == 0) {
+											for (var j = 0; j < $this.$data.refdatastore.length; j++) {
+												if ($this.$data.refdatastore[j].attr == result[i]
+													.attr) {
+													$this.$data.refdatastore[j].value = result[i]
+														.value;
+												}
+											}
+										}
 									}
+								} else if (data.action[i].action_type == 'set_global_attr') {
+									$this.$data.global_attr = data.action[i].value || [];
 								}
 							}
+						}
 
-							if (data.result) {
-								var result = data.result;
-								for (var i = 0; i < result.length; i++) {
-									for (var c = 0; c < $this.$data.classAttrList.length; c++) {
-										var attr = $this.$data.classAttrList[c].Attr;
-										for (var j = 0; j < attr.length; j++) {
-											if (attr[j].Name == result[i].attr) {
-												attr[j].Value = result[i].value;
-											}
+						if (data.result) {
+							var result = data.result;
+							for (var i = 0; i < result.length; i++) {
+								for (var c = 0; c < $this.$data.classAttrList.length; c++) {
+									var attr = $this.$data.classAttrList[c].Attr;
+									for (var j = 0; j < attr.length; j++) {
+										if (attr[j].Name == result[i].attr) {
+											attr[j].Value = result[i].value;
 										}
 									}
+								}
 
-									var length = 0;
-									if (!$this.$data.refdatastore.filter(function(s) {
-											return result[i].attr == s.attr
-										}).length) {
-										length = 1;
-										$this.$data.refdatastore.push(result[i]);
-									}
-									if (length == 0) {
-										for (var j = 0; j < $this.$data.refdatastore.length; j++) {
-											if ($this.$data.refdatastore[j].attr == result[i].attr) {
-												$this.$data.refdatastore[j].value = result[i].value;
-											}
+								var length = 0;
+								if (!$this.$data.refdatastore.filter(function(s) {
+										return result[i].attr == s.attr
+									}).length) {
+									length = 1;
+									$this.$data.refdatastore.push(result[i]);
+								}
+								if (length == 0) {
+									for (var j = 0; j < $this.$data.refdatastore.length; j++) {
+										if ($this.$data.refdatastore[j].attr == result[i].attr) {
+											$this.$data.refdatastore[j].value = result[i].value;
 										}
 									}
 								}
 							}
 						}
-					} else {
-						uni.showModal({
-							title: this.translateSys('error') + " 3",
-							content: success.err_msg,
-							showCancel: false,
-							confirmText: this.translateSys('cancel')
-						});
 					}
+
 				}).catch(ex => {
 					// console.log(ex);
 					uni.showModal({
@@ -332,190 +349,181 @@
 				};
 				console.log(dataInfo);
 				// return;
-				this.$store.dispatch('runCustomEvent', dataInfo).then(success => {
-					console.log(success);
-					if (success.err_code == 0) {
-						var data = success.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) uni.showModal({
-								title: this.translateSys('tip'),
-								content: tip,
-								showCancel: false,
-								confirmText: this.translateSys('cancel')
-							});
-							else uni.showModal({
-								title: this.translateSys('tip'),
-								content: tip + ',鎻愮ず:' + data.ret,
-								showCancel: false,
-								confirmText: this.translateSys('cancel')
-							});
-							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('cancel')
-							});
-
-							if (data != "") {
-								var actions = data.action;
-								console.log(actions);
-								if (actions) {
-									for (var i = 0; i < actions.length; i++) {
-										var action = actions[i];
-										var val = action.value;
-										var enviroment = JSON.stringify(enviroment);
-
-										if (action.action_type == 'open_panel') {
-
-											uni.showModal({
-												title: this.translateSys('tip'),
-												content: action.action_type + '姝ction灏氭湭澶勭悊锛�
-												showCancel: false,
-												confirmText: this.translateSys('close')
-											})
-
-										} else if (action.action_type == 'open_select_userdlg') {
-											var style = val.style;
-											var $this = this;
-											var param = {
-												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(data, param);
-														let inputParameter = data;
-														this.onClicked({
-															inputParameter
-														});
-													}
-												}
-											});
-										} else if (action.action_type == 'open_data_query_dlg') {
-											uni.showModal({
-												title: this.translateSys('tip'),
-												content: action.action_type + '姝ction灏氭湭澶勭悊锛�
-												showCancel: false,
-												confirmText: this.translateSys('close')
-											})
-										} else if (action.action_type == 'open_common_dlg') {
-											var $this = this;
-											if (val.common_dlg_id == 'check_list') {
-												$this.$data.check_list = val.config;
-												if (val.config.appear_style == 'sideslip') //鍒ゆ柇鏄惁鏄晶婊�-													$this.$data.popupType = 'right';
-												else
-													$this.$data.popupType = 'center'
-												// open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴�
-												$this.$refs.popup.open($this.$data.popupType);
-												var popupParam = {
-													index: index,
-													iindex: iindex,
-													button_callback: button_callback,
-													req: req,
-													data_attr: data_attr
-												}
-												$this.$data.popupParam = popupParam;
-											}
-										} else if (action.action_type == 'open_project_query_dlg') {
-											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 $this = this;
-											var param_ = {
-												index: index,
-												iindex: iindex,
-												button_callback: button_callback,
-												req: req
-											}
-											uni.navigateTo({
-												url: '../selPrj/index?relation=' + priRel +
-													'&param=' +
-													JSON.stringify(param_),
-												events: {
-													AddPer(data, param) {
-														$this.$data.classAttrList[param.index]
-															.Attr[param
-																.iindex].Value = data[0].Name;
-														$this.$data.classAttrList[param.index]
-															.Attr[param
-																.iindex].ValID = data[0].ID + ';' +
-															data[0]
-															.Name;
-														var callback_eventid = param
-															.button_callback
-															.trim();
-														if ($this.callbackEventId) {
-															var info = {
-																eventid: $this.callbackEventId,
-																edtype: "2",
-																projectid: data[0].ID,
-																rclsid: "",
-																robjid: "",
-																userlogin: "",
-																clsid: $this.clsId,
-																objid: "",
-																attr: param.req,
-																dataJson: [],
-															}
-
-															$this.DataObjRunCustomEvent(info);
-														}
-													}
-												}
-											});
-										} else {
-											var d = dialog({
-												title: '<i class="ace-icon fa fa-info-circle"></i> ' +
-													this.translateSys('tip'),
-												content: action.action_type + '姝ction灏氭湭澶勭悊锛�
-											});
-											d.show();
-										}
-									}
-								}
-							} else {
-								uni.showModal({
-									title: this.translateSys('tip') + "5.2",
-									content: '璋冪敤 before_click_button 鑴氭湰杩斿洖绌猴紝event_id' + eventid,
-									showCancel: false,
-									confirmText: this.translateSys('cancel')
-								});
-							}
-						}
-					} else {
-						uni.showModal({
-							title: this.translateSys('error') + " 5",
-							content: success.err_msg,
+				runCustomEvent(dataInfo).then(data => {
+					console.log(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) uni.showModal({
+							title: this.translateSys('tip'),
+							content: tip,
 							showCancel: false,
 							confirmText: this.translateSys('cancel')
 						});
+						else uni.showModal({
+							title: this.translateSys('tip'),
+							content: tip + ',鎻愮ず:' + data.ret,
+							showCancel: false,
+							confirmText: this.translateSys('cancel')
+						});
+						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('cancel')
+						});
+
+						if (data != "") {
+							var actions = data.action;
+							console.log(actions);
+							if (actions) {
+								for (var i = 0; i < actions.length; i++) {
+									var action = actions[i];
+									var val = action.value;
+									var enviroment = JSON.stringify(enviroment);
+
+									if (action.action_type == 'open_panel') {
+
+										uni.showModal({
+											title: this.translateSys('tip'),
+											content: action.action_type + '姝ction灏氭湭澶勭悊锛�
+											showCancel: false,
+											confirmText: this.translateSys('close')
+										})
+
+									} else if (action.action_type == 'open_select_userdlg') {
+										var style = val.style;
+										var $this = this;
+										var param = {
+											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(data, param);
+													let inputParameter = data;
+													this.onClicked({
+														inputParameter
+													});
+												}
+											}
+										});
+									} else if (action.action_type == 'open_data_query_dlg') {
+										uni.showModal({
+											title: this.translateSys('tip'),
+											content: action.action_type + '姝ction灏氭湭澶勭悊锛�
+											showCancel: false,
+											confirmText: this.translateSys('close')
+										})
+									} else if (action.action_type == 'open_common_dlg') {
+										var $this = this;
+										if (val.common_dlg_id == 'check_list') {
+											$this.$data.check_list = val.config;
+											if (val.config.appear_style == 'sideslip') //鍒ゆ柇鏄惁鏄晶婊�+												$this.$data.popupType = 'right';
+											else
+												$this.$data.popupType = 'center'
+											// open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴�
+											$this.$refs.popup.open($this.$data.popupType);
+											var popupParam = {
+												index: index,
+												iindex: iindex,
+												button_callback: button_callback,
+												req: req,
+												data_attr: data_attr
+											}
+											$this.$data.popupParam = popupParam;
+										}
+									} else if (action.action_type == 'open_project_query_dlg') {
+										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 $this = this;
+										var param_ = {
+											index: index,
+											iindex: iindex,
+											button_callback: button_callback,
+											req: req
+										}
+										uni.navigateTo({
+											url: '../selPrj/index?relation=' + priRel +
+												'&param=' +
+												JSON.stringify(param_),
+											events: {
+												AddPer(data, param) {
+													$this.$data.classAttrList[param.index]
+														.Attr[param
+															.iindex].Value = data[0].Name;
+													$this.$data.classAttrList[param.index]
+														.Attr[param
+															.iindex].ValID = data[0].ID + ';' +
+														data[0]
+														.Name;
+													var callback_eventid = param
+														.button_callback
+														.trim();
+													if ($this.callbackEventId) {
+														var info = {
+															eventid: $this.callbackEventId,
+															edtype: "2",
+															projectid: data[0].ID,
+															rclsid: "",
+															robjid: "",
+															userlogin: "",
+															clsid: $this.clsId,
+															objid: "",
+															attr: param.req,
+															dataJson: [],
+														}
+
+														$this.DataObjRunCustomEvent(info);
+													}
+												}
+											}
+										});
+									} else {
+										var d = dialog({
+											title: '<i class="ace-icon fa fa-info-circle"></i> ' +
+												this.translateSys('tip'),
+											content: action.action_type + '姝ction灏氭湭澶勭悊锛�
+										});
+										d.show();
+									}
+								}
+							}
+						} else {
+							uni.showModal({
+								title: this.translateSys('tip') + "5.2",
+								content: '璋冪敤 before_click_button 鑴氭湰杩斿洖绌猴紝event_id' + eventid,
+								showCancel: false,
+								confirmText: this.translateSys('cancel')
+							});
+						}
 					}
+
 				}).catch(ex => {
 					// console.log(ex);
 					uni.showModal({

--
Gitblit v1.9.1