BMS.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <view style="padding-bottom: 30rpx;">
  3. <!-- tab -->
  4. <view class="tab-box ddflex">
  5. <view class="fflex ddflex">
  6. <view :class="'tab-item fflex '+(queryType==1?'tab-item-active':'')" @click="queryTypeChange(1)">
  7. <view>实时状态</view>
  8. <image class="tab-active-icon" src="../../static/images/tab_cur.png"></image>
  9. </view>
  10. <view :class="'tab-item fflex '+(queryType==2?'tab-item-active':'')" @click="queryTypeChange(2)">
  11. <view>BMS控制</view>
  12. <image class="tab-active-icon" src="../../static/images/tab_cur.png"></image>
  13. </view>
  14. </view>
  15. </view>
  16. <view style="height: 110rpx;"></view>
  17. <block v-if="queryType==1">
  18. <view class="option-box">
  19. <view class="option-time ddflex">
  20. <view>更新时间: {{time}}</view>
  21. <view class="refresh ddflex" @click="getData()">
  22. <image src="../../static/pages/images/refresh.png"></image>
  23. <text>刷新</text>
  24. </view>
  25. </view>
  26. <view style="position: relative;">
  27. <view style="height: 140rpx;"></view>
  28. <view style="margin-top: 40rpx;justify-content: center;position: absolute;left: 50%;transform: translateX(-50%);top: -50%;" class="ddflex">
  29. <cell :width="99" :height="197" :soc="info.State.SOC" :showsoc="true" :rotate="90"></cell>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="bms-info">
  34. <view class="bms-row ddflex">
  35. <view class="fflex ddflex">
  36. <text>电池类型:</text>
  37. <text class="bms-row-data">{{info.State.BetteryType==1?'铁锂':'三元'}} </text>
  38. </view>
  39. </view>
  40. <view class="bms-row ddflex">
  41. <view class="fflex ddflex">
  42. <text>工作状态:</text>
  43. <text class="bms-row-data">{{info.State.WorkStatus==1?'充电中':info.State.WorkStatus==2?'闲置':'放电中'}} </text>
  44. </view>
  45. </view>
  46. <view class="bms-row ddflex">
  47. <view class="fflex ddflex">
  48. <text>总电压:</text>
  49. <text class="bms-row-data">{{info.State.BetteryV_All}}V </text>
  50. </view>
  51. </view>
  52. <view class="bms-row ddflex">
  53. <view class="fflex ddflex">
  54. <text>标称容量:</text>
  55. <text class="bms-row-data">{{info.State.FCC}} </text>
  56. </view>
  57. </view>
  58. <view class="bms-row ddflex">
  59. <view class="fflex ddflex">
  60. <text>剩余容量:</text>
  61. <text class="bms-row-data">{{info.State.SYLA}} </text>
  62. </view>
  63. </view>
  64. <view class="bms-row ddflex">
  65. <view class="fflex ddflex">
  66. <text>充电电流:</text>
  67. <text class="bms-row-data">{{info.State.CPowerA}}A </text>
  68. </view>
  69. </view>
  70. <view class="bms-row ddflex">
  71. <view class="fflex ddflex">
  72. <text>剩余容量百分比:</text>
  73. <text class="bms-row-data">{{info.State.SOC}}% </text>
  74. </view>
  75. </view>
  76. <view class="bms-row ddflex">
  77. <view class="fflex ddflex">
  78. <text>充电保护状态:</text>
  79. <text class="bms-row-data">{{info.State.CPStatus==1?'硬控保护':info.State.CPStatus==2?'软控保护':'正常'}} </text>
  80. </view>
  81. </view>
  82. <view class="bms-row ddflex">
  83. <view class="fflex ddflex">
  84. <text>放电保护状态:</text>
  85. <text class="bms-row-data">{{info.State.DPStatus==1?'硬控保护':info.State.DPStatus==2?'软控保护':'正常'}} </text>
  86. </view>
  87. </view>
  88. <view class="bms-row ddflex">
  89. <view class="fflex ddflex">
  90. <text>短路保护:</text>
  91. <text class="bms-row-data">{{info.State.SCProtect==1?'保护':'正常'}} </text>
  92. </view>
  93. </view>
  94. <view class="bms-row ddflex">
  95. <view class="fflex ddflex">
  96. <text>均衡类型:</text>
  97. <text class="bms-row-data">{{info.State.BetteryType==1?'被动':info.State.BetteryType==2?'主动':'无'}} </text>
  98. </view>
  99. </view>
  100. <view class="bms-row ddflex">
  101. <view class="fflex ddflex">
  102. <text>均衡开关:</text>
  103. <text class="bms-row-data">{{(info.State.EM==1||info.State.EM=='Open')?'打开':'关闭'}} </text>
  104. </view>
  105. </view>
  106. <view class="bms-row ddflex">
  107. <view class="fflex ddflex">
  108. <text>保护板温度:</text>
  109. <text class="bms-row-data">{{info.State.TC_T}}°C </text>
  110. </view>
  111. </view>
  112. <view class="bms-row ddflex">
  113. <view class="fflex ddflex">
  114. <text>出厂日期:</text>
  115. <text class="bms-row-data">{{info.State.CCXX}} </text>
  116. </view>
  117. </view>
  118. <view class="bms-row ddflex">
  119. <view class="fflex ddflex">
  120. <text>厂商编码:</text>
  121. <text class="bms-row-data">{{info.State.BMSCode}} </text>
  122. </view>
  123. </view>
  124. </view>
  125. </block>
  126. <block v-if="queryType==2">
  127. <view class="option-box">
  128. <view class="option-time ddflex">
  129. <view>更新时间: {{time}}</view>
  130. <view class="refresh ddflex" @click="getData()">
  131. <image src="../../static/pages/images/refresh.png"></image>
  132. <text>刷新</text>
  133. </view>
  134. </view>
  135. <!-- <view class="ddflex state">
  136. <view class="ddflex">
  137. <view>充电开关:</view>
  138. <view style="color: #A8A5A5;">{{info.Seting.CHON==1?'开启':'关闭'}}</view>
  139. </view>
  140. <switch style="transform: scale(0.7);" :checked="info.Seting.CHON" color="#FF753A"></switch>
  141. </view> -->
  142. <view class="ddflex state">
  143. <view class="ddflex">
  144. <view>放电开关:</view>
  145. <view style="color: #A8A5A5;">{{info.Seting.DHON==1?'开启':'关闭'}}</view>
  146. </view>
  147. <switch style="transform: scale(0.7);" :checked="info.Seting.DHON==1?true:false" color="#FF753A" @change="switchChange"></switch>
  148. </view>
  149. </view>
  150. </block>
  151. </view>
  152. </template>
  153. <script>
  154. const app = getApp();
  155. const req = require("../../utils/request.js");
  156. import cell from "../../components/cell/index";
  157. const utils = require("../../utils/util");
  158. export default {
  159. components: {
  160. cell
  161. },
  162. props: {},
  163. data() {
  164. return {
  165. systems: {},
  166. isTop:0,
  167. queryType: 1,
  168. id:null,
  169. info:{},
  170. time:''
  171. }
  172. },
  173. onLoad(options) {
  174. this.id = options.id
  175. this.getData()
  176. },
  177. onShow() {
  178. },
  179. methods: {
  180. jumpUrl(url) {
  181. if (req.isLogins(true)) {
  182. uni.navigateTo({
  183. url: url
  184. })
  185. }
  186. },
  187. queryTypeChange(val) {
  188. if (this.queryType == val) return false
  189. this.queryType = val
  190. },
  191. getData(){
  192. uni.showLoading({
  193. title:'加载中'
  194. })
  195. req.getRequest('/admin/v2/battery/bmsData',{batteryId:this.id},res=>{
  196. this.info = res[0]
  197. this.info.Seting = JSON.parse(this.info.Seting)
  198. this.info.State = JSON.parse(this.info.State)
  199. this.time = utils.formatTime(new Date()).t1
  200. uni.hideLoading()
  201. })
  202. },
  203. switchChange(event){
  204. event.detail.value = event.detail.value?1:0
  205. this.info.Seting.DHON = event.detail.value
  206. let that = this
  207. uni.showModal({
  208. title:'提示',
  209. content:event.detail.value?'确定开启放电开关?':'确定关闭放电开关?',
  210. success: (r) => {
  211. if(r.confirm){
  212. uni.showLoading({
  213. title:event.detail.value?'开启中':'关闭中',
  214. })
  215. req.postRequest('/admin/v2/battery/bmsSend',{batteryId:this.id,type:event.detail.value},res=>{
  216. uni.hideLoading()
  217. if(res){
  218. // req.msg(event.detail.value?'开启成功':'关闭成功')
  219. uni.showModal({
  220. title:'提示',
  221. content:'操作成功,该操作会有延迟,请稍候查看最新状态',
  222. showCancel:false,
  223. success() {
  224. that.getData()
  225. }
  226. })
  227. }else {
  228. req.msg(event.detail.value?'开启失败':'关闭失败')
  229. this.info.Seting.DHON = this.info.Seting.DHON==1?0:1
  230. }
  231. })
  232. }else{
  233. this.info.Seting.DHON = this.info.Seting.DHON==1?0:1
  234. // this.getData()
  235. }
  236. }
  237. })
  238. },
  239. },
  240. mounted() {
  241. },
  242. onPageScroll: function(e) {
  243. }
  244. }
  245. </script>
  246. <style>
  247. @import "./BMS.css";
  248. </style>