From 2e01be1d067ad3366f8353e2732307ce8a769d52 Mon Sep 17 00:00:00 2001
From: jt <jt@activesoft.com.cn>
Date: 星期三, 30 八月 2023 11:38:08 +0800
Subject: [PATCH] 3037增加从数据-带选择按钮-选择前事件和选择后事件处理功能和侧滑功能

---
 pages/modal/ms_classAttr.vue |  275 +++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 256 insertions(+), 19 deletions(-)

diff --git a/pages/modal/ms_classAttr.vue b/pages/modal/ms_classAttr.vue
index 7a98041..463dbc3 100644
--- a/pages/modal/ms_classAttr.vue
+++ b/pages/modal/ms_classAttr.vue
@@ -257,7 +257,67 @@
 	    right: -10px;
 	    z-index: 100;
 	}
-	
+	.view-popup{
+		position:relative;
+	}
+	.popup-content {
+		@include flex;
+		align-items: center;
+		justify-content: center;
+		padding: 30rpx;
+		background-color: #fff;
+		/* height: 150px; */
+		/* border: 1px solid red; */
+	}
+	.popup-cont {
+		overflow-y: auto;
+		/* border: 1px solid red; */
+	}
+	.popup-height {
+		@include height;
+		/* width: 200px; */
+	}
+	.popup-header{
+		font-size: 42rpx;
+		font-weight: bold;
+		margin:20rpx 20rpx 0px 20rpx;
+	}
+	.view_popup_CheckList{
+		margin-bottom: 20rpx;
+	}
+	.popup-footer{
+		float: right;
+		position:absolute;
+		bottom:0;
+		right:20rpx;
+	}
+	button.btn_popup_add {
+		width:180rpx;
+		margin-top: 50rpx;
+		margin-right: 20rpx;
+		padding: 15rpx;
+		line-height: 1.5;
+		background: #27A6E1;
+		border: none;
+		color: #fff;
+	    font-size: 38rpx;
+		font-weight: bold;
+		/* float: left; */
+		display: inline-block;
+	}
+	button.btn_popup_cancel {
+		width:180rpx;
+		margin-top: 50rpx;
+		padding: 15rpx;
+		line-height: 1.5;
+		background: #27A6E1;
+		border: none;
+		color: #fff;
+	    font-size: 38rpx;
+		font-weight: bold;
+		/* float: right; */
+		display: inline-block;
+	}
 </style>
 
 <template>
@@ -611,6 +671,30 @@
 		<button type="default" @tap="cancel" class="btn_cancel" v-if="param.Sub_Cls.Can_Add_Delete == true">鍙栨秷</button>
 		<button type="default" @tap="sava" class="btn_add" 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>
+		
+		<!-- 鏅�寮圭獥 top bottom center left right -->
+		<view>
+			<uni-popup class="view-popup" ref="popup" background-color="#fff" @change="popupChange">
+				<view class="popup-header">{{check_list.title}}</view>
+				<view class="popup-content" :class="{ 'popup-height': popupType === 'left' || popupType === 'right' }" 
+				:style="{'width':check_list.width?check_list.width+'px':'200px','height':check_list.height?check_list.height+'px':'88%'}">
+					<view class="popup-cont" :style="{'height':check_list.height?check_list.height-45+'px':'415px'}">
+						<view class="view_popup_CheckList" v-for="(item,index) in check_list.items">
+							<checkbox-group class="check_list" @change="checkChange" :data-ischeck="item.check" :data-index="index"  :style="{'margin-left': '10rpx'}">
+								<label>
+									<checkbox :value="item.check" :checked="item.check"/>
+									<text>{{item.name}}</text>
+								</label>
+							</checkbox-group>
+						</view>
+					</view>
+					<view class="popup-footer">
+						<button type="default" @tap="popup_sava" class="btn_popup_add">纭畾</button>
+						<button type="default" @tap="popup_cancel" class="btn_popup_cancel">鍙栨秷</button>
+					</view>
+				</view>
+			</uni-popup>
+		</view>
 	</view>
 </template> 
 
@@ -636,6 +720,8 @@
 				subClassAttrList:[],
 				subPanelList:[],
 				subClassGridStyle:[],
+				popupType:"center",
+				check_list:{},
 			}
 		},
 		onLoad(options) {
@@ -708,6 +794,157 @@
 			}
 		},
 		methods: {
+			scan_classAttr_extButton(e){ //閫夋嫨鎸夐挳鍓�+				var $this = this;
+				var Before_Select_Event = $this.$data.param.Scan_Code.Before_Select_Event;
+				if(!Before_Select_Event){
+					uni.showModal({title:"鎻愮ず",content:"閫夋嫨鍓嶄簨浠朵负绌猴紒",showCancel:false,confirmText:"鍙栨秷"});
+					return;
+				}
+				// if(!After_Select_Event){
+				// 	uni.showModal({title:"鎻愮ず",content:"閫夋嫨鍚庝簨浠朵负绌猴紒",showCancel:false,confirmText:"鍙栨秷"});
+				// 	return;
+				// }
+				// var data_attr = this.$data.classAttrList[index].Attr[iindex];
+				// this.DataObjRunCustomEvent_Return(Before_Select_Event, '', After_Select_Event, '', '');
+				var mast_attr=[];
+				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=='璇烽�鎷�){
+							uni.showModal({title:"鎻愮ず",content:ar.DispName+"鏈�鎷╂暟鎹紒",showCancel:false,confirmText:"鍙栨秷"});
+							return;
+						}
+						if(ar.Type=='寮曠敤瀵硅薄(澶氫釜)')
+							if(ar.Value=='璇�) ar.Value='';
+						if(ar.Type=='寮曠敤浜哄憳' || ar.Type=='寮曠敤椤圭洰')
+							mast_attr.push({ attr: ar.Name, value: ar.ValID ?ar.ValID :'' });
+						else if(ar.Type=='甯冨皵鍊�)
+							mast_attr.push({ attr: ar.Name, value: ar.Value?'1':'0'});
+						else
+							mast_attr.push({ attr: ar.Name, value: ar.Value ?ar.Value :''});
+					}
+				}
+				
+				var req=[];
+				var attrlist = this.$data.subClassAttrList;
+				var msg='';
+				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.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
+							req.push({ attr: ar.Name, value: ar.Value ?ar.Value :''});
+					}
+				}
+				
+				var info = {
+				    eventid: Before_Select_Event.ID,
+				    edtype: "7",//"0",
+				    projectid: '',
+				    rclsid: '',
+				    robjid: '',
+				    userlogin: '',
+				    clsid: 'MBOX',//this.$data.param.Sub_Cls.ID,
+				    objid: "",
+				    attr: req,
+					mast_attr: mast_attr,
+					inputParamter: mast_attr
+				}
+				// console.log(info);
+				this.scan_DataObjRunCustomEvent(info, "");
+			},
+			popupChange(e) {
+				console.log('褰撳墠妯″紡锛� + e.type + ',鐘舵�锛� + e.show);
+			},
+			checkChange(e){ //寮规check閫夋嫨
+				// console.log(e.target.dataset);
+				var index = e.target.dataset.index;
+				var ischeck = e.target.dataset.ischeck;
+				var data = this.$data.check_list.items;
+				// this.$data.check_list.items=[];
+				if(this.$data.check_list.multiple_choice=="0"){ //鍒ゆ柇鏃跺崟閫夎繕鏄閫�+					for(var i in data){
+						data[i].check=false;
+					}
+				}
+				data[index].check=ischeck?false:true;
+				this.$data.check_list.items=data;
+				
+			},
+			popup_cancel(e){ //寮规鍙栨秷
+				this.$refs.popup.close();
+			},
+			popup_sava(e){ //寮规纭畾 閫夋嫨鎸夐挳鍚�+				var $this = this;
+				var After_Select_Event = $this.$data.param.Scan_Code.After_Select_Event;
+				if(!After_Select_Event){
+					uni.showModal({title:"鎻愮ず",content:"閫夋嫨鍚庝簨浠朵负绌猴紒",showCancel:false,confirmText:"鍙栨秷"});
+					return;
+				}
+				var items = $this.$data.check_list.items;
+				var data=[];
+				var name="";
+				for (var i = 0; i < items.length; i++) {
+					if(items[i].check==true){
+						if(name)
+							name+=';';
+						name+=items[i].name;
+						data.push({id:items[i].id,name:items[i].name});
+					}
+				}
+				if(data.length==0){
+					uni.showModal({title:"鎻愮ず",content:"鏈�鎷╂暟鎹紒",showCancel:false,confirmText:"鍙栨秷"});
+					return;
+				}
+				var mast_attr=[];
+				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=='璇烽�鎷�){
+							uni.showModal({title:"鎻愮ず",content:ar.DispName+"鏈�鎷╂暟鎹紒",showCancel:false,confirmText:"鍙栨秷"});
+							return;
+						}
+						if(ar.Type=='寮曠敤瀵硅薄(澶氫釜)')
+							if(ar.Value=='璇�) ar.Value='';
+						if(ar.Type=='寮曠敤浜哄憳' || ar.Type=='寮曠敤椤圭洰')
+							mast_attr.push({ attr: ar.Name, value: ar.ValID ?ar.ValID :'' });
+						else if(ar.Type=='甯冨皵鍊�)
+							mast_attr.push({ attr: ar.Name, value: ar.Value?'1':'0'});
+						else
+							mast_attr.push({ attr: ar.Name, value: ar.Value ?ar.Value :''});
+					}
+				}
+				
+				$this.$data.scanCodeVal=name;
+				var info = {
+				    eventid: After_Select_Event.ID,
+				    edtype: "7",
+				    projectid: '',
+				    rclsid: '',
+				    robjid: '',
+					userlogin: '',
+					clsid: 'MBOX',
+					objid: "",
+				    attr: mast_attr,
+					inputParamter: data,
+					enviroment: ''
+				}
+				// console.log(info);
+				this.scan_DataObjRunCustomEvent(info, "");
+				this.$refs.popup.close();
+			},
+			
 			cancel(e){
 				uni.navigateBack({
 					delta:1 //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
@@ -1404,21 +1641,6 @@
 				}
 				var data_attr = this.$data.classAttrList[index].Attr[iindex];
 				this.DataObjRunCustomEvent_Return(before_click_button, data_attr, button_callback, index,iindex);
-			},
-			scan_classAttr_extButton(e){  //---------鏈畬鎴�----------
-				var $this = this;
-				var Before_Select_Event = $this.$data.param.Scan_Code.Before_Select_Event.ID;
-				var After_Select_Event = $this.$data.param.Scan_Code.After_Select_Event.ID;
-				if(!Before_Select_Event){
-					uni.showModal({title:"鎻愮ず",content:"閫夋嫨鎸夐挳鍓嶄簨浠朵负绌猴紒",showCancel:false,confirmText:"鍙栨秷"});
-					return;
-				}
-				if(!After_Select_Event){
-					uni.showModal({title:"鎻愮ず",content:"鏂板鎸夐挳鍚庝簨浠朵负绌猴紒",showCancel:false,confirmText:"鍙栨秷"});
-					return;
-				}
-				// var data_attr = this.$data.classAttrList[index].Attr[iindex];
-				this.DataObjRunCustomEvent_Return(Before_Select_Event, '', After_Select_Event, '', '');
 			},
 			classAttr_AddPer(index,iindex){
 				var param={index:index,iindex:iindex};
@@ -2569,12 +2791,26 @@
 		    			            }
 		    			        } else if (action.action_type == 'set_global_attr') {
 		    			            $this.$actiontr = action.value || [];
-		    			        } else if (action.action_type == 'add_subcls_panel') { //涓讳粠鏁版嵁绫绘壂鐮佹煡璇㈡暟鎹�+		    			        } else if (action.action_type == 'open_common_dlg') {  //鎵撳紑渚ф粦寮规
+									var $this = this;
+						            if(action.value.common_dlg_id == 'check_list'){
+									   $this.$data.check_list= action.value.config;
+									   if(action.value.config.appear_style == 'sideslip') //鍒ゆ柇鏄惁鏄晶婊�+											$this.$data.popupType = 'right';
+									   else
+											$this.$data.popupType = 'center'
+									   // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴�
+									   $this.$refs.popup.open($this.$data.popupType);
+								    }
+						        } else if (action.action_type == 'add_subcls_panel') { //涓讳粠鏁版嵁绫绘壂鐮佹煡璇㈡暟鎹� 		    			            var result = action.value;
+									var $this = this;
 									let list_1 = JSON.parse(JSON.stringify(this.$data.subClassAttrList));
 									var scanCodeVal = $this.$data.scanCodeVal;
-									if(info.inputParamter[0].attr=="mast_input_3037") //鍒ゆ柇鏄富鏁版嵁绫绘壂鐮佹煡璇㈡暟鎹�-										scanCodeVal = "mast_input_3037-"+ii;
+									if(info.inputParamter[0].attr){
+										if(info.inputParamter[0].attr=="mast_input_3037") //鍒ゆ柇鏄富鏁版嵁绫绘壂鐮佹煡璇㈡暟鎹�+											scanCodeVal = "mast_input_3037-"+ii;
+									}
 									$this.$data.subPanelList.push({
 										scanCodeVal:scanCodeVal,
 										subClassAttr:list_1
@@ -2614,6 +2850,7 @@
 										}
 									}
 		    			        }
+								
 		    			    }
 		    			}
 		    			

--
Gitblit v1.9.1