autoOff.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044
  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.“智能停电”结束时,如果处于停电状态将打开电源供电;
  115. </view>
  116. </view>
  117. </view>
  118. <view class="time-item" v-show="switchStatus==2">
  119. <view class="time">
  120. <view class="type">
  121. 在时间段开始时间开启电源供电,时间段结束时间停止供电。
  122. </view>
  123. </view>
  124. </view>
  125. <view class="time-item2" v-show="startTime||endTime" >
  126. <view class="time">
  127. <view class="time-slot" >
  128. 用电设置图示
  129. </view>
  130. </view>
  131. <view class="progressText" >
  132. <view class="progress1" v-if="progress1style.width!='0%'" :style="progress1style" >{{progress1style.text}}</view>
  133. <view class="progress2">&nbsp;</view>
  134. <view class="progress3" v-if="progress3style.width!='0%'"
  135. :style="progress3style">{{progress3style.text}}</view>
  136. </view>
  137. <view class="progress" :style="{
  138. backgroundColor:progressColor
  139. }" >
  140. <view class="progress1" :style="progress1style" ></view>
  141. <view class="progress2">&nbsp;</view>
  142. <view class="progress3" :style="progress3style"></view>
  143. </view>
  144. <view class="type" style=" color: #777777; margin-top: 16rpx;" >
  145. <view></view>
  146. </view>
  147. <view class="type" style=" color: #777777;" v-if="switchStatus!=3">
  148. <view v-if="switchStatus==1||switchStatus==2">设置生效后将在{{gethtml(startTime)}}供电</view>
  149. <view v-if="switchStatus==0||switchStatus==2">设置生效后将在{{gethtml(endTime)}}停电</view>
  150. </view>
  151. <view class="type" style=" color: #777777;" v-else >
  152. <view>设置生效后将在{{gethtml(startTime)}}开启“智能停电”</view>
  153. <view>设置生效后将在{{gethtml(endTime)}}关闭“智能停电”</view>
  154. </view>
  155. </view>
  156. </view>
  157. <!-- 重复类型 -->
  158. <view class="repeatType" v-if="typeShow">
  159. <u-popup v-model="typeShow" mode="bottom">
  160. <view>
  161. <view class="headline">
  162. 重复类型
  163. </view>
  164. <view class="type-group">
  165. <view class="item" :class="{
  166. 'item-title-checked':typeShowIndex==0
  167. }" @click="typeShowIndex=0,typeShow=false">
  168. <view class="item-title " >
  169. 执行一次
  170. </view>
  171. <view class="item-icon item-icon1">
  172. <img src="@/assets/img/riLine-check-line.svg" alt="" />
  173. </view>
  174. <view class="item-icon item-icon2">
  175. <img src="" alt="" />
  176. </view>
  177. </view>
  178. <view class="item" :class="{
  179. 'item-title-checked':typeShowIndex==1
  180. }" @click="typeShowIndex=1,typeShow=false">
  181. <view class="item-title " > 每天
  182. </view>
  183. <view class="item-icon item-icon1">
  184. <img src="@/assets/img/riLine-check-line.svg" alt="" />
  185. </view>
  186. <view class="item-icon item-icon2">
  187. <img src="" alt="" />
  188. </view>
  189. </view>
  190. <view class="item" :class="{
  191. 'item-title-checked':typeShowIndex==2
  192. }" @click="customPopup=true,weekdaysListTemp=weekdaysList">
  193. <view class="item-title" >
  194. 自定义
  195. </view>
  196. <view class="item-icon item-icon1">
  197. <img src="@/assets/img/riLine-check-line.svg" alt="" />
  198. </view>
  199. <view class="item-icon item-icon2">
  200. <img src="" alt="" />
  201. </view>
  202. </view>
  203. </view>
  204. </view>
  205. </u-popup>
  206. </view>
  207. <!-- 关闭时间 -->
  208. <ujpPicker mode="time" jp="1" :default-time="startTime?'2024-1-1 '+startTime+':1':''"
  209. v-model="pickerShow1" :params="params" @confirm="pickerShow1confirm" ></ujpPicker>
  210. <ujpPicker mode="time" jp="2" :default-time="endTime?'2024-1-1 '+endTime+':1':''" :defaultStartTime="startTime"
  211. v-model="pickerShow2" :params="params" @confirm="pickerShow2confirm" ></ujpPicker>
  212. <!-- 自定义重复 -->
  213. <ujpPicker2 :texts="['开启“智能停电”','停止“智能停电”']"
  214. :defaultTime="startTime?'2024-1-1 '+startTime+':1':''"
  215. :defaultTime2="endTime?'2024-1-1 '+endTime+':1':''"
  216. v-model="pickerShow3" @confirm="pickerShow1confirm2" ></ujpPicker2>
  217. <ujpPicker2 :texts="['供电时间','停电时间']"
  218. :defaultTime="startTime?'2024-1-1 '+startTime+':1':''"
  219. :defaultTime2="endTime?'2024-1-1 '+endTime+':1':''"
  220. v-model="pickerShow4" @confirm="pickerShow1confirm2" ></ujpPicker2>
  221. <u-popup v-model="customPopup" mode="bottom">
  222. <view class="custom">
  223. <view class="headline">
  224. 自定义重复
  225. </view>
  226. <view class="radio-group">
  227. <checkbox-group @change="checkboxChange" >
  228. <view class="radio-item" v-for="(item,i) in weekdaysListTemp" :key="i">
  229. <view class="item-title" >
  230. {{weeklist[i]}}
  231. </view>
  232. <view class="item-value">
  233. <checkbox
  234. :value="''+i"
  235. :checked="item?true:false"
  236. ></checkbox>
  237. </view>
  238. </view>
  239. </checkbox-group>
  240. </view>
  241. <view class="btn-group">
  242. <view class="btn cancel" @click="customPopup=false">
  243. 取消
  244. </view>
  245. <view class="btn confirm" @click="customPopupApi" >
  246. 确认
  247. </view>
  248. </view>
  249. </view>
  250. </u-popup>
  251. <!-- 最大功率阈值 -->
  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>