<template>
	<view>
		<view class="tit adminTit">
			操作
		</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>
		</view>
		<view class="tit adminTit">
			设备开关
		</view>
		<view class="uni-list-cell"  @click="on_off_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>
		</view>
		<view class="tit adminTit">
			时控开关
		</view>
		<view class="uni-list-cell"  @click="on_off_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>
		</view>
		<view class="tit">
			时控时长
		</view>
		<view class="selectTime">
			<view class="uni-list-cell time" @click="selectTime('st1')">
				<text>{{equipContrlForm1.st||'开始时间'}}</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>
				<u-icon name="clock"></u-icon>
			</view>
			<u-select v-model="timeShow" mode="single-column" :list="timeList" @confirm="collConfirm($event,timeType)"></u-select>
		</view>
		<view class="tit">
			数据频率(min)
		</view>
		<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>
</template>

<script>
	export default {
		data() {
			return {
				d_id:'',
				equipContrlForm1: {
			        // st: '', //时控开始时间
			        // et: '', //时控结束时间
			        // dat_f: null ,//数据上传时间间隔
			        // ds:'',//开关，1开机，0关机
					//timctrl:''
			    },	
				timeList:[],
				timeShow:false,
			}
		},
		onLoad(option){
			this.d_id=option.d_id
			this.equipSet()
		},
		methods: {
			//回显设备控制参数
			async equipSet(){
				let res=await this.$myRequest({
					url:'/api/api_gateway?method=forecast.send_control.device_control_info',
					data:{
						d_id:this.d_id,
						cmd: "paramconf" 
					}
				})
				console.log(res)
			},
			equipBtnControl(){
				
			},
			sliderChange(e){
				
			}
		}
	}
</script>

<style lang="scss">
page{
	padding:20rpx;
	.tit{
		line-height:30rpx;
		font-size:30rpx;
		padding-left:20rpx;
		border-left-width:2px;
		border-left-style: solid;
		border-left-color:$uni-color-success;
		margin:30rpx 0;
		}
	.adminTit{border-left-color:#e64340;}
	.btns{
		display:flex;
		justify-content: flex-start;
		flex-wrap:no-wrap;
		button{margin:0;margin-right:10rpx;padding:0 25rpx;}
	}
	.uni-list-cell{
		background:#F7F8FA;
		padding:10rpx 40rpx;
		font-size:28rpx;
		.arrow{
			display:inline-block;
			border-width:12rpx 8rpx ;
			border-style: solid;
			float:right;
			margin-top:10rpx;
			border-color:#888 transparent transparent transparent;
		}
	}
	.selectTime{
		display:flex;
		margin-bottom:20rpx;
		.time{
			width:350rpx;
			display:flex;
			justify-content: space-between;
		}
		.line{width:50rpx;text-align: center;}
	}
}
</style>
