loopDetail.vue 12 KB

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