contros.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <view>
  3. <view style="position: fixed;z-index: 100;width: 100%;">
  4. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="设备控制"></uni-nav-bar>
  5. </view>
  6. <view class="operation">
  7. <p class="operation_title">操作</p>
  8. <view class="operation_btn">
  9. <button @click="chongqi">重 启</button>
  10. <button @click="shengji">升 级</button>
  11. <button @click="search">查询时间上传间隔</button>
  12. </view>
  13. </view>
  14. <view class="viewing">
  15. <p class="operation_title">显示屏设置</p>
  16. <view class="viewing_text">
  17. <view class="viewing_text_top">
  18. 标题文字设置 :
  19. <input type="text" v-model="config.content" />
  20. </view>
  21. <view class="viewing_text_bot">
  22. 显示时间设置(min) :
  23. <input type="number" v-model="config.timeout" />
  24. </view>
  25. </view>
  26. </view>
  27. <view class="timing">
  28. <p class="operation_title">上传时间间隔(min)</p>
  29. <view class="timing_text">
  30. <slider value="1" @change="sliderChange" step="1" min="1" max="360" show-value block-size="18" activeColor="#57C878"/>
  31. </view>
  32. </view>
  33. <view class="ensure">
  34. <view class="ensure_btn" @click="ensure">
  35. 确 定
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. export default {
  42. data() {
  43. return {
  44. config:{
  45. content:"",
  46. timeout:"",
  47. interval:""
  48. },
  49. id:''
  50. }
  51. },
  52. methods: {
  53. //forecast.send_control.device_control config: {"interval":10,"content":"content","timeout":"1"}
  54. async timing(datas) { //提交数据
  55. const res = await this.$myRequest({
  56. url: '/api/api_gateway?method=weather.weather.qxz_status',
  57. data: {
  58. device_type_id: 5,
  59. d_id:this.id ,
  60. config:JSON.stringify(datas)
  61. }
  62. })
  63. },
  64. //forecast.send_control.admin_device_control
  65. async restart(datas) { //重启
  66. const res = await this.$myRequest({
  67. url: '/api/api_gateway?method=forecast.send_control.admin_device_control',
  68. data: {
  69. device_type_id: 5,
  70. d_id:this.id,
  71. cmd:datas
  72. }
  73. })
  74. if(res == true){
  75. uni.showToast({
  76. title: '指令下发成功!'
  77. });
  78. }else{
  79. uni.showToast({
  80. title: '指令下发失败!'
  81. });
  82. }
  83. },
  84. //forecast.send_control.get_device_config
  85. async uploading() { //上传时间
  86. const res = await this.$myRequest({
  87. url: '/api/api_gateway?method=forecast.send_control.get_device_config',
  88. data: {
  89. device_type_id: 5,
  90. d_id:this.id,
  91. control_type :"data"
  92. }
  93. })
  94. console.log(res)
  95. if(res == true){
  96. uni.showToast({
  97. title: '指令下发成功!'
  98. });
  99. }else{
  100. uni.showToast({
  101. title: '指令下发失败!'
  102. });
  103. }
  104. },
  105. clickLeft(){//返回
  106. uni.navigateBack({
  107. delta:1
  108. })
  109. },
  110. ensure(){//提交
  111. this.timing(this.config)
  112. },
  113. sliderChange(e){//滑动块
  114. this.config.interval = e.detail.value
  115. },
  116. chongqi(){//重启按钮
  117. this.restart('reboot')
  118. },
  119. shengji(){//升级按钮
  120. this.restart('update')
  121. },
  122. search(){//查询按钮
  123. this.uploading()
  124. }
  125. },
  126. onLoad(option){
  127. this.id = option.id
  128. }
  129. }
  130. </script>
  131. <style lang="scss">
  132. .operation_title{
  133. border-left: 6rpx solid #28AE4F;
  134. padding-left: 20rpx;
  135. margin-bottom: 20rpx;
  136. height: 36rpx;
  137. }
  138. .operation{
  139. position: absolute;
  140. top: 54px;
  141. width: 90%;
  142. left: 5%;
  143. .operation_btn{
  144. display: flex;
  145. padding-left: 20rpx;
  146. button{
  147. font-size: 24rpx;
  148. padding:0 38rpx;
  149. background-color: #28AE4F;
  150. color: #FFFFFF;
  151. }
  152. button:last-child{
  153. width: 360rpx !important;
  154. }
  155. }
  156. }
  157. .viewing{
  158. position: absolute;
  159. top: 124px;
  160. width: 90%;
  161. left: 5%;
  162. .viewing_text{
  163. .viewing_text_top,.viewing_text_bot{
  164. display:flex;
  165. background-color: #F7F8FA;
  166. padding-left: 20rpx;
  167. margin-bottom: 20rpx;
  168. height: 60rpx;
  169. line-height: 60rpx;
  170. font-size: 24rpx;
  171. input{
  172. font-size: 24rpx;
  173. margin-top: 16rpx;
  174. width: 400rpx;
  175. }
  176. }
  177. }
  178. }
  179. .timing{
  180. position: absolute;
  181. top: 234px;
  182. width: 90%;
  183. left: 5%;
  184. }
  185. .ensure{
  186. width: 100%;
  187. position: absolute;
  188. bottom: 30rpx;
  189. .ensure_btn{
  190. width: 90%;
  191. margin: 0 auto;
  192. height: 60rpx;
  193. line-height: 60rpx;
  194. text-align: center;
  195. background-color: #28AE4F;
  196. color: #FFFFFF;
  197. border-radius: 200rpx;
  198. }
  199. }
  200. </style>