center-top.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <div class="center-top_container position-r ">
  3. <div class="position-a sign-container">
  4. <div class="flex items-center">
  5. <div class="sign-style mr-0vw green"/>
  6. <span class="mr-0vw">运行</span>{{ run }}
  7. </div>
  8. <div class="flex items-center">
  9. <div class="sign-style mr-0vw yellow"/>
  10. <span class="mr-0vw">限电</span>{{ limit }}
  11. </div>
  12. <div class="flex items-center">
  13. <div class="sign-style mr-0vw red"/>
  14. <span class="mr-0vw">检修</span>{{ overhaul }}
  15. </div>
  16. <div class="flex items-center">
  17. <div class="sign-style mr-0vw grey"/>
  18. <span class="mr-0vw">无通讯</span>{{ noCommunication }}
  19. </div>
  20. </div>
  21. <div class="position-a" v-for="item in stationInfo" :style="{top:item.top+'vh',left:item.left+'vw',cursor:'pointer'}" @mouseenter="mousemoveRows(item)" @mouseleave="removeTips(item)" @click="jumpCloudDataPage(item)">
  22. <div v-if="Number(item.status) === 1">
  23. <img src="../../../assets/images/mapIcon/green-gf.png" class="img-style" v-if="item.stationType === 'E1'"/>
  24. <img src="../../../assets/images/mapIcon/green-fj.png" class="img-style" v-else/>
  25. </div>
  26. <div v-else-if="Number(item.status) === 2">
  27. <img src="../../../assets/images/mapIcon/yellow-gf.png" class="img-style" v-if="item.stationType === 'E1'"/>
  28. <img src="../../../assets/images/mapIcon/yellow-fj.png" class="img-style" v-else/>
  29. </div>
  30. <div v-else-if="Number(item.status) === 3">
  31. <img src="../../../assets/images/mapIcon/red-gf.png" class="img-style" v-if="item.stationType === 'E1'"/>
  32. <img src="../../../assets/images/mapIcon/red-fj.png" class="img-style" v-else/>
  33. </div>
  34. <div v-else class="image-container">
  35. <img src="../../../assets/images/mapIcon/grey-gf.png" class="img-style" v-if="item.stationType === 'E1'"/>
  36. <img src="../../../assets/images/mapIcon/grey-fj.png" class="img-style" v-else />
  37. </div>
  38. </div>
  39. <span class="runDay position-a">安全运行天数: {{ runningDays }}</span>
  40. </div>
  41. </template>
  42. <script>
  43. import '../../../assets/images/mapIcon/green-gf.png'
  44. export default {
  45. data() {
  46. return {
  47. runningDays: '',
  48. run: 0,
  49. limit: 0,
  50. overhaul: 0,
  51. noCommunication: 0,
  52. // 场站状态暂定: 运行:1 限电:2 检修:3 无通讯;0
  53. // left top 需要存数据库代替经纬度在图片上打点
  54. stationInfo:[],
  55. // stationInfo: [
  56. // {
  57. // name: '新疆测试场站信息',
  58. // stationCode: 'J01100',
  59. // status: '2',
  60. // capacity: '99.52',
  61. // ws: '12',
  62. // sjgl: '12',
  63. // dq: '12',
  64. // cdq: 12,
  65. // kygl: 12,
  66. // llgl: 12,
  67. // left: 24.7,
  68. // top: 14.5
  69. // },
  70. // {
  71. // name: '光电',
  72. // stationCode: 'J01101',
  73. // status: '1',
  74. // capacity: '99.52',
  75. // ws: '12',
  76. // sjgl: '12',
  77. // dq: '12',
  78. // cdq: 12,
  79. // kygl: 12,
  80. // llgl: 12,
  81. // left: 29,
  82. // top: 25
  83. // }
  84. // ]
  85. }
  86. },
  87. props: {
  88. params: {type: Object}
  89. },
  90. watch: {
  91. params: {
  92. // immediate: true,// 第一次立即监听
  93. handler(value) {
  94. this.stationInfo = value.mapDataDtoList
  95. this.runningDays = value.runDays
  96. this.run = value.yxcoutns
  97. this.limit = value.xdcoutns
  98. this.overhaul = value.jxcoutns
  99. this.noCommunication = value.txcoutns
  100. }
  101. }
  102. },
  103. mounted() {
  104. this.run = this.stationInfo.filter(w=>Number(w.status) === 1).length || 0
  105. this.limit = this.stationInfo.filter(w=>Number(w.status) === 2).length || 0
  106. this.overhaul = this.stationInfo.filter(w=>Number(w.status) === 3).length || 0
  107. this.noCommunication = this.stationInfo.filter(w=>Number(w.status) === 0).length || 0
  108. },
  109. methods: {
  110. /**
  111. * 创建tips
  112. * */
  113. mousemoveRows(row) {
  114. let hjLabel = '轮毂风速';
  115. if (row.stationType=='E1'){
  116. // 光
  117. hjLabel = '总辐射';
  118. }
  119. let status = Number(row.status) === 1?'运行':Number(row.status) === 2?'限电':Number(row.status) === 3?'检修':'无通讯'
  120. let content = `${row.name}<br/>当前状态:${status}<br/>容量状态:${row.capacity} MW<br/>`+hjLabel+`:${row.hj} m/s<br/>实时功率:${row.sjgl} MW<br/>短期功率:${row.dq} MW<br/>
  121. 超短期功率:${row.cdq} MW<br/>可用功率:${row.kygl} MW<br/>理论功率:${row.llgl} MW`
  122. this.createTips(row, content)
  123. },
  124. createTips(row, value) {
  125. const parent = document.querySelector('.center-top_container');
  126. const {detailId} = row
  127. const tooltipDom = document.createElement('div')
  128. tooltipDom.style.cssText = `
  129. display: inline-block;
  130. max-width: 400px;
  131. max-height: 400px;
  132. position: absolute;
  133. top: ${Number(row.top) + 1}vh;
  134. left: ${Number(row.left)+1.5}vw;
  135. padding:.5vh .6vw;
  136. overflow: auto;
  137. font-size: .7vw;
  138. font-family: PingFangSC-Regular, PingFang SC;
  139. font-weight: 400;
  140. color: #fff;
  141. background: rgba(77, 109, 144, 0.87);
  142. border-radius: 5px;
  143. z-index: 19999;
  144. box-shadow: 0 4px 12px 1px #89BFE5;
  145. `
  146. tooltipDom.innerHTML = value
  147. tooltipDom.setAttribute('id', `tooltip-${detailId}`)
  148. // 将浮层插入到body中
  149. parent.appendChild(tooltipDom);
  150. },
  151. /**
  152. * 移除tips
  153. * */
  154. removeTips(row) {
  155. const parent = document.querySelector('.center-top_container');
  156. const {detailId} = row
  157. const tooltipDomLeave = document.querySelectorAll(`#tooltip-${detailId}`)
  158. if (tooltipDomLeave.length) {
  159. tooltipDomLeave.forEach(dom => {
  160. parent.removeChild(dom)
  161. })
  162. }
  163. },
  164. /**
  165. * 跳转到中心预测页面
  166. * */
  167. jumpCloudDataPage(row){
  168. localStorage.setItem('map-jump-staion', row.stationCode)
  169. this.$router.push({path: "cloudDataQuery"})
  170. }
  171. }
  172. }
  173. </script>
  174. <style>
  175. .center-top_container {
  176. width: 100%;
  177. height: 58vh;
  178. //color: rgba(77, 109, 144, 0.87);
  179. }
  180. .sign-container {
  181. width: 5vw;
  182. right: .5vw;
  183. top: 1vh;
  184. }
  185. .runDay {
  186. left: 20vw;
  187. bottom: 0;
  188. color: orange;
  189. font-size: 1vw;
  190. font-weight: bold;
  191. }
  192. .sign-style {
  193. width: .5vw;
  194. height: 1vh;
  195. border-radius: .5vh;
  196. }
  197. .mr-0vw {
  198. margin-right: .5vw;
  199. }
  200. .green {
  201. background: #68ed68;
  202. }
  203. .green:hover {
  204. box-shadow: 0 4px 12px 1px #68ed68;
  205. }
  206. .yellow {
  207. background: yellow;
  208. }
  209. .yellow:hover {
  210. box-shadow: 0 4px 12px 1px yellow;
  211. }
  212. .red {
  213. background: red;
  214. }
  215. .red:hover {
  216. box-shadow: 0 4px 12px 1px red;
  217. }
  218. .grey {
  219. border-color: white;
  220. background: grey;
  221. }
  222. .grey:hover {
  223. box-shadow: 0 4px 12px 1px grey;
  224. }
  225. .img-style{
  226. width: 1.5vw;
  227. }
  228. .img-style:hover {
  229. transform: scale(1.3); /* 悬浮时放大图片 */
  230. }
  231. </style>