equip-set.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. <template>
  2. <view>
  3. <view class="tit adminTit">
  4. 联网模块
  5. </view>
  6. <view class="btns">
  7. <button type="warn" size="mini">升级</button>
  8. <button type="warn" size="mini">重启</button>
  9. <button type="warn" size="mini">MQTT配置</button>
  10. </view>
  11. <view class="tit adminTit">
  12. 板子设置
  13. </view>
  14. <view class="btns">
  15. <button type="warn" size="mini">查看原始IMEI</button>
  16. <button type="warn" size="mini">更改IMEI</button>
  17. </view>
  18. <view class="tit adminTit">
  19. 强制操作
  20. </view>
  21. <view class="btns">
  22. <button type="warn" size="mini">拍照</button>
  23. <button type="warn" size="mini">升级</button>
  24. <button type="warn" size="mini">重启</button>
  25. <button type="warn" size="mini">震动关闭</button>
  26. <button type="warn" size="mini">震动开启</button>
  27. </view>
  28. <view class="tit">
  29. 设备开关
  30. </view>
  31. <view class="uni-list-cell">
  32. <picker @change="turnChange($event,'ds')" value="equipContrlForm.ds" :range="dsArr">
  33. <text class="uni-input">{{dsArr[equipContrlForm.ds]}}</text>
  34. <view class="arrow"></view>
  35. </picker>
  36. </view>
  37. <view class="tit">
  38. 工作模式
  39. </view>
  40. <view class="uni-list-cell">
  41. <picker @change="turnChange($event,'ws')" :value="equipContrlForm.ws" :range="wsArr">
  42. <text class="uni-input">{{wsArr[equipContrlForm.ws]}}</text>
  43. <view class="arrow"></view>
  44. </picker>
  45. </view>
  46. <view class="tit">
  47. 定时模式
  48. </view>
  49. <view class="uni-list-cell">
  50. <picker @change="turnChange($event,'ts')" :value="equipContrlForm.ts" :range="tsArr">
  51. <text class="uni-input">{{tsArr[equipContrlForm.ts]}}</text>
  52. <view class="arrow"></view>
  53. </picker>
  54. </view>
  55. <template v-if="equipContrlForm.ts==0">
  56. <view class="tit">
  57. 定时时长(h)
  58. </view>
  59. <view class="">
  60. <slider :value="equipContrlForm.tt" show-value="true" :min="1" :max="10" @change="sliderChange($event,'tt')" block-color="#57C878" activeColor="#57C878" step="1" />
  61. </view>
  62. </template>
  63. <template v-if="equipContrlForm.ts==1">
  64. <view class="tit">
  65. 开始结束时间
  66. </view>
  67. <view class="selectTime">
  68. <view class="uni-list-cell time" @click="selectTime('st')">
  69. <text>{{stLabel}}</text>
  70. <u-icon name="clock"></u-icon>
  71. </view>
  72. <text class="line">-</text>
  73. <view class="uni-list-cell time" @click="selectTime('et')">
  74. <text>{{etLabel}}</text>
  75. <u-icon name="clock"></u-icon>
  76. </view>
  77. </view>
  78. <u-select v-model="stShow" mode="single-column" :list="list" @confirm="stConfirm"></u-select>
  79. <u-select v-model="etShow" mode="single-column" :list="list" @confirm="etConfirm"></u-select>
  80. </template>
  81. <view class="tit">
  82. 落虫时间(min)
  83. </view>
  84. <view class="">
  85. <slider :value="equipContrlForm.collt" show-value="true" :min="1" :max="20" @change="sliderChange($event,'collt')" block-color="#57C878" activeColor="#57C878" step="1" />
  86. </view>
  87. <view class="tit">
  88. 加热时间(min)
  89. </view>
  90. <view class="">
  91. <slider :value="equipContrlForm.htim" show-value="true" :min="1" :max="20" @change="sliderChange($event,'htim')" block-color="#57C878" activeColor="#57C878" step="1" />
  92. </view>
  93. <view class="tit">
  94. 加热温度(℃)
  95. </view>
  96. <view class="">
  97. <slider :value="equipContrlForm.hst" show-value="true" :min="75" :max="120" @change="sliderChange($event,'hst')" block-color="#57C878" activeColor="#57C878" step="1" />
  98. </view>
  99. <view class="tit">
  100. 高温保护阈值(℃)
  101. </view>
  102. <view class="">
  103. <slider :value="equipContrlForm.tph" show-value="true" :min="50" :max="70" @change="sliderChange($event,'tph')" block-color="#57C878" activeColor="#57C878" step="1" />
  104. </view>
  105. <view class="tit">
  106. 低温保护阈值(℃)
  107. </view>
  108. <view class="">
  109. <slider :value="equipContrlForm.tpl" show-value="true" :min="1" :max="10" @change="sliderChange($event,'tpl')" block-color="#57C878" activeColor="#57C878" step="1" />
  110. </view>
  111. <view class="tit">
  112. 数据上传间隔(min)
  113. </view>
  114. <view class="">
  115. <slider :value="equipContrlForm.datt" show-value="true" :min="10" :max="60" @change="sliderChange($event,'datt')" block-color="#57C878" activeColor="#57C878" step="1" />
  116. </view>
  117. <view class="submit-box">
  118. <u-button @click="submit" type="success">确定</u-button>
  119. </view>
  120. </view>
  121. </template>
  122. <script>
  123. export default {
  124. data() {
  125. return {
  126. d_id:'',
  127. dsArr:['开机','关机'],
  128. dsIndex:0,
  129. wsArr:['待机','工作'],
  130. wsIndex:0,
  131. tsArr:['光控','时控'],
  132. tsIndex:0,
  133. imgresArr:['高','中','低'],
  134. imgresIndex:"",
  135. equipContrlForm:{
  136. ds:0,//设备开关
  137. ws:0,//工作模式
  138. ts:0,//定时模式
  139. tt:1,//定时时长
  140. collt: 1,
  141. htim: 1,
  142. hst: 75,
  143. tph: 50,
  144. tpl: 1,
  145. datt: 10,
  146. st: null,
  147. et: null,
  148. },
  149. stShow:false,
  150. etShow:false,
  151. stLabel:'00:00',
  152. etLabel:'00:00',
  153. list:[
  154. {
  155. value:0,
  156. label:'00:00'
  157. },
  158. {
  159. value:1,
  160. label:'01:00'
  161. },
  162. {
  163. value:2,
  164. label:'02:00'
  165. },
  166. {
  167. value:3,
  168. label:'03:00'
  169. },
  170. {
  171. value:4,
  172. label:'04:00'
  173. },
  174. {
  175. value:5,
  176. label:'05:00'
  177. },
  178. {
  179. value:6,
  180. label:'06:00'
  181. },
  182. {
  183. value:7,
  184. label:'04:00'
  185. }, {
  186. value:8,
  187. label:'08:00'
  188. },
  189. {
  190. value:9,
  191. label:'09:00'
  192. },
  193. {
  194. value:10,
  195. label:'10:00'
  196. },
  197. {
  198. value:11,
  199. label:'11:00'
  200. },
  201. {
  202. value:12,
  203. label:'12:00'
  204. },
  205. {
  206. value:13,
  207. label:'13:00'
  208. },
  209. {
  210. value:14,
  211. label:'14:00'
  212. }, {
  213. value:15,
  214. label:'15:00'
  215. },
  216. {
  217. value:16,
  218. label:'16:00'
  219. },
  220. {
  221. value:17,
  222. label:'17:00'
  223. },
  224. {
  225. value:18,
  226. label:'18:00'
  227. },
  228. {
  229. value:19,
  230. label:'19:00'
  231. },
  232. {
  233. value:20,
  234. label:'20:00'
  235. },
  236. {
  237. value:21,
  238. label:'21:00'
  239. }, {
  240. value:22,
  241. label:'22:00'
  242. },
  243. {
  244. value:23,
  245. label:'23:00'
  246. },
  247. ]
  248. }
  249. },
  250. onLoad(option){
  251. this.d_id=option.d_id
  252. this.getInfo()
  253. },
  254. methods: {
  255. turnChange(e,a){
  256. if(a=='ds'){
  257. // this.dsIndex = e.target.value
  258. this.equipContrlForm.ds=e.target.value
  259. }else if(a=='ws'){
  260. // this.wsIndex = e.target.value
  261. this.equipContrlForm.ws=e.target.value
  262. }else if(a=='ts'){
  263. // this.tsIndex = e.target.value
  264. this.equipContrlForm.ts=e.target.value
  265. }
  266. },
  267. stConfirm(e){
  268. this.stLabel=e[0].label
  269. this.equipContrlForm.st=e[0].value
  270. },
  271. etConfirm(e){
  272. this.etLabel=e[0].label
  273. this.equipContrlForm.et=e[0].value
  274. },
  275. selectTime(a){
  276. if(a=='st'){
  277. this.stShow=true;
  278. }else{
  279. this.etShow=true;
  280. }
  281. },
  282. sliderChange(e,a){
  283. let val=e.detail.value
  284. switch(a){
  285. case 'tt':
  286. this.equipContrlForm.tt=val;
  287. break;
  288. case 'collt':
  289. this.equipContrlForm.collt=val;
  290. break;
  291. case 'htim':
  292. this.equipContrlForm.htim=val;
  293. break;
  294. case 'hst':
  295. this.equipContrlForm.hst=val;
  296. break;
  297. case 'tph':
  298. this.equipContrlForm.tph=val;
  299. break;
  300. case 'tpl':
  301. this.equipContrlForm.tpl=val;
  302. break;
  303. case 'datt':
  304. this.equipContrlForm.datt=val;
  305. break;
  306. }
  307. },
  308. async getInfo(){
  309. let res=await this.$myRequest({
  310. url:'/api/api_gateway?method=forecast.send_control.device_control_info',
  311. data:{
  312. d_id:this.d_id,
  313. cmd: 'paramconf'
  314. }
  315. })
  316. this.equipContrlForm=res
  317. console.log(res)
  318. },
  319. async submit(){
  320. console.log(this.equipContrlForm)
  321. let res=await this.$myRequest({
  322. url:'/api/api_gateway?method=forecast.send_control.device_control',
  323. data:{
  324. device_type_id:'',
  325. d_id: this.d_id,
  326. config: JSON.stringify(this.equipContrlForm)
  327. }
  328. })
  329. }
  330. }
  331. }
  332. </script>
  333. <style lang="scss">
  334. page{
  335. padding:20rpx;
  336. .tit{
  337. line-height:30rpx;
  338. font-size:30rpx;
  339. padding-left:20rpx;
  340. border-left-width:2px;
  341. border-left-style: solid;
  342. border-left-color:$uni-color-success;
  343. margin:30rpx 0;
  344. }
  345. .adminTit{border-left-color:#e64340;}
  346. .btns{
  347. display:flex;
  348. justify-content: flex-start;
  349. flex-wrap:no-wrap;
  350. button{margin:0;margin-right:10rpx;padding:0 25rpx;}
  351. }
  352. .uni-list-cell{
  353. background:#F7F8FA;
  354. padding:10rpx 40rpx;
  355. font-size:28rpx;
  356. .arrow{
  357. display:inline-block;
  358. border-width:12rpx 8rpx ;
  359. border-style: solid;
  360. float:right;
  361. margin-top:10rpx;
  362. border-color:#888 transparent transparent transparent;
  363. }
  364. }
  365. .selectTime{
  366. display:flex;
  367. .time{
  368. width:350rpx;
  369. display:flex;
  370. justify-content: space-between;
  371. }
  372. .line{width:50rpx;text-align: center;}
  373. }
  374. .submit-box{
  375. margin-top:60rpx
  376. }
  377. }
  378. </style>