lift.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. <template>
  2. <div class="yui-tree-box">
  3. <div class="hui-tree-content" style="padding: 0;">
  4. <div class="box-background lift">
  5. <div class="lift-lists">
  6. <div class="hui-chart-title">电梯告警信息</div>
  7. <div class="lift-alarm">
  8. <div class="device-alarm-test">
  9. <div class="alarm-img"></div>
  10. <div class="test-number">
  11. <span class="number alibaba">{{testCount}}</span>
  12. <span class="unit">台</span>
  13. </div>
  14. <div class="test-btn">
  15. 故障电梯
  16. </div>
  17. </div>
  18. <div class="alarm-list">
  19. <div class="hui-test-alarm">
  20. <div class="alarm-table-box hui-flex">
  21. <div class="alarm-title">
  22. <div class="alarm-tr">
  23. <span class="tr-100">设备名称</span>
  24. <span class="tr-flex">报警信息</span>
  25. <span class="tr-130">报警时间</span>
  26. <span class="tr-50">状态</span>
  27. </div>
  28. </div>
  29. <div class="hui-flex-box hui-no-tips" v-if="list.length === 0">
  30. <empty width="100" description="暂无报警记录"></empty>
  31. </div>
  32. <div class="alarm-table hui-flex-box" v-else>
  33. <div class="alarm-tr" v-for="(item,index) in list" :key="index">
  34. <span class="tr-100 hui-ellipsis">{{item.deviceName}}</span>
  35. <span class="tr-flex hui-ellipsis">{{item.info}}</span>
  36. <span class="tr-130">{{item.date}}</span>
  37. <span class="tr-50 tr-center">
  38. <span class="color-red" v-if="!item.state">报警中</span>
  39. <span class="color-blue" v-else-if="item.state === 1">处理中</span>
  40. <span class="color-green" v-else-if="item.state === 2">已处理</span>
  41. </span>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="hui-chart-title">
  49. <span>电梯运行情况</span>
  50. <div class="legend-box">
  51. <div class="legend-item">
  52. <span class="legend-page" style="background: #2DB85C;"></span>
  53. <span class="legend-name">正常</span>
  54. </div>
  55. <div class="legend-item">
  56. <span class="legend-page" style="background: #F04243;"></span>
  57. <span class="legend-name">报警</span>
  58. </div>
  59. </div>
  60. </div>
  61. <div class="lift-box hui-no-tips" v-if="liftList.length === 0">
  62. <empty width="100" description="暂无电梯"></empty>
  63. </div>
  64. <div class="lift-box" v-else>
  65. <div class="lift-prev">
  66. <div class="icon"></div>
  67. </div>
  68. <div class="lift-list">
  69. <div class="lift-view">
  70. <div class="lift-item" v-for="(item,index) in liftList">
  71. <div class="lift-title">{{item.name}}</div>
  72. <div class="lift-content">
  73. <div class="lift-bage" :style="'bottom:'+returnHeight(item.data)+'%'">
  74. <span>{{item.data.nowLevel}}F</span>
  75. <div class="bage" v-if="!item.state"></div>
  76. <div class="bage error" v-else></div>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. <div class="lift-next">
  83. <div class="icon"></div>
  84. </div>
  85. </div>
  86. </div>
  87. <div class="lift-test">
  88. <div class="test-top">
  89. <div class="hui-chart-title">今日客流量统计</div>
  90. <div class="test-count">
  91. <div class="test-item">
  92. <div class="test-icon">
  93. <i class="iconfont huifont-zaichangrenshu"></i>
  94. </div>
  95. <div class="test-label">
  96. <div class="test-name">平均流量</div>
  97. <div class="test-value alibaba">{{personCount.averageNum}}</div>
  98. </div>
  99. </div>
  100. <div class="test-item">
  101. <div class="test-icon green">
  102. <i class="iconfont huifont-jinchang"></i>
  103. </div>
  104. <div class="test-label">
  105. <div class="test-name">进场人次</div>
  106. <div class="test-value alibaba">{{personCount.inNum}}</div>
  107. </div>
  108. </div>
  109. <div class="test-item">
  110. <div class="test-icon red">
  111. <i class="iconfont huifont-chuchang"></i>
  112. </div>
  113. <div class="test-label">
  114. <div class="test-name">出场人次</div>
  115. <div class="test-value alibaba">{{personCount.outNum}}</div>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. <div class="bim-box">
  121. <model ref="model" type="lift" fileId="10000892771892"></model>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. </template>
  128. <script>
  129. import model from '@/components/work/common/model'
  130. import {
  131. getDeviceCountList,
  132. getDeviceAlarmList,
  133. getEnergyDeviceList
  134. } from '@/httpApi/test'
  135. export default {
  136. data() {
  137. return {
  138. list: [],
  139. testCount: 0,
  140. personCount: {
  141. averageNum: 0,
  142. inNum: 0,
  143. outNum: 0,
  144. },
  145. liftList: []
  146. }
  147. },
  148. created() {
  149. this.init();
  150. },
  151. components: {
  152. model
  153. },
  154. methods: {
  155. init() {
  156. let postData = {
  157. type: 16,
  158. projectId: this.$store.getters.project.id
  159. }
  160. getDeviceCountList(postData).then(res => {
  161. if (res.state) {
  162. this.testCount = res.data[0] ? res.data[0].offline : 0;
  163. }
  164. })
  165. getDeviceAlarmList(postData).then(res => {
  166. if (res.state) {
  167. this.list = res.data;
  168. }
  169. })
  170. getEnergyDeviceList({
  171. projectId: this.$store.getters.project.id,
  172. type: 3
  173. }).then(res => {
  174. let inNum = 0,
  175. outNum = 0;
  176. this.liftList = res.data.map(node => {
  177. if (node['data']) node['data'] = JSON.parse(node.data);
  178. if (node['column2']) node['column2'] = JSON.parse(node.column2);
  179. inNum += parseInt(node.column1);
  180. outNum += parseInt(node.column3);
  181. return node;
  182. })
  183. if (this.liftList.length == 0) {
  184. this.personCount = {
  185. averageNum: 0,
  186. inNum: 0,
  187. outNum: 0,
  188. }
  189. } else {
  190. this.personCount = {
  191. averageNum: Math.floor(inNum / this.liftList.length),
  192. inNum: inNum,
  193. outNum: outNum,
  194. }
  195. }
  196. if (this.$refs.model) this.$refs.model.setData(this.liftList);
  197. })
  198. },
  199. returnHeight(data) {
  200. let all = data.max - data.min;
  201. return ((data.nowLevel - data.min) / all).toFixed(4) * 90
  202. }
  203. }
  204. }
  205. </script>
  206. <style lang="scss">
  207. .lift {
  208. width: 100%;
  209. height: 100%;
  210. display: flex;
  211. padding: 20px;
  212. .lift-test {
  213. flex: 1;
  214. display: flex;
  215. flex-direction: column;
  216. .test-top {
  217. background: #151A25;
  218. padding: 20px;
  219. }
  220. .test-count {
  221. margin-top: 20px;
  222. display: flex;
  223. .test-item {
  224. flex: 1;
  225. height: 94px;
  226. background: #19202E;
  227. display: flex;
  228. align-items: center;
  229. padding-left: 24px;
  230. color: #D2E4FF;
  231. margin-right: 12px;
  232. }
  233. .test-item:last-child {
  234. margin-right: 0;
  235. }
  236. .test-label {
  237. flex: 1;
  238. width: 0;
  239. overflow: hidden;
  240. }
  241. .test-value {
  242. font-size: 24px;
  243. margin-top: 5px;
  244. }
  245. .test-icon {
  246. width: 56px;
  247. height: 56px;
  248. background: #3371FF;
  249. border-radius: 20px;
  250. display: flex;
  251. align-items: center;
  252. justify-content: center;
  253. margin-right: 16px;
  254. i {
  255. font-size: 32px;
  256. color: #e6e6e6;
  257. }
  258. }
  259. .green {
  260. background: $--color-green;
  261. }
  262. .gray {
  263. background: #AFB9CC;
  264. }
  265. .purple {
  266. background: #9D60FB;
  267. }
  268. .red {
  269. background: $--color-red;
  270. }
  271. }
  272. }
  273. .lift-lists {
  274. flex: 1;
  275. background: #151A25;
  276. border-radius: 2px;
  277. display: flex;
  278. flex-direction: column;
  279. padding: 20px;
  280. margin-right: 13px;
  281. .hui-chart-title {
  282. margin-bottom: 20px;
  283. }
  284. .legend-box {
  285. width: 150px;
  286. position: relative;
  287. }
  288. .lift-alarm {
  289. margin-bottom: 30px;
  290. display: flex;
  291. }
  292. .alarm-list {
  293. flex: 1;
  294. width: 0;
  295. .alarm-title,
  296. .alarm-table {
  297. padding: 0;
  298. margin: 0;
  299. }
  300. .hui-test-alarm {
  301. height: 100%;
  302. }
  303. }
  304. .alarm-img {
  305. width: 104px;
  306. height: 104px;
  307. background-image: url(../../../../assets/img/work/lift/alarm.png);
  308. background-size: 100% 100%;
  309. display: flex;
  310. align-items: center;
  311. justify-content: center;
  312. margin-top: 32px;
  313. }
  314. .test-btn {
  315. width: 126px;
  316. line-height: 26px;
  317. background-image: url(../../../../assets/img/work/device/btn-bg.png);
  318. background-size: 100% 100%;
  319. text-align: center;
  320. margin-top: 7px;
  321. color: #FFE6E6;
  322. }
  323. .device-alarm-test {
  324. width: 168px;
  325. height: 232px;
  326. background: rgba(97, 133, 214, 0.05);
  327. display: flex;
  328. flex-direction: column;
  329. align-items: center;
  330. }
  331. .test-number {
  332. display: flex;
  333. align-items: center;
  334. margin-top: 12px;
  335. }
  336. .number {
  337. font-size: 24px;
  338. font-weight: bold;
  339. color: #FFE6E6;
  340. line-height: 33px;
  341. text-shadow: 0px 0px 12px rgba(249, 51, 59, 0.5);
  342. margin-right: 4px;
  343. }
  344. .unit {
  345. font-size: 12px;
  346. text-shadow: 0px 0px 12px rgba(249, 51, 59, 0.5);
  347. }
  348. .lift-title {
  349. width: 100%;
  350. overflow: hidden;
  351. height: 17px;
  352. line-height: 17px;
  353. margin-bottom: 6px;
  354. text-align: center;
  355. }
  356. .lift-bage {
  357. position: absolute;
  358. bottom: 0;
  359. text-align: center;
  360. width: 100%;
  361. }
  362. .bage {
  363. width: 12px;
  364. height: 6px;
  365. background: #2DB85C;
  366. box-shadow: 0px 0px 4px 0px rgba(45, 184, 92, 0.5);
  367. border-radius: 4px;
  368. margin: 5px auto;
  369. }
  370. .bage.error {
  371. background: #F04243;
  372. box-shadow: 0px 0px 4px 0px rgba(240, 66, 67, 0.5);
  373. }
  374. .lift-view {
  375. display: flex;
  376. height: 100%;
  377. }
  378. .lift-box {
  379. display: flex;
  380. flex: 1;
  381. height: 0;
  382. overflow: hidden;
  383. }
  384. .lift-list {
  385. flex: 1;
  386. width: 0;
  387. overflow: hidden;
  388. }
  389. .icon {
  390. background: url(../../../../assets/image/device/prev.png) no-repeat;
  391. width: 16px;
  392. height: 18px;
  393. background-size: 100% 100%;
  394. cursor: pointer;
  395. }
  396. .lift-next .icon {
  397. transform: rotate(180deg);
  398. }
  399. .lift-item {
  400. width: 60px;
  401. display: flex;
  402. flex-direction: column;
  403. align-items: center;
  404. font-size: 12px;
  405. padding: 0 2px;
  406. }
  407. .lift-content {
  408. width: 26px;
  409. flex: 1;
  410. height: 0;
  411. background: rgba(39, 54, 83, 0.3);
  412. border: 1px solid rgba(50, 74, 120, 0.7);
  413. position: relative;
  414. }
  415. }
  416. }
  417. </style>