evTwoLevelMenu.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  1. <template>
  2. <div class='evTwoContainer'>
  3. <div class='evTwoContainer-out'>
  4. <Head :headText='headText'></Head>
  5. <div class='count-top'>
  6. <div class='count-top-left MicrYaHei'>
  7. <span>首页</span>
  8. <span>></span>
  9. <span>单日运行评价</span>
  10. </div>
  11. <ul class='MicrYaHei'>
  12. <router-link style='display: inline-block;min-width:300px;min-height:30px;cursor: pointer;' :to='{path:"/evaluate"}'></router-link>
  13. <div>
  14. <li v-for='(item,index) in tabArr' :key='index' :class='{current:num==`${index+1}`}' @click='changeNum(`${index+1}`)'>{{item}}</li>
  15. </div>
  16. <div class='count-top-right'>
  17. <date-temp v-if='date' @pickerVal='pickerVal' :date='date'></date-temp>
  18. </div>
  19. </ul>
  20. <div class='count-bottom'>
  21. <div v-if='num == 1'>
  22. <ev-rate-title :tab='1' :rate='tindoorFillRate'></ev-rate-title>
  23. <div class='count-bottom-switch'>
  24. <span class='switchSpan'>只显示不满足的点位</span>
  25. <el-switch v-model='value2' @change='changeNum("1")'></el-switch>
  26. </div>
  27. <div class='count-bottom-content'>
  28. <ev-two-table v-if='dataList.length>0' :switch='value2' :dataList='dataList' :value2='value2'></ev-two-table>
  29. </div>
  30. <div class='count-bottom-foot'>
  31. <ev-stacked-line v-if='stackArr.length>0' :stackArr='stackArr'></ev-stacked-line>
  32. </div>
  33. </div>
  34. <div v-show='num == 2'>
  35. <ev-rate-title :tab='2' :rate='energySavingRate' :accuracy='accuracy'></ev-rate-title>
  36. <div class='count-historical-data'>
  37. <ev-history
  38. v-if='Object.keys(current).length>0||Object.keys(similarDay).length>0||Object.keys(maxArr).length>0'
  39. :current='current'
  40. :similarDay='similarDay'
  41. :maxArr='maxArr'
  42. ></ev-history>
  43. <div class='count-foot'>
  44. <div class='count-foot-title'>
  45. <span class='Micbold'>相似日概况</span>
  46. <span class='MicrYaHei'>相似度{{current.similarity||'--'}}</span>
  47. </div>
  48. <div class='count-foot-table'>
  49. <ev-energy-table v-if='samples.length>=0' :samples='samples'></ev-energy-table>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. <div v-show='num == 3'>
  55. <ev-rate-title :chillerExecuteRateReal='chillerExecuteRateReal' :tab='3'></ev-rate-title>
  56. <ev-card v-if='cardList.length>=0' :cardList='cardList' :date='date'></ev-card>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. </template>
  63. <script>
  64. import Head from '../main/index'
  65. import EvTwoTable from './evTwoTable'
  66. import EvStackedLine from './evStackedLine'
  67. import EvEnergyTable from './evEnergyTable'
  68. import EvCard from './evCard' //执行率
  69. import EvRateTitle from './evRateTitle'
  70. import EvHistory from './evHistory'
  71. import DateTemp from './dateTemp'
  72. import { energyDayQuery, querychiller, queryTdbDay } from '@/api/evaluate/evaluate.js'
  73. import { queryChillerExecuteInfo } from '@/api/appeal/appeal.js'
  74. import { formatterRes } from '@/utils/moment.js'
  75. export default {
  76. data() {
  77. return {
  78. formatterRes,
  79. tabArr: ['室内温度', '节能率', '执行率'],
  80. headText: '运行评价',
  81. num: 1, //tab @
  82. date: '', // 传过来的日期@
  83. type: '', //传过来的日期 @
  84. value2: true,
  85. current: {}, //本日概况 @
  86. similarDay: {}, //相似日概况 @
  87. samples: [], //相似日列表 @
  88. maxArr: [], // @
  89. dataList: [], //室内温度满足率@
  90. tindoorFillRate: '', //室内温度满足率@
  91. energySavingRate: '', //节能率
  92. cardList: [], //执行率@
  93. dateVal: '', //@
  94. stackArr: [],
  95. accuracy: '',
  96. chillerExecuteRateReal: ''
  97. }
  98. },
  99. components: {
  100. Head,
  101. EvTwoTable,
  102. EvStackedLine,
  103. EvEnergyTable,
  104. EvCard,
  105. EvRateTitle,
  106. EvHistory,
  107. DateTemp
  108. },
  109. mounted() {
  110. this.init()
  111. },
  112. methods: {
  113. init() {
  114. this.type = this.$route.params.name
  115. this.date = this.$route.params.date
  116. if (this.type == '室内温度满足率') {
  117. this.num = 1
  118. } else if (this.type == '节能率') {
  119. this.num = 2
  120. } else {
  121. this.num = 3
  122. }
  123. },
  124. // 室内温度table @
  125. queryTdbDayMethod(date) {
  126. this.dataList = []
  127. let obj = {}
  128. let getParams = {}
  129. if (this.value2) {
  130. getParams.isSatisfy = !this.value2
  131. } else {
  132. getParams = {}
  133. }
  134. this.tindoorFillRate = ''
  135. queryTdbDay(date, { getParams }).then(res => {
  136. this.tindoorFillRate = this.formatterRes(res.tindoorFillRate, 0, 1)
  137. console.log('室内温度满足率', this.tindoorFillRate)
  138. let content = res.content
  139. this.stackArr = content
  140. if (content && content.length > 0) {
  141. content.forEach(({ spaceDayRpt }) => {
  142. if (obj.hasOwnProperty(spaceDayRpt.floorId)) {
  143. obj[spaceDayRpt.floorId].children.push(spaceDayRpt)
  144. } else {
  145. obj[spaceDayRpt.floorId] = {
  146. id: spaceDayRpt.floorId,
  147. name: spaceDayRpt.floorLocalName,
  148. children: [spaceDayRpt]
  149. }
  150. }
  151. })
  152. }
  153. this.dataList = Object.values(obj).map(i => {
  154. // 增加 isExpand 属性
  155. i.isExpand = i.children.some(c => c.isSatisfy == false)
  156. return i
  157. })
  158. })
  159. },
  160. // 执行率@
  161. queryimplement(date) {
  162. let params = {
  163. postParams: {
  164. criteria: {
  165. date: date,
  166. projectId: this.$store.state.projectId
  167. }
  168. }
  169. }
  170. queryChillerExecuteInfo(params).then(res => {
  171. this.cardList = res.data ? res.data : []
  172. // console.log('执行率', res)
  173. })
  174. },
  175. // 根据tab @
  176. changeNumMethod(date) {
  177. if (this.num == 1) {
  178. this.queryTdbDayMethod(date)
  179. } else if (this.num == 2) {
  180. this.queryEnergyDayQuery(date)
  181. } else if (this.num == 3) {
  182. this.queryimplement(date)
  183. this.querychillerMethod(date)
  184. }
  185. },
  186. querychillerMethod(date) {
  187. let params = {
  188. postParams: {
  189. criteria: {
  190. projectId: this.$store.state.projectId,
  191. date: date
  192. }
  193. }
  194. }
  195. this.chillerExecuteRateReal = ''
  196. querychiller(params).then(res => {
  197. //执行率
  198. this.chillerExecuteRateReal = this.formatterRes(res.content[0].chillerExecuteRateReal, 0, 1)
  199. console.log('执行率', this.chillerExecuteRateReal)
  200. })
  201. },
  202. // 点击tab @
  203. changeNum(index) {
  204. this.num = index
  205. this.changeNumMethod(this.dateVal)
  206. },
  207. // @
  208. formatterStr(str) {
  209. if (str) {
  210. return str.substring(0, 4) + str.substring(5, 7) + str.substring(8, 10)
  211. }
  212. },
  213. // @
  214. pickerVal(val) {
  215. if (val) {
  216. this.dateVal = this.formatterStr(val)
  217. this.changeNumMethod(this.dateVal)
  218. }
  219. },
  220. // 节能率@
  221. queryEnergyDayQuery(date) {
  222. this.maxArr = []
  223. this.current = {}
  224. this.similarDay = {}
  225. this.samples = []
  226. energyDayQuery(date, {}).then(res => {
  227. if (res.result == 'success') {
  228. // 本日概况
  229. this.current = res.current ? res.current : {}
  230. if (Object.keys(res.current).length > 0) {
  231. this.energySavingRate = res.current.energySavingRate
  232. this.accuracy = res.current.accuracy
  233. // 节能率
  234. this.energySavingRate = this.formatterRes(this.energySavingRate, 0, 1)
  235. // 准确率
  236. this.accuracy = this.formatterRes(this.accuracy, 0, 1)
  237. }
  238. // 相似日概况
  239. this.similarDay = res.similarDay ? res.similarDay : {}
  240. // 相似日列表
  241. this.samples = res.samples ? res.samples : []
  242. if (this.samples.length > 0) {
  243. var outsiteTemp = [],
  244. indoorTemp = [],
  245. energy = []
  246. for (var i in this.samples) {
  247. outsiteTemp.push(this.samples[i].outsiteTemp)
  248. indoorTemp.push(this.samples[i].indoorTemp)
  249. energy.push(this.samples[i].energy)
  250. }
  251. let maxOutsiteTemp = this.maxMethod(this.sortMethod(outsiteTemp)),
  252. maxIndoorTemp = this.maxMethod(this.sortMethod(indoorTemp)),
  253. maxEnergy = this.maxMethod(this.sortMethod(energy))
  254. this.maxArr.push(maxOutsiteTemp, maxIndoorTemp, maxEnergy)
  255. } else {
  256. this.maxArr[0] = this.currentN(this.current.tempOutdoor, 0, 1)
  257. this.maxArr[1] = this.currentN(this.current.tempIndoor, 0, 1)
  258. this.maxArr[2] = this.currentN(this.current.energy, 0, 1)
  259. }
  260. } else {
  261. this.$message.error(res.message)
  262. }
  263. })
  264. },
  265. currentN(data) {
  266. let num
  267. if (data == '-9999') {
  268. num = 'x'
  269. } else if (data == '-9998') {
  270. num = '--'
  271. } else {
  272. num = data * 1.2
  273. }
  274. return num
  275. },
  276. // @
  277. sortMethod(arr) {
  278. if (arr instanceof Array) {
  279. return arr.sort(function(num1, num2) {
  280. return num1 - num2
  281. })
  282. } else {
  283. return 1
  284. }
  285. },
  286. // @
  287. maxMethod(arr) {
  288. if (arr instanceof Array) {
  289. return eval(arr[arr.length - 1])
  290. }
  291. }
  292. }
  293. }
  294. </script>
  295. <style lang="scss" scoped>
  296. .evTwoContainer {
  297. background: #fff;
  298. min-width: 1000px;
  299. .count-top {
  300. width: 100%;
  301. height: 100%;
  302. .count-top-left {
  303. width: 200px;
  304. display: flex;
  305. align-items: center;
  306. z-index: 1;
  307. position: fixed;
  308. left: 240px;
  309. top: 65px;
  310. span {
  311. display: inline-block;
  312. }
  313. span:nth-of-type(1) {
  314. height: 22px;
  315. font-size: 14px;
  316. color: #8d9399;
  317. line-height: 22px;
  318. cursor: pointer;
  319. }
  320. span:nth-of-type(2) {
  321. color: #c3c6cb;
  322. margin: 0 4px;
  323. margin-top: -3px;
  324. }
  325. span:nth-of-type(3) {
  326. height: 22px;
  327. font-size: 14px;
  328. color: #1f2429;
  329. line-height: 22px;
  330. }
  331. }
  332. ul {
  333. display: flex;
  334. padding: 0 16px;
  335. // width: 100%;
  336. justify-content: space-between;
  337. white-space: nowrap;
  338. align-items: center;
  339. margin: 0;
  340. text-align: center;
  341. position: fixed;
  342. left: 0;
  343. right: 0;
  344. top: 50px;
  345. z-index: 1;
  346. min-width: 810px;
  347. .count-top-right {
  348. width: 148px;
  349. }
  350. }
  351. ul li {
  352. cursor: pointer;
  353. height: 21px;
  354. float: left;
  355. font-size: 16px;
  356. color: rgba(31, 35, 41, 1);
  357. line-height: 21px;
  358. padding: 14px 16px;
  359. margin-right: 22px;
  360. }
  361. .count-bottom {
  362. padding: 0 16px;
  363. height: auto;
  364. background: #fff;
  365. margin-top: 16px;
  366. .count-bottom-switch {
  367. display: flex;
  368. justify-content: flex-end;
  369. align-items: center;
  370. margin-top: -14px;
  371. .switchSpan {
  372. height: 22px;
  373. font-size: 14px;
  374. font-family: PingFangSC-Regular, PingFang SC;
  375. font-weight: 400;
  376. color: rgba(31, 36, 41, 1);
  377. line-height: 20px;
  378. margin-right: 16px;
  379. }
  380. }
  381. .count-historical-data {
  382. .count-foot {
  383. .count-foot-title {
  384. display: flex;
  385. align-items: center;
  386. margin-bottom: 16px;
  387. span:nth-of-type(1) {
  388. height: 24px;
  389. font-size: 16px;
  390. color: rgba(31, 36, 41, 1);
  391. line-height: 21px;
  392. margin-right: 16px;
  393. }
  394. span:nth-of-type(2) {
  395. width: 72px;
  396. height: 22px;
  397. background: rgba(225, 242, 255, 1);
  398. border-radius: 2px;
  399. font-size: 14px;
  400. color: rgba(0, 101, 179, 1);
  401. line-height: 22px;
  402. text-align: center;
  403. }
  404. }
  405. }
  406. }
  407. .count-bottom-content {
  408. margin-top: 12px;
  409. }
  410. .count-bottom-foot {
  411. margin-top: 46px;
  412. height: 480px;
  413. background: rgba(255, 255, 255, 1);
  414. border: 1px solid rgba(228, 230, 231, 1);
  415. }
  416. }
  417. .current {
  418. font-size: 16px;
  419. font-family: MicrosoftYaHei;
  420. color: #0091ff;
  421. line-height: 21px;
  422. border-bottom: 2px solid#0091FF;
  423. }
  424. }
  425. }
  426. </style>
  427. <style lang="scss">
  428. .count-bottom-switch {
  429. .el-switch__core {
  430. width: 40px !important;
  431. height: 22px;
  432. border-radius: 12px;
  433. }
  434. .el-switch.is-checked .el-switch__core::after {
  435. left: 100%;
  436. margin-left: -19px;
  437. }
  438. .el-switch__core:after {
  439. content: '';
  440. position: absolute;
  441. border-radius: 100%;
  442. -webkit-transition: all 0.3s;
  443. transition: all 0.3s;
  444. width: 18px;
  445. height: 18px;
  446. background-color: #fff;
  447. top: 1px;
  448. }
  449. }
  450. </style>