移动储能车V1版本
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <image class="top_logo" src="../../static/logo.png" mode=""></image>
  5. <image class="tite" src="../../static/tite.png" mode=""></image>
  6. <view class="time">
  7. <view class="time_top">
  8. {{ formattedTime}}
  9. </view>
  10. <view class="time_bottom">
  11. <view>
  12. </view>
  13. <view class="time_bottom1">
  14. 连接状态:
  15. <view class="time_state" v-if="uidatasdata.bms_ChgLinkSt">
  16. 在线
  17. </view>
  18. <view class="time_state1" v-else>
  19. 离线
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="tap">
  26. <view class="tap_1">
  27. AC
  28. </view>
  29. <view class="tap_2">
  30. DC
  31. </view>
  32. <view class="tap_3">
  33. System
  34. </view>
  35. </view>
  36. <view class="power">
  37. <view class="power_1" @click="onclick(3)">
  38. <image v-if="selectorid==3" src="../../static/electricity.png" mode=""></image>
  39. <image v-else src="../../static/choice1.png" mode=""></image>
  40. </view>
  41. <view class="power_1" @click="onclick(2)">
  42. <image v-if="selectorid==2" src="../../static/power1.png" mode=""></image>
  43. <image v-else src="../../static/choice2.png" mode=""></image>
  44. </view>
  45. <view class="power_1" @click="onclick(4)">
  46. <image v-if="selectorid==4" src="../../static/direct1.png" mode=""></image>
  47. <image v-else src="../../static/choice3.png" mode=""></image>
  48. </view>
  49. <view class="power_1" @click="onclick(1)">
  50. <image v-if="selectorid==1" src="../../static/DCpower1.png" mode=""></image>
  51. <image v-else src="../../static/choice4.png" mode=""></image>
  52. </view>
  53. <view class="power_5" @click="system">
  54. <image src="../../static/system.png" mode=""></image>
  55. </view>
  56. </view>
  57. <view class="power_6" v-if="this.uidatasdata.SysControl_RunCmd==1">
  58. <image src="../../static/!.png" mode=""></image>若想重新选择模式,请返回之前模式停止以后再重新选择!
  59. </view>
  60. <uni-popup ref="message" type="message">
  61. <uni-popup-message type="error" :message="messageText" :duration="2500"></uni-popup-message>
  62. </uni-popup>
  63. </view>
  64. </template>
  65. <script>
  66. import {getuidatas,control} from "../../api/api.js"
  67. import {getTime} from "../../utils/index.js"
  68. export default {
  69. data() {
  70. return {
  71. title: '',
  72. uidatasdata:{},
  73. uidatas:'',
  74. formattedTime:getTime('yyyy年MM月dd日 hh:mm:ss'),
  75. formatTimeid:'',
  76. selectorid:0,
  77. messageText:''
  78. }
  79. },
  80. created() {
  81. this.formatTimeid = setInterval(() => {
  82. const customFormat = 'yyyy年MM月dd日 hh:mm:ss';
  83. this.formattedTime = getTime(customFormat);
  84. }, 1000);
  85. },
  86. mounted(){
  87. },
  88. onLoad() {
  89. // this.onlogin();
  90. this.onfaultsList();
  91. },
  92. beforeUnmount() {
  93. clearInterval(this.uidatas);
  94. clearInterval(this.formatTimeid);
  95. },
  96. methods: {
  97. onfaultsList() {
  98. let data = {
  99. id: "3224a3eb-2375-4dfc-99ce-b182edd30996",
  100. page: 1,
  101. rows: 10000,
  102. }
  103. getuidatas(data).then(data => {
  104. if (data.status == 'ok') {
  105. this.uidatasdata = data.data.reduce((obj, item) => {
  106. let a = item.module;
  107. let b = item[a];
  108. let numericValue = parseFloat(b); // 转换为数字
  109. // 如果是有效的数字,保留小数点后两位
  110. let roundedValue = isNaN(numericValue) ? b : numericValue.toFixed(2);
  111. return {
  112. ...obj,
  113. [item.id]: roundedValue
  114. };
  115. }, {});
  116. this.selectorid =this.uidatasdata.SysInstall_EssRunModeManual
  117. // console.log(this.uidatasdata);
  118. this.uidatas =setTimeout(() => {
  119. this.onfaultsList();
  120. }, 2000); // 10秒后隐藏消息
  121. }else{
  122. this.uidatas =setTimeout(() => {
  123. this.onfaultsList();
  124. }, 2000); // 10秒后隐藏消息
  125. }
  126. }).catch(error => {
  127. console.log(error);
  128. this.uidatasdata={}
  129. this.uidatas =setTimeout(() => {
  130. this.onfaultsList();
  131. }, 2000); // 10秒后隐藏消息
  132. });
  133. },
  134. onclick(e){
  135. console.log(e);
  136. if(this.uidatasdata.SysInstall_EssRunModeManual==e){
  137. if (this.uidatasdata.SysInstall_EssRunModeManual==3) {
  138. uni.redirectTo({
  139. url: '/pages/home/index'
  140. });
  141. } else if(this.uidatasdata.SysInstall_EssRunModeManual==2){
  142. uni.redirectTo({
  143. url: '/pages/electricity/index'
  144. });
  145. }else if(this.uidatasdata.SysInstall_EssRunModeManual==4){
  146. uni.redirectTo({
  147. url: '/pages/supply/supply'
  148. });
  149. }else if(this.uidatasdata.SysInstall_EssRunModeManual==1){
  150. uni.redirectTo({
  151. url: '/pages/supplyss/supplyss'
  152. });
  153. }
  154. }else{
  155. if(this.uidatasdata.SysControl_RunCmd==1||this.uidatasdata.SysControl_Gun1RunCmd==1||this.uidatasdata.SysControl_Gun2RunCmd==1){
  156. // uni.showToast({
  157. // title:'请停止之前模式选择',
  158. // icon: 'warning',
  159. // duration: 2500, // 显示时长,单位为毫秒
  160. // });
  161. this.messageText = '请停止之前模式,在选择'
  162. this.$refs.message.open()
  163. return
  164. }else if(e==3){
  165. if(this.uidatasdata.AC_Out_380V_125A_Status==1){
  166. // uni.showToast({
  167. // title:'请先手动断开125A',
  168. // icon: 'warning',
  169. // duration: 2500, // 显示时长,单位为毫秒
  170. // });
  171. this.messageText = '需将AC输出端125A的开关手动断开'
  172. this.$refs.message.open()
  173. return
  174. }else if(this.uidatasdata.AC_Out_380V_63A_Status==1){
  175. // uni.showToast({
  176. // title:'请先手动断开63A',
  177. // icon: 'warning',
  178. // duration: 2500, // 显示时长,单位为毫秒
  179. // });
  180. this.messageText = '需将AC输出端63A的开关手动断开'
  181. this.$refs.message.open()
  182. return
  183. }else if(this.uidatasdata.AC_Out_220V_16A_Status==1){
  184. // uni.showToast({
  185. // title:'请先手动断开16A',
  186. // icon: 'warning',
  187. // duration: 2500, // 显示时长,单位为毫秒
  188. // });
  189. this.messageText = '需将AC输出端16A的开关手动断开'
  190. this.$refs.message.open()
  191. return
  192. }else{
  193. uni.setStorageSync('selector',e);
  194. this.pattern(e)
  195. }
  196. }else if(e==2){
  197. if(this.uidatasdata.AC_In_380V_63A1_Status==1){
  198. // uni.showToast({
  199. // title:'请先手动断开63A1',
  200. // icon: 'warning',
  201. // duration: 2500, // 显示时长,单位为毫秒
  202. // });
  203. this.messageText = '需将AC输出端63A1的开关手动断开'
  204. this.$refs.message.open()
  205. return
  206. } else if(this.uidatasdata.AC_In_380V_63A2_Status==1){
  207. // uni.showToast({
  208. // title:'请先手动断开63A2',
  209. // icon: 'warning',
  210. // duration: 2500, // 显示时长,单位为毫秒
  211. // });
  212. this.messageText = '需将AC输出端63A2的开关手动断开'
  213. this.$refs.message.open()
  214. return
  215. }else{
  216. uni.setStorageSync('selector',e);
  217. this.pattern(e)
  218. }
  219. }else{
  220. uni.setStorageSync('selector',e);
  221. this.pattern(e)
  222. }
  223. }
  224. },
  225. pattern(unm){
  226. let data = {
  227. id: "c32e6a80-9159-4f6e-9acc-8525cf177808",
  228. issaveinitvalue:false,
  229. value:unm+'' // 直流供电=1,直流补电=4,交流供电=2,交流补电=3
  230. }
  231. control(data).then(data => {
  232. console.log(data);
  233. if (data.status == 'ok') {
  234. if (unm==3) {
  235. uni.redirectTo({
  236. url: '/pages/home/index'
  237. });
  238. } else if(unm==2){
  239. uni.redirectTo({
  240. url: '/pages/electricity/index'
  241. });
  242. }else if(unm==4){
  243. uni.redirectTo({
  244. url: '/pages/supply/supply'
  245. });
  246. }else if(unm==1){
  247. uni.redirectTo({
  248. url: '/pages/supplyss/supplyss'
  249. });
  250. }
  251. } else {
  252. // uni.hideLoading()
  253. // uni.showToast({
  254. // title:'选择模式失败请重新选择',
  255. // icon: 'warning',
  256. // duration: 2500, // 显示时长,单位为毫秒
  257. // });
  258. this.messageText = '选择模式失败请重新选择'
  259. this.$refs.message.open()
  260. return
  261. }
  262. });
  263. },
  264. system(){
  265. uni.redirectTo({
  266. url: '/pages/details/index'
  267. });
  268. }
  269. }
  270. }
  271. </script>
  272. <style scoped>
  273. .content{
  274. width: 100%;
  275. height: 100vh;
  276. opacity: 1;
  277. background: linear-gradient(180deg, rgba(215, 230, 245, 0) 0%, rgba(196, 229, 255, 1) 100%);
  278. box-sizing: border-box;
  279. }
  280. .top {
  281. width: 100%;
  282. height: 100px;
  283. display: flex;
  284. align-items: center;
  285. justify-content: space-between;
  286. background-size: 100% 100%;
  287. background-repeat: no-repeat;
  288. box-sizing: border-box;
  289. background-color: #fff;
  290. padding: 0px 46px;
  291. }
  292. .top_logo{
  293. width:426px;
  294. height: 68px;
  295. }
  296. .tite{
  297. width:277px;
  298. height: 48px;
  299. }
  300. .time{
  301. text-align: right;
  302. }
  303. .time_top{
  304. font-size: 17px;
  305. }
  306. .time_bottom{
  307. display: flex;
  308. font-size: 17px;
  309. justify-content: space-between;
  310. }
  311. .time_bottom1{
  312. display: flex;
  313. }
  314. .time_state{
  315. font-size: 17px;
  316. font-weight: 600;
  317. color: rgba(22, 68, 144, 1);
  318. }
  319. .time_state1 {
  320. font-size: 17px;
  321. font-weight: 600;
  322. color: rgba(217, 22, 22, 1);
  323. }
  324. .tap{
  325. width: 100%;
  326. height: 46.01px;
  327. display: flex;
  328. justify-content: space-between;
  329. margin-top: 118px;
  330. margin-bottom: 50px;
  331. padding: 0px 20px;
  332. box-sizing: border-box;
  333. }
  334. .tap_1{
  335. width: 485.57px;
  336. height: 46.5px;
  337. border-radius: 50px;
  338. background: linear-gradient(180deg, rgba(43, 158, 218, 1) 0%, rgba(39, 114, 186, 1) 100%);
  339. display: flex;
  340. align-items: center;
  341. justify-content: center;
  342. font-size: 35.24px;
  343. font-weight: 700;
  344. color: #fff;
  345. }
  346. .tap_2{
  347. width: 485px;
  348. height: 46.5px;
  349. border-radius: 50px;
  350. background: linear-gradient(180deg, rgba(43, 158, 218, 1) 0%, rgba(39, 114, 186, 1) 100%);
  351. display: flex;
  352. align-items: center;
  353. justify-content: center;
  354. font-size: 35.24px;
  355. font-weight: 700;
  356. color: #fff;
  357. }
  358. .tap_3{
  359. width: 155.17px;
  360. height: 46.01px;
  361. opacity: 1;
  362. border-radius: 24.47px;
  363. background: linear-gradient(180deg, rgba(43, 158, 218, 1) 0%, rgba(39, 114, 186, 1) 100%);
  364. display: flex;
  365. align-items: center;
  366. justify-content: center;
  367. font-size: 30px;
  368. font-weight: 700;
  369. color: #fff;
  370. }
  371. .power{
  372. width: 100%;
  373. display: flex;
  374. justify-content: space-between;
  375. padding: 0px 20px;
  376. box-sizing: border-box;
  377. }
  378. .power_1{
  379. width: 237.55px;
  380. height: 298.98px;
  381. opacity: 1;
  382. box-sizing: border-box;
  383. image{
  384. width: 100%;
  385. height: 100%;
  386. }
  387. }
  388. .power_11{
  389. width: 237.55px;
  390. height: 298.98px;
  391. opacity: 1;
  392. box-sizing: border-box;
  393. font-size: 23px;
  394. font-family: 400;
  395. display: flex;
  396. flex-direction: column;
  397. align-items: center;
  398. .power_image{
  399. width: 100%;
  400. height: 248px;
  401. margin-bottom: 20px;
  402. background-image: url("../../static/electricity1.png");
  403. background-size: 100% 100%;
  404. display: flex;
  405. align-items: center;
  406. justify-content: center;
  407. padding: 0px 16px;
  408. box-sizing: border-box;
  409. image{
  410. width: 100%;
  411. height: 160.06px;
  412. }
  413. }
  414. }
  415. .power_5{
  416. width: 154.19px;
  417. height: 297.61px;
  418. opacity: 1;
  419. image{
  420. width: 100%;
  421. height: 100%;
  422. }
  423. }
  424. .power_6{
  425. width: 100%;
  426. height: 50px;
  427. font-size: 17.62px;
  428. margin-top: 80px;
  429. display: flex;
  430. align-items: center;
  431. padding: 0px 20px;
  432. box-sizing: border-box;
  433. position: fixed;
  434. left: 0px;
  435. bottom: 64px;
  436. image{
  437. margin-right: 10px;
  438. width: 27.41px;
  439. height: 27.41px;
  440. };
  441. }
  442. </style>