evTwoLevelMenu.vue 12 KB

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