BatteryCharger.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <view>
  3. <view class="communication">
  4. <view class="battery_title">
  5. <view class="first">
  6. <image class="img" src="../../../static/equipment/cangwei.png" />
  7. </image><text class="p"> {{chargerCode}}号仓位充电机</text>
  8. <!-- <view :class="[buttonState[0],buttonState === 1?'is-disabled':'']" @click.stop="sendCharger">
  9. {{buttonState === 1 ?'不可操作':buttonState[1]}}
  10. </view> -->
  11. </view>
  12. </view>
  13. <view :class="statustext[1]">{{statustext[0]}}</view>
  14. </view>
  15. <!-- 顶部公共提示信息 -->
  16. <uni-popup ref="Exchangepopup" type="message">
  17. <uni-popup-message :type="popupType" :message="popupMessage" :duration="2000"></uni-popup-message>
  18. </uni-popup>
  19. <!-- 顶部提示信息结束-->
  20. </view>
  21. </template>
  22. <script>
  23. // import {
  24. // startCharge,
  25. // stopCharge
  26. // } from '@/common/http.js'
  27. export default {
  28. name: "BatteryCharger",
  29. props: ['chargerCode', 'comState'],
  30. data() {
  31. return {
  32. loading: false,
  33. popupType:'',
  34. popupMessage:''
  35. }
  36. },
  37. computed: {
  38. statustext() {
  39. if (this.comState === 1) {
  40. return ['通讯正常', 'success']
  41. } else {
  42. return ['通讯异常', 'warning']
  43. }
  44. },
  45. // buttonState() {
  46. // if ((this.chgState === 0 || this.chgState === 3)&& this.storeState === 1) {
  47. // return ['btnState', '充电']
  48. // } else if (this.chgState === 2&& this.storeState === 1) {
  49. // return ['purple', '断电']
  50. // } else {
  51. // return 1
  52. // }
  53. // }
  54. },
  55. methods: {
  56. //顶部公共消息提示
  57. ExchangeMessage(type, message) {
  58. this.popupType = type
  59. this.popupMessage = message?message:'后端接口404错误!'
  60. this.$refs.Exchangepopup.open()
  61. },
  62. }
  63. }
  64. </script>
  65. <style lang="scss" scoped>
  66. .communication {
  67. display: flex;
  68. margin-bottom: 10px;
  69. view {
  70. line-height: 32px;
  71. font-size: 18px;
  72. font-weight: 600;
  73. height: 32px;
  74. width: 185px;
  75. text-align: center;
  76. }
  77. .battery_title {
  78. background-color: #1b263a;
  79. border: #25334d solid 1px;
  80. color: white;
  81. line-height: 32px;
  82. display: flex;
  83. justify-content: space-between;
  84. padding: 0 5px;
  85. .is-disabled {
  86. width: 75px;
  87. height: 24px;
  88. line-height: 24px;
  89. padding: 0 0 0 15px;
  90. border-radius: 15px;
  91. margin-top: 4px;
  92. color: #5f6571;
  93. border-color: #353c4c;
  94. background: url('@/static/equipment/d3.png') #353c4c no-repeat 6px center;
  95. position: absolute;
  96. right: 0px;
  97. }
  98. .first {
  99. display: flex;
  100. position: relative;
  101. .p {
  102. margin: 0;
  103. padding: 0;
  104. }
  105. .img {
  106. width: 22px;
  107. height: 22px;
  108. vertical-align: middle;
  109. margin-top: 6px;
  110. margin-right: 5px;
  111. }
  112. }
  113. .btnState {
  114. width: 45px;
  115. height: 24px;
  116. padding: 0 0 0 15px;
  117. font-size: 14px;
  118. color: #fff;
  119. border-radius: 15px;
  120. margin-top: 4px;
  121. line-height: 24px;
  122. cursor: pointer;
  123. border: none;
  124. letter-spacing: 1px;
  125. background: url('@/static/equipment/d1.png') rgb(105, 184, 137) no-repeat 6px center;
  126. background-position-x: 5px;
  127. position: absolute;
  128. right: 0px;
  129. }
  130. .purple {
  131. width: 45px;
  132. height: 24px;
  133. padding: 0 0 0 15px;
  134. font-size: 14px;
  135. color: #fff;
  136. line-height: 24px;
  137. border-radius: 15px;
  138. margin-top: 4px;
  139. cursor: pointer;
  140. border: none;
  141. letter-spacing: 1px;
  142. background: url('@/static/equipment/d2.png') rgb(224, 125, 68) no-repeat 6px center;
  143. background-position-x: 5px;
  144. position: absolute;
  145. right: 0px;
  146. }
  147. }
  148. .success {
  149. color: #92fdb9;
  150. text-align: right;
  151. }
  152. .warning {
  153. color: #c85e60;
  154. text-align: right;
  155. }
  156. }
  157. </style>