Jelajahi Sumber

逻辑修改

lilei 4 tahun lalu
induk
melakukan
e940c57657
1 mengubah file dengan 28 tambahan dan 29 penghapusan
  1. 28 29
      pages/work/index/index.vue

+ 28 - 29
pages/work/index/index.vue

@@ -137,6 +137,7 @@ export default {
 			// 紧急停止成功
 			this.stopWashCarSuccess()
 			// 复位成功
+			this.resetRabtSuccess()
 		})
 	},
 	methods: {
@@ -155,6 +156,8 @@ export default {
 			if (this.status == 'start') {
 				cmd.operateType = 'start' //操作命令
 				this.$store.commit("$sendWebsocket",JSON.stringify(cmd))
+				this.step= 0;
+				this.showStart = true;
 			}
 			// 急停
 			if (this.status == 'working') {
@@ -165,6 +168,8 @@ export default {
 				        if (res.confirm) {
 							cmd.operateType = 'stop' //操作命令
 							_this.$store.commit("$sendWebsocket",JSON.stringify(cmd))
+							_this.showStop = true;
+							_this.status = 'stop';
 				        }
 				    }
 				});
@@ -172,30 +177,24 @@ export default {
 		},
 		// 启动成功
 		startWashCarSuccess(){
-			this.step= 0;
-			this.showStart = true;
-			setTimeout(() => {
-				this.status = 'working';
-				this.curWorkStutesText='设备已启动';
-				this.showStart = false;
-				// 进度条,服务时间根据不同的服务类型而不同
-				let serverTime = this.washDuration/60
-				this.interId = setInterval(()=>{
-					// 小于60时说明洗车机正在工作中
-					if(this.step<=60){
-						this.loading(this.step++)
-					}else{
-						// 洗车机正常状态下工作结束
-						this.washCarSuccess()
-					}
-				},1000*serverTime)
-			}, 3000);
+			this.status = 'working';
+			this.curWorkStutesText='设备已启动';
+			this.showStart = false;
+			// 进度条,服务时间根据不同的服务类型而不同
+			let serverTime = this.washDuration/60
+			this.interId = setInterval(()=>{
+				// 小于60时说明洗车机正在工作中
+				if(this.step<=60){
+					this.loading(this.step++)
+				}else{
+					// 洗车机正常状态下工作结束
+					this.washCarSuccess()
+				}
+			},1000*serverTime)
 		},
 		// 紧急停止成功
 		stopWashCarSuccess(){
 			// 显示急停提示弹框
-			this.showStop = true;
-			this.status = 'stop';
 			this.curWorkStutesText='设备已紧急停止';
 			this.resetLoadingStatus();
 		},
@@ -252,18 +251,18 @@ export default {
 			}
 			this.$store.commit("$sendWebsocket",JSON.stringify(cmd))
 			this.status = 'reseting';
-			this.curWorkStutesText='设备正在归位';
 			this.showStart = true;
 			this.showStop = false;
-			// 归位结束后
-			setTimeout(()=>{
-				// 关闭socket
-				this.$store.commit("$closeWebsocket")
-				uni.redirectTo({
-					url:"/pages/work/success/success"
-				})
-			},3000)
 		},
+		// 归位结束后
+		resetRabtSuccess(){
+			this.curWorkStutesText='设备已归位';
+			// 关闭socket
+			this.$store.commit("$closeWebsocket");
+			uni.redirectTo({
+				url:"/pages/work/success/success"
+			})
+		}
 	}
 };
 </script>