map.vue 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484
  1. <template>
  2. <div class="map-index">
  3. <!-- 苏州河 -->
  4. <div ref="scrollContainer" v-if="route.params.id=='28'" style="border: 2px solid #409EFF;background-color: rgba(127, 161, 215, 0.5);border-radius: 50px 50px 50px 50px;
  5. align-items: center;display: flex;position: absolute;z-index: 100;bottom: 1%;left: 1%;width:50vw;height: 10vh;overflow-x:auto;overflow-y: hidden;">
  6. <svg-icon icon-class="start1" v-if="!isStart" @click="reStart" style="margin-left: 10%;width: 30px;height:30px;cursor: pointer;"/>
  7. <svg-icon icon-class="pause1" v-if="isStart" @click="pause" style="margin-left: 10%;width: 30px;height:30px;cursor: pointer;"/>
  8. <el-slider @change="pauseIn" :format-tooltip="formatTooltip" v-model="activities1" :max="dateLength" :marks="marks" style="width: 80%;margin-left: 1%;"/>
  9. </div>
  10. <div v-if="route.params.id=='28'" style="background-color: white;position: absolute;z-index: 100;top: 1%;left: 1%;width: 20vw;height: 45vh;overflow:auto;">
  11. <div class="biz-data-card-header">方案列表</div>
  12. <el-table
  13. :data="tableDataFangan"
  14. style="width: 98%;margin-left: 1%;margin-top: 1%;height: 40vh;"
  15. :cell-style="{ padding:'5px' }"
  16. :header-cell-style="{height: heightAll*0.01+'px',}"
  17. :row-style="{ fontSize: '16px',textAlign:'center'}"
  18. border >
  19. <el-table-column type="index" label="序号" width="80">
  20. <template #default="{ $index }">
  21. <div style="text-align: center;">
  22. {{ $index + 1 }}
  23. </div>
  24. </template>
  25. </el-table-column>
  26. <el-table-column prop="name" label="名称">
  27. <template #default="scope">
  28. <span style="cursor: pointer;color:#409EFF" @click="getZ(scope.row)">{{ scope.row.name }}</span>
  29. </template>
  30. </el-table-column>
  31. </el-table>
  32. </div>
  33. <div v-if="route.params.id=='28'" style="background-color: white;position: absolute;z-index: 100;top: 1%;right: 1%;width: 30vw;height: 85vh;overflow:auto;">
  34. <div class="biz-data-card-header">水位信息</div>
  35. <el-table
  36. :data="tableData"
  37. style="width: 98%;margin-left: 1%;margin-top: 1%;height: 80vh;"
  38. :cell-style="{ padding:'5px' }"
  39. :header-cell-style="{height: heightAll*0.01+'px',}"
  40. :row-style="{ fontSize: '16px',textAlign:'center'}"
  41. border >
  42. <el-table-column type="index" label="序号" width="80">
  43. <template #default="{ $index }">
  44. <div style="text-align: center;">
  45. {{ $index + 1 }}
  46. </div>
  47. </template>
  48. </el-table-column>
  49. <el-table-column prop="name" label="站名" width="200">
  50. </el-table-column>
  51. <el-table-column prop="z" label="水位" width=""/>
  52. <el-table-column prop="time" label="时间" width="210"/>
  53. </el-table>
  54. </div>
  55. <div id="tooltip" ref="tooltipRef" class="tooltip"></div>
  56. <!-- 温带风暴潮 -->
  57. <div ref="scrollContainer" v-if="route.params.id=='20'" style="border: 2px solid #409EFF;background-color: rgba(127, 161, 215, 0.5);border-radius: 50px 50px 50px 50px;
  58. align-items: center;display: flex;position: absolute;z-index: 100;bottom: 1%;left: 1%;width:50vw;height: 10vh;overflow-x:auto;overflow-y: hidden;">
  59. <svg-icon icon-class="start1" v-if="!isStart" @click="reStartWen" style="margin-left: 10%;width: 30px;height:30px;cursor: pointer;"/>
  60. <svg-icon icon-class="pause1" v-if="isStart" @click="pauseInWen" style="margin-left: 10%;width: 30px;height:30px;cursor: pointer;"/>
  61. <el-slider @change="pauseIn" :format-tooltip="formatTooltip" v-model="activities1" :max="dateLength" :marks="marks" style="width: 80%;margin-left: 1%;"/>
  62. </div>
  63. <div v-if="route.params.id=='20'" style="background-color: white;position: absolute;z-index: 100;top: 1%;left: 1%;width: 20vw;height: 45vh;overflow:auto;">
  64. <div class="biz-data-card-header">方案列表</div>
  65. <el-table
  66. :data="tableDataFangan"
  67. style="width: 98%;margin-left: 1%;margin-top: 1%;height: 40vh;"
  68. :cell-style="{ padding:'5px' }"
  69. :header-cell-style="{height: heightAll*0.01+'px',}"
  70. :row-style="{ fontSize: '16px',textAlign:'center'}"
  71. border >
  72. <el-table-column type="index" label="序号" width="80">
  73. <template #default="{ $index }">
  74. <div style="text-align: center;">
  75. {{ $index + 1 }}
  76. </div>
  77. </template>
  78. </el-table-column>
  79. <el-table-column prop="name" label="名称">
  80. <template #default="scope">
  81. <span style="cursor: pointer;color:#409EFF" @click="getZ(scope.row)">{{ scope.row.name }}</span>
  82. </template>
  83. </el-table-column>
  84. </el-table>
  85. </div>
  86. <div v-if="route.params.id=='20'" style="background-color: white;position: absolute;z-index: 100;top: 1%;right: 1%;width: 30vw;height: 85vh;overflow:auto;">
  87. <div class="biz-data-card-header">风暴潮信息</div>
  88. <el-table
  89. :data="tableData"
  90. style="width: 98%;margin-left: 1%;margin-top: 1%;height: 80vh;"
  91. :cell-style="{ padding:'5px' }"
  92. :header-cell-style="{height: heightAll*0.01+'px',}"
  93. :row-style="{ fontSize: '16px',textAlign:'center'}"
  94. border >
  95. <el-table-column type="index" label="序号" width="80">
  96. <template #default="{ $index }">
  97. <div style="text-align: center;">
  98. {{ $index + 1 }}
  99. </div>
  100. </template>
  101. </el-table-column>
  102. <el-table-column prop="stnm" label="站名" width="150">
  103. </el-table-column>
  104. <el-table-column prop="gfsZ" label="水位" width=""/>
  105. <el-table-column prop="gfsAddz" label="增水" width=""/>
  106. <el-table-column prop="gfsAddz" label="风速" width=""/>
  107. <el-table-column prop="gfsWnddir" label="风向" width=""/>
  108. </el-table>
  109. </div>
  110. <!-- 上海风暴潮 -->
  111. <div v-if="route.params.id=='30'" style="background-color: white;position: absolute;z-index: 100;top: 1%;left: 1%;width: 20vw;height: 45vh;overflow:auto;">
  112. <div class="biz-data-card-header">方案列表</div>
  113. <el-table
  114. :data="tableDataShanghaifeng"
  115. style="width: 98%;margin-left: 1%;margin-top: 1%;height: 40vh;"
  116. :cell-style="{ padding:'5px' }"
  117. :header-cell-style="{height: heightAll*0.01+'px',}"
  118. :row-style="{ fontSize: '16px',textAlign:'center'}"
  119. border >
  120. <el-table-column type="index" label="序号" width="80">
  121. <template #default="{ $index }">
  122. <div style="text-align: center;">
  123. {{ $index + 1 }}
  124. </div>
  125. </template>
  126. </el-table-column>
  127. <el-table-column prop="planName" label="名称">
  128. <template #default="scope">
  129. <span style="cursor: pointer;color:#409EFF" @click="getZ(scope.row)">{{ scope.row.planName }}</span>
  130. </template>
  131. </el-table-column>
  132. </el-table>
  133. </div>
  134. <el-dialog @close="clearFromLev" :title="titleFengbao" v-model="dialogVisibleFengbao" width="50%" destroy-on-close>
  135. <div>
  136. <div style="font-size: 20px;margin-left: 2%;">水位</div>
  137. <div id="shuiwei" style="width: 100%;height: 18vh;margin-top: 0%;"></div>
  138. </div>
  139. <div>
  140. <div style="font-size: 20px;margin-left: 2%;margin-top:1% ;">增水</div>
  141. <div id="zengshui" style="width: 100%;height: 18vh;margin-top: 1%;"></div>
  142. </div>
  143. <div>
  144. <div style="font-size: 20px;margin-left: 2%;margin-top:1%">风速</div>
  145. <div id="fengsu" style="width: 100%;height: 18vh;margin-top: 1%;"></div>
  146. </div>
  147. <div>
  148. <div style="font-size: 20px;margin-left: 2%;margin-top:1%">风向</div>
  149. <div id="fengxiang" style="width: 100%;height:18vh;margin-top: 1%;"></div>
  150. </div>
  151. </el-dialog>
  152. <el-dialog @close="clearFromLev" title="" v-model="dialogVisibleSuzhou" width="30%" destroy-on-close>
  153. <el-descriptions
  154. class="margin-top"
  155. :title="titleSuzhou"
  156. :column="1"
  157. :size="size"
  158. border
  159. >
  160. <el-descriptions-item>
  161. <template #label>
  162. <div class="cell-item">
  163. 站码
  164. </div>
  165. </template>
  166. {{suzhou.stationId}}
  167. </el-descriptions-item>
  168. <el-descriptions-item>
  169. <template #label>
  170. <div class="cell-item">
  171. 水位
  172. </div>
  173. </template>
  174. {{suzhou.waterLevel}}
  175. </el-descriptions-item>
  176. <el-descriptions-item>
  177. <template #label>
  178. <div class="cell-item">
  179. 时间
  180. </div>
  181. </template>
  182. {{suzhou.tm}}
  183. </el-descriptions-item>
  184. </el-descriptions>
  185. </el-dialog>
  186. <div id="mapChart"></div>
  187. </div>
  188. </template>
  189. <script setup>
  190. import 'ol/css';
  191. import {defaults as defaultControls} from 'ol/control';
  192. import {getForecastlist} from "@/api/standardization/bizDataShowConfig.js";
  193. import Map from 'ol/Map';
  194. import View from 'ol/View';
  195. import TileLayer from "ol/layer/Tile";
  196. import VectorLayer from "ol/layer/Vector";
  197. import Overlay from 'ol/Overlay';
  198. import {XYZ} from 'ol/source';
  199. import Point from 'ol/geom/Point';
  200. import * as echarts from 'echarts';
  201. import {createDynamicStyle} from "@/views/map/utils/styleParser.js";
  202. import {loadSource} from "../hooks/dataSourceManager.js";
  203. import bus from "@/utils/bus.js";
  204. import {getPopupContentByTemplate, loadPopupChartByTemplate} from "@/views/map/hooks/popupContent.js";
  205. import {isArray} from "@/utils/validate.js";
  206. import {getCenter} from "ol/extent.js";
  207. import jsonData from "./kaixuan5.json";
  208. import 'ol/ol.css';
  209. import VectorSource from 'ol/source/Vector';
  210. import OSM from 'ol/source/OSM';
  211. import Feature from 'ol/Feature';
  212. import { Style, Fill, Stroke, Text, Circle,Icon,RegularShape } from 'ol/style';
  213. import { fromLonLat } from 'ol/proj';
  214. import GeoJSON from 'ol/format/GeoJSON';
  215. import jsonDatak5 from "./kaixuan5.json";
  216. import jsonDatal3 from "./laixuan3.json";
  217. import jsonDatakw from "./wanhang.json";
  218. import jsonDatakw3 from "./wanhang3.json";
  219. import suzhouJson from "./suzhou.json";
  220. import {useRoute} from "vue-router";
  221. import suzhouPoint from "./suzhouPoints.json";
  222. import { ref } from 'vue';
  223. import fangan from "./fangan.json";
  224. import {getStromlist,getStromdataList,getStromdatade} from "@/api/standardization/bizDataShowConfig.js";
  225. const dialogVisibleFengbao = ref(false)
  226. const titleFengbao = ref('')
  227. const tableDataFangan = ref([])
  228. const fanganId = ref(null)
  229. const scrollContainer = ref(null);
  230. const scrollAmount =0;
  231. const widthAll = ref(window.innerWidth)
  232. const dialogVisibleSuzhou = ref(false)
  233. const route = useRoute();
  234. const suzhou = ref({})
  235. const props = defineProps({
  236. config: Object,
  237. });
  238. const mapChart = ref(null);
  239. // 存储弹窗的引用
  240. const popupOverlays = ref([]);
  241. const activities =ref( [
  242. ])
  243. const activities1= ref()
  244. const dateLength = ref(0)
  245. const marks = ref({
  246. })
  247. const isStart = ref(true)
  248. const tooltipRef = ref(null);
  249. let currentFeature = null
  250. let overlay = null
  251. const tableDataShanghaifeng = ref([])
  252. onMounted(async () => {
  253. initMap();
  254. // 初始化完成后执行配置渲染
  255. if(route.params.id==='30'){
  256. getForecastlist({appId: route.params.id}).then(res=>{
  257. tableDataShanghaifeng.value = res.rows
  258. })
  259. polygonLayer.value = createPolygonLayer(jsonDatak5)
  260. mapChart.value.addLayer(polygonLayer.value);
  261. overlay = new Overlay({
  262. element: tooltipRef.value,
  263. positioning: 'bottom-center',
  264. offset: [0, -10],
  265. stopEvent: false,
  266. });
  267. mapChart.value.addOverlay(overlay);
  268. mapChart.value.getView().setZoom(18)
  269. mapChart.value.getView().setCenter([121.41335460526926,31.205820744558153]);
  270. mapChart.value.on('pointermove', (e) => {
  271. if (e.dragging) {
  272. return; // 如果正在拖拽地图,则不处理[2,7](@ref)
  273. }
  274. const pixel = mapChart.value.getEventPixel(e.originalEvent);
  275. const feature = mapChart.value.forEachFeatureAtPixel(pixel, (feature) => feature);
  276. if (feature) {
  277. // 鼠标在要素上[7](@ref)
  278. if (feature !== currentFeature) {
  279. currentFeature = feature;
  280. console.log(feature.values_)
  281. // 获取要素属性信息
  282. const featureCode = feature.values_.element_no;
  283. const featureDep = feature.values_.DEPTH2D
  284. // 更新工具提示内容[2](@ref)
  285. tooltipRef.value.innerHTML = `
  286. <div class="tooltip-header">编号:${featureCode}</div>
  287. <div class="tooltip-content">水深: ${featureDep}</div>
  288. `;
  289. // 设置工具提示位置并显示[7](@ref)
  290. overlay.setPosition(e.coordinate);
  291. tooltipRef.value.style.display = 'block';
  292. // 更改鼠标指针样式为手型[3,5](@ref)
  293. mapChart.value.getTargetElement().style.cursor = 'pointer';
  294. }
  295. } else {
  296. // 鼠标不在要素上
  297. tooltipRef.value.style.display = 'none';
  298. currentFeature = null;
  299. mapChart.value.getTargetElement().style.cursor = ''; // 恢复默认指针[3](@ref)
  300. }
  301. });
  302. }
  303. if(route.params.id==='28'){
  304. tableDataFangan.value = fangan.data.records
  305. const keys = Object.keys(suzhouJson.data.outPutQUZ)
  306. dateLength.value = keys.length-1
  307. keys.forEach(item=>{
  308. var par = {
  309. content: '',
  310. timestamp: item,
  311. size: 'large',
  312. type: 'primary',
  313. }
  314. activities.value.push(par)
  315. })
  316. var parTime = uniformSample(activities.value)
  317. console.log(activities.value)
  318. var a = Math.round((dateLength.value - 1) * 1 / 3)
  319. var b = Math.round((dateLength.value - 1) * 2 / 3)
  320. var c = dateLength.value
  321. marks.value = {
  322. 0:{
  323. style: {
  324. color: '#1989FA',
  325. },
  326. label: parTime[0].timestamp.slice(5),
  327. },
  328. }
  329. marks.value[a] = {
  330. style: {
  331. color: '#1989FA',
  332. },
  333. label: parTime[1].timestamp.slice(5),
  334. }
  335. marks.value[b] = {
  336. style: {
  337. color: '#1989FA',
  338. },
  339. label: parTime[2].timestamp.slice(5),
  340. }
  341. marks.value[c] = {
  342. style: {
  343. color: '#1989FA',
  344. },
  345. label: parTime[3].timestamp.slice(5),
  346. }
  347. console.log(activities)
  348. suzhouJson.data.inputParam = JSON.parse(suzhouJson.data.inputParam)
  349. console.log(suzhouJson.data)
  350. timerId = setInterval(changeMap, 1000)
  351. console.log(suzhouPoint)
  352. pointLayer.value = createPointlayer(suzhouPoint)
  353. mapChart.value.addLayer(pointLayer.value);
  354. mapChart.value.on('click', (event) => {
  355. const feature = mapChart.value.forEachFeatureAtPixel(
  356. event.pixel,
  357. (feature) => feature
  358. );
  359. if (feature) {
  360. pause()
  361. const properties = feature.getProperties();
  362. dialogVisibleSuzhou.value = true
  363. titleSuzhou.value = properties.name
  364. console.log('要素属性:', properties);
  365. suzhou.value = properties
  366. suzhou.value.tm = activities.value[count.value-1].timestamp
  367. const title = feature.get('title');
  368. const id = feature.get('id');
  369. console.log('标题:', title, 'ID:', id);
  370. // 获取几何信息
  371. const geometry = feature.getGeometry();
  372. const coordinates = geometry.getCoordinates();
  373. console.log('几何坐标:', coordinates);
  374. } else {
  375. console.log('未点击到任何要素');
  376. }
  377. })
  378. if (route.params.id === '28') {
  379. getFanganList().then(res => {
  380. tableDataFangan.value = res.data.records
  381. fanganId.value = tableDataFangan.value[0].id
  382. getFanganDataList(fanganId.value).then(res => {
  383. const outPutQUZ = res.data.outPutQUZ
  384. const keys = Object.keys(outPutQUZ)
  385. dateLength.value = keys.length - 1
  386. keys.forEach(item => {
  387. let par = {
  388. content: '',
  389. timestamp: item,
  390. size: 'large',
  391. type: 'primary',
  392. }
  393. activities.value.push(par)
  394. })
  395. var parTime = uniformSample(activities.value)
  396. console.log(activities.value)
  397. var a = Math.round((dateLength.value - 1) * 1 / 3)
  398. var b = Math.round((dateLength.value - 1) * 2 / 3)
  399. var c = dateLength.value
  400. marks.value = {
  401. 0: {
  402. style: {
  403. color: '#1989FA',
  404. },
  405. label: parTime[0].timestamp.slice(5),
  406. },
  407. }
  408. marks.value[a] = {
  409. style: {
  410. color: '#1989FA',
  411. },
  412. label: parTime[1].timestamp.slice(5),
  413. }
  414. marks.value[b] = {
  415. style: {
  416. color: '#1989FA',
  417. },
  418. label: parTime[2].timestamp.slice(5),
  419. }
  420. marks.value[c] = {
  421. style: {
  422. color: '#1989FA',
  423. },
  424. label: parTime[3].timestamp.slice(5),
  425. }
  426. suzhouJson.data.inputParam = JSON.parse(suzhouJson.data.inputParam)
  427. console.log(suzhouJson.data)
  428. timerId = setInterval(changeMap, 1000)
  429. pointLayer.value = createPointlayer(suzhouPoint)
  430. mapChart.value.addLayer(pointLayer.value);
  431. })
  432. })
  433. }
  434. if(route.params.id==='20'){
  435. tableDataFangan.value = fangan.data.records
  436. wendai()
  437. }
  438. if (props.config) {
  439. // toCenter(props.config.center, props.config.zoom);
  440. await loadLayers(props.config.layers);
  441. }
  442. });
  443. const titleSuzhou = ref('')
  444. const count = ref(0)
  445. const tableData = ref()
  446. function getZ(row){
  447. console.log(row.id)
  448. }
  449. function initChart(x,y,mdName,id,color,danwei){
  450. var chartDom = document.getElementById(id);
  451. var myChart = echarts.init(chartDom);
  452. var option;
  453. option = {
  454. tooltip: {
  455. trigger: 'axis'
  456. },
  457. grid: {
  458. left: '5%',
  459. right: '5%',
  460. bottom: '15%',
  461. top: '18%',
  462. containLabel: true
  463. },
  464. xAxis: {
  465. splitLine: { show: false },
  466. // type: 'category',
  467. data: x
  468. },
  469. yAxis: {
  470. type: 'value',
  471. show: true,
  472. splitLine: { show: false },
  473. name: danwei,
  474. axisTick: {
  475. show: true // 确保显示刻度线
  476. },
  477. axisLine: {
  478. show: true, // 确保显示轴线
  479. lineStyle: {
  480. color: '#333', // 可以设置轴线的颜色,例如与文字颜色一致
  481. // width: 1 // 可以设置轴线宽度,可选
  482. }
  483. },
  484. },
  485. series: [
  486. {
  487. name: mdName,
  488. type: 'line',
  489. color:color,
  490. data: y,
  491. smooth: true
  492. },
  493. ]
  494. };
  495. option && myChart.setOption(option);
  496. }
  497. function formatTooltip(val){
  498. if (activities.value && activities.value[val]) {
  499. return activities.value[val].timestamp.slice(5);
  500. }
  501. // 数据未就绪时返回默认提示
  502. return 'Loading...';
  503. }
  504. const tableJason = ref([])
  505. async function wendai(){
  506. await getStromlist().then(res=>{
  507. var dataJson = res.data
  508. const vectorSource = new VectorSource();
  509. dataJson.forEach(station => {
  510. const feature = new Feature({
  511. geometry: new Point([station.lgtd, station.lttd]),
  512. stcd: station.stcd,
  513. stnm: station.stnm,
  514. });
  515. // 设置样式(根据水位值动态设置颜色)
  516. const style = new Style({
  517. image: new RegularShape({
  518. points: 3, // 三角形
  519. radius: 8, // 大小
  520. fill: new Fill({
  521. color: '#FF5722' // 红色填充
  522. }),
  523. stroke: new Stroke({
  524. color: '#fff', // 白色边框
  525. width: 2
  526. }),
  527. angle: Math.PI // 旋转180度,使三角形倒置[1,4](@ref)
  528. }),
  529. text: new Text({
  530. text: station.stnm,
  531. offsetY: 20,
  532. font: '12px Microsoft YaHei, sans-serif',
  533. fill: new Fill({
  534. color: '#333'
  535. }),
  536. stroke: new Stroke({
  537. color: '#fff',
  538. width: 1
  539. }),
  540. backgroundFill: new Fill({
  541. color: 'transparent'
  542. }),
  543. padding: [2, 4, 2, 4]
  544. })
  545. });
  546. feature.setStyle(style);
  547. vectorSource.addFeature(feature);
  548. });
  549. const vectorLayer = new VectorLayer({
  550. source: vectorSource,
  551. properties: {
  552. name: 'weidaiLayers',
  553. type: 'vector'
  554. }
  555. });
  556. mapChart.value.addLayer(vectorLayer)
  557. mapChart.value.on('click', (event) => {
  558. const feature = mapChart.value.forEachFeatureAtPixel(
  559. event.pixel,
  560. (feature) => feature
  561. );
  562. if (feature) {
  563. const properties = feature.getProperties();
  564. dialogVisibleFengbao.value = true
  565. titleFengbao.value = properties.stnm + '(站码:' + properties.stcd + ')'
  566. getStromdatade({stcd:properties.stcd}).then(res=>{
  567. var x = []
  568. var ygfsZ = []
  569. var ygfsAddz = []
  570. var ygfsWndv = []
  571. var ygfsWnddir = []
  572. res.data.forEach(item=>{
  573. var parTm = item.tm.slice(5)
  574. x.push(parTm.slice(0, 5) + '\n' + parTm.slice(-8,-3))
  575. ygfsZ.push(item.gfsZ)
  576. ygfsAddz.push(item.gfsAddz)
  577. ygfsWndv.push(item.gfsWndv)
  578. ygfsWnddir.push(item.gfsWnddir)
  579. })
  580. initChart(x,ygfsZ,properties.stnm,'shuiwei','#409EFF','单位:m')
  581. initChart(x,ygfsAddz,properties.stnm,'zengshui','#67C23A','单位:m')
  582. initChart(x,ygfsWndv,properties.stnm,'fengsu','#E6A23C','单位:m/s')
  583. initChart(x,ygfsWnddir,properties.stnm,'fengxiang','#F56C6C','单位:°')
  584. })
  585. console.log('要素属性:', properties);
  586. // 获取特定属性
  587. const title = feature.get('title');
  588. const id = feature.get('id');
  589. console.log('标题:', title, 'ID:', id);
  590. // 获取几何信息
  591. const geometry = feature.getGeometry();
  592. const coordinates = geometry.getCoordinates();
  593. console.log('几何坐标:', coordinates);
  594. } else {
  595. console.log('未点击到任何要素');
  596. }
  597. })
  598. })
  599. await getStromdataList().then(res=>{
  600. tableJason.value = res.data
  601. const keys = Object.keys(res.data)
  602. dateLength.value = keys.length
  603. console.log(keys,dateLength.value)
  604. keys.forEach(item=>{
  605. var par = {
  606. content: '',
  607. timestamp: item,
  608. size: 'large',
  609. type: 'primary',
  610. }
  611. activities.value.push(par)
  612. })
  613. var parTime = uniformSample(activities.value)
  614. console.log(activities.value)
  615. var a = Math.round((dateLength.value - 1) * 1 / 3)
  616. var b = Math.round((dateLength.value - 1) * 2 / 3)
  617. var c = dateLength.value - 1
  618. marks.value = {
  619. 0:{
  620. style: {
  621. color: '#1989FA',
  622. },
  623. label: parTime[0].timestamp.slice(5),
  624. },
  625. }
  626. marks.value[a] = {
  627. style: {
  628. color: '#1989FA',
  629. },
  630. label: parTime[1].timestamp.slice(5),
  631. }
  632. marks.value[b] = {
  633. style: {
  634. color: '#1989FA',
  635. },
  636. label: parTime[2].timestamp.slice(5),
  637. }
  638. marks.value[c] = {
  639. style: {
  640. color: '#1989FA',
  641. },
  642. label: parTime[3].timestamp.slice(5),
  643. }
  644. })
  645. dateLength.value = dateLength.value -1
  646. timerId = setInterval(changeWen, 1000)
  647. }
  648. function changeWen(){
  649. if(tableJason.value){
  650. tableData.value = []
  651. var valuesArray = Object.values(tableJason.value)
  652. tableData.value = valuesArray[count.value]
  653. activities1.value = count.value
  654. count.value++
  655. if(count.value > dateLength.value){
  656. count.value = 0
  657. }
  658. }
  659. }
  660. function pause(){
  661. clearInterval(timerId);
  662. timerId = null
  663. isStart.value = false
  664. }
  665. function reStart(){
  666. timerId = setInterval(changeMap, 1000)
  667. isStart.value = true
  668. }
  669. function reStartWen(){
  670. timerId = setInterval(changeWen, 1000)
  671. isStart.value = true
  672. }
  673. function uniformSample(arr) {
  674. const n = arr.length;
  675. if (n === 0) return [];
  676. if (n <= 4) {
  677. return arr.slice();
  678. }
  679. // 计算三个等分点的索引
  680. const index0 = 0; // 首元素
  681. const index1 = Math.round((n - 1) * 1 / 3); // 第一个等分点
  682. const index2 = Math.round((n - 1) * 2 / 3); // 第二个等分点
  683. const index3 = n - 1; // 尾元素
  684. return [
  685. arr[index0],
  686. arr[index1],
  687. arr[index2],
  688. arr[index3]
  689. ];
  690. }
  691. function pauseIn(){
  692. pause()
  693. count.value = activities1.value
  694. changeMap()
  695. }
  696. function pauseInWen(){
  697. pause()
  698. count.value = activities1.value
  699. changeWen()
  700. }
  701. function changeMap(){
  702. tableData.value = []
  703. const keys1 = Object.keys(suzhouJson.data.outPutQUZ)
  704. if(count.value >= keys1.length){
  705. console.log(count.value,keys1.length)
  706. count.value = 0
  707. }
  708. activities1.value = count.value
  709. mapChart.value.removeLayer(pointLayer.value)
  710. const keys = Object.keys(suzhouJson.data.outPutQUZ)
  711. tableData.value = suzhouJson.data.outPutQUZ[keys[count.value]]
  712. for(var i = 0;i<suzhouPoint.length;i++){
  713. for(var i1 = 0;i1<suzhouJson.data.outPutQUZ[keys[count.value]].length;i1++){
  714. if(suzhouPoint[i].STATIONNAME===suzhouJson.data.outPutQUZ[keys[count.value]][i1].name){
  715. suzhouPoint[i].ZZ = suzhouJson.data.outPutQUZ[keys[count.value]][i1].z
  716. }
  717. }
  718. }
  719. pointLayer.value = createPointlayer(suzhouPoint)
  720. mapChart.value.addLayer(pointLayer.value);
  721. // if(count.value%10===0&&count.value!==0){
  722. // scrollContainer.value.scrollLeft += scrollAmount + widthAll.value;
  723. // }
  724. count.value++
  725. }
  726. function createPolygonLayer(jsonData){
  727. var parData = []
  728. if(Array.isArray(jsonData)){
  729. jsonData.forEach(item => {
  730. var par = {
  731. type:'Feature',
  732. geometry:JSON.parse(item.geometry),
  733. properties:JSON.parse(item.properties),
  734. }
  735. parData.push(par)
  736. });
  737. const polygonGeoJSON = {
  738. "type": "FeatureCollection",
  739. "features": parData
  740. };
  741. console.log(parData)
  742. // 创建矢量数据源并加载GeoJSON多边形数据[3,4](@ref)
  743. const vectorSource = new VectorSource({
  744. features: new GeoJSON().readFeatures(polygonGeoJSON, {
  745. dataProjection: 'EPSG:4326',
  746. featureProjection: 'EPSG:4326'
  747. })
  748. });
  749. // 创建多边形要素样式[6,7](@ref)
  750. const styleFunction = function(feature) {
  751. const properties = feature.getProperties();
  752. if (properties.DEPTH2D >= 1) {
  753. return new Style({
  754. fill: new Fill({
  755. color: 'rgba(255, 0, 0, 0.5)'
  756. }),
  757. stroke: new Stroke({
  758. color: '#ff0000',
  759. width: 3
  760. })
  761. });
  762. }
  763. else if (properties.DEPTH2D < 1&&properties.DEPTH2D>=0.5) {
  764. return new Style({
  765. fill: new Fill({
  766. color: 'rgb(238, 190, 119)'
  767. }),
  768. stroke: new Stroke({
  769. color: '#ff0000',
  770. width: 3
  771. })
  772. });
  773. }
  774. else if (properties.DEPTH2D < 0.5&&properties.DEPTH2D>=0.3) {
  775. return new Style({
  776. fill: new Fill({
  777. color: 'rgb(238, 190, 119)'
  778. }),
  779. stroke: new Stroke({
  780. color: '#ff0000',
  781. width: 3
  782. })
  783. });
  784. }
  785. else if (properties.DEPTH2D < 0.3&&properties.DEPTH2D>=0.25) {
  786. return new Style({
  787. fill: new Fill({
  788. color: 'rgb(238, 190, 119)'
  789. }),
  790. stroke: new Stroke({
  791. color: '#ff0000',
  792. width: 3
  793. })
  794. });
  795. }
  796. else if (properties.DEPTH2D < 0.25&&properties.DEPTH2D>=0.2) {
  797. return new Style({
  798. fill: new Fill({
  799. color: 'rgb(121, 187, 255)'
  800. }),
  801. stroke: new Stroke({
  802. color: '#ff0000',
  803. width: 3
  804. })
  805. });
  806. }
  807. else if (properties.DEPTH2D < 0.2&&properties.DEPTH2D>=0.15) {
  808. return new Style({
  809. fill: new Fill({
  810. color: 'rgb(198, 226, 255)'
  811. }),
  812. stroke: new Stroke({
  813. color: '#ff0000',
  814. width: 3
  815. })
  816. });
  817. }
  818. // 默认样式
  819. return new Style({
  820. fill: new Fill({
  821. color: 'rgb(51, 126, 204)' // 半透明蓝色填充
  822. }),
  823. stroke: new Stroke({
  824. color: '#0066ff', // 蓝色边框
  825. width: 2 // 边框宽度
  826. })
  827. });
  828. };
  829. // 创建矢量图层[1,2](@ref)
  830. return new VectorLayer({
  831. source: vectorSource,
  832. style: styleFunction
  833. });
  834. }
  835. }
  836. function createStationStyle(station) {
  837. // 根据水位值设置颜色[7](@ref)
  838. let color = '#3399CC'; // 默认蓝色
  839. if (station.ZZ > 5.0) {
  840. color = '#FF6B6B'; // 高水位用红色
  841. } else if (station.ZZ < 4.5) {
  842. color = '#4ECDC4'; // 低水位用绿色
  843. }
  844. return new Style({
  845. image: new RegularShape({
  846. points: 3, // 三角形
  847. radius: 8, // 大小
  848. fill: new Fill({
  849. color: '#FF5722' // 红色填充
  850. }),
  851. stroke: new Stroke({
  852. color: '#fff', // 白色边框
  853. width: 2
  854. }),
  855. angle: Math.PI // 旋转180度,使三角形倒置[1,4](@ref)
  856. }),
  857. text: new Text({
  858. text: station.STATIONNAME + '\n水位: ' + station.ZZ + 'm',
  859. offsetY: 20,
  860. font: '12px Microsoft YaHei, sans-serif',
  861. fill: new Fill({
  862. color: '#333'
  863. }),
  864. stroke: new Stroke({
  865. color: '#fff',
  866. width: 1
  867. }),
  868. backgroundFill: new Fill({
  869. color: 'transparent'
  870. }),
  871. padding: [2, 4, 2, 4]
  872. })
  873. });
  874. }
  875. function createPointlayer(dataJson){
  876. const vectorSource = new VectorSource();
  877. // 为每个水文站创建要素[2,3](@ref)
  878. dataJson.forEach(station => {
  879. // 使用经纬度坐标创建点要素[5](@ref)
  880. const feature = new Feature({
  881. geometry: new Point([station.XX2000, station.YY2000]),
  882. name: station.STATIONNAME,
  883. waterLevel: station.ZZ,
  884. area: station.QUYU,
  885. river: station.HELIU,
  886. type: station.TYPE,
  887. // tm:,
  888. stationId: station.STATIONID
  889. });
  890. // 设置样式(根据水位值动态设置颜色)
  891. const style = createStationStyle(station);
  892. feature.setStyle(style);
  893. vectorSource.addFeature(feature);
  894. });
  895. // 创建矢量图层[1,4](@ref)
  896. const vectorLayer = new VectorLayer({
  897. source: vectorSource,
  898. // 可以设置图层属性便于后续管理
  899. properties: {
  900. name: 'hydrologicalStations',
  901. type: 'vector'
  902. }
  903. });
  904. // 将图层添加到地图
  905. return vectorLayer;
  906. }
  907. // 创建多边形图层
  908. const pointLayer = ref(null)
  909. const polygonLayer = ref(null)
  910. const initMap = () => {
  911. let vecLayer = new TileLayer({
  912. source: new XYZ({
  913. url: "http://t0.tianditu.gov.cn/vec_w/wmts?" +
  914. "SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles" +
  915. "&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}" +
  916. "&tk=9bb941214f10fbf9a3eab43f45cb2b7e",
  917. }),
  918. });
  919. let cvaLayer = new TileLayer({
  920. source: new XYZ({
  921. url: "http://t0.tianditu.gov.cn/cva_w/wmts?" +
  922. "SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles" +
  923. "&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}" +
  924. "&tk=9bb941214f10fbf9a3eab43f45cb2b7e",
  925. }),
  926. });
  927. mapChart.value = new Map({
  928. target: 'mapChart',
  929. view: new View({
  930. center: [121.472644, 31.231706],
  931. zoom: 10,
  932. minZoom: 3,
  933. maxZoom: 16,
  934. projection: 'EPSG:4326',
  935. }),
  936. layers: [vecLayer, cvaLayer],
  937. controls: defaultControls({
  938. zoom: false,//不显示放大放小按钮
  939. rotate: false,//不显示指北针控件
  940. attribution: false,//不显示右下角的地图信息控件
  941. scaleLine: false,//不显示比例尺控件
  942. })
  943. });
  944. mapChart.value.on('moveend', function (event) {
  945. var center = mapChart.value.getView().getCenter(); // 获取中心点位置
  946. var zoom = mapChart.value.getView().getZoom(); // 获取层级
  947. console.log('Center:', center); // 转换为经纬度格式
  948. console.log('Zoom:', zoom);
  949. });
  950. };
  951. const addVectorLayer = async (config) => {
  952. loadSource(config).then(source => {
  953. // 创建矢量图层
  954. const vectorLayer = new VectorLayer({
  955. id: config.id,
  956. zIndex: config.zIndex,
  957. source: source,
  958. style: config.style ? createDynamicStyle(config.style) : null,
  959. visible: config.visible !== false // 默认可见
  960. });
  961. // 添加到地图
  962. mapChart.value.addLayer(vectorLayer);
  963. // 添加事件监听
  964. if (config.events) {
  965. setupLayerEvents(vectorLayer, config.events);
  966. }
  967. return vectorLayer;
  968. })
  969. };
  970. // 设置图层事件监听
  971. const setupLayerEvents = (layer, events) => {
  972. // 点击事件处理
  973. if (events.click) {
  974. mapChart.value.on('click', (event) => {
  975. const features = mapChart.value.getFeaturesAtPixel(event.pixel);
  976. if (features && features.length > 0) {
  977. // 处理点击事件,例如显示弹窗
  978. handleFeatureClick(features[0], events.click);
  979. }
  980. });
  981. }
  982. // 悬停事件处理
  983. if (events.hover) {
  984. mapChart.value.on('pointermove', (event) => {
  985. const features = mapChart.value.getFeaturesAtPixel(event.pixel);
  986. if (features && features.length > 0) {
  987. // 处理悬停事件,例如高亮显示
  988. handleFeatureHover(features[0], events.hover);
  989. }
  990. });
  991. }
  992. };
  993. // 处理要素点击事件
  994. const handleFeatureClick = (feature, clickConfig) => {
  995. if (clickConfig.action === 'popup') {
  996. // 显示弹窗逻辑
  997. showFeaturePopup(feature, clickConfig.popupConfig);
  998. }
  999. };
  1000. // 处理要素悬停事件
  1001. const handleFeatureHover = (feature, hoverConfig) => {
  1002. if (hoverConfig.action === 'highlight') {
  1003. // 高亮显示逻辑
  1004. highlightFeature(feature);
  1005. }
  1006. };
  1007. // 显示要素弹窗
  1008. const showFeaturePopup = (feature, popupConfig) => {
  1009. // 清除已存在的弹窗
  1010. clearPopups();
  1011. const properties = feature.getProperties();
  1012. const geometry = feature.getGeometry();
  1013. const coordinates = geometry.getCoordinates();
  1014. let center = coordinates
  1015. if (isArray(coordinates)) {
  1016. const extent = geometry.getExtent()
  1017. center = getCenter(extent); // 计算包围盒的中心点坐标
  1018. }
  1019. // 创建弹窗元素
  1020. const popupElement = document.createElement('div');
  1021. popupElement.className = 'feature-popup';
  1022. // 根据配置生成弹窗内容
  1023. if (popupConfig && popupConfig.template) {
  1024. popupElement.innerHTML = getPopupContentByTemplate(popupConfig.template, properties, popupElement);
  1025. } else {
  1026. // 生成默认弹窗内容
  1027. let content = `
  1028. <div class="popup-header">
  1029. <h3>${properties.name || properties['测站名称'] || '未知站点'}</h3>
  1030. <button class="popup-close" onclick="closePopup()">×</button>
  1031. </div>
  1032. <div class="popup-content">
  1033. <div class="popup-info">
  1034. `;
  1035. // 添加属性信息
  1036. Object.keys(properties).forEach(key => {
  1037. if (key !== 'geometry' && key !== 'name' && key !== 'stationName') {
  1038. content += `<div class="info-item"><span class="label">${key}:</span><span class="value">${properties[key]}</span></div>`;
  1039. }
  1040. });
  1041. content += `
  1042. </div>
  1043. </div>
  1044. `;
  1045. popupElement.innerHTML = content;
  1046. }
  1047. // 添加关闭按钮事件监听
  1048. const closeBtn = popupElement.querySelector('.popup-close');
  1049. if (closeBtn) {
  1050. closeBtn.onclick = () => {
  1051. clearPopups();
  1052. };
  1053. }
  1054. let popupOverlay = new Overlay({
  1055. element: popupElement,
  1056. positioning: popupConfig?.positioning || "bottom-center",
  1057. stopEvent: popupConfig?.stopEvent !== undefined ? popupConfig.stopEvent : true,
  1058. offset: popupConfig?.offset || [0, -10],
  1059. autoPan: true
  1060. });
  1061. popupOverlay.setPosition(center);
  1062. mapChart.value.addOverlay(popupOverlay);
  1063. popupOverlays.value.push(popupOverlay);
  1064. if (popupConfig && popupConfig.template) {
  1065. loadPopupChartByTemplate(popupConfig.template, properties);
  1066. }
  1067. };
  1068. // 高亮要素
  1069. const highlightFeature = (feature) => {
  1070. // 获取要素的原始样式
  1071. const originalStyle = feature.get('originalStyle') || feature.getStyle();
  1072. // 保存原始样式以便恢复
  1073. feature.set('originalStyle', originalStyle);
  1074. // 创建高亮样式
  1075. const highlightStyle = createDynamicStyle({
  1076. fill: {
  1077. color: 'rgba(255, 255, 0, 0.8)' // 黄色填充
  1078. },
  1079. stroke: {
  1080. color: '#ff0000', // 红色边框
  1081. width: 3
  1082. },
  1083. circle: {
  1084. radius: 8,
  1085. fill: {
  1086. color: 'rgba(255, 255, 0, 0.8)'
  1087. },
  1088. stroke: {
  1089. color: '#ff0000',
  1090. width: 3
  1091. }
  1092. }
  1093. });
  1094. // 应用高亮样式
  1095. feature.setStyle(highlightStyle);
  1096. };
  1097. let timerId = null
  1098. // 聚焦
  1099. function highlightPoint(center) {
  1100. // 先清除已存在的高亮图层
  1101. const existingHighlightOverlay = mapChart.value.getOverlays().getArray().find(ov => ov['id'] === 'highlight-point');
  1102. if (existingHighlightOverlay) {
  1103. mapChart.value.removeOverlay(existingHighlightOverlay);
  1104. if (timerId) {
  1105. clearTimeout(timerId);
  1106. }
  1107. }
  1108. // 创建 Overlay 并绑定元素
  1109. const overlayElement = document.createElement('div');
  1110. overlayElement.className = 'highlight-point-overlay';
  1111. const overlay = new Overlay({
  1112. id: 'highlight-point',
  1113. element: overlayElement,
  1114. position: center,
  1115. stopEvent: false,
  1116. zIndex: 1000,
  1117. offset: [-16, -18],
  1118. });
  1119. mapChart.value.addOverlay(overlay);
  1120. // 3秒后删掉 - 改进的删除方式
  1121. timerId = setTimeout(() => {
  1122. if (mapChart.value) {
  1123. try {
  1124. const overlayToRemove = mapChart.value.getOverlays().getArray().find(ov => ov['id'] === 'highlight-point');
  1125. if (overlayToRemove) {
  1126. mapChart.value.removeOverlay(overlayToRemove);
  1127. }
  1128. } catch (error) {
  1129. console.warn('删除高亮Overlay时出错:', error);
  1130. }
  1131. }
  1132. }, 3000)
  1133. }
  1134. // 清除所有弹窗
  1135. const clearPopups = () => {
  1136. popupOverlays.value.forEach(overlay => {
  1137. mapChart.value.removeOverlay(overlay);
  1138. });
  1139. popupOverlays.value = [];
  1140. };
  1141. // 跳转到新中心点
  1142. function toCenter(center, zoom, duration = 500, highlight) {
  1143. if (center && center.length >= 2) {
  1144. mapChart.value.getView().animate({
  1145. center: center,
  1146. zoom: zoom ? zoom : mapChart.value.getView().getZoom(),
  1147. duration: duration,
  1148. });
  1149. if (highlight) {
  1150. highlightPoint(center);
  1151. }
  1152. }
  1153. }
  1154. async function loadLayers(layers) {
  1155. for (const layer of layers) {
  1156. switch (layer.type) {
  1157. case 'vector':
  1158. await addVectorLayer(layer)
  1159. }
  1160. }
  1161. }
  1162. bus.on('show-map-position', ({latitude, longitude}) => {
  1163. toCenter([longitude, latitude], null, 1500, true)
  1164. })
  1165. // 实时更新地图
  1166. watch(() => props.config, async (config) => {
  1167. if (config) {
  1168. // 渲染配置
  1169. // 1. 跳转中心点
  1170. // toCenter(config.center, config.zoom);
  1171. // 渲染图层
  1172. await loadLayers(config.layers);
  1173. }
  1174. }, {deep: true});
  1175. </script>
  1176. <style scoped lang="scss">
  1177. .biz-data-card-header {
  1178. width: 100%;
  1179. height: 36px;
  1180. background: url("@/assets/map/img/left-title.png") no-repeat;
  1181. background-size: 100% 100%;
  1182. font-size: 16px;
  1183. font-family: 'PuHuiTi', sans-serif;
  1184. font-weight: bolder;
  1185. color: #fff;
  1186. text-align: center;
  1187. line-height: 34px;
  1188. }
  1189. /*滚动条里面轨道*/
  1190. ::-webkit-scrollbar-track {
  1191. background-color: rgba(20, 19, 19, 0);
  1192. }
  1193. /*关键设置 tbody出现滚动条*/
  1194. ::-webkit-scrollbar-thumb {
  1195. background-color: rgba(58, 100, 179, 0.5);
  1196. border-radius: 8px 10px;
  1197. }
  1198. ::v-deep(.el-scrollbar) {
  1199. --el-scrollbar-bg-color: rgba(58, 100, 179);
  1200. --el-scrollbar-hover-bg-color: rgba(58, 100, 179);
  1201. }
  1202. .map-index {
  1203. height: 100%;
  1204. width: 100%;
  1205. position: relative;
  1206. #mapChart {
  1207. height: 100%;
  1208. width: 100%;
  1209. }
  1210. }
  1211. </style>
  1212. <style lang="scss">
  1213. .custom-popup {
  1214. background: rgba(255, 255, 255, 0.95);
  1215. border-radius: 8px;
  1216. box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  1217. border: 1px solid #3498db;
  1218. width: 172px;
  1219. .popup-title {
  1220. width: 100%;
  1221. line-height: 15px;
  1222. background-color: rgba(255, 23, 0);
  1223. padding: 10px;
  1224. text-align: center;
  1225. color: #fff;
  1226. font-size: 16px;
  1227. }
  1228. .popup-top {
  1229. padding: 5px 10px;
  1230. width: 100%;
  1231. background-color: rgba(58, 100, 179);
  1232. display: flex;
  1233. flex-direction: column;
  1234. color: #fff;
  1235. font-size: 14px;
  1236. }
  1237. .popup-bottom {
  1238. padding: 5px 10px;
  1239. width: 100%;
  1240. background-color: rgba(71, 146, 211);
  1241. display: flex;
  1242. flex-direction: column;
  1243. color: #fff;
  1244. font-size: 14px;
  1245. }
  1246. }
  1247. .feature-popup {
  1248. background: rgba(255, 255, 255, 0.95);
  1249. border-radius: 8px;
  1250. box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  1251. border: 1px solid #3498db;
  1252. width: 250px;
  1253. font-family: Arial, sans-serif;
  1254. .popup-header {
  1255. display: flex;
  1256. justify-content: space-between;
  1257. align-items: center;
  1258. background-color: rgba(58, 100, 179);
  1259. padding: 10px;
  1260. border-radius: 8px 8px 0 0;
  1261. h3 {
  1262. margin: 0;
  1263. color: white;
  1264. font-size: 14px;
  1265. }
  1266. .popup-close {
  1267. background: none;
  1268. border: none;
  1269. color: white;
  1270. font-size: 18px;
  1271. cursor: pointer;
  1272. }
  1273. }
  1274. .popup-content {
  1275. padding: 10px;
  1276. }
  1277. .popup-info {
  1278. .info-item {
  1279. display: flex;
  1280. justify-content: space-between;
  1281. margin-bottom: 5px;
  1282. font-size: 12px;
  1283. .label {
  1284. font-weight: bold;
  1285. color: #333;
  1286. }
  1287. .value {
  1288. color: #666;
  1289. }
  1290. }
  1291. }
  1292. .popup-chart {
  1293. border-top: 1px solid #eee;
  1294. padding-top: 10px;
  1295. canvas {
  1296. width: 100%;
  1297. }
  1298. }
  1299. }
  1300. .highlight-point-overlay {
  1301. width: 32px;
  1302. height: 32px;
  1303. background-image: url('@/assets/map/img/dyCenter.gif');
  1304. background-size: contain;
  1305. background-repeat: no-repeat;
  1306. }
  1307. </style>
  1308. <style scoped>
  1309. .horizontal-timeline-container {
  1310. width: 100%;
  1311. overflow-x: auto; /* 允许横向滚动 */
  1312. padding: 20px 0;
  1313. }
  1314. .horizontal-timeline {
  1315. display: flex;
  1316. min-width: 800px; /* 根据时间轴项的数量调整最小宽度 */
  1317. padding: 50px; /* 增加内边距 */
  1318. }
  1319. .timeline-item {
  1320. flex: 1; /* 每个项平均分配宽度 */
  1321. position: relative;
  1322. min-width: 200px; /* 每个项的最小宽度 */
  1323. }
  1324. .content-wrapper {
  1325. display: flex;
  1326. flex-direction: column;
  1327. text-align: center;
  1328. padding: 0 10px;
  1329. }
  1330. .content-title {
  1331. font-size: 16px;
  1332. margin: 10px 0;
  1333. }
  1334. .content-people {
  1335. color: #8c8c8c;
  1336. font-size: 14px;
  1337. }
  1338. /* 使用 :deep() 穿透修改 Element Plus 组件内部样式 */
  1339. :deep(.horizontal-timeline .el-timeline-item) {
  1340. flex: 1;
  1341. position: relative;
  1342. }
  1343. :deep(.horizontal-timeline .el-timeline-item__tail) {
  1344. border-left: none;
  1345. border-top: 2px solid #e4e7ed;
  1346. width: 100%;
  1347. position: absolute;
  1348. top: 12px;
  1349. left: 0;
  1350. }
  1351. :deep(.horizontal-timeline .el-timeline-item__node) {
  1352. position: absolute;
  1353. top: 6px;
  1354. left: 50%;
  1355. transform: translateX(-50%);
  1356. }
  1357. :deep(.horizontal-timeline .el-timeline-item__wrapper) {
  1358. padding-left: 0;
  1359. position: absolute;
  1360. top: 30px;
  1361. left: 50%;
  1362. transform: translateX(-50%);
  1363. text-align: center;
  1364. width: 100%;
  1365. }
  1366. /* 激活状态样式 */
  1367. .active :deep(.el-timeline-item__node) {
  1368. background-color: #409EFF; /* 使用 Element Plus 主色 */
  1369. }
  1370. .active :deep(.el-timeline-item__tail) {
  1371. border-color: #409EFF;
  1372. }
  1373. .tooltip {
  1374. position: absolute;
  1375. background: #409EFF;
  1376. color: white;
  1377. padding: 8px 12px;
  1378. border-radius: 4px;
  1379. width: 100px;
  1380. font-size: 12px;
  1381. pointer-events: none;
  1382. display: none; /* 初始隐藏 */
  1383. box-shadow: 0 2px 4px #409EFF;
  1384. max-width: 200px;
  1385. z-index: 1000;
  1386. }
  1387. .tooltip-header {
  1388. font-weight: bold;
  1389. margin-bottom: 4px;
  1390. border-bottom: 1px solid rgba(255,255,255,0.3);
  1391. padding-bottom: 2px;
  1392. }
  1393. .tooltip-content {
  1394. font-size: 11px;
  1395. opacity: 0.9;
  1396. }
  1397. </style>