| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- <template>
- <view>
- <view>
- <view class="item ddflex">
- <view class="label">箱体编号</view>
- <view class="item-input fflex ddflex">
- <view>{{doorInfo.doorId}}</view>
- </view>
- </view>
- <view class="item ddflex">
- <view class="label">机柜名称</view>
- <view class="item-input fflex ddflex">
- <view>{{doorInfo.devName}}</view>
- </view>
- </view>
- <view class="item ddflex">
- <view class="label">机柜编号</view>
- <view class="item-input fflex">
- {{doorInfo.devId}}
- </view>
- </view>
- <view class="item ddflex">
- <view class="label">电池电压</view>
- <view class="item-input fflex">
- <block v-if="doorInfo.batVol">{{doorInfo.batVol}}V</block>
- <view v-else>未知</view>
- </view>
- </view>
- <view class="item ddflex">
- <view class="label">电池温度</view>
- <view class="item-input fflex">
- <block v-if="doorInfo.batTemp">{{doorInfo.batTemp}}℃</block>
- <view v-else>未知</view>
- </view>
- </view>
- <view class="item ddflex">
- <view class="label">电池编号</view>
- <view class="item-input fflex">
- {{doorInfo.batteryId}}
- </view>
- <view class="bms" @click="jumpUrl('/machineAndCell/BMS/BMS?id='+doorInfo.batteryId)">BMS分析</view>
- </view>
- <view class="item ddflex">
- <view class="label">bms告警</view>
- <view class="item-input fflex">
- <block v-if="doorInfo.bmsAlarm">{{doorInfo.bmsAlarm}}</block>
- <view v-else>未知</view>
- </view>
- </view>
- <view class="item ddflex">
- <view class="label">更新时间</view>
- <view class="item-input fflex">
- {{doorInfo.updateTime ? doorInfo.updateTime : time}}
- </view>
- <view class="refresh ddflex" @click="getState()">
- <image src="../../static/pages/images/refresh.png"></image>
- <text>刷新</text>
- </view>
- </view>
- <view class="item ddflex">
- <view class="label">电池类型</view>
- <view class="item-input fflex">
- <block v-if="doorInfo.model">{{doorInfo.model}}</block>
- <view v-else>未知</view>
- </view>
- </view>
- <view class="item ddflex">
- <view class="label">仓门状态</view>
- <view class="item-input fflex">
- {{doorInfo.doorStatus == 1 ? '开启':'关闭'}}
- </view>
- </view>
- <view class="item ddflex">
- <view class="label">仓内温度</view>
- <view class="item-input fflex">
- <block v-if="doorInfo.boxTemp">{{doorInfo.boxTemp}}℃</block>
- <view v-else>未知</view>
- </view>
- </view>
- </view>
- <view style="height: 165rpx;" class="savepadding"></view>
- <view class="bottom-btns">
- <view class="savepadding dflex">
- <view :class="'btn'+(doorInfo.boxEnable==1?'':' gray')" @click="boxEnableChange(false)">禁用</view>
- <view :class="'btn'+(doorInfo.boxEnable==1?' gray':'')" @click="boxEnableChange(true)">启用</view>
- <view class="btn" @click="open">一键开门</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- const app = getApp();
- const req = require("../../utils/request.js");
- const utils = require("../../utils/util");
- export default {
- components: {},
- props: {},
- data() {
- return {
- id:null,//仓门id
- devId:null,//机柜id
- doorInfo:{},
- time:''
- }
- },
- async onLoad(options) {
- this.id = options.id
- this.devId = options.devId
- await this.getState()
- },
- onShow() {
-
- },
- methods: {
- jumpUrl(url){
- uni.navigateTo({
- url:url
- })
- },
- getState(){
- return new Promise((r,j)=>{
- uni.showLoading({
- title:'加载中'
- })
- req.getRequest('/admin/v2/door/info',{devId:this.devId,doorId:this.id},res=>{
- this.doorInfo = res
- this.time = utils.formatTime(new Date()).t1
- uni.hideLoading()
- })
- })
- },
- boxEnableChange(type){
- let that = this;
- if(type){
- if(this.doorInfo.boxEnable == 1) return false;
- }else{
- if(this.doorInfo.boxEnable == 0) return false;
- }
- uni.showModal({
- title:'提示',
- content:type?'确定启用该仓门?':'确定禁用该仓门?',
- success: (r) => {
- if(r.confirm){
- uni.showLoading({
- title:type?'启用中':'禁用中',
- })
- req.postRequest('/admin/v2/cab/ableDoor',{devId:this.devId,doorId:this.id,cabEnable:type?1:0},res=>{
- uni.hideLoading()
- if(res){
- req.msg(type?'启用成功':'禁用成功');
- that.getState();
- }else {
- req.msg(type?'启用失败':'禁用失败')
- this.doorInfo.boxEnable = !this.doorInfo.boxEnable
- }
- })
- }
- // else{
- // this.doorInfo.boxEnable = !this.doorInfo.boxEnable
- // }
-
- }
- })
- },
- open(){
- uni.showLoading({
- title:'开门中',
- })
- req.postRequest('/admin/v2/cab/openDoor',{devId:this.devId,doorId:this.id},res=>{
- uni.hideLoading()
- if(res){
- req.msg('操作成功')
- }else {
- req.msg('操作失败')
- }
- })
- }
- },
- mounted() {
-
- },
- onPageScroll: function(e) {
-
- }
- }
- </script>
- <style>
- @import "./machineItemManage.css";
- </style>
|