From 6be7369a96ac84bbc5dc95f792a180d7b86cc89a Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期二, 11 六月 2024 18:04:24 +0800
Subject: [PATCH] 5600

---
 pages/modal/ms_classAttr.vue |  236 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 225 insertions(+), 11 deletions(-)

diff --git a/pages/modal/ms_classAttr.vue b/pages/modal/ms_classAttr.vue
index 4123c2b..d95414f 100644
--- a/pages/modal/ms_classAttr.vue
+++ b/pages/modal/ms_classAttr.vue
@@ -214,6 +214,20 @@
 		float: left;
 		display: inline-block;
 	}
+	
+	button.btn_trigger {
+		width: 100%;
+		margin-top: 20rpx;
+		padding: 20rpx;
+		line-height: 1.5;
+		background: #27A6E1;
+		border: none;
+		color: #fff;
+		font-size: 38rpx;
+		font-weight: bold;
+		float: left;
+		display: inline-block;
+	}
 
 	.i_tishi {
 		color: red;
@@ -948,6 +962,10 @@
 			v-if="param.Sub_Cls.Can_Add_Delete == true">{{title}}</button>
 		<button type="default" @tap="sava" class="btn_sava"
 			v-else-if="param.Sub_Cls.Can_Add_Delete == false">{{title}}</button>
+			
+		<button type="default" @tap="trigger" class="btn_trigger"
+			v-if="param.After_Trigger_Event">绾垎鎷�/button>
+			
 
 		<!-- 鏅�寮圭獥 top bottom center left right -->
 		<view>
@@ -1485,8 +1503,7 @@
 				//console.log(e.target)
 				getApp().onScan((result) => {
 					//console.log(result.decodedata);
-					var isVal = this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset[
-						'iindex']].Value;
+					var isVal = this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value;
 					// if(!isVal){
 					// 	this.$data.subPanelList[e.target.dataset['iiindex']].subClassAttr[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value=result.decodedata;
 					// 	var isVald =this.$data.subPanelList[e.target.dataset['iiindex']].subClassAttr[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value;
@@ -1494,8 +1511,7 @@
 					// }
 					//涓绘暟鎹被鎵爜鏌ヨ鏁版嵁
 					if (isVal != result.decodedata) {
-						this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']]
-							.Value = result.decodedata;
+						this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value = result.decodedata;
 						uni.hideKeyboard();
 						//瀛愭暟鎹被鎵爜鍖轰簨浠惰剼鏈� 						var eventid = this.$data.param.Scan_Code.Input_Change_Event.ID;
@@ -1535,7 +1551,7 @@
 								clsid: 'MBOX', //this.$data.param.Sub_Cls.ID,
 								objid: "",
 								attr: req,
-								mast_attr: [],
+								mast_attr: req,
 								inputParamter: [{
 									attr: 'mast_input_3037',
 									value: result.decodedata
@@ -1551,12 +1567,10 @@
 				//console.log(e.target)
 				getApp().onScan((result) => {
 					//console.log(result.decodedata);
-					var isVal = this.$data.subClassAttrList[e.target.dataset['index']].Attr[e.target.dataset[
-						'iindex']].Value;
+					var isVal = this.$data.subClassAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value;
 					//涓绘暟鎹被鎵爜鏌ヨ鏁版嵁
 					if (isVal != result.decodedata) {
-						this.$data.subClassAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']]
-							.Value = result.decodedata;
+						this.$data.subClassAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value = result.decodedata;
 						uni.hideKeyboard();
 						//瀛愭暟鎹被鎵爜鍖轰簨浠惰剼鏈� 						var eventid = this.$data.param.Scan_Code.Input_Change_Event.ID;
@@ -2145,7 +2159,7 @@
 							clsid: 'MBOX', //this.$data.param.Sub_Cls.ID,
 							objid: "",
 							attr: req,
-							mast_attr: [],
+							mast_attr: req,
 							inputParamter: [{
 								attr: 'mast_input_3037',
 								value: e.target.value
@@ -2348,6 +2362,16 @@
 				else if (this.$data.param.After_OK_Event) //鍒ゆ柇鍔熻兘鐐瑰弬鏁版槸鍚︽湁纭畾鍚庤剼鏈� 					this.scan_OKDataObjRunCustomEvent(this.$data.param.After_OK_Event.ID);
 				else
+					uni.navigateBack({
+						delta: 1
+					}); //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
+			},
+			trigger() { 
+				if (this.$data.param.Before_Trigger_Event) //鍒ゆ柇鍔熻兘鐐瑰弬鏁版槸鍚︽湁瑙﹀彂鍓嶈剼鏈�+					this.scan_TriggerDataObjRunCustomEvent(this.$data.param.Before_Trigger_Event.ID);
+				else if (this.$data.param.After_Trigger_Event) //鍒ゆ柇鍔熻兘鐐瑰弬鏁版槸鍚︽湁瑙﹀彂鍚庤剼鏈�+					this.scan_TriggerDataObjRunCustomEvent(this.$data.param.After_Trigger_Event.ID);
+				elsess
 					uni.navigateBack({
 						delta: 1
 					}); //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
@@ -3564,7 +3588,12 @@
 						edit_dlg: {
 							type: 'small', //灏忕獥鍙� 							class_id: 'MBOX', //this.$data.param.Sub_Cls.ID,//褰撳墠鏁版嵁绫籭d
-						},
+						}, 
+                        master: {
+                            cls_id: 'MBOX',//self.options.ExtParam.Sub_Cls.ID, // button=bottom鏃�master鐨刢ls_id
+                            attr: info.mast_attr //涓绘暟鎹被灞炴�
+                                //objs_id: ''  // button=bottom鏃�master鐨刼bj_id
+                        }
 					};
 					
 				}
@@ -3965,6 +3994,191 @@
 					});
 				});
 			},
+			scan_TriggerDataObjRunCustomEvent(eventID) {
+				uni.showLoading({title: "鍔犺浇涓�..",mask: true});
+				var $this = this;
+				var req = [];
+				var attrlist = $this.$data.classAttrList;
+				for (var i = 0; i < attrlist.length; i++) {
+					var attr = attrlist[i].Attr;
+					for (var j = 0; j < attr.length; j++) {
+						var ar = attr[j];
+						if (ar.Value == '璇烽�鎷� || ar.Value == '鈥斺�璇烽�鎷┾�鈥�) ar.Value = '';
+						if (ar.Type == '寮曠敤瀵硅薄(澶氫釜)')
+							if (ar.Value == '璇�) ar.Value = '';
+						if (ar.Type == '寮曠敤浜哄憳' || ar.Type == '寮曠敤椤圭洰')
+							req.push({
+								attr: ar.Name,
+								value: ar.ValID ? ar.ValID : ''
+							});
+						else if (ar.Type == '甯冨皵鍊�)
+							req.push({
+								attr: ar.Name,
+								value: ar.Value ? '1' : '0'
+							});
+						else if (ar.Type == '瀛楀吀' || ar.Type == '瀛楀吀-瀛楃涓� || ar.Type == '瀛楀吀-鏁存暟') {
+							if (ar.select == true) { //鍒ゆ柇涓嬫媺鏄惁澶氶�
+								var valStr = "";
+								for (var v in ar.Value) {
+									if (valStr)
+										valStr += ";";
+									valStr += ar.Value[v];
+								}
+								req.push({
+									attr: ar.Name,
+									value: valStr
+								});
+							} else
+								req.push({
+									attr: ar.Name,
+									value: ar.Value
+								});
+						} else
+							req.push({
+								attr: ar.Name,
+								value: ar.Value ? ar.Value : ''
+							});
+
+						if (ar.notempty == true && !ar.Value) {
+							// if(ar.NotEmpty=='1'){
+							uni.hideLoading();
+							// uni.showToast({title:ar.DispName+'涓嶈兘涓虹┖锛�,icon:"success",duration:3000});
+							uni.showModal({
+								title: "鎻愮ず",
+								content: ar.DispName + '涓嶈兘涓虹┖锛�,
+								showCancel: false,
+								confirmText: "鍙栨秷"
+							});
+							return;
+						}
+					}
+				}
+				var objects = [];
+				var subPanelList = $this.$data.subPanelList;
+				for (var s = 0; s < subPanelList.length; s++) {
+					var sub_req = [];
+					for (var i = 0; i < subPanelList[s].subClassAttr.length; i++) {
+						var attr = subPanelList[s].subClassAttr[i].Attr;
+						for (var j = 0; j < attr.length; j++) {
+							var ar = attr[j];
+							if (ar.Value == '璇烽�鎷� || ar.Value == '鈥斺�璇烽�鎷┾�鈥�) ar.Value = '';
+							if (ar.Type == '寮曠敤瀵硅薄(澶氫釜)')
+								if (ar.Value == '璇�) ar.Value = '';
+							if (ar.Type == '寮曠敤浜哄憳' || ar.Type == '寮曠敤椤圭洰')
+								sub_req.push({
+									attr: ar.Name,
+									value: ar.ValID ? ar.ValID : ''
+								});
+							else if (ar.Type == '甯冨皵鍊�)
+								sub_req.push({
+									attr: ar.Name,
+									value: ar.Value ? '1' : '0'
+								});
+							else if (ar.Type == '瀛楀吀' || ar.Type == '瀛楀吀-瀛楃涓� || ar.Type == '瀛楀吀-鏁存暟') {
+								if (ar.select == true) { //鍒ゆ柇涓嬫媺鏄惁澶氶�
+									var valStr = "";
+									for (var v in ar.Value) {
+										if (valStr)
+											valStr += ";";
+										valStr += ar.Value[v];
+									}
+									sub_req.push({
+										attr: ar.Name,
+										value: valStr
+									});
+								} else
+									sub_req.push({
+										attr: ar.Name,
+										value: ar.Value
+									});
+							} else
+								sub_req.push({
+									attr: ar.Name,
+									value: ar.Value ? ar.Value : ''
+								});
+
+							if (ar.notempty == true && !ar.Value) {
+								// if(ar.NotEmpty=='1'){
+								uni.hideLoading();
+								// uni.showToast({title:ar.DispName+'涓嶈兘涓虹┖锛�,icon:"success",duration:3000});
+								uni.showModal({
+									title: "鎻愮ず",
+									content: ar.DispName + '涓嶈兘涓虹┖锛�,
+									showCancel: false,
+									confirmText: "鍙栨秷"
+								});
+								return;
+							}
+						}
+					}
+					objects.push({
+						obj_id: subPanelList[s].scanCodeVal,
+						obj_attrs: sub_req
+					});
+				}
+				var dataJson = {
+					master_cls: {
+						cls_name: 'MBOX', //$this.$data.param.Master_Cls.Name,
+						obj_attrs: req
+					},
+					input_3037: $this.$data.scanCodeVal, //鎵爜鍐呭
+					op_type: $this.$data.param.OperationType, //浣滀笟绫诲瀷瀹氫箟
+					sub_cls: {
+						cls_name: 'MBOX', //$this.$data.param.Sub_Cls.Name,
+						objects: objects
+					}
+				};
+				// console.log(JSON.stringify(dataJson));
+				var dataInfo = {
+					edtype: "7",
+					eventid: eventID,
+					projectid: '',
+					rclsid: '',
+					robjid: '',
+					userlogin: '',
+					clsid: 'MBOX',
+					objid: '',
+					attr: JSON.stringify([]),
+					extinfo: JSON.stringify([]),
+					global_attr: JSON.stringify($this.$data.global_attr),
+					dataJson: JSON.stringify(dataJson)
+				}
+				// console.log(JSON.stringify(dataInfo));
+				console.log(dataInfo);
+				this.$store.dispatch('DataObjRunCustomEventInfo', dataInfo).then(success => {
+					console.log(success);
+					uni.hideLoading();
+					if (success.code == '00000') {
+						var data = JSON.parse(success.data);
+						var result = data.result;
+						if (eventID != $this.$data.param.After_Trigger_Event.ID)
+							$this.scan_TriggerDataObjRunCustomEvent($this.$data.param.After_Trigger_Event.ID);
+						else {
+							//鍒锋柊
+							uni.redirectTo({
+								url: '../modal/ms_classAttr?param=' + JSON.stringify($this.$data.param) +
+									"&titlename=" + $this.$data.title
+							});
+						}
+					} else {
+						uni.showModal({
+							title: "閿欒8",
+							content: success.msg,
+							showCancel: false,
+							confirmText: "鍙栨秷"
+						});
+					}
+				}).catch(ex => {
+					// console.log(ex);
+					uni.hideLoading();
+					uni.showModal({
+						title: "閿欒8.1",
+						content: ex.errMsg,
+						showCancel: false,
+						confirmText: "鍙栨秷"
+					});
+				});
+			},
 
 
 		}

--
Gitblit v1.9.1