lj vor 5 Jahren
Ursprung
Commit
f646a3a8f9
2 geänderte Dateien mit 67 neuen und 11 gelöschten Zeilen
  1. 66 10
      pages/cb/cbd/equip-set/equip-set.vue
  2. 1 1
      pages/login/login.vue

+ 66 - 10
pages/cb/cbd/equip-set/equip-set.vue

@@ -4,9 +4,9 @@
 			联网模块
 		</view>
 		<view class="btns">
-			 <button type="warn" size="mini">升级</button>
-			 <button type="warn" size="mini">重启</button>
-			 <button type="warn" size="mini">MQTT配置</button>
+			 <button type="warn" @click="equipBtnControl('dtu_update')" size="mini">升级</button>
+			 <button type="warn" @click="equipBtnControl('dtu_reboot')" size="mini">重启</button>
+			 <button type="warn" @click="mqttInfo" size="mini">MQTT配置</button>
 		</view>
 		<view class="tit adminTit">
 			板子设置
@@ -34,15 +34,17 @@
 				<view class="arrow"></view>
 			</picker>
 		</view>
-		<view class="tit">
-			工作模式
+	<!-- 	<view class="tit">
+			工作状态
 		</view>
 		<view class="uni-list-cell">
 			 <picker @change="turnChange($event,'ws')" :value="equipContrlForm.ws" :range="wsArr">
 				<text class="uni-input">{{wsArr[equipContrlForm.ws]}}</text>
 				<view class="arrow"></view>
 			</picker>
-		</view>
+			<u-modal v-model="wsModelShow" content="确定修改工作模式?"  show-cancel-button @confirm="wsConfirm" @cancel="wsCancel" ref="uModal" ></u-modal>
+		    <u-toast ref="wsToast" />
+		</view> -->
 		<view class="tit">
 			定时模式
 		</view>
@@ -117,6 +119,7 @@
 		<view class="submit-box">
 			<u-button  @click="submit" type="success">确定</u-button>
 		</view>
+		<u-toast ref="toast" />
 	</view>
 </template>
 
@@ -133,11 +136,12 @@
 				tsIndex:0,
 				imgresArr:['高','中','低'],
 				imgresIndex:"",
+				wsModelShow:false, 
 				equipContrlForm:{
 					ds:0,//设备开关
-					ws:0,//工作模式
 					ts:0,//定时模式
 					tt:1,//定时时长
+					ws:0,//工作状态
 					collt: 1,
 					htim: 1,
 					hst: 75,
@@ -259,7 +263,9 @@
 					this.equipContrlForm.ds=e.target.value 
 				}else if(a=='ws'){
 					// this.wsIndex = e.target.value
+					this.wsModelShow=true
 					this.equipContrlForm.ws=e.target.value
+					
 				}else if(a=='ts'){
 					// this.tsIndex = e.target.value
 					this.equipContrlForm.ts=e.target.value
@@ -273,6 +279,29 @@
 				this.etLabel=e[0].label
 				this.equipContrlForm.et=e[0].value
 			},
+			async wsConfirm(){
+				console.log(222)
+				const res=await this.$myRequest({
+					url:'/api/api_gateway?method=forecast.send_control.device_control',
+					data:{
+						device_type_id:3,
+						d_id:this.d_id,
+						work_type: this.equipContrlForm.ws,
+					}
+				})
+				if(res){
+					this.$refs.wsToast.show({
+						title: '修改成功',
+						type: 'success',
+					})
+				}
+			},
+			wsCancel(){
+				this.$refs.wsToast.show({
+					title: '取消修改',
+					type: 'default',
+				})
+			},
 			selectTime(a){
 				if(a=='st'){
 					this.stShow=true;
@@ -314,21 +343,48 @@
 						cmd: 'paramconf'
 					}
 				})
+				this.stLabel =
+					res.st && res.st < 10 ? '0' + res.st + ':00' : res.st + ':00'
+				this.etLabel=
+					res.et && res.et < 10 ? '0' + res.et + ':00' : res.et + ':00'
 				this.equipContrlForm=res
-				console.log(res)
 			},
 			async submit(){
 				console.log(this.equipContrlForm)
 				let res=await this.$myRequest({
 					url:'/api/api_gateway?method=forecast.send_control.device_control',
 					data:{
-						device_type_id:'',
+						device_type_id:3,
 						d_id: this.d_id,
 						config: JSON.stringify(this.equipContrlForm)
 					}
 				})
+				if(res){
+					this.$refs.toast.show({
+						title: '修改成功!',
+						type: 'success',
+					})
+				}
+			},
+			async equipBtnControl(cmd){
+				let res=await this.$myRequest({
+					url:'/api/api_gateway?method=forecast.send_control.admin_device_control',
+					data:{
+						cmd,
+						device_type_id: 3,
+						d_id: this.d_id
+					}
+				})
+				if(res){
+					this.$refs.toast.show({
+						title: '指令下发成功!',
+						type: 'success',
+					})
+				}
+			},
+			mqttInfo(){
+				
 			}
-			
 		}
 	}
 </script>

+ 1 - 1
pages/login/login.vue

@@ -44,7 +44,7 @@
 						password: formdata.pass
 					}
 				})
-				let session_key=res.data.data.session_key
+				let session_key=res.session_key
 				uni.setStorage({
 				    key: 'session_key',
 				    data: session_key,