Pārlūkot izejas kodu

控制道闸添加确认提示

gcz 3 gadi atpakaļ
vecāks
revīzija
1c70195da7
1 mainītis faili ar 16 papildinājumiem un 3 dzēšanām
  1. 16 3
      pages/deviceList/deviceListType3/deviceInfo.vue

+ 16 - 3
pages/deviceList/deviceListType3/deviceInfo.vue

@@ -39,6 +39,7 @@
 			<u-button type="primary" @click="submit" style="margin-top: 20vh;">提交</u-button>
 			</view>
 		</u-popup>
+		<u-modal v-model="modalShow" :content="modalContent" @confirm="modalConfirm" :show-cancel-button="true"></u-modal>
 	</view>
 </template>
 
@@ -80,7 +81,10 @@
 				placeStatus:[],
 				buttonStyle:{
 					padding:'0 50px'
-				}
+				},
+				modalShow:false,
+				modalContent:'',
+				command:'',
 			}
 		},
 		onLoad(page){
@@ -211,8 +215,8 @@
 					this.mescroll.endErr();
 				})
 			},
-			controlDevice(command){
-				this.$u.api.controlDevice({roadwayNo:this.roadNo,command:command}).then(res=>{
+			modalConfirm(){
+				this.$u.api.controlDevice({roadwayNo:this.roadNo,command:this.command}).then(res=>{
 					uni.showToast({
 						icon:'none',
 						title:res.msg
@@ -222,6 +226,15 @@
 					//联网失败, 结束加载
 					this.mescroll.endErr();
 				})
+			},
+			controlDevice(command){
+				if(command==0){
+					this.modalContent = '是否对此车道进行关闸操作?'
+				}else if(command==1){
+					this.modalContent = '是否对此车道进行开闸操作?'
+				}
+				this.command = command;
+				this.modalShow = true;
 			}
 		}
 	}