machineInfo.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <view>
  3. <view style="padding:0 30rpx;" class="ddflex">
  4. <view class="cell-item" v-for="item,index in groupList" @click="jumpUrl('/machineAndCell/machineItemManage/machineItemManage?id='+item.doorId+'&devId='+id)">
  5. <view class="cell-item-num">{{item.doorId?item.doorId:0}}</view>
  6. <block v-if="item.boxEnable==0">
  7. <view :style="(item.boxStatus==5||item.boxStatus==6)?'margin-top: 30rpx;':'margin-top: 70rpx;'"></view>
  8. <view class="error-sta" v-if="item.boxStatus==5">
  9. 异常
  10. </view>
  11. <view class="error-sta" v-else-if="item.boxStatus==6">
  12. 电池通讯故障
  13. </view>
  14. <view class="error-sta">
  15. 禁用
  16. </view>
  17. </block>
  18. <block v-else>
  19. <view class="error-sta" v-if="item.boxStatus==5" style="margin-top: 70rpx;">
  20. 异常
  21. </view>
  22. <view class="error-sta" v-else-if="item.boxStatus==6" style="margin-top: 70rpx;">
  23. 电池通讯故障
  24. </view>
  25. <block v-else>
  26. <view class="ddflex" v-if="item.boxStatus!=0&&item.batteryId">
  27. <view style="margin-right: 13rpx;">
  28. <cell :soc="item.soc"></cell>
  29. </view>
  30. <view class="cell-item-info fflex">
  31. <view class="cell-item-info-item ddflex">
  32. <view>机柜状态</view>
  33. <view>{{item.boxEnable==1?'启用':'禁用'}}</view>
  34. </view>
  35. <view class="cell-item-info-item ddflex">
  36. <view>柜门</view>
  37. <view>{{item.doorStatus==1?'开':item.doorStatus==0?'关':'-'}}</view>
  38. </view>
  39. <view class="cell-item-info-item ddflex">
  40. <view>型号</view>
  41. <view>{{item.model}}</view>
  42. </view>
  43. <view class="cell-item-info-item ddflex">
  44. <view>电量</view>
  45. <view>{{item.soc}}%</view>
  46. </view>
  47. <view class="cell-item-info-item ddflex">
  48. <view>电压</view>
  49. <view>{{item.batVol?item.batVol:'-'}}V</view>
  50. </view>
  51. <view class="cell-item-info-item ddflex">
  52. <view>电流</view>
  53. <view>{{item.chgCur?item.chgCur:'-'}}A</view>
  54. </view>
  55. <view class="cell-item-info-item ddflex">
  56. <view>温度</view>
  57. <view>{{item.batTemp?item.batTemp:'-'}}℃</view>
  58. </view>
  59. </view>
  60. </view>
  61. <view v-else class="kongcang">
  62. 空仓
  63. </view>
  64. </block>
  65. </block>
  66. <view class="cell-item-option ddflex">
  67. <view class="fflex btn" style="margin-right: 10rpx;" @click.stop="boxEnableChange(item)">{{item.boxEnable==1?'禁用':'启用'}}</view>
  68. <view class="fflex btn" @click.stop="open(item)">开仓</view>
  69. </view>
  70. </view>
  71. </view>
  72. <view style="height: 165rpx;" class="savepadding"></view>
  73. <view class="bottom-btns savepadding">
  74. <view class="ddflex" style="margin: 30rpx;justify-content: space-between;">
  75. <view class="btn1" @click="jumpUrl('/warning/machineAlarm/machineAlarm?id='+id)">故障告警</view>
  76. <view class="btn1" @click="jumpUrl('/machineAndCell/machineDetail/machineDetail?id='+id)">柜体信息</view>
  77. <view class="btn2" @click="getDataList()">刷新</view>
  78. </view>
  79. </view>
  80. </view>
  81. </template>
  82. <script>
  83. const app = getApp();
  84. const req = require("../../utils/request.js");
  85. import cell from "../../components/cell/index";
  86. export default {
  87. components: {
  88. cell
  89. },
  90. props: {},
  91. data() {
  92. return {
  93. id:null,
  94. groupList: [],
  95. page: 1,
  96. limit: 10,
  97. searchValue:'',
  98. isQuerying:false,//正在查询数据
  99. }
  100. },
  101. onLoad(options) {
  102. this.id = options.id
  103. this.getDataList()
  104. },
  105. onShow() {
  106. },
  107. onReachBottom() {
  108. this.getDataList(true)
  109. },
  110. methods: {
  111. jumpUrl(url) {
  112. if (req.isLogins(true)) {
  113. uni.navigateTo({
  114. url: url
  115. })
  116. }
  117. },
  118. getDataList(isPage) {
  119. if(this.isQuerying) return
  120. else this.isQuerying = true
  121. if (!isPage) {
  122. this.page = 1
  123. uni.showLoading({
  124. title:'加载中'
  125. })
  126. }
  127. let queryParams = {
  128. page: this.page,
  129. limit: this.limit,
  130. }
  131. queryParams.devId = this.id
  132. req.getRequest(
  133. '/admin/v2/door/page',
  134. queryParams,
  135. data => {
  136. if (data != null && data.list.length > 0) {
  137. if (!isPage) {
  138. this.groupList = data.list
  139. } else {
  140. this.groupList = this.groupList.concat(data.list)
  141. }
  142. this.page++
  143. } else {
  144. if (!isPage)
  145. this.groupList = data.list
  146. else {}
  147. }
  148. uni.hideLoading()
  149. this.isQuerying = false
  150. }
  151. )
  152. },
  153. // 禁用
  154. boxEnableChange(item){
  155. let open = item.boxEnable==1?false:true
  156. uni.showModal({
  157. title:'提示',
  158. content:open?'确定启用该仓门?':'确定禁用该仓门?',
  159. success: (r) => {
  160. if(r.confirm){
  161. uni.showLoading({
  162. title:open?'启用中':'禁用中',
  163. })
  164. req.postRequest('/admin/v2/cab/ableDoor',{devId:this.id,doorId:item.doorId,cabEnable:open?1:0},res=>{
  165. uni.hideLoading()
  166. if(res){
  167. req.msg(open?'启用成功':'禁用成功')
  168. // if(item.boxEnable == 1){
  169. // item.boxEnable = 0
  170. // }else{
  171. // item.boxEnable = 1
  172. // }
  173. // this.groupList = JSON.parse(JSON.stringify(this.groupList))
  174. }else {
  175. req.msg(open?'启用失败':'禁用失败')
  176. }
  177. this.getDataList()
  178. })
  179. }
  180. }
  181. })
  182. },
  183. // 开仓
  184. open(item){
  185. uni.showLoading({
  186. title:'开门中',
  187. })
  188. req.postRequest('/admin/v2/cab/openDoor',{devId:this.id,doorId:item.doorId},res=>{
  189. uni.hideLoading()
  190. if(res){
  191. req.msg('操作成功')
  192. }else {
  193. req.msg('操作失败')
  194. }
  195. this.getDataList()
  196. })
  197. }
  198. },
  199. mounted() {
  200. },
  201. onPageScroll: function(e) {
  202. }
  203. }
  204. </script>
  205. <style>
  206. @import "./machineInfo.css";
  207. </style>