| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- <template>
- <view>
- <view class="status_bar"></view>
- <view class="" style="position: relative;top: 44px;">
- <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="contros_box">
- <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" v-if="led==1">
- <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">
- <p>显示时间设置(min) :</p>
- <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="0" v-model="config.interval" @change="sliderChange" step="1" min="0" max="359" show-value block-size="18" activeColor="#57C878" />
- </view>
- </view>
- <view class="ensure">
- <view class="ensure_btn" @click="ensure">
- 确 定
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- config: {
- content: "",
- timeout: "",
- interval: 1
- },
- id: '',
- led:0
- }
- },
- methods: {
- // forecast.send_control.device_control_info 设备配置查询
- async controsdata(datas) { //提交数据
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=forecast.send_control.device_control_info',
- data: {
- d_id: this.id,
- cmd: "config"
- }
- })
- console.log(res)
- this.config.interval = res.interval
- this.led = Number(res.led)
- },
- //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=forecast.send_control.device_control',
- data: {
- device_type_id: 5,
- d_id: this.id,
- config: JSON.stringify(datas)
- }
- })
- console.log(res)
- if(res){
- uni.showToast({
- title: '指令下发成功!'
- });
- }else{
- uni.showToast({
- title: '指令下发失败!',
- icon: "none"
- });
- }
- },
- //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: '指令下发失败!',
- icon: "none"
- });
- }
- },
- //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: "interval"
- }
- })
- console.log(res)
- if (res == true) {
- uni.showToast({
- title: '指令下发成功!'
- });
- } else {
- uni.showToast({
- title: '指令下发失败!',
- icon: "none"
- });
- }
- },
- clickLeft() { //返回
- uni.navigateBack({
- delta: 1
- })
- },
- ensure() { //提交
- this.timing(this.config)
- console.log(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
- },
- onShow() {
- this.controsdata()
- }
- }
- </script>
- <style lang="scss">
- .operation_title {
- border-left: 6rpx solid #28AE4F;
- padding-left: 20rpx;
- margin-bottom: 20rpx;
- height: 36rpx;
- }
- .contros_box{
- position: absolute;
- top: 54px;
- width: 90%;
- left: 5%;
- }
- .operation {
- width: 95%;
- .operation_btn {
- display: flex;
- padding-left: 20rpx;
- box-sizing: border-box;
- button {
- font-size: 24rpx;
- background-color: #28AE4F;
- color: #FFFFFF;
- box-sizing: border-box;
- height: 60rpx;
- }
- button:last-child {
- width: 360rpx !important;
- }
- }
- }
- .viewing {
- width: 95%;
- margin-top: 30rpx;
- .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: 16rpx 0 0 10rpx;
- width: 380rpx;
- }
- }
- }
- }
- .timing {
- width: 95%;
- margin-top: 30rpx;
- }
- .ensure {
- width: 100%;
- margin-top: 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>
|