Home.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <script lang="ts" setup>
  2. import {onMounted, reactive, ref} from "vue";
  3. import {useMapStore} from "@/stores/map";
  4. import RightFrame from "@/components/RightFrame.vue";
  5. import Card01 from "@/components/card/Card01.vue";
  6. import Chart from "@/components/chart.vue";
  7. import StripeTable from "@/components/StripeTable.vue";
  8. import {getRStLLMaxDate} from "@/api/home";
  9. import bus from "@/utils/bus";
  10. import stations from "@/utils/station";
  11. import {jumpPage} from "@/utils";
  12. const zmwjianjie = new URL('@/assets/images/zmw_jieshao.jpg', import.meta.url).href
  13. const left2Ref = ref(null)
  14. function reloadLeft2() {
  15. const option = {
  16. tooltip: {
  17. trigger: 'item'
  18. },
  19. legend: {
  20. textStyle: {
  21. color: '#fff',
  22. },
  23. },
  24. series: [
  25. {
  26. type: 'pie',
  27. radius: '70%',
  28. label: {
  29. show: true,
  30. color: '#fff'
  31. },
  32. data: [
  33. {value: 7, name: '水位站'},
  34. {value: 6, name: '雨量站'},
  35. {value: 8, name: '水质站'},
  36. {value: 14, name: '风情站'},
  37. ],
  38. }
  39. ]
  40. };
  41. left2Ref.value.loadChart(option)
  42. }
  43. const right1Ref = ref(null)
  44. function reloadRight1() {
  45. const option = {
  46. tooltip: {
  47. trigger: 'axis',
  48. axisPointer: {
  49. type: 'shadow'
  50. },
  51. formatter(params) {
  52. let circle = `<span style="display:inline-block;margin-right:5px;border-radius:50%;width:10px;height:10px;left:5px;background-color:`;
  53. let info = params[0].axisValueLabel
  54. for (let i = 0; i < params.length; i++) {
  55. let param = params[i];
  56. if (param.value > 0) {
  57. info += `<br/>${circle}${param.color}"></span> ${param.seriesName}: ${param.value}个`;
  58. break
  59. }
  60. }
  61. return info;
  62. }
  63. },
  64. legend: {
  65. type: 'scroll',
  66. icon: 'circle',
  67. data: ['1', '2', '3', '4', '5'],
  68. selectedMode: false,
  69. textStyle: {
  70. color: '#fff'
  71. },
  72. },
  73. grid: {
  74. top: '14%',
  75. left: '2%',
  76. right: '2%',
  77. bottom: '0%',
  78. containLabel: true
  79. },
  80. yAxis: {
  81. type: 'value',
  82. name: '个',
  83. nameTextStyle: {
  84. color: '#fff',
  85. },
  86. axisLabel: {
  87. color: '#fff',
  88. },
  89. },
  90. xAxis: {
  91. type: 'category',
  92. axisLabel: {
  93. // interval: 0,
  94. rotate: -45, //旋转的角度从 -90 度到 90 度。
  95. color: '#fff',
  96. },
  97. data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月']
  98. },
  99. series: [
  100. {
  101. name: 'aaa',
  102. type: 'bar',
  103. // stack: 'total',
  104. // barWidth: '20%',
  105. label: {
  106. show: true,
  107. position: 'top',
  108. color: '#fff',
  109. formatter: params => params.value > 0 ? params.value + '个' : ''
  110. },
  111. data: [1, 2, 4, 1, 2, 5, 2, 4]
  112. },
  113. {
  114. name: 'bbb',
  115. type: 'bar',
  116. // stack: 'total',
  117. // barWidth: '20%',
  118. label: {
  119. show: true,
  120. position: 'top',
  121. color: '#fff',
  122. formatter: params => params.value > 0 ? params.value + '个' : ''
  123. },
  124. data: [2, 1, 5, 2, 3, 4, 2, 4]
  125. }
  126. ]
  127. };
  128. right1Ref.value.loadChart(option)
  129. }
  130. const tableColumns = [
  131. {
  132. label: '站名', prop: 'stnm', width: '110', convertFn: (data) => {
  133. return data ? data.trim() : ''
  134. }
  135. },
  136. {
  137. label: '时间', prop: 'tm', width: '90', convertFn: (data) => {
  138. return data ? data.substring(5, 16) : ''
  139. }
  140. },
  141. {
  142. label: '水位(m)', prop: 'z', width: '80', convertFn: (data) => {
  143. return Number(data).toFixed(2)
  144. }
  145. },
  146. {
  147. label: '流量', prop: 'q', width: '70', convertFn: (data) => {
  148. return Number(data).toFixed(2)
  149. }
  150. },
  151. {
  152. label: '雨量', prop: 'drp', width: '65', convertFn: (data) => {
  153. return data | 0
  154. }
  155. },
  156. ]
  157. const tableData = reactive([])
  158. function getStationList() {
  159. getRStLLMaxDate().then(res => {
  160. tableData.push(...res)
  161. initPoints()
  162. })
  163. }
  164. const right3Ref = ref(null)
  165. function reloadRight3() {
  166. const option = {
  167. backgroundColor: "#0B2D55",
  168. tooltip: {
  169. axisPointer: {
  170. type: "cross"
  171. }
  172. },
  173. grid: {
  174. top: '14%',
  175. left: '2%',
  176. right: '4%',
  177. bottom: '5%',
  178. containLabel: true
  179. },
  180. xAxis: [{
  181. type: 'category',
  182. boundaryGap: false,
  183. axisLine: { // 坐标轴轴线相关设置。数学上的x轴
  184. show: true,
  185. lineStyle: {
  186. color: '#233e64'
  187. },
  188. },
  189. axisLabel: { //坐标轴刻度标签的相关设置
  190. textStyle: {
  191. color: '#fff',
  192. },
  193. },
  194. axisTick: {show: false,},
  195. data: [1, 2, 3, 4, 5, 6, 7, 889, 9, 90],
  196. }],
  197. yAxis: [{
  198. name: 'm',
  199. nameTextStyle: {
  200. color: '#fff',
  201. },
  202. min: value => value.min.toFixed(2),
  203. axisLabel: {
  204. margin: 20,
  205. textStyle: {
  206. color: '#fff',
  207. },
  208. },
  209. splitLine: {
  210. show: true,
  211. lineStyle: {
  212. color: '#233e64'
  213. }
  214. },
  215. }],
  216. series: [{
  217. name: '太湖水位',
  218. type: 'line',
  219. smooth: true, //是否平滑曲线显示
  220. lineStyle: {
  221. normal: {
  222. color: "#3deaff" // 线条颜色
  223. }
  224. },
  225. data: [1, 2, 3, 4, 5, 6, 7, 889, 9, 90],
  226. },
  227. ]
  228. };
  229. right3Ref.value.loadChart(option)
  230. }
  231. const mapStore = useMapStore()
  232. /**
  233. * 初始化测站点位
  234. */
  235. function initPoints() {
  236. const option = {
  237. view: {
  238. center: [104.114129, 37.550339],
  239. zoom: 5,
  240. },
  241. layers: [
  242. {
  243. type: 'point',
  244. data: tableData,
  245. dataOptions: {
  246. parser: {
  247. type: 'json',
  248. x: 'lgtd',
  249. y: 'lttd',
  250. },
  251. },
  252. label: {
  253. show: true,
  254. field: 'stnm',
  255. },
  256. emphasis: {
  257. show: true,
  258. label: {
  259. show: true
  260. }
  261. },
  262. size: 16,
  263. color: {
  264. isConstant: true,
  265. value: '#004ef8',
  266. field: null,
  267. conditions: []
  268. },
  269. shape: {
  270. isConstant: true,
  271. value: 'circle',
  272. imageSrc: null,
  273. field: null,
  274. conditions: []
  275. },
  276. popup: {
  277. enabled: true,
  278. trigger: 'click',
  279. content: '',
  280. },
  281. },
  282. ]
  283. }
  284. mapStore.setOption(option)
  285. }
  286. onMounted(() => {
  287. reloadLeft2()
  288. reloadRight1()
  289. getStationList()
  290. reloadRight3()
  291. })
  292. // 订阅一个具体的事件
  293. bus.on('point_click', (data: any) => {
  294. console.log('data', data.data, data.e)
  295. const station = stations.find(item => item.stcd === data.data.stcd)
  296. if (station) {
  297. if (station.isExternalAddress) {
  298. jumpPage(station.path, null, true)
  299. } else {
  300. jumpPage(`/station/${station.stcd}`)
  301. }
  302. }
  303. })
  304. </script>
  305. <template>
  306. <right-frame>
  307. <template #leftModule>
  308. <card01 title="简介">
  309. <h3 class="introduce-title">浙闽皖水文水资源监测中心</h3>
  310. <p class="introduce-text">
  311. 位于浙江省嘉兴市经济技术开发区龙舟路753号,土地面积4.98亩,建筑面积1699.87平方米。
  312. </p>
  313. <p class="introduce-text">
  314. 浙闽皖水文水资源监测中心主要负责太湖流域片浙闽、浙皖边界河流、湖泊(千岛湖)、新安江水文实验区水文测站运行管理、水文水资源水环境监测评价分析工作;负责太湖流域地下水监测管理、资料汇交,提供地下水信息服务;负责杭州湾、钱塘江河口区域风暴潮监测与研究,负责太湖流域片沿海潮位站的风暴潮信息收集、分析等工作。
  315. 浙闽皖水文水资源监测中心内设综合科、测验与技术科、黄山水文水资源监测分中心、宁德水文水资源监测分中心。
  316. </p>
  317. <img :src="zmwjianjie" alt="" class="introduce-img"/>
  318. </card01>
  319. <card01 style="height: 30%" title="站点统计">
  320. <chart ref="left2Ref"></chart>
  321. </card01>
  322. </template>
  323. <template #rightModule>
  324. <card01 style="height: 33%" title="超警超保统计">
  325. <chart ref="right1Ref"></chart>
  326. </card01>
  327. <card01 style="height: 33%" title="站点清单">
  328. <stripe-table :columns="tableColumns" :data="tableData"></stripe-table>
  329. </card01>
  330. <card01 style="height: 33%" title="水质分析">
  331. <chart ref="right3Ref"></chart>
  332. </card01>
  333. </template>
  334. </right-frame>
  335. </template>
  336. <style lang="scss" scoped>
  337. @use "@/assets/styles/introduce.scss";
  338. </style>