machineItemManage.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <view>
  3. <view>
  4. <view class="item ddflex">
  5. <view class="label">箱体编号</view>
  6. <view class="item-input fflex ddflex">
  7. <view>{{doorInfo.doorId}}</view>
  8. </view>
  9. </view>
  10. <view class="item ddflex">
  11. <view class="label">机柜名称</view>
  12. <view class="item-input fflex ddflex">
  13. <view>{{doorInfo.devName}}</view>
  14. </view>
  15. </view>
  16. <view class="item ddflex">
  17. <view class="label">机柜编号</view>
  18. <view class="item-input fflex">
  19. {{doorInfo.devId}}
  20. </view>
  21. </view>
  22. <view class="item ddflex">
  23. <view class="label">电池电压</view>
  24. <view class="item-input fflex">
  25. <block v-if="doorInfo.batVol">{{doorInfo.batVol}}V</block>
  26. <view v-else>未知</view>
  27. </view>
  28. </view>
  29. <view class="item ddflex">
  30. <view class="label">电池温度</view>
  31. <view class="item-input fflex">
  32. <block v-if="doorInfo.batTemp">{{doorInfo.batTemp}}℃</block>
  33. <view v-else>未知</view>
  34. </view>
  35. </view>
  36. <view class="item ddflex">
  37. <view class="label">电池编号</view>
  38. <view class="item-input fflex">
  39. {{doorInfo.batteryId}}
  40. </view>
  41. <view class="bms" @click="jumpUrl('/machineAndCell/BMS/BMS?id='+doorInfo.batteryId)">BMS分析</view>
  42. </view>
  43. <view class="item ddflex">
  44. <view class="label">bms告警</view>
  45. <view class="item-input fflex">
  46. <block v-if="doorInfo.bmsAlarm">{{doorInfo.bmsAlarm}}</block>
  47. <view v-else>未知</view>
  48. </view>
  49. </view>
  50. <view class="item ddflex">
  51. <view class="label">更新时间</view>
  52. <view class="item-input fflex">
  53. {{doorInfo.updateTime ? doorInfo.updateTime : time}}
  54. </view>
  55. <view class="refresh ddflex" @click="getState()">
  56. <image src="../../static/pages/images/refresh.png"></image>
  57. <text>刷新</text>
  58. </view>
  59. </view>
  60. <view class="item ddflex">
  61. <view class="label">电池类型</view>
  62. <view class="item-input fflex">
  63. <block v-if="doorInfo.model">{{doorInfo.model}}</block>
  64. <view v-else>未知</view>
  65. </view>
  66. </view>
  67. <view class="item ddflex">
  68. <view class="label">仓门状态</view>
  69. <view class="item-input fflex">
  70. {{doorInfo.doorStatus == 1 ? '开启':'关闭'}}
  71. </view>
  72. </view>
  73. <view class="item ddflex">
  74. <view class="label">仓内温度</view>
  75. <view class="item-input fflex">
  76. <block v-if="doorInfo.boxTemp">{{doorInfo.boxTemp}}℃</block>
  77. <view v-else>未知</view>
  78. </view>
  79. </view>
  80. </view>
  81. <view style="height: 165rpx;" class="savepadding"></view>
  82. <view class="bottom-btns">
  83. <view class="savepadding dflex">
  84. <view :class="'btn'+(doorInfo.boxEnable==1?'':' gray')" @click="boxEnableChange(false)">禁用</view>
  85. <view :class="'btn'+(doorInfo.boxEnable==1?' gray':'')" @click="boxEnableChange(true)">启用</view>
  86. <view class="btn" @click="open">一键开门</view>
  87. </view>
  88. </view>
  89. </view>
  90. </template>
  91. <script>
  92. const app = getApp();
  93. const req = require("../../utils/request.js");
  94. const utils = require("../../utils/util");
  95. export default {
  96. components: {},
  97. props: {},
  98. data() {
  99. return {
  100. id:null,//仓门id
  101. devId:null,//机柜id
  102. doorInfo:{},
  103. time:''
  104. }
  105. },
  106. async onLoad(options) {
  107. this.id = options.id
  108. this.devId = options.devId
  109. await this.getState()
  110. },
  111. onShow() {
  112. },
  113. methods: {
  114. jumpUrl(url){
  115. uni.navigateTo({
  116. url:url
  117. })
  118. },
  119. getState(){
  120. return new Promise((r,j)=>{
  121. uni.showLoading({
  122. title:'加载中'
  123. })
  124. req.getRequest('/admin/v2/door/info',{devId:this.devId,doorId:this.id},res=>{
  125. this.doorInfo = res
  126. this.time = utils.formatTime(new Date()).t1
  127. uni.hideLoading()
  128. })
  129. })
  130. },
  131. boxEnableChange(type){
  132. let that = this;
  133. if(type){
  134. if(this.doorInfo.boxEnable == 1) return false;
  135. }else{
  136. if(this.doorInfo.boxEnable == 0) return false;
  137. }
  138. uni.showModal({
  139. title:'提示',
  140. content:type?'确定启用该仓门?':'确定禁用该仓门?',
  141. success: (r) => {
  142. if(r.confirm){
  143. uni.showLoading({
  144. title:type?'启用中':'禁用中',
  145. })
  146. req.postRequest('/admin/v2/cab/ableDoor',{devId:this.devId,doorId:this.id,cabEnable:type?1:0},res=>{
  147. uni.hideLoading()
  148. if(res){
  149. req.msg(type?'启用成功':'禁用成功');
  150. that.getState();
  151. }else {
  152. req.msg(type?'启用失败':'禁用失败')
  153. this.doorInfo.boxEnable = !this.doorInfo.boxEnable
  154. }
  155. })
  156. }
  157. // else{
  158. // this.doorInfo.boxEnable = !this.doorInfo.boxEnable
  159. // }
  160. }
  161. })
  162. },
  163. open(){
  164. uni.showLoading({
  165. title:'开门中',
  166. })
  167. req.postRequest('/admin/v2/cab/openDoor',{devId:this.devId,doorId:this.id},res=>{
  168. uni.hideLoading()
  169. if(res){
  170. req.msg('操作成功')
  171. }else {
  172. req.msg('操作失败')
  173. }
  174. })
  175. }
  176. },
  177. mounted() {
  178. },
  179. onPageScroll: function(e) {
  180. }
  181. }
  182. </script>
  183. <style>
  184. @import "./machineItemManage.css";
  185. </style>