|
|
@@ -4,41 +4,41 @@
|
|
|
操作
|
|
|
</view>
|
|
|
<view class="btns">
|
|
|
- <button type="warn" @click="equipBtnControl('dtu_update')" size="mini">升级</button>
|
|
|
- <button type="warn" @click="equipBtnControl('dtu_reboot')" size="mini">重启</button>
|
|
|
- <button type="warn" @click="equipBtnControl('dtu_reboot')" size="mini">清网</button>
|
|
|
- <button type="warn" @click="equipBtnControl('dtu_reboot')" size="mini">查询服务器配置</button>
|
|
|
+ <button type="warn" @click="equipBtnControl('update')" size="mini">升级</button>
|
|
|
+ <button type="warn" @click="equipBtnControl('reboot')" size="mini">重启</button>
|
|
|
+ <button type="warn" @click="equipBtnControl('clearworm')" size="mini">清网</button>
|
|
|
+ <button type="warn" @click="" size="mini">查询服务器配置</button>
|
|
|
</view>
|
|
|
<view class="tit adminTit">
|
|
|
设备开关
|
|
|
</view>
|
|
|
- <view class="uni-list-cell" @click="on_off_show=true">
|
|
|
+ <view class="uni-list-cell" @click="ds_show=true">
|
|
|
<text class="uni-input">{{equipContrlForm1.ds=="0"?'关机':'开机'}}</text>
|
|
|
<view class="arrow"></view>
|
|
|
- <u-select v-model="on_off_show" mode="single-column" :list="on_off_list" @confirm="confirm($event,'on_off')"></u-select>
|
|
|
+ <u-select v-model="ds_show" mode="single-column" :list="ds_list" @confirm="confirm($event,'ds')"></u-select>
|
|
|
</view>
|
|
|
<view class="tit adminTit">
|
|
|
时控开关
|
|
|
</view>
|
|
|
- <view class="uni-list-cell" @click="on_off_show=true">
|
|
|
+ <view class="uni-list-cell" @click="timctrl_show=true">
|
|
|
<text class="uni-input">{{equipContrlForm1.timctrl=="0"?'关':'开'}}</text>
|
|
|
<view class="arrow"></view>
|
|
|
- <u-select v-model="on_off_show" mode="single-column" :list="on_off_list" @confirm="confirm($event,'on_off')"></u-select>
|
|
|
+ <u-select v-model="timctrl_show" mode="single-column" :list="timctrl_list" @confirm="confirm($event,'timctrl')"></u-select>
|
|
|
</view>
|
|
|
<view class="tit">
|
|
|
时控时长
|
|
|
</view>
|
|
|
<view class="selectTime">
|
|
|
- <view class="uni-list-cell time" @click="selectTime('st1')">
|
|
|
- <text>{{equipContrlForm1.st||'开始时间'}}</text>
|
|
|
+ <view class="uni-list-cell time" @click="selectTime('st')">
|
|
|
+ <text>{{time.time1||'开始时间'}}</text>
|
|
|
<u-icon name="clock"></u-icon>
|
|
|
</view>
|
|
|
<text class="line">-</text>
|
|
|
- <view class="uni-list-cell time" @click="selectTime('et1')">
|
|
|
- <text>{{equipContrlForm1.et||'结束时间'}}</text>
|
|
|
+ <view class="uni-list-cell time" @click="selectTime('et')">
|
|
|
+ <text>{{time.time2||'结束时间'}}</text>
|
|
|
<u-icon name="clock"></u-icon>
|
|
|
</view>
|
|
|
- <u-select v-model="timeShow" mode="single-column" :list="timeList" @confirm="collConfirm($event,timeType)"></u-select>
|
|
|
+ <u-select v-model="timeShow" mode="single-column" :list="timeList" @confirm="timeConfirm($event,timeType)"></u-select>
|
|
|
</view>
|
|
|
<view class="tit">
|
|
|
数据频率(min)
|
|
|
@@ -46,6 +46,10 @@
|
|
|
<view class="">
|
|
|
<slider :value="equipContrlForm1.dat_f" show-value="true" :min="10" :max="40" @change="sliderChange" block-color="#57C878" activeColor="#57C878" step="1" />
|
|
|
</view>
|
|
|
+ <view class="submit-box">
|
|
|
+ <u-button @click="submit" type="success">确定</u-button>
|
|
|
+ </view>
|
|
|
+ <u-toast ref="toast" />
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
@@ -55,14 +59,38 @@
|
|
|
return {
|
|
|
d_id:'',
|
|
|
equipContrlForm1: {
|
|
|
- // st: '', //时控开始时间
|
|
|
- // et: '', //时控结束时间
|
|
|
- // dat_f: null ,//数据上传时间间隔
|
|
|
- // ds:'',//开关,1开机,0关机
|
|
|
- //timctrl:''
|
|
|
+ st: '', //时控开始时间
|
|
|
+ et: '', //时控结束时间
|
|
|
+ dat_f: 10 ,//数据上传时间间隔
|
|
|
+ ds:'',//开关,1开机,0关机
|
|
|
+ timctrl:''//时控开关 1开,0关
|
|
|
},
|
|
|
+ time:{
|
|
|
+ time1:'',
|
|
|
+ time2:''
|
|
|
+ },
|
|
|
+ ds_list:[{
|
|
|
+ value:0,
|
|
|
+ label:'关机'
|
|
|
+ },{
|
|
|
+ value:1,
|
|
|
+ label:'开机'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ ds_show:false,
|
|
|
+ timctrl_list:[
|
|
|
+ {
|
|
|
+ value:0,
|
|
|
+ label:'关'
|
|
|
+ },{
|
|
|
+ value:1,
|
|
|
+ label:'开'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ timctrl_show:false,
|
|
|
timeList:[],
|
|
|
timeShow:false,
|
|
|
+ timeType:''
|
|
|
}
|
|
|
},
|
|
|
onLoad(option){
|
|
|
@@ -80,12 +108,104 @@
|
|
|
}
|
|
|
})
|
|
|
console.log(res)
|
|
|
+ let obj = {
|
|
|
+ st: res.work_tim.st,
|
|
|
+ et: res.work_tim.et,
|
|
|
+ timctrl: res.work_tim.timctrl,
|
|
|
+ ds: res.power.ds,
|
|
|
+ dat_f: res.data_tim.dat_f,
|
|
|
+ };
|
|
|
+ this.equipContrlForm1=obj
|
|
|
+ this.time.time1= obj.st && obj.st < 10 ? "0" + obj.st + ":00" : obj.st + ":00";
|
|
|
+ this.time.time2= obj.et && obj.et < 10 ? "0" + obj.et + ":00" : obj.et + ":00";
|
|
|
},
|
|
|
- equipBtnControl(){
|
|
|
-
|
|
|
+ async equipBtnControl(cmd){
|
|
|
+ let res=await this.$myRequest({
|
|
|
+ url:'/api/api_gateway?method=forecast.send_control.admin_device_control',
|
|
|
+ data:{
|
|
|
+ cmd,
|
|
|
+ device_type_id: 4,
|
|
|
+ d_id: this.d_id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(res){
|
|
|
+ this.$refs.toast.show({
|
|
|
+ title: '指令下发成功!',
|
|
|
+ type: 'success',
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
sliderChange(e){
|
|
|
+ this.equipContrlForm1.dat_f=e.detail.value
|
|
|
+ },
|
|
|
+ selectTime(a){
|
|
|
+ this.timeType=a
|
|
|
+ if(this.timeList.length==0){
|
|
|
+ let arr=[]
|
|
|
+ for(let i=0;i<24;i++){
|
|
|
+ let label=i<10?`0${i}:00`:`${i}:00`
|
|
|
+ arr.push({
|
|
|
+ value:i,
|
|
|
+ label
|
|
|
+ })
|
|
|
+ }
|
|
|
+ arr.unshift({
|
|
|
+ value:'',
|
|
|
+ label:'重置'
|
|
|
+ })
|
|
|
+ this.timeList=arr
|
|
|
+ }
|
|
|
|
|
|
+
|
|
|
+ this.timeShow=true
|
|
|
+ },
|
|
|
+ confirm(e,a){
|
|
|
+ if(a=='ds'){
|
|
|
+ this.equipContrlForm1.ds=e[0].value
|
|
|
+ }else if(a=='timctrl'){
|
|
|
+ this.equipContrlForm1.timctrl=e[0].value
|
|
|
+ }
|
|
|
+ },
|
|
|
+ timeConfirm(e,a){
|
|
|
+ if(a=='st'){
|
|
|
+ this.time.time1=e[0].label
|
|
|
+ this.equipContrlForm1.st=e[0].value
|
|
|
+ }else{
|
|
|
+ this.time.time2=e[0].label
|
|
|
+ this.equipContrlForm1.et=e[0].value
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async submit(){
|
|
|
+ console.log(this.equipContrlForm1)
|
|
|
+ let obj = {
|
|
|
+ work_tim: {
|
|
|
+ timctrl: this.equipContrlForm1.timctrl,
|
|
|
+ st: this.equipContrlForm1.st,
|
|
|
+ et: this.equipContrlForm1.et ,
|
|
|
+ },
|
|
|
+ data_tim: { dat_f: this.equipContrlForm1.dat_f },
|
|
|
+ power: { ds: this.equipContrlForm1.ds },
|
|
|
+ };
|
|
|
+ let res=await this.$myRequest({
|
|
|
+ url:'/api/api_gateway?method=forecast.send_control.device_control',
|
|
|
+ data:{
|
|
|
+ device_type_id: 4,
|
|
|
+ d_id: this.d_id,
|
|
|
+ config: JSON.stringify(obj),
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(res){
|
|
|
+ this.$refs.toast.show({
|
|
|
+ title: '修改成功!',
|
|
|
+ type: 'success',
|
|
|
+ callback:function(){
|
|
|
+ uni.navigateBack({
|
|
|
+ delta: 1
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -133,5 +253,8 @@ page{
|
|
|
}
|
|
|
.line{width:50rpx;text-align: center;}
|
|
|
}
|
|
|
+ .submit-box{
|
|
|
+ margin-top:60rpx
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|