| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- <template>
- <view>
- <view style="position: fixed;z-index: 100;width: 100%;">
- <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="设备控制"></uni-nav-bar>
- </view>
- <view class="operation">
- <p class="operation_title">操作</p>
- <view class="operation_btn">
- <button @click="chongqi">重 启</button>
- <button @click="shengji">升 级</button>
- <button @click="search">查询时间上传间隔</button>
- </view>
- </view>
- <view class="viewing">
- <p class="operation_title">显示屏设置</p>
- <view class="viewing_text">
- <view class="viewing_text_top">
- 标题文字设置 :
- <input type="text" v-model="config.content" />
- </view>
- <view class="viewing_text_bot">
- 显示时间设置(min) :
- <input type="number" v-model="config.timeout" />
- </view>
- </view>
- </view>
- <view class="timing">
- <p class="operation_title">上传时间间隔(min)</p>
- <view class="timing_text">
- <slider value="1" @change="sliderChange" step="1" min="1" max="360" show-value block-size="18" activeColor="#57C878"/>
- </view>
- </view>
- <view class="ensure">
- <view class="ensure_btn" @click="ensure">
- 确 定
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- config:{
- content:"",
- timeout:"",
- interval:""
- },
- id:''
- }
- },
- methods: {
- //forecast.send_control.device_control config: {"interval":10,"content":"content","timeout":"1"}
- async timing(datas) { //提交数据
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=weather.weather.qxz_status',
- data: {
- device_type_id: 5,
- d_id:this.id ,
- config:JSON.stringify(datas)
- }
- })
- },
- //forecast.send_control.admin_device_control
- async restart(datas) { //重启
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=forecast.send_control.admin_device_control',
- data: {
- device_type_id: 5,
- d_id:this.id,
- cmd:datas
- }
- })
- if(res == true){
- uni.showToast({
- title: '指令下发成功!'
- });
- }else{
- uni.showToast({
- title: '指令下发失败!'
- });
- }
- },
- //forecast.send_control.get_device_config
- async uploading() { //上传时间
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=forecast.send_control.get_device_config',
- data: {
- device_type_id: 5,
- d_id:this.id,
- control_type :"data"
- }
- })
- console.log(res)
- if(res == true){
- uni.showToast({
- title: '指令下发成功!'
- });
- }else{
- uni.showToast({
- title: '指令下发失败!'
- });
- }
- },
- clickLeft(){//返回
- uni.navigateBack({
- delta:1
- })
- },
- ensure(){//提交
- this.timing(this.config)
- },
- sliderChange(e){//滑动块
- this.config.interval = e.detail.value
- },
- chongqi(){//重启按钮
- this.restart('reboot')
- },
- shengji(){//升级按钮
- this.restart('update')
- },
- search(){//查询按钮
- this.uploading()
- }
- },
- onLoad(option){
- this.id = option.id
- }
- }
- </script>
- <style lang="scss">
- .operation_title{
- border-left: 6rpx solid #28AE4F;
- padding-left: 20rpx;
- margin-bottom: 20rpx;
- height: 36rpx;
- }
- .operation{
- position: absolute;
- top: 54px;
- width: 90%;
- left: 5%;
- .operation_btn{
- display: flex;
- padding-left: 20rpx;
- button{
- font-size: 24rpx;
- padding:0 38rpx;
- background-color: #28AE4F;
- color: #FFFFFF;
- }
- button:last-child{
- width: 360rpx !important;
- }
- }
- }
- .viewing{
- position: absolute;
- top: 124px;
- width: 90%;
- left: 5%;
- .viewing_text{
- .viewing_text_top,.viewing_text_bot{
- display:flex;
- background-color: #F7F8FA;
- padding-left: 20rpx;
- margin-bottom: 20rpx;
- height: 60rpx;
- line-height: 60rpx;
- font-size: 24rpx;
- input{
- font-size: 24rpx;
- margin-top: 16rpx;
- width: 400rpx;
- }
- }
- }
- }
- .timing{
- position: absolute;
- top: 234px;
- width: 90%;
- left: 5%;
- }
- .ensure{
- width: 100%;
- position: absolute;
- bottom: 30rpx;
- .ensure_btn{
- width: 90%;
- margin: 0 auto;
- height: 60rpx;
- line-height: 60rpx;
- text-align: center;
- background-color: #28AE4F;
- color: #FFFFFF;
- border-radius: 200rpx;
- }
- }
- </style>
|