autoOff.vue 23 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045
  1. <template>
  2. <view>
  3. <u-navbar :title="title" title-color="#101010">
  4. <view slot="right" @click="submitApi">
  5. <img src="@/assets/img/riLine-check-line 1.svg" alt="" />
  6. </view>
  7. </u-navbar>
  8. <view class="time-group">
  9. <view class="time-item" @click="typeShow=true">
  10. <view class="time">
  11. <view class="time-slot">
  12. 重复
  13. </view>
  14. <view class="type weeklistclass" v-if="typeShowIndex==2">
  15. <template v-for="(item,i) in weekdaysList">
  16. <template v-if="item==1">
  17. <span :key="i">
  18. {{weeklist[i]}}
  19. </span>
  20. <span class="weeklistclassSpan" :key="i+'a'" >
  21. ,
  22. </span>
  23. </template>
  24. </template>
  25. </view>
  26. <view class="type" v-else >
  27. {{typeShowIndex==0?'执行一次':''}}
  28. {{typeShowIndex==1?'每天':''}}
  29. </view>
  30. </view>
  31. <view class="more">
  32. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  33. </view>
  34. </view>
  35. <view class="time-item" v-show="switchStatus==2"
  36. @click="pickerShow4=true">
  37. <view class="time">
  38. <view class="time-slot" >
  39. 供电时间段
  40. </view>
  41. <view class="type">
  42. {{startTime?startTimeStr(startTime)+'-':'未设置'}}
  43. {{showjp2time(startTime,endTime)?'次日':''}}
  44. {{endTime?startTimeStr(endTime):''}}
  45. </view>
  46. </view>
  47. <view class="more">
  48. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  49. </view>
  50. </view>
  51. <view class="time-item" v-show="switchStatus==3"
  52. @click="pickerShow3=true">
  53. <view class="time">
  54. <view class="time-slot" >
  55. 智能停电时间区间
  56. </view>
  57. <view class="type">
  58. {{startTime?startTimeStr(startTime)+'-':'未设置'}}
  59. {{showjp2time(startTime,endTime)?'次日':''}}
  60. {{endTime?startTimeStr(endTime):''}}
  61. </view>
  62. </view>
  63. <view class="more">
  64. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  65. </view>
  66. </view>
  67. <view class="time-item" v-show="switchStatus==1"
  68. @click="pickerShow1=true">
  69. <view class="time">
  70. <view class="time-slot" >
  71. 供电时间
  72. </view>
  73. <view class="type">
  74. {{startTime?startTimeStr(startTime):'未设置'}}
  75. </view>
  76. </view>
  77. <view class="more">
  78. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  79. </view>
  80. </view>
  81. <view class="time-item" v-show="switchStatus==0"
  82. @click="pickerShow2=true">
  83. <view class="time">
  84. <view class="time-slot" v-show="switchStatus==0">
  85. 停电时间
  86. </view>
  87. <view class="type">
  88. {{endTime?startTimeStr(endTime):'未设置'}}
  89. </view>
  90. </view>
  91. <view class="more">
  92. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  93. </view>
  94. </view>
  95. <view class="time-item" v-show="switchStatus==3"
  96. @click="thresholdsPopup=true" >
  97. <view class="time">
  98. <view class="time-slot">
  99. 智能停电条件
  100. </view>
  101. <view class="type">
  102. {{formData.maxPower!=''?formData.maxPower+'kW':'未设置'}}
  103. </view>
  104. </view>
  105. <view class="more">
  106. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  107. </view>
  108. </view>
  109. <view class="time-item" v-show="switchStatus==3"
  110. >
  111. <view class="time">
  112. <view class="type">
  113. 1. 智能停电条件:智能停电是功率大于等于阈值持续达到一定时间后;<br/>
  114. 2. 达到智能停电条件后“自动停电”,1分钟后回复电源供电;<br/>
  115. 3.“智能停电”结束时,如果处于停电状态将打开电源供电;
  116. </view>
  117. </view>
  118. </view>
  119. <view class="time-item" v-show="switchStatus==2">
  120. <view class="time">
  121. <view class="type">
  122. 在时间段开始时间开启电源供电,时间段结束时间停止供电。
  123. </view>
  124. </view>
  125. </view>
  126. <view class="time-item2" v-show="startTime||endTime" >
  127. <view class="time">
  128. <view class="time-slot" >
  129. 用电设置图示
  130. </view>
  131. </view>
  132. <view class="progressText" >
  133. <view class="progress1" v-if="progress1style.width!='0%'" :style="progress1style" >{{progress1style.text}}</view>
  134. <view class="progress2">&nbsp;</view>
  135. <view class="progress3" v-if="progress3style.width!='0%'"
  136. :style="progress3style">{{progress3style.text}}</view>
  137. </view>
  138. <view class="progress" :style="{
  139. backgroundColor:progressColor
  140. }" >
  141. <view class="progress1" :style="progress1style" ></view>
  142. <view class="progress2">&nbsp;</view>
  143. <view class="progress3" :style="progress3style"></view>
  144. </view>
  145. <view class="type" style=" color: #777777; margin-top: 16rpx;" >
  146. <view></view>
  147. </view>
  148. <view class="type" style=" color: #777777;" v-if="switchStatus!=3">
  149. <view v-if="switchStatus==1||switchStatus==2">设置生效后将在{{gethtml(startTime)}}供电</view>
  150. <view v-if="switchStatus==0||switchStatus==2">设置生效后将在{{gethtml(endTime)}}停电</view>
  151. </view>
  152. <view class="type" style=" color: #777777;" v-else >
  153. <view>设置生效后将在{{gethtml(startTime)}}开启“智能停电”</view>
  154. <view>设置生效后将在{{gethtml(endTime)}}关闭“智能停电”</view>
  155. </view>
  156. </view>
  157. </view>
  158. <!-- 重复类型 -->
  159. <view class="repeatType" v-if="typeShow">
  160. <u-popup v-model="typeShow" mode="bottom">
  161. <view>
  162. <view class="headline">
  163. 重复类型
  164. </view>
  165. <view class="type-group">
  166. <view class="item" :class="{
  167. 'item-title-checked':typeShowIndex==0
  168. }" @click="typeShowIndex=0,typeShow=false">
  169. <view class="item-title " >
  170. 执行一次
  171. </view>
  172. <view class="item-icon item-icon1">
  173. <img src="@/assets/img/riLine-check-line.svg" alt="" />
  174. </view>
  175. <view class="item-icon item-icon2">
  176. <img src="" alt="" />
  177. </view>
  178. </view>
  179. <view class="item" :class="{
  180. 'item-title-checked':typeShowIndex==1
  181. }" @click="typeShowIndex=1,typeShow=false">
  182. <view class="item-title " > 每天
  183. </view>
  184. <view class="item-icon item-icon1">
  185. <img src="@/assets/img/riLine-check-line.svg" alt="" />
  186. </view>
  187. <view class="item-icon item-icon2">
  188. <img src="" alt="" />
  189. </view>
  190. </view>
  191. <view class="item" :class="{
  192. 'item-title-checked':typeShowIndex==2
  193. }" @click="customPopup=true,weekdaysListTemp=weekdaysList">
  194. <view class="item-title" >
  195. 自定义
  196. </view>
  197. <view class="item-icon item-icon1">
  198. <img src="@/assets/img/riLine-check-line.svg" alt="" />
  199. </view>
  200. <view class="item-icon item-icon2">
  201. <img src="" alt="" />
  202. </view>
  203. </view>
  204. </view>
  205. </view>
  206. </u-popup>
  207. </view>
  208. <!-- 关闭时间 -->
  209. <ujpPicker mode="time" jp="1" :default-time="startTime?'2024-1-1 '+startTime+':1':''"
  210. v-model="pickerShow1" :params="params" @confirm="pickerShow1confirm" ></ujpPicker>
  211. <ujpPicker mode="time" jp="2" :default-time="endTime?'2024-1-1 '+endTime+':1':''" :defaultStartTime="startTime"
  212. v-model="pickerShow2" :params="params" @confirm="pickerShow2confirm" ></ujpPicker>
  213. <!-- 自定义重复 -->
  214. <ujpPicker2 :texts="['开启“智能停电”','停止“智能停电”']"
  215. :defaultTime="startTime?'2024-1-1 '+startTime+':1':''"
  216. :defaultTime2="endTime?'2024-1-1 '+endTime+':1':''"
  217. v-model="pickerShow3" @confirm="pickerShow1confirm2" ></ujpPicker2>
  218. <ujpPicker2 :texts="['供电时间','停电时间']"
  219. :defaultTime="startTime?'2024-1-1 '+startTime+':1':''"
  220. :defaultTime2="endTime?'2024-1-1 '+endTime+':1':''"
  221. v-model="pickerShow4" @confirm="pickerShow1confirm2" ></ujpPicker2>
  222. <u-popup v-model="customPopup" mode="bottom">
  223. <view class="custom">
  224. <view class="headline">
  225. 自定义重复
  226. </view>
  227. <view class="radio-group">
  228. <checkbox-group @change="checkboxChange" >
  229. <view class="radio-item" v-for="(item,i) in weekdaysListTemp" :key="i">
  230. <view class="item-title" >
  231. {{weeklist[i]}}
  232. </view>
  233. <view class="item-value">
  234. <checkbox
  235. :value="''+i"
  236. :checked="item?true:false"
  237. ></checkbox>
  238. </view>
  239. </view>
  240. </checkbox-group>
  241. </view>
  242. <view class="btn-group">
  243. <view class="btn cancel" @click="customPopup=false">
  244. 取消
  245. </view>
  246. <view class="btn confirm" @click="customPopupApi" >
  247. 确认
  248. </view>
  249. </view>
  250. </view>
  251. </u-popup>
  252. <u-popup v-model="thresholdsPopup" mode="bottom">
  253. <view class="thresholds">
  254. <view class="headline">
  255. 智能停电条件:功率(kW)
  256. </view>
  257. <view class="input" style=" padding: 0 24rpx;">
  258. <u-input type="digit" min="1"
  259. v-model="maxPower" placeholder="填写触发智能停电的功率数值" />
  260. </view>
  261. <view class="btn-group">
  262. <view class="btn cancel" @click="thresholdsPopup=false" >
  263. 取消
  264. </view>
  265. <view class="btn confirm" @click="thresholdsPopupApi">
  266. 确认
  267. </view>
  268. </view>
  269. </view>
  270. </u-popup>
  271. </view>
  272. </template>
  273. <script>
  274. import ujpPicker from '@/components/u-picker.vue'
  275. import ujpPicker2 from '@/components/u-picker2.vue'
  276. import * as API from '@/apis/pagejs/meterTimer.js'
  277. import {
  278. hourDistanceArr,
  279. parseUnixTime,
  280. newDate
  281. } from '@/apis/utils/index.js'
  282. export default {
  283. components: {
  284. ujpPicker,ujpPicker2
  285. },
  286. data() {
  287. return {
  288. typeShow: true,
  289. pickerShow1: false,
  290. pickerShow2: false,
  291. pickerShow3: false,
  292. pickerShow4: false,
  293. typeShow: false,
  294. customPopup: false,
  295. thresholdsPopup: false,
  296. listtemp: [3,2,1,0],
  297. list: [
  298. {
  299. text:'智能停电',
  300. value:3
  301. },{
  302. text: '供电时间',
  303. value:2
  304. }, {
  305. text: '定时供电',
  306. value:1
  307. }, {
  308. text: '定时停电' ,
  309. value:0
  310. }],
  311. params: {
  312. year: false,
  313. month: false,
  314. day: false,
  315. hour: true,
  316. minute: true,
  317. second: false,
  318. },
  319. id:"",
  320. type:"",
  321. meterId:"",
  322. title:"",
  323. weekdaysListTemp:[0,0,0,0,0,0,0],
  324. weekdaysList:[0,0,0,0,0,0,0],
  325. weeklist:[
  326. '周一','周二','周三','周四','周五','周六','周日'
  327. ],
  328. typeShowIndex:0,
  329. startTime:"",
  330. endTime:"",
  331. maxPower:"",
  332. timerSwitch:{},
  333. switchStatus:"",
  334. formData:{
  335. meterId:"",
  336. weekdays:"",
  337. startTime:"",
  338. type:"",
  339. switchStatus:"",
  340. status:true,
  341. id:"",
  342. endTime:"",
  343. maxPower:"",
  344. },
  345. progressColor:"#53b56b",
  346. }
  347. },
  348. onLoad(op) {
  349. if(op.meterId){
  350. this.meterId=op.meterId;
  351. this.formData.meterId=this.meterId
  352. }
  353. if(op.type){
  354. this.type=op.type;
  355. this.title=this.list[this.type].text
  356. this.switchStatus=this.list[this.type].value
  357. }
  358. if(op.id){
  359. this.id=op.id;
  360. this.getMeterTimerDetails()
  361. }
  362. },
  363. computed:{
  364. progress1style(){
  365. var width=0;
  366. var color="red"
  367. this.progressColor="#53b56b"
  368. var text=""
  369. var textColor=""
  370. if(this.switchStatus==1||this.switchStatus==2||this.switchStatus==3){
  371. var startTime=this.startTime
  372. var endTime=this.endTime
  373. if(!startTime){
  374. startTime="9999"
  375. }
  376. if(!endTime){
  377. endTime="9999"
  378. }
  379. console.log(startTime,endTime)
  380. var num1=parseInt(startTime.replace(":",''))
  381. var num2=parseInt(endTime.replace(":",''))
  382. var num=parseInt(num1>num2?num2:num1)
  383. if(num1>num2){
  384. if(this.switchStatus!=1){
  385. color=" #53b56b"
  386. this.progressColor="red"
  387. }
  388. textColor=" red"
  389. if(this.switchStatus==3){
  390. text=`智能停电${endTime}`
  391. }else{
  392. text=`停电 (${endTime})`
  393. }
  394. }else{
  395. textColor="#53b56b"
  396. if(this.switchStatus==3){
  397. text=`智能停电${startTime}`
  398. }else{
  399. text+=`供电 (${startTime})`
  400. }
  401. }
  402. width=parseInt(num/2400*100)
  403. console.log(width)
  404. }else{
  405. }
  406. return {
  407. color:textColor,
  408. text:text,
  409. width: width+"%",
  410. backgroundColor:color
  411. }
  412. },
  413. progress3style(){
  414. var width=0;
  415. var color="red"
  416. var text=""
  417. var textColor=""
  418. if(this.switchStatus==0||this.switchStatus==2||this.switchStatus==3){
  419. var startTime=this.startTime
  420. var endTime=this.endTime
  421. if(!startTime){
  422. startTime="-1"
  423. }
  424. if(!endTime){
  425. endTime="-1"
  426. }
  427. var num1=parseInt(startTime.replace(":",''))
  428. var num2=parseInt(endTime.replace(":",''))
  429. if(num1<num2||this.switchStatus==0){
  430. textColor=" red"
  431. if(this.switchStatus==3){
  432. text=`智能停电${endTime}`
  433. }else{
  434. text=`停电(${endTime})`
  435. }
  436. }else{
  437. if(this.switchStatus!=0){
  438. color=" #53b56b"
  439. }
  440. textColor=" #53b56b"
  441. //this.progressColor="red"
  442. if(this.switchStatus==3){
  443. text=`智能停电${startTime}`
  444. }else{
  445. text+=`供电(${startTime})`
  446. }
  447. }
  448. var num=parseInt(num1<num2?num2:num1)
  449. width=parseInt((2400-num)/2400*100)
  450. }else{
  451. }
  452. return {
  453. color:textColor,
  454. text:text,
  455. width: width+"%",
  456. backgroundColor:color
  457. }
  458. }
  459. },
  460. methods: {
  461. gethtml(item) {
  462. var str = parseUnixTime(new Date().getTime(), '{y}-{m}-{d}');
  463. var time1 = new Date();
  464. var time2 = newDate(str + ' ' + item + ':00');
  465. var sz = []
  466. if (time1 > time2) {
  467. time2.setDate(time2.getDate() + 1)
  468. sz = hourDistanceArr(time1, time2)
  469. } else {
  470. sz = hourDistanceArr(time1, time2)
  471. }
  472. console.log(sz[0])
  473. return (sz[0] ? sz[0] + '小时' : '') + (sz[1] ? sz[1] + '分钟后' : '0分钟后')
  474. },
  475. showjp2time(time1,time2){
  476. if(time1&&time2){
  477. var num1=parseInt(time1.replace(":",''))
  478. var num2=parseInt(time2.replace(":",''))
  479. return num1>num2
  480. }else{
  481. return false
  482. }
  483. },
  484. getMeterTimerDetails(){
  485. uni.showLoading({
  486. title: "加载中",
  487. mask: true,
  488. })
  489. API.meterTimerDetails({
  490. id:this.id
  491. }).then((response) => {
  492. uni.hideLoading();
  493. var timerSwitch=response.data.timerSwitch;
  494. this.formData=timerSwitch
  495. this.meterId=timerSwitch.meterId
  496. this.type=this.listtemp[timerSwitch.switchStatus]
  497. this.switchStatus=this.list[this.type].value
  498. this.title=this.list[this.type].text
  499. if(timerSwitch.type==1){
  500. this.typeShowIndex=0;
  501. }else{
  502. if(timerSwitch.weekdays=="1,2,3,4,5,6,7"){
  503. this.typeShowIndex=1;
  504. }else{
  505. this.typeShowIndex=2;
  506. var sz=timerSwitch.weekdays.split(',');
  507. for(var i in sz){
  508. var num= parseInt(sz[i])-1
  509. this.weekdaysListTemp[num]=1
  510. }
  511. this.weekdaysList=this.weekdaysListTemp
  512. }
  513. }
  514. this.startTime=timerSwitch.startTime
  515. this.endTime=timerSwitch.endTime
  516. if(this.switchStatus==0){
  517. this.endTime=timerSwitch.startTime
  518. }
  519. this.maxPower=this.formData.maxPower
  520. }).catch(error => {
  521. uni.showToast({
  522. title: error,
  523. icon: "none"
  524. })
  525. })
  526. },
  527. thresholdsPopupApi(){
  528. if(this.maxPower!=''){
  529. if(this.maxPower<=0){
  530. uni.showToast({
  531. title: "请输入大于0的功率阈值(kw)",
  532. icon: "none"
  533. })
  534. }else{
  535. this.thresholdsPopup=false
  536. this.formData.maxPower=this.maxPower
  537. }
  538. }else{
  539. uni.showToast({
  540. title: "请填写智能停电条件:功率(kw)",
  541. icon: "none"
  542. })
  543. }
  544. },
  545. pickerShow1confirm2(e){
  546. if(e.hour+":"+e.minute+""==e.hour2+":"+e.minute2+""){
  547. this.pickerShow3=true
  548. uni.showToast({
  549. title: "请勿设置相同时间",
  550. icon: "none"
  551. })
  552. }else{
  553. this.startTime=e.hour+":"+e.minute+""
  554. this.endTime=e.hour2+":"+e.minute2+""
  555. }
  556. },
  557. pickerShow1confirm(e){
  558. this.startTime=e.hour+":"+e.minute+""
  559. //this.startTimeStr=e.hour+"时"+e.minute+"分"
  560. },
  561. startTimeStr(str){
  562. if(str){
  563. return str.replace(":","时")+"分"
  564. }else{
  565. return ''
  566. }
  567. },
  568. pickerShow2confirm(e){
  569. this.endTime=e.hour+":"+e.minute+""
  570. //this.endTimeStr=e.hour+"时"+e.minute+"分"
  571. },
  572. customPopupApi(){
  573. var str1=[0,0,0,0,0,0,0].join()
  574. var str2=this.weekdaysListTemp.join()
  575. if(str1!=str2){
  576. this.typeShowIndex=2;
  577. this.customPopup=false
  578. this.typeShow=false;
  579. this.weekdaysList=this.weekdaysListTemp;
  580. }else{
  581. uni.showToast({
  582. title: "请至少勾选一项",
  583. icon: "none"
  584. })
  585. }
  586. },
  587. checkboxChange(e){
  588. var sz=e.detail.value;
  589. this.weekdaysListTemp=[0,0,0,0,0,0,0]
  590. for(var i in sz){
  591. var k=sz[i]
  592. this.weekdaysListTemp[k]=1
  593. }
  594. console.log(this.weekdaysListTemp)
  595. },
  596. submitApi(){
  597. this.formData.weekdays=""
  598. this.formData.switchStatus=this.list[this.type].value
  599. if(!this.startTime){
  600. if(this.formData.switchStatus==1){
  601. uni.showToast({
  602. title: "请设置供电时间",
  603. icon: "none"
  604. })
  605. return
  606. }
  607. if(this.formData.switchStatus==2){
  608. uni.showToast({
  609. title: "请设置供电时间段",
  610. icon: "none"
  611. })
  612. return
  613. }
  614. if(this.formData.switchStatus==3){
  615. uni.showToast({
  616. title: "请设置智能停电时间区间",
  617. icon: "none"
  618. })
  619. return
  620. }
  621. }
  622. if(!this.endTime){
  623. if(this.formData.switchStatus==0){
  624. uni.showToast({
  625. title: "请设置停电时间",
  626. icon: "none"
  627. })
  628. return
  629. }
  630. }
  631. if(this.formData.switchStatus==0){
  632. this.formData.startTime=this.endTime
  633. }else{
  634. this.formData.startTime=this.startTime
  635. this.formData.endTime=this.endTime
  636. }
  637. if(!this.formData.endTime){
  638. this.formData.endTime=""
  639. }
  640. if(this.typeShowIndex==0){
  641. this.formData.type="1"
  642. }else{
  643. this.formData.type="2"
  644. var weekdaysList=this.weekdaysList
  645. if(this.typeShowIndex==1){
  646. this.formData.weekdays='1,2,3,4,5,6,7'
  647. }
  648. if(this.typeShowIndex==2){
  649. for(var i in weekdaysList){
  650. var day=weekdaysList[i]
  651. if(day==1){
  652. if(this.formData.weekdays!=""){
  653. this.formData.weekdays+=","
  654. }
  655. this.formData.weekdays+=(parseInt(i)+1)
  656. }
  657. }
  658. }
  659. }
  660. if(this.formData.switchStatus==3&&this.maxPower==''){
  661. uni.showToast({
  662. title: "请填写智能停电条件:功率(kw)",
  663. icon: "none"
  664. })
  665. return
  666. }else{
  667. this.formData.maxPower=this.maxPower;
  668. if(!this.formData.maxPower){
  669. this.formData.maxPower=''
  670. }
  671. }
  672. uni.showLoading({
  673. title: "加载中",
  674. mask: true,
  675. })
  676. API.saveSwitch(this.formData).then((response) => {
  677. //uni.hideLoading();
  678. //this.getMeterTimerListReady=true
  679. //this.timerSwitchList=response.data.timerSwitchList;
  680. uni.navigateBack();
  681. }).catch(error => {
  682. uni.showToast({
  683. title: error,
  684. icon: "none"
  685. })
  686. })
  687. }
  688. }
  689. }
  690. </script>
  691. <style lang="scss" scoped>
  692. .progressText{
  693. margin-top: 16rpx;
  694. margin-bottom: 2rpx;
  695. display: flex;
  696. justify-content: space-between;
  697. .progress1,.progress3{
  698. white-space: pre;
  699. background-color: #fff !important;
  700. }
  701. .progress1{
  702. text-align: right;
  703. }
  704. .progress3{
  705. text-align: left;
  706. min-width: 25%;
  707. }
  708. }
  709. .progress{
  710. background-color: #53b56b;
  711. color: #53b56b;
  712. height: 60rpx;
  713. border-radius: 30px;
  714. display: flex;
  715. justify-content: space-between;
  716. .progress1{
  717. border-radius: 30px 0 0 30px;
  718. }
  719. .progress3{
  720. border-radius:0 30px 30px 0;
  721. }
  722. }
  723. /deep/.u-slot-right {
  724. padding-right: 32rpx;
  725. img {
  726. width: 48rpx;
  727. height: 48rpx;
  728. }
  729. }
  730. .time-group {
  731. background-color: #fff;
  732. .time-item2 {
  733. padding: 24rpx 0;
  734. margin: 0 32rpx;
  735. .time {
  736. .time-slot {
  737. color: rgba(16, 16, 16, 1);
  738. font-size: 32rpx;
  739. }
  740. .type {
  741. color: rgba(119, 119, 119, 1);
  742. }
  743. }
  744. }
  745. .time-item {
  746. padding: 24rpx 0;
  747. margin: 0 32rpx;
  748. display: flex;
  749. justify-content: space-between;
  750. align-items: center;
  751. border-bottom: 1px solid rgba(221, 221, 221, 1);
  752. .time {
  753. .time-slot {
  754. color: rgba(16, 16, 16, 1);
  755. font-size: 32rpx;
  756. }
  757. .type {
  758. color: rgba(119, 119, 119, 1);
  759. }
  760. }
  761. }
  762. .time-item:last-of-type {
  763. border: none;
  764. }
  765. }
  766. .weeklistclassSpan:last-child{
  767. display: none;
  768. }
  769. // 重复类型
  770. .repeatType {
  771. .headline {
  772. color: rgba(16, 16, 16, 1);
  773. font-size: 36rpx;
  774. margin-top: 32rpx;
  775. font-weight: bold;
  776. text-align: center;
  777. }
  778. .type-group {
  779. margin-top: 24rpx;
  780. .item {
  781. display: flex;
  782. align-items: center;
  783. justify-content: space-between;
  784. height: 96rpx;
  785. line-height: 96rpx;
  786. border-bottom: 1px solid rgba(245,245,245,1);
  787. padding: 0 32rpx;
  788. }
  789. .time-item:last-of-type{
  790. border: none;
  791. }
  792. .item-title {
  793. color: rgb(16, 16, 16);
  794. font-size: 32rpx;
  795. }
  796. .item-icon1{
  797. display: none;
  798. }
  799. .item-icon2{
  800. display: block;
  801. }
  802. .item-title-checked {
  803. color: rgba(22, 119, 255, 1);
  804. .item-title {
  805. color: rgba(22, 119, 255, 1);
  806. font-size: 32rpx;
  807. }
  808. .item-icon1{
  809. display: block;
  810. }
  811. .item-icon2{
  812. display: none;
  813. }
  814. }
  815. }
  816. }
  817. // 自定义重复
  818. .custom,
  819. .thresholds {
  820. padding: 32rpx 0;
  821. .headline {
  822. color: rgba(16, 16, 16, 1);
  823. font-size: 36rpx;
  824. margin-bottom: 32rpx;
  825. font-weight: bold;
  826. text-align: center;
  827. }
  828. .radio-group {
  829. .radio-item {
  830. padding: 0 32rpx;
  831. display: flex;
  832. align-items: center;
  833. justify-content: space-between;
  834. height: 96rpx;
  835. line-height: 96rpx;
  836. border-bottom: 1px solid rgba(245,245,245,1);
  837. .item-title {
  838. color: rgba(16, 16, 16, 1);
  839. font-size: 32rpx;
  840. }
  841. }
  842. }
  843. .btn-group {
  844. display: flex;
  845. align-items: center;
  846. justify-content: space-between;
  847. padding: 0 32rpx;
  848. .btn {
  849. width: 328rpx;
  850. height: 80rpx;
  851. line-height: 80rpx;
  852. font-size: 32rpx;
  853. border-radius: 4px;
  854. text-align: center;
  855. margin-top: 24rpx;
  856. }
  857. .cancel {
  858. background-color: rgba(222, 225, 228, 1);
  859. color: rgba(51, 51, 51, 1);
  860. }
  861. .confirm {
  862. background-color: rgba(22, 119, 255, 1);
  863. color: rgba(255, 255, 255, 1);
  864. }
  865. }
  866. }
  867. /deep/.u-drawer-content-visible {
  868. border-radius: 12px 12px 0 0;
  869. }
  870. /deep/uni-input{
  871. background-color: rgba(241,242,245,1);
  872. color: rgba(119,119,119,1);
  873. font-size: 36rpx;
  874. height: 80rpx;
  875. padding-left: 16rpx;
  876. }
  877. </style>