EneryParams.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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 {currentTime} from '../../tools/currentDate.js'
  74. import {formatTime, amendTime, date} from '../../tools/formatTime.js'
  75. import alarmCharts from '../main/AlarmCharts'
  76. export default {
  77. components: {
  78. alarmCharts
  79. },
  80. mixins: [],
  81. props: {
  82. roomInfo: {
  83. type: Object
  84. },
  85. isShowChange: {
  86. type: Boolean
  87. }
  88. },
  89. data () {
  90. return {
  91. ElecConsumPData: "--",
  92. GasConsumPData: "--",
  93. GasPressData: "--",
  94. FuelConsumPData: "--",
  95. FuelPressData: "--",
  96. WaterConsumPData: "--",
  97. WaterPressData: "--",
  98. HeatConsumPData: "--",
  99. charts: []
  100. }
  101. },
  102. computed: {
  103. },
  104. mounted () {
  105. this.$nextTick(function () {
  106. this.getCurrentData()
  107. })
  108. },
  109. watch: {
  110. isShowChange (newv, oldv) {
  111. if (newv) {
  112. this.changeDisplayNone()
  113. } else {
  114. this.changeDisplayBlock()
  115. }
  116. }
  117. },
  118. methods: {
  119. getCurrentData () {
  120. let params = {
  121. criterias: [
  122. {
  123. id: this.roomInfo.id,
  124. code: "ElecConsumP"
  125. },
  126. {
  127. id: this.roomInfo.id,
  128. code: "GasConsumP"
  129. },
  130. {
  131. id: this.roomInfo.id,
  132. code: "GasPress"
  133. },
  134. {
  135. id: this.roomInfo.id,
  136. code: "FuelConsumP"
  137. },
  138. {
  139. id: this.roomInfo.id,
  140. code: "FuelPress"
  141. },
  142. {
  143. id: this.roomInfo.id,
  144. code: "WaterConsumP"
  145. },
  146. {
  147. id: this.roomInfo.id,
  148. code: "WaterPress"
  149. },
  150. {
  151. id: this.roomInfo.id,
  152. code: "HeatConsumP"
  153. }
  154. ]
  155. }
  156. axios.post(`/data-platform-3/data-platform-3/parameter/batch_query_param?projectId=${this.$store.state.projId}&secret=${this.$store.state.secret}`, params).then(res => {
  157. let data = res.data
  158. if (data.Result == 'success') {
  159. let content = data.Content
  160. content.forEach(el => {
  161. if (el.code == 'ElecConsumP') {
  162. this.ElecConsumPData = el.data
  163. }
  164. if (el.code == 'GasConsumP') {
  165. this.GasConsumPData = el.data
  166. }
  167. if (el.code == 'GasPress') {
  168. this.GasPressData = el.data
  169. }
  170. if (el.code == 'FuelConsumP') {
  171. this.FuelConsumPData = el.data
  172. }
  173. if (el.code == 'FuelPress') {
  174. this.FuelPressData = el.data
  175. }
  176. if (el.code == 'WaterConsumP') {
  177. this.WaterConsumPData = el.data
  178. }
  179. if (el.code == 'WaterPress') {
  180. this.WaterPressData = el.data
  181. }
  182. if (el.code == 'HeatConsumP') {
  183. this.HeatConsumPData = el.data
  184. }
  185. })
  186. }
  187. })
  188. },
  189. changeDisplayNone () {
  190. let arr = document.querySelectorAll('.en-table .test')
  191. arr.forEach(i => {
  192. if (i.innerHTML.includes('--')) {
  193. i.parentNode.style.display = 'none'
  194. }
  195. })
  196. },
  197. changeDisplayBlock () {
  198. let arr = document.querySelectorAll('.en-table .test')
  199. arr.forEach(i => {
  200. if (i.innerHTML.includes('--')) {
  201. i.parentNode.style.display = 'table-row'
  202. }
  203. })
  204. },
  205. closeMask () {
  206. document.querySelector(".mask-bg").style.display = 'none'
  207. document.querySelector(".mask-layout").style.display = 'none'
  208. },
  209. // 得到图的数据
  210. getBoundData (code) {
  211. document.querySelector(".mask-bg").style.display = 'block'
  212. document.querySelector(".mask-layout").style.display = 'block'
  213. let period = "5min"
  214. let receivetime = {
  215. $gte: date(amendTime(Date.parse(new Date()) - 24 * 60 * 60 * 60 * 30)),
  216. $lt: date(amendTime(Date.parse(new Date())))
  217. }
  218. let params = {
  219. criteria: {
  220. id: this.roomInfo.id,
  221. code: code, // 信息点编码
  222. period: period,
  223. receivetime: receivetime
  224. }
  225. }
  226. axios.post(`/data-platform-3/data-platform-3/hisdata/query_period_data?projectId=${this.$store.state.projId}&secret=${this.$store.state.secret}`, params).then(res => {
  227. let data = res.data
  228. if (data.Result == 'success') {
  229. this.charts = data.Content
  230. this.charts.forEach(el => {
  231. el.time = formatTime(el.data_time)
  232. el.value = parseInt(el.data_value)
  233. })
  234. }
  235. })
  236. }
  237. }
  238. }
  239. </script>
  240. <style scoped lang="less" >
  241. .en-table {
  242. width:95%;
  243. margin-bottom: 38px;
  244. table{
  245. width: 100%;
  246. font-size: 14px;
  247. }
  248. tr:nth-child(2n)>td{
  249. background: #f5f5f5;
  250. }
  251. td {
  252. width:30%;
  253. .look-btn{
  254. color:#6682E6;
  255. background:none;
  256. }
  257. }
  258. .mask-bg {
  259. position: fixed;
  260. top: 0;
  261. bottom: 0;
  262. left: 0;
  263. right: 0;
  264. z-index: 99;
  265. background:rgba(0, 0, 0, .6);
  266. display: none;
  267. }
  268. .mask-layout{
  269. width: 680px;
  270. height: 480px;
  271. background: #fff;
  272. box-shadow: 0 2px 8px 0 rgba(0,0,0,0.12);
  273. border-radius: 4px;
  274. z-index: 999;
  275. position: fixed;
  276. top: 230px;
  277. left: 50%;
  278. margin-left: -360px;
  279. display: none;
  280. .box-title {
  281. line-height: 60px;
  282. height: 60px;
  283. font-size: 16px;
  284. color: #FFFFFF;
  285. background: #728DEE;
  286. padding-left: 40px;
  287. margin-bottom: 0;
  288. // .box-header{
  289. // display: inline-block;
  290. // width: 503px;
  291. // height: 60px;
  292. // overflow: hidden;
  293. // text-overflow: ellipsis;
  294. // white-space: nowrap;
  295. // }
  296. .close-btn{
  297. float: right;
  298. margin-top: 20px;
  299. margin-right: 14px;
  300. cursor: pointer;
  301. }
  302. }
  303. }
  304. }
  305. </style>