heatStationDetail.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <template>
  2. <div class="system-dic-container data-overview">
  3. <el-row :gutter="15" class="home-card-one">
  4. <el-col
  5. :xs="24"
  6. :sm="12"
  7. :md="12"
  8. :lg="6"
  9. :xl="6"
  10. v-for="(v, k) in dataOne"
  11. :key="k"
  12. :class="{ 'home-media home-media-lg': k > 1, 'home-media-sm': k === 1 }"
  13. >
  14. <div class="home-card-item">
  15. <div class="item-header">
  16. <img :src="isIsDark ? v.iconDark : v.icon" alt="" />
  17. <span>{{ v.title }}</span>
  18. </div>
  19. <div class="item-content w100" :class="` home-one-animation${k}`">
  20. <p>
  21. <span class="text-no-wrap">{{ v.contentTitle1 }}</span>
  22. <span>{{ v.val1 }} {{ unitMap[v.contentTitle1] }}</span>
  23. </p>
  24. <p>
  25. <span class="text-no-wrap">{{ v.contentTitle2 }}</span>
  26. <span
  27. >{{ v.val2 }}
  28. {{ unitMap[v.title + ':' + v.contentTitle2] ? unitMap[v.title + ':' + v.contentTitle2] : unitMap[v.contentTitle2] }}</span
  29. >
  30. </p>
  31. <p style="height: 30px">
  32. <template v-if="v.contentTitle3">
  33. <span class="text-no-wrap">{{ v.contentTitle3 || ' ' }}</span>
  34. <span
  35. >{{ v.val3 || ' ' }}
  36. {{ unitMap[v.title + ':' + v.contentTitle3] ? unitMap[v.title + ':' + v.contentTitle3] : unitMap[v.contentTitle3] }}</span
  37. >
  38. </template>
  39. </p>
  40. </div>
  41. </div>
  42. </el-col>
  43. </el-row>
  44. <el-row :gutter="15" class="home-card-one mt15">
  45. <el-col :span="24">
  46. <div class="home-card-item p20">
  47. <div class="home-card-item-title" style="display: flex; justify-content: space-between">
  48. <span>热网总能耗</span>
  49. <el-button type="text" @click="goDetail()">更多 &gt;</el-button>
  50. <!-- <el-select @change="getStatisticsLineChartData()" v-model="rangeValue" placeholder="请选择查询范围" size="mini">
  51. <el-option
  52. v-for="item in [10, 30, 60]"
  53. :key="item"
  54. :label="'近'+item+'天'"
  55. :value="item"
  56. />
  57. </el-select> -->
  58. </div>
  59. <div style="height: 300px" ref="homeLineRef"></div>
  60. </div>
  61. </el-col>
  62. </el-row>
  63. </div>
  64. </template>
  65. <script lang="ts">
  66. import { toRefs, reactive, onMounted, ref, defineComponent, nextTick, watch } from 'vue';
  67. import { FormInstance } from 'element-plus';
  68. import * as echarts from 'echarts';
  69. import api from '/@/api/loopSupervision';
  70. import ele from '/@/assets/img/ele.svg';
  71. import ele1 from '/@/assets/img/ele1.svg';
  72. import fire from '/@/assets/img/fire.svg';
  73. import fire1 from '/@/assets/img/fire1.svg';
  74. import map from '/@/assets/img/map.svg';
  75. import map1 from '/@/assets/img/map1.svg';
  76. import water from '/@/assets/img/water.svg';
  77. import water1 from '/@/assets/img/water1.svg';
  78. import { useRoute, useRouter } from 'vue-router';
  79. import { useStore } from '/@/store/index';
  80. import apiDatahub from '/@/api/datahub';
  81. let global: any = {
  82. homeCharThree: null,
  83. dispose: [null, '', undefined],
  84. };
  85. export default defineComponent({
  86. name: 'deviceproduct',
  87. setup() {
  88. const addDicRef = ref();
  89. const editDicRef = ref();
  90. const queryRef = ref();
  91. const homeLineRef = ref();
  92. const router = useRouter();
  93. const route = useRoute();
  94. const store = useStore();
  95. const unitMap = ref<any>({});
  96. // 统计信息的单位的字典
  97. apiDatahub.template.getDictData({ DictType: 'overview_unit' }).then((res: any) => {
  98. res.values.forEach((v: any) => {
  99. unitMap.value[v.value] = v.key;
  100. });
  101. });
  102. const state = reactive({
  103. dataOne: [
  104. {
  105. icon: map,
  106. iconDark: map1,
  107. title: '供热面积',
  108. contentTitle1: '联网面积',
  109. val1: '0',
  110. contentTitle2: '实供面积',
  111. val2: '0',
  112. contentTitle3: '供热率',
  113. val3: '',
  114. },
  115. {
  116. icon: fire,
  117. iconDark: fire1,
  118. title: '热量',
  119. contentTitle1: '总耗热',
  120. val1: '0',
  121. contentTitle2: '总单耗',
  122. val2: '0',
  123. },
  124. {
  125. icon: ele,
  126. iconDark: ele1,
  127. title: '负荷',
  128. contentTitle1: '供热负荷',
  129. val1: '0',
  130. contentTitle2: '平均供热负荷',
  131. val2: '-',
  132. },
  133. {
  134. icon: water,
  135. iconDark: water1,
  136. title: '水量',
  137. contentTitle1: '总耗水',
  138. val1: '0',
  139. contentTitle2: '总单耗',
  140. val2: '0',
  141. },
  142. ],
  143. lineName: '换热站监测',
  144. myCharts: [],
  145. charts: {
  146. theme: '',
  147. bgColor: '',
  148. color: '#303133',
  149. },
  150. searchParams: {
  151. name: '',
  152. },
  153. xAxisData: [],
  154. inTemperatureEchart: [], // 供水温度
  155. outTemperatureEchart: [], // 回水温度
  156. isIsDark: false,
  157. });
  158. const getNumDetail = () => {
  159. api
  160. .getLoopRegulationDetail({
  161. QueryType: 'num',
  162. types: 'station',
  163. code: route.query.code,
  164. })
  165. .then((res: any) => {
  166. const { flowLoss, flowLossTotal, forRealArea, heatingArea, unitConsumption, unitConsumptionTotal, heatRate, heatDemandAvg, heatDemand } =
  167. res;
  168. state.dataOne[0].val1 = forRealArea;
  169. state.dataOne[0].val2 = heatingArea;
  170. state.dataOne[0].val3 = heatRate;
  171. state.dataOne[1].val1 = unitConsumptionTotal;
  172. state.dataOne[1].val2 = unitConsumption;
  173. state.dataOne[2].val1 = heatDemand;
  174. state.dataOne[2].val2 = heatDemandAvg || '-';
  175. state.dataOne[3].val1 = flowLossTotal;
  176. state.dataOne[3].val2 = flowLoss;
  177. });
  178. };
  179. const getChartDetail = () => {
  180. api
  181. .getLoopRegulationDetail({
  182. QueryType: 'echart',
  183. types: 'station',
  184. code: route.query.code,
  185. })
  186. .then((res: any) => {
  187. state.inTemperatureEchart = res.inTemperatureEchart.map((item: any) => item.value);
  188. state.outTemperatureEchart = res.outTemperatureEchart.map((item: any) => item.value);
  189. state.xAxisData = res.inTemperatureEchart.map((item: any) => item.time);
  190. nextTick(() => {
  191. initLineChart();
  192. });
  193. });
  194. };
  195. const goDetail = () => {
  196. router.push({
  197. path: '/heating-monitor/loopSupervision/heatStationHistory',
  198. query: {
  199. code: route.query.code,
  200. },
  201. });
  202. };
  203. // 折线图
  204. const initLineChart = () => {
  205. if (!global.dispose.some((b: any) => b === global.homeCharThree)) global.homeCharThree.dispose();
  206. global.homeCharThree = <any>echarts.init(homeLineRef.value, state.charts.theme);
  207. const option = {
  208. backgroundColor: state.charts.bgColor,
  209. tooltip: { trigger: 'axis' },
  210. legend: {},
  211. grid: { top: 40, right: 40, bottom: 40, left: 40 },
  212. xAxis: [
  213. {
  214. type: 'category',
  215. data: state.xAxisData,
  216. boundaryGap: true,
  217. axisTick: { show: false },
  218. },
  219. ],
  220. yAxis: [
  221. {
  222. type: 'value',
  223. axisLabel: {
  224. formatter: '{value} °C',
  225. },
  226. },
  227. ],
  228. series: [
  229. {
  230. name: '供水温度',
  231. type: 'line',
  232. data: state.inTemperatureEchart,
  233. },
  234. {
  235. name: '回水温度',
  236. type: 'line',
  237. data: state.outTemperatureEchart,
  238. },
  239. // {
  240. // name: '室外温度',
  241. // type: 'line',
  242. // data: [3, 0, 4, 7, 5, 7, 5]
  243. // }
  244. ],
  245. };
  246. (<any>global.homeCharThree).setOption(option);
  247. (<any>state.myCharts).push(global.homeCharThree);
  248. };
  249. // 批量设置 echarts resize
  250. const initEchartsResizeFun = () => {
  251. nextTick(() => {
  252. for (let i = 0; i < state.myCharts.length; i++) {
  253. setTimeout(() => {
  254. (<any>state.myCharts[i]).resize();
  255. }, i * 1000);
  256. }
  257. });
  258. };
  259. // 批量设置 echarts resize
  260. const initEchartsResize = () => {
  261. window.addEventListener('resize', initEchartsResizeFun);
  262. };
  263. // 监听 vuex 中是否开启深色主题
  264. watch(
  265. () => store.state.themeConfig.themeConfig.isIsDark,
  266. (isIsDark) => {
  267. nextTick(() => {
  268. state.isIsDark = store.state.themeConfig.themeConfig.isIsDark;
  269. state.charts.theme = isIsDark ? 'transparent' : '';
  270. state.charts.bgColor = isIsDark ? 'transparent' : '';
  271. state.charts.color = isIsDark ? '#dadada' : '#303133';
  272. setTimeout(() => {
  273. initLineChart();
  274. }, 1000);
  275. });
  276. },
  277. {
  278. deep: true,
  279. immediate: true,
  280. }
  281. );
  282. // 页面加载时
  283. onMounted(() => {
  284. getNumDetail();
  285. getChartDetail();
  286. initEchartsResize();
  287. // 获取布局配置信息
  288. state.isIsDark = store.state.themeConfig.themeConfig.isIsDark;
  289. });
  290. /** 重置按钮操作 */
  291. const resetQuery = (formEl: FormInstance | undefined) => {
  292. if (!formEl) return;
  293. formEl.resetFields();
  294. // typeList();
  295. };
  296. return {
  297. unitMap,
  298. addDicRef,
  299. editDicRef,
  300. queryRef,
  301. homeLineRef,
  302. ...toRefs(state),
  303. resetQuery,
  304. goDetail,
  305. };
  306. },
  307. });
  308. </script>
  309. <style lang="scss" scoped>
  310. $homeNavLengh: 8;
  311. .home-card-one {
  312. @for $i from 0 through 3 {
  313. .home-one-animation#{$i} {
  314. opacity: 0;
  315. animation-name: error-num;
  316. animation-duration: 0.5s;
  317. animation-fill-mode: forwards;
  318. animation-delay: calc($i/10) + s;
  319. }
  320. }
  321. }
  322. .home-card-one .home-card-item {
  323. width: 100%;
  324. border-radius: 4px;
  325. transition: all ease 0.3s;
  326. overflow: hidden;
  327. background: var(--el-color-white);
  328. color: var(--el-text-color-primary);
  329. border: 1px solid var(--next-border-color-light);
  330. &:hover {
  331. box-shadow: 0 2px 12px var(--next-color-dark-hover);
  332. transition: all ease 0.3s;
  333. }
  334. &.p20 {
  335. padding: 20px;
  336. }
  337. .item-header {
  338. display: flex;
  339. justify-content: center;
  340. align-content: center;
  341. color: #101010;
  342. padding: 10px 0;
  343. border-bottom: 1px solid var(--next-border-color-light);
  344. font-size: 20px;
  345. font-weight: bold;
  346. img {
  347. margin-right: 32px;
  348. width: 24px;
  349. height: 24px;
  350. margin-top: 3px;
  351. }
  352. }
  353. .item-content {
  354. padding: 26px;
  355. p {
  356. display: flex;
  357. justify-content: space-between;
  358. align-content: center;
  359. span:nth-child(1) {
  360. // padding-top: 4px;
  361. line-height: 33px;
  362. font-size: 14px;
  363. }
  364. span:nth-child(2) {
  365. color: #101010;
  366. font-weight: bold;
  367. font-size: 22px;
  368. }
  369. }
  370. p:nth-child(2),
  371. p:nth-child(3) {
  372. margin-top: 5px;
  373. }
  374. }
  375. &-title {
  376. font-size: 15px;
  377. font-weight: bold;
  378. height: 30px;
  379. align-items: center;
  380. }
  381. }
  382. // :deep(.el-form-item--default) {
  383. // margin-bottom: 0;
  384. // }
  385. </style>