heatStationDetail.vue 11 KB

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