loopDetail.vue 9.9 KB

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