index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. <template>
  2. <div>
  3. <Head :headText='headText'></Head>
  4. <div class='nav-right'>
  5. <el-radio-group v-model='radio'>
  6. <el-radio label='1' @change='radioChange'>近30天</el-radio>
  7. <el-radio label='2' @change='radioChange' style='margin-right:10px;'>自定义</el-radio>
  8. </el-radio-group>
  9. <div class='count-top-right'>
  10. <span class='arrow-left' @click='daterangeLeft'></span>
  11. <span class='arrow-line arrow-line1' @click='daterangeLeft'></span>
  12. <el-date-picker
  13. v-model='pickerVal2'
  14. type='daterange'
  15. format='yyyy.MM.dd'
  16. value-format='timestamp'
  17. range-separator='至'
  18. start-placeholder='开始日期'
  19. end-placeholder='结束日期'
  20. :picker-options='pickerOptions'
  21. @change='query(1)'
  22. ></el-date-picker>
  23. <span class='arrow-line' @click='daterangeRight'></span>
  24. <span class='arrow-right' @click='daterangeRight'></span>
  25. </div>
  26. </div>
  27. <div class='evaluateContainer'>
  28. <div class='ev-content'>
  29. <div class='ev-cont-div'>
  30. <p class='ev-top Micbold'>室内温度满足率</p>
  31. <div class='ev-bottom'>
  32. <div class='ev-bottom-left'>
  33. <div id='rate1' style='width:100%;height:100%;'></div>
  34. </div>
  35. <div class='ev-bottom-right MicrYaHei'>
  36. <p></p>
  37. <p>
  38. <span>超限程度</span>
  39. <span>{{tindoorOverrunDegree}}</span>
  40. <span>°C</span>
  41. </p>
  42. </div>
  43. </div>
  44. </div>
  45. <div class='ev-cont-div'>
  46. <p class='ev-top'>节能率</p>
  47. <div class='ev-bottom'>
  48. <div class='ev-bottom-left'>
  49. <div id='rate2' style='width:100%;height:100%;'></div>
  50. </div>
  51. <div class='ev-bottom-right'>
  52. <p>
  53. <span>节能量</span>
  54. <span>{{energySaving}}</span>
  55. <span>kWh</span>
  56. </p>
  57. </div>
  58. </div>
  59. </div>
  60. <div class='ev-cont-div'>
  61. <p class='ev-top'>策略执行率</p>
  62. <div class='ev-bottom'>
  63. <div class='ev-bottom-left'>
  64. <div id='rate3' style='width:100%;height:100%;'></div>
  65. </div>
  66. <div class='ev-bottom-right'>
  67. <p>
  68. <span>执行数量</span>
  69. <span>{{isExecutedNum}}</span>
  70. <span></span>
  71. </p>
  72. <p>
  73. <span>已发策略</span>
  74. <span>{{allReceivedNum}}</span>
  75. <span></span>
  76. </p>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. <div class='ev-footer'>
  82. <ev-indoor-temperature v-if='energyDataList.length>=0' :energyDataList='energyDataList'></ev-indoor-temperature>
  83. </div>
  84. </div>
  85. </div>
  86. </template>
  87. <script>
  88. import echarts from 'echarts'
  89. import Head from '../main/index'
  90. import EvIndoorTemperature from './evIndoorTemperature'
  91. import { runDataQury } from '@/api/evaluate/evaluate.js'
  92. import moment from 'moment'
  93. import { timestamp2String } from '@/utils/helper.js'
  94. import { mapGetters } from 'vuex'
  95. export default {
  96. data() {
  97. return {
  98. headText: '运行评价',
  99. pickerOptions: {
  100. onPick: ({ maxDate, minDate }) => {
  101. this.pickerMinDate = minDate.getTime()
  102. if (maxDate) {
  103. this.pickerMinDate = ''
  104. }
  105. },
  106. disabledDate(time) {
  107. return time.getTime() > Date.now() - 8.64e7
  108. }
  109. },
  110. date: '2',
  111. pickerVal2: [new Date().getTime() - 24 * 60 * 60 * 1000 * 30, new Date().getTime() - 24 * 60 * 60 * 1000],
  112. radio: '1',
  113. tindoorFillRate: '', //室内温度满足率
  114. energySavingRate: '', //节能率
  115. chillerExecuteRate: '', //略执行率
  116. energySaving: '', //节能量
  117. isExecutedNum: '', //已执行数量
  118. allReceivedNum: '', //共收到数量
  119. tindoorOverrunDegree: '', //超限程度
  120. energyDataList: [] //图标数据
  121. }
  122. },
  123. components: {
  124. Head,
  125. EvIndoorTemperature
  126. },
  127. mounted() {
  128. this.query(0)
  129. },
  130. computed: {
  131. ...mapGetters(['projects', 'projectId'])
  132. },
  133. methods: {
  134. rate(pieData, box, colors) {
  135. const myChart = echarts.init(document.querySelector(box))
  136. const data = pieData
  137. const option = {
  138. grid: {
  139. top: 5,
  140. bottom: 5
  141. },
  142. color: colors,
  143. series: [
  144. {
  145. name: 'valueOfMarket',
  146. type: 'pie',
  147. center: ['50%', '50%'],
  148. radius: ['60%', '70%'],
  149. avoidLabelOverlap: false,
  150. hoverAnimation: false,
  151. label: {
  152. normal: {
  153. show: true,
  154. position: 'center',
  155. color: '#000000',
  156. fontSize: 20,
  157. lineHeight: 0,
  158. formatter: '{b}\n{c}%'
  159. }
  160. },
  161. data: [
  162. {
  163. value: data,
  164. label: {
  165. normal: {
  166. show: true
  167. }
  168. }
  169. },
  170. {
  171. value: 100 - data,
  172. name: '',
  173. label: {
  174. normal: {
  175. show: false
  176. }
  177. }
  178. }
  179. ]
  180. }
  181. ]
  182. }
  183. myChart.setOption(option)
  184. },
  185. formatter(date) {
  186. return moment.unix(date / 1000).format('YYYYMMDD')
  187. },
  188. radioChange(val) {
  189. if (this.radio == '1') {
  190. this.pickerVal2 = [new Date().getTime() - 24 * 60 * 60 * 1000 * 30, new Date().getTime() - 24 * 60 * 60 * 1000]
  191. }
  192. this.query(0)
  193. },
  194. query(type) {
  195. if (type == '1') {
  196. this.radio = '2'
  197. }
  198. this.runDataQuryArr = []
  199. let getParams = {
  200. begin: timestamp2String(this.pickerVal2[0]).slice(0, 8),
  201. end: timestamp2String(this.pickerVal2[1]).slice(0, 8)
  202. }
  203. runDataQury(null, { getParams }).then(res => {
  204. if (res.result == 'success') {
  205. this.tindoorFillRate = res.tindoorFillRate != undefined && res.tindoorFillRate != -9999 ? res.tindoorFillRate.toFixed(1) : 0 //室内温度满足率
  206. console.log('室内温度满足率', this.tindoorFillRate)
  207. this.energySavingRate = res.energySavingRate != undefined && res.energySavingRate != -9999 ? res.energySavingRate.toFixed(1) : 0 //节能率
  208. console.log('节能率', this.energySavingRate)
  209. this.chillerExecuteRate =
  210. res.chillerExecuteRate != undefined && res.chillerExecuteRate != -9999 ? res.chillerExecuteRate.toFixed(1) : 0 //略执行率
  211. console.log('略执行率', this.chillerExecuteRate)
  212. this.energySaving = res.energySaving != undefined && res.energySaving != -9999 ? res.energySaving.toFixed(0) : 0 //节能量
  213. console.log('节能量', this.energySaving)
  214. this.isExecutedNum = res.isExecutedNum //已执行数量
  215. console.log('已执行数量', this.isExecutedNum)
  216. this.allReceivedNum = res.allReceivedNum //共收到数量
  217. console.log('共收到数量', this.allReceivedNum)
  218. this.tindoorOverrunDegree =
  219. res.tindoorOverrunDegree != undefined && res.tindoorOverrunDegree != -9999 ? res.tindoorOverrunDegree.toFixed(1) : 0 //超限程度
  220. console.log('超限程度', this.tindoorOverrunDegree)
  221. this.energyDataList = res.dataList ? res.dataList : []
  222. this.queryRate()
  223. }
  224. })
  225. },
  226. queryRate() {
  227. if (this.tindoorFillRate) {
  228. this.rate(this.tindoorFillRate, '#rate1', ['#0091FF', '#E1F2FF'])
  229. }
  230. if (this.energySavingRate) {
  231. this.rate(this.energySavingRate, '#rate2', ['#FFBA6B', '#FEE9D2'])
  232. }
  233. if (this.chillerExecuteRate) {
  234. this.rate(this.chillerExecuteRate, '#rate3', ['#00D6B9', '#D5F6F2'])
  235. }
  236. },
  237. daterangeLeft() {
  238. if (this.pickerVal2.length > 0) {
  239. this.pickerVal2[0] = this.pickerVal2[0] - 24 * 60 * 60 * 1000
  240. this.pickerVal2[1] = this.pickerVal2[1] - 24 * 60 * 60 * 1000
  241. this.pickerVal2 = [this.pickerVal2[0], this.pickerVal2[1]]
  242. this.query(0)
  243. }
  244. },
  245. daterangeRight() {
  246. if (this.pickerVal2.length > 0) {
  247. let end = this.formatter(new Date().getTime() - 24 * 60 * 60 * 1000)
  248. if (this.formatter(this.pickerVal2[1]) == end) {
  249. this.pickerVal2[1] = new Date().getTime() - 24 * 60 * 60 * 1000
  250. } else {
  251. this.pickerVal2[0] = this.pickerVal2[0] + 24 * 60 * 60 * 1000
  252. this.pickerVal2[1] = this.pickerVal2[1] + 24 * 60 * 60 * 1000
  253. }
  254. this.pickerVal2 = [this.pickerVal2[0], this.pickerVal2[1]]
  255. this.query(0)
  256. }
  257. }
  258. }
  259. }
  260. </script>
  261. <style lang="scss" scoped>
  262. .nav-right {
  263. height: 48px;
  264. position: fixed;
  265. right: 24px;
  266. top: 53px;
  267. z-index: 1;
  268. display: flex;
  269. align-items: center;
  270. .count-top-right {
  271. width: 264px;
  272. height: 32px;
  273. background: rgba(255, 255, 255, 1);
  274. border-radius: 4px;
  275. border: 1px solid rgba(195, 198, 203, 1);
  276. display: flex;
  277. align-items: center;
  278. .arrow-left {
  279. width: 16px;
  280. height: 16px;
  281. background: url('../../assets/left.png');
  282. margin-right: 5px;
  283. margin-left: 7px;
  284. cursor: pointer;
  285. }
  286. .arrow-right {
  287. margin-right: 7px;
  288. margin-left: 5px;
  289. width: 16px;
  290. height: 16px;
  291. background: url('../../assets/right.png');
  292. cursor: pointer;
  293. }
  294. .arrow-line {
  295. display: inline-block;
  296. width: 2px;
  297. height: 16px;
  298. background: rgba(228, 229, 231, 1);
  299. }
  300. .arrow-line1 {
  301. margin-right: 3.5px;
  302. }
  303. }
  304. }
  305. .evaluateContainer {
  306. padding: 0 24px;
  307. background: #fff;
  308. .ev-content {
  309. margin-top: 20px;
  310. display: flex;
  311. .ev-cont-div {
  312. padding: 16px 20px;
  313. background: rgba(248, 249, 250, 1);
  314. border-radius: 6px;
  315. border: 1px solid rgba(238, 238, 238, 1);
  316. margin-right: 12px;
  317. flex: 1;
  318. .ev-top {
  319. margin: 0;
  320. height: 24px;
  321. font-size: 16px;
  322. color: rgba(31, 36, 41, 1);
  323. line-height: 21px;
  324. }
  325. .ev-bottom {
  326. display: flex;
  327. align-items: center;
  328. p {
  329. margin: 0;
  330. }
  331. .ev-bottom-left {
  332. width: 124px;
  333. height: 124px;
  334. justify-content: flex-start;
  335. margin: 0;
  336. }
  337. .ev-bottom-right {
  338. p {
  339. font-size: 14px;
  340. color: rgba(100, 108, 115, 1);
  341. line-height: 19px;
  342. span {
  343. display: inline-block;
  344. }
  345. span:nth-of-type(1) {
  346. margin-right: 12px;
  347. }
  348. span:nth-of-type(2) {
  349. font-size: 18px;
  350. font-family: Persagy;
  351. color: rgba(32, 35, 42, 1);
  352. line-height: 22px;
  353. }
  354. span:nth-of-type(3) {
  355. font-size: 10px;
  356. }
  357. }
  358. p:nth-of-type(1) {
  359. margin-bottom: 10px;
  360. }
  361. }
  362. }
  363. }
  364. }
  365. .ev-footer {
  366. width: 100%;
  367. height: 430px;
  368. margin-top: 36px;
  369. }
  370. }
  371. </style>
  372. <style lang="scss">
  373. .count-top-right {
  374. .count-top-right .el-input__inner {
  375. margin: 7px 0;
  376. }
  377. .el-input__inner {
  378. width: 210px;
  379. margin: 7px 6px;
  380. height: 22px;
  381. line-height: 22px;
  382. font-size: 12px;
  383. border: none;
  384. }
  385. .el-input__icon {
  386. display: none;
  387. }
  388. .el-range-editor.el-input__inner {
  389. padding: 3px 0;
  390. }
  391. .el-input--prefix .el-input__inner {
  392. padding-left: 5px;
  393. }
  394. .el-input--suffix .el-input__inner {
  395. padding-right: 5px;
  396. }
  397. .el-date-editor .el-range-input {
  398. width: 65%;
  399. }
  400. .el-date-editor .el-range-separator {
  401. line-height: 18px;
  402. color: #8d9399;
  403. }
  404. .el-date-editor .el-range-input {
  405. color: #1f2329;
  406. }
  407. .el-date-editor .el-range-separator {
  408. padding: 0 15px;
  409. }
  410. .el-radio__label {
  411. height: 22px;
  412. font-size: 14px;
  413. font-family: MicrosoftYaHei;
  414. color: rgba(31, 36, 41, 1);
  415. line-height: 19px;
  416. padding-left: 5px;
  417. }
  418. .el-radio {
  419. margin-right: 20px !important;
  420. }
  421. }
  422. </style>