heatStationDetail.vue 9.8 KB

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