EneryParams.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <template>
  2. <div class="en-table">
  3. <table class="ivu-table-wrapper stripe ivu-table ivu-table-border ivu-table-stripe" style="position:relative">
  4. <div class="">
  5. <table class="">
  6. <colgroup></colgroup>
  7. <tr class="ivu-table-row">
  8. <td class="ivu-table-cell " >信息点</td>
  9. <td class="ivu-table-cell" >表号功能号</td>
  10. <td class="ivu-table-cell" >实时数据</td>
  11. <td class="ivu-table-cell" >曲线变化</td>
  12. </tr>
  13. <tr class="ivu-table-row" >
  14. <td class="ivu-table-cell fixed-td">逐时用电功率</td>
  15. <td class="ivu-table-cell test">{{roomInfo.infos.ElecConsumP || '--'}} </td>
  16. <td class="ivu-table-cell" >{{ ElecConsumPData || '--'}} kW</td>
  17. <td class="ivu-table-cell" ><button v-if="roomInfo.infos.ElecConsumP" class="look-btn" @click="getBoundData(roomInfo.infos.ElecConsumP)">查看</button></td>
  18. </tr>
  19. <tr class="ivu-table-row" >
  20. <td class="ivu-table-cell fixed-td" >逐时用燃气量</td>
  21. <td class="ivu-table-cell test">{{roomInfo.infos.GasConsumP || '--'}}</td>
  22. <td class="ivu-table-cell" >{{GasConsumPData || '--'}} m³/h</td>
  23. <td class="ivu-table-cell" ><button v-if="roomInfo.infos.GasConsumP" class="look-btn" @click="getBoundData(roomInfo.infos.GasConsumP)">查看</button></td>
  24. </tr>
  25. <tr class="ivu-table-row" >
  26. <td class="ivu-table-cell fixed-td">燃气压力</td>
  27. <td class="ivu-table-cell test">{{roomInfo.infos.GasPress || '--'}}</td>
  28. <td class="ivu-table-cell" >{{GasPressData || '--'}} Pa</td>
  29. <td class="ivu-table-cell" ><button v-if="roomInfo.infos.GasPress" class="look-btn" @click="getBoundData(roomInfo.infos.GasPress)">查看</button></td>
  30. </tr>
  31. <tr class="ivu-table-row" >
  32. <td class="ivu-table-cell fixed-td" >逐时用燃油量</td>
  33. <td class="ivu-table-cell test">{{roomInfo.infos.FuelConsumP || '--'}} </td>
  34. <td class="ivu-table-cell" >{{FuelConsumPData || '--'}} L/h</td>
  35. <td class="ivu-table-cell" ><button v-if="roomInfo.infos.FuelConsumP" class="look-btn" @click="getBoundData(roomInfo.infos.FuelConsumP)">查看</button></td>
  36. </tr>
  37. <tr class="ivu-table-row" >
  38. <td class="ivu-table-cell ">燃油压力</td>
  39. <td class="ivu-table-cell test">{{roomInfo.infos.FuelPress || '--'}}</td>
  40. <td class="ivu-table-cell" >{{FuelPressData || '--'}} MPa</td>
  41. <td class="ivu-table-cell" ><button v-if="roomInfo.infos.FuelPress" class="look-btn" @click="getBoundData(roomInfo.infos.FuelPress)">查看</button></td>
  42. </tr>
  43. <tr class="ivu-table-row" >
  44. <td class="ivu-table-cell ">逐时用水量</td>
  45. <td class="ivu-table-cell test">{{roomInfo.infos.WaterConsumP || '--'}}</td>
  46. <td class="ivu-table-cell" >{{WaterConsumPData || '--'}} m³/h</td>
  47. <td class="ivu-table-cell" ><button v-if="roomInfo.infos.WaterConsumP" class="look-btn" @click="getBoundData(roomInfo.infos.WaterConsumP)">查看</button></td>
  48. </tr>
  49. <tr class="ivu-table-row" >
  50. <td class="ivu-table-cell">自来水压力</td>
  51. <td class="ivu-table-cell test">{{roomInfo.infos.WaterPress || '--'}}</td>
  52. <td class="ivu-table-cell" >{{WaterPressData || '--'}} MPa</td>
  53. <td class="ivu-table-cell" ><button v-if="roomInfo.infos.WaterPress" class="look-btn" @click="getBoundData(roomInfo.infos.WaterPress)">查看</button></td>
  54. </tr>
  55. <tr class="ivu-table-row" >
  56. <td class="ivu-table-cell " >逐时用热量</td>
  57. <td class="ivu-table-cell test">{{roomInfo.infos.HeatConsumP || '--'}}</td>
  58. <td class="ivu-table-cell" >{{HeatConsumPData || '--'}} kW</td>
  59. <td class="ivu-table-cell" ><button v-if='roomInfo.infos.HeatConsumP' class="look-btn" @click="getBoundData(roomInfo.infos.HeatConsumP)">查看</button></td>
  60. </tr>
  61. </table>
  62. </div>
  63. </table>
  64. <div class="mask-bg"></div>
  65. <div class="mask-layout">
  66. <p class="box-title">详细信息<Icon type="md-close" class='close-btn' @click="closeMask"/></p>
  67. <alarm-charts v-if="charts" :charts='charts'></alarm-charts>
  68. </div>
  69. </div>
  70. </template>
  71. <script>
  72. import axios from 'axios'
  73. import {formatTime, amendTime, date} from '../../tools/formatTime.js'
  74. import alarmCharts from '../main/alarmChart'
  75. export default {
  76. components: {
  77. alarmCharts
  78. },
  79. mixins: [],
  80. props: {
  81. roomInfo: {
  82. type: Object
  83. },
  84. isShowChange: {
  85. type: Boolean
  86. }
  87. },
  88. data () {
  89. return {
  90. ElecConsumPData: "--",
  91. GasConsumPData: "--",
  92. GasPressData: "--",
  93. FuelConsumPData: "--",
  94. FuelPressData: "--",
  95. WaterConsumPData: "--",
  96. WaterPressData: "--",
  97. HeatConsumPData: "--",
  98. charts: []
  99. }
  100. },
  101. computed: {
  102. },
  103. mounted () {
  104. this.$nextTick(function () {
  105. this.getCurrentData()
  106. })
  107. },
  108. watch: {
  109. isShowChange (newv, oldv) {
  110. if (newv) {
  111. this.changeDisplayNone()
  112. } else {
  113. this.changeDisplayBlock()
  114. }
  115. }
  116. },
  117. methods: {
  118. getCurrentData () {
  119. let params = {
  120. criterias: [
  121. {
  122. id: this.roomInfo.id,
  123. code: "ElecConsumP"
  124. },
  125. {
  126. id: this.roomInfo.id,
  127. code: "GasConsumP"
  128. },
  129. {
  130. id: this.roomInfo.id,
  131. code: "GasPress"
  132. },
  133. {
  134. id: this.roomInfo.id,
  135. code: "FuelConsumP"
  136. },
  137. {
  138. id: this.roomInfo.id,
  139. code: "FuelPress"
  140. },
  141. {
  142. id: this.roomInfo.id,
  143. code: "WaterConsumP"
  144. },
  145. {
  146. id: this.roomInfo.id,
  147. code: "WaterPress"
  148. },
  149. {
  150. id: this.roomInfo.id,
  151. code: "HeatConsumP"
  152. }
  153. ]
  154. }
  155. axios.post(`/data-platform-3/parameter/batch_query_param?projectId=${this.$store.state.projId}&secret=${this.$store.state.secret}`, params).then(res => {
  156. let data = res.data
  157. if (data.Result == 'success') {
  158. let content = data.Content
  159. content.forEach(el => {
  160. if (el.code == 'ElecConsumP') {
  161. this.ElecConsumPData = el.data
  162. }
  163. if (el.code == 'GasConsumP') {
  164. this.GasConsumPData = el.data
  165. }
  166. if (el.code == 'GasPress') {
  167. this.GasPressData = el.data
  168. }
  169. if (el.code == 'FuelConsumP') {
  170. this.FuelConsumPData = el.data
  171. }
  172. if (el.code == 'FuelPress') {
  173. this.FuelPressData = el.data
  174. }
  175. if (el.code == 'WaterConsumP') {
  176. this.WaterConsumPData = el.data
  177. }
  178. if (el.code == 'WaterPress') {
  179. this.WaterPressData = el.data
  180. }
  181. if (el.code == 'HeatConsumP') {
  182. this.HeatConsumPData = el.data
  183. }
  184. })
  185. }
  186. })
  187. },
  188. changeDisplayNone () {
  189. let arr = document.querySelectorAll('.en-table .test')
  190. arr.forEach(i => {
  191. if (i.innerHTML.includes('--')) {
  192. i.parentNode.style.display = 'none'
  193. }
  194. })
  195. },
  196. changeDisplayBlock () {
  197. let arr = document.querySelectorAll('.en-table .test')
  198. arr.forEach(i => {
  199. if (i.innerHTML.includes('--')) {
  200. i.parentNode.style.display = 'table-row'
  201. }
  202. })
  203. },
  204. closeMask () {
  205. document.querySelector(".mask-bg").style.display = 'none'
  206. document.querySelector(".mask-layout").style.display = 'none'
  207. },
  208. // 得到图的数据
  209. getBoundData (code) {
  210. document.querySelector(".mask-bg").style.display = 'block'
  211. document.querySelector(".mask-layout").style.display = 'block'
  212. let period = "5min"
  213. let receivetime = {
  214. $gte: date(amendTime(Date.parse(new Date()) - 24 * 60 * 60 * 60 * 30)),
  215. $lt: date(amendTime(Date.parse(new Date())))
  216. }
  217. let params = {
  218. criteria: {
  219. id: this.roomInfo.id,
  220. code: code, // 信息点编码
  221. period: period,
  222. receivetime: receivetime
  223. }
  224. }
  225. axios.post(`/data-platform-3/hisdata/query_period_data?projectId=${this.$store.state.projId}&secret=${this.$store.state.secret}`, params).then(res => {
  226. let data = res.data
  227. if (data.Result == 'success') {
  228. this.charts = data.Content
  229. this.charts.forEach(el => {
  230. el.time = formatTime(el.data_time)
  231. el.value = parseInt(el.data_value)
  232. })
  233. }
  234. })
  235. }
  236. }
  237. }
  238. </script>
  239. <style scoped lang="less" >
  240. .en-table {
  241. width:95%;
  242. margin-bottom: 38px;
  243. table{
  244. width: 100%;
  245. font-size: 14px;
  246. }
  247. tr:nth-child(2n)>td{
  248. background: #f5f5f5;
  249. }
  250. td {
  251. width:30%;
  252. .look-btn{
  253. color:#6682E6;
  254. background:none;
  255. }
  256. }
  257. .mask-bg {
  258. position: fixed;
  259. top: 0;
  260. bottom: 0;
  261. left: 0;
  262. right: 0;
  263. z-index: 99;
  264. background:rgba(0, 0, 0, .6);
  265. display: none;
  266. }
  267. .mask-layout{
  268. width: 680px;
  269. height: 480px;
  270. background: #fff;
  271. box-shadow: 0 2px 8px 0 rgba(0,0,0,0.12);
  272. border-radius: 4px;
  273. z-index: 999;
  274. position: fixed;
  275. top: 230px;
  276. left: 50%;
  277. margin-left: -360px;
  278. display: none;
  279. .box-title {
  280. line-height: 60px;
  281. height: 60px;
  282. font-size: 16px;
  283. color: #FFFFFF;
  284. background: #728DEE;
  285. padding-left: 40px;
  286. margin-bottom: 0;
  287. // .box-header{
  288. // display: inline-block;
  289. // width: 503px;
  290. // height: 60px;
  291. // overflow: hidden;
  292. // text-overflow: ellipsis;
  293. // white-space: nowrap;
  294. // }
  295. .close-btn{
  296. float: right;
  297. margin-top: 20px;
  298. margin-right: 14px;
  299. cursor: pointer;
  300. }
  301. }
  302. }
  303. }
  304. </style>