evTwoLevelMenu.vue 12 KB

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