index.vue 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202
  1. <template>
  2. <div class="container">
  3. <el-row id="earth" style="height: 100%; width: 100%; display: flex; position: relative">
  4. <el-col style="height: 100%; position: relative" :span="this.leftwidth">
  5. <div class="main-layout" v-on:mouseover="changeActive('2D')" @mousemove="getMouseLocation">
  6. <div id="2DcesiumContainer" class="map" @click="onMapClick"></div>
  7. </div>
  8. </el-col>
  9. <el-col style="height: 100%; position: relative" :span="24 - this.leftwidth">
  10. <div class="main-layout" v-on:mouseover="changeActive('3D')" @mousemove="getMouseLocation">
  11. <div id="3DcesiumContainer" class="map" @click="onMapClick"></div>
  12. </div>
  13. </el-col>
  14. <el-tabs type="border-card" v-model="activeName" tab-position="left" class="menu" :stretch="true"
  15. @tab-click="legendClick">
  16. <!-- <el-tab-pane name="first">
  17. <el-tooltip placement="right" effect="light" slot="label">
  18. <span slot="content" class="item">标绘</span>
  19. <span><i class="el-icon-wind-power"></i></span>
  20. </el-tooltip>
  21. </el-tab-pane> -->
  22. <!-- <el-tab-pane name="second">
  23. <el-tooltip placement="right" effect="light" slot="label">
  24. <span slot="content" class="item">模型</span>
  25. <span><i class="el-icon-receiving"></i></span>
  26. </el-tooltip>
  27. <Model @selectModel="selectModel" :isShow="isShow"></Model>
  28. </el-tab-pane> -->
  29. <!-- <el-tab-pane name="third">
  30. <el-tooltip placement="right" effect="light" slot="label">
  31. <span slot="content" class="item">测量</span>
  32. <span><i class="el-icon-discount"></i></span>
  33. </el-tooltip>
  34. </el-tab-pane> -->
  35. <el-tab-pane name="fouth">
  36. <el-tooltip placement="right" effect="light" slot="label">
  37. <span slot="content" class="item">测想定</span>
  38. <span><i class="el-icon-house"></i></span>
  39. </el-tooltip>
  40. <el-table :data="situation">
  41. <el-table-column label="名称" prop="xdname" width="150px"></el-table-column>
  42. <el-table-column label="操作" align="center">
  43. <template slot-scope="scope">
  44. <el-button type="primary" @click="getJson(scope.row)">导入</el-button>
  45. <!-- <el-button type="primary" @click="saveJson()">保存</el-button> -->
  46. </template>
  47. </el-table-column>
  48. </el-table>
  49. </el-tab-pane>
  50. </el-tabs>
  51. <div class="buttons">
  52. <el-button icon="el-icon-full-screen" circle @click="ismax()"></el-button>
  53. <el-button icon="el-icon-house" circle @click="home()"></el-button>
  54. <el-button icon="el-icon-plus" circle @click="big()"></el-button>
  55. <el-button icon="el-icon-minus" circle @click="small()"></el-button>
  56. <el-button icon="el-icon-download" circle @click="saveJson()"></el-button>
  57. </div>
  58. </el-row>
  59. <div v-if="isShow" class="modeltooltip" ref="modeltooltip">{{ modeltooltip }}</div>
  60. </div>
  61. </template>
  62. <script>
  63. import screenfull from "screenfull";
  64. import fireController from "@/api/fireController.js";
  65. import { getToken } from "@/utils";
  66. import axios from "axios";
  67. import Model from "@/views/situation/Model.vue";
  68. import satelliteModel from '@/assets/model/satelite.glb';
  69. import missileModel from '@/assets/model/basic_missle.glb';
  70. import thaadModel from '@/assets/model/anti-aircraft_gun_fire_control_radar_vehicle.glb';
  71. import centerModel from '@/assets/model/the_white_house.glb';
  72. import radarModel from '@/assets/model/radar.glb'
  73. import { mapGetters } from "vuex";
  74. export default {
  75. components: {
  76. Model
  77. },
  78. computed: {
  79. ...mapGetters([
  80. "dimension"
  81. ])
  82. },
  83. data() {
  84. return {
  85. save : false,
  86. situation: [],
  87. nameIdList:[],
  88. websocket: null,
  89. leftwidth: 12,
  90. unit: [],
  91. satellite: [],
  92. center: [],
  93. move_data: {},
  94. viewer2D: null,
  95. viewer3D: null,
  96. mousevalue: null,
  97. // 选中的点
  98. selectedMarker: null,
  99. // 以前的标记点坐标
  100. oldPosition: null,
  101. activeName: 'fouth',
  102. currentLab: {
  103. index: -1,
  104. isActive: false
  105. },
  106. url: "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
  107. isShow: false,
  108. handler3D: null,
  109. handler2D: null,
  110. image: null,
  111. modeltooltip: null,
  112. id: 1,
  113. jsonData: null
  114. };
  115. },
  116. watch: {
  117. dimension: {
  118. handler: function (val, oldVal) {
  119. console.log(val)
  120. if (val == 2) {
  121. this.leftwidth = 24;
  122. } else if (val == 3) {
  123. this.leftwidth = 0;
  124. } else if (val == 5) {
  125. this.leftwidth = 12;
  126. }
  127. },
  128. },
  129. },
  130. created() {
  131. this.getData();
  132. },
  133. mounted() {
  134. this.cesiumInit();
  135. this.pointMove();
  136. this.startWebSocket();
  137. },
  138. beforeDestroy() {
  139. // 在组件销毁前,关闭WebSocket连接
  140. if (this.websocket && this.websocket.readyState === WebSocket.OPEN) {
  141. this.websocket.close();
  142. }
  143. },
  144. methods: {
  145. startWebSocket() {
  146. this.websocket = new WebSocket('ws://localhost:8765');
  147. this.websocket.onopen = () => {
  148. console.log('WebSocket连接已建立!');
  149. };
  150. this.websocket.onmessage = (event) => {
  151. // 处理从WebSocket服务器接收到的消息
  152. const data = JSON.parse(event.data);
  153. console.log('收到消息:', data);
  154. // 在这里处理接收到的数据,更新Vue组件的数据等操作
  155. };
  156. this.websocket.onerror = (error) => {
  157. console.error('WebSocket错误:', error);
  158. };
  159. this.websocket.onclose = () => {
  160. console.log('WebSocket连接已关闭!');
  161. };
  162. },
  163. async saveJson() {
  164. if(this.save){
  165. const jsonData = JSON.stringify(this.jsonData);
  166. const blob = new Blob([jsonData], { type: 'application/json' });
  167. const url = URL.createObjectURL(blob);
  168. const link = document.createElement('a');
  169. link.href = url;
  170. link.download = this.jsonData.xdname + '.json';
  171. document.body.appendChild(link);
  172. link.click();
  173. document.body.removeChild(link);
  174. }
  175. else{
  176. this.$message("请先导入想定文件!!!")
  177. }
  178. // await axios
  179. // .post("http://localhost:8084/admin/online/onlineOperation/updateDatasource/main", {
  180. // params: {
  181. // datasourceId: "1656243335922192384",
  182. // masterData: row,
  183. // slaveData: {}
  184. // }
  185. // })
  186. // .then((res) => {
  187. // console.log("update successfully ");
  188. // });
  189. // const requestData = row
  190. // if(this.websocket && this.websocket.readyState === WebSocket.OPEN){
  191. // this.websocket.send(JSON.stringify(requestData));
  192. // }
  193. // else{
  194. // this.startWebSocket();
  195. // setTimeout(() => {
  196. // this.websocket.send(JSON.stringify(requestData));
  197. // }, 2000);
  198. // }
  199. },
  200. changeItemPosition(data) {
  201. },
  202. async getJson(row) {
  203. let redunit = [];
  204. let blueunit = [];
  205. let satellite = [];
  206. let center = [];
  207. // let fileInfoStr = row.blueunit;
  208. // let fileInfoArr = JSON.parse(fileInfoStr);
  209. // for (let i = 0; i < fileInfoArr.length; i++) {
  210. // await axios
  211. // .get("http://localhost:8084/admin/online/onlineOperation/downloadDatasource/main", {
  212. // params: {
  213. // datasourceId: "1656243335922192384",
  214. // fieldName: "blueunit",
  215. // asImage: false,
  216. // dataId: row.id,
  217. // filename: fileInfoArr[i].filename,
  218. // Authorization: getToken(),
  219. // MenuId: "1656244747347431424"
  220. // }
  221. // })
  222. // .then((response) => {
  223. // // 处理成功的响应
  224. // blueunit.push(response.data);
  225. // })
  226. // .catch((error) => {
  227. // // 处理错误
  228. // console.error(error);
  229. // });
  230. // }
  231. // fileInfoStr = row.redunit;
  232. // fileInfoArr = JSON.parse(fileInfoStr);
  233. // for (let i = 0; i < fileInfoArr.length; i++) {
  234. // await axios
  235. // .get("http://localhost:8084/admin/online/onlineOperation/downloadDatasource/main", {
  236. // params: {
  237. // datasourceId: "1656243335922192384",
  238. // fieldName: "redunit",
  239. // asImage: false,
  240. // dataId: row.id,
  241. // filename: fileInfoArr[i].filename,
  242. // Authorization: getToken(),
  243. // MenuId: "1656244747347431424"
  244. // }
  245. // })
  246. // .then((response) => {
  247. // // 处理成功的响应
  248. // redunit.push(response.data);
  249. // })
  250. // .catch((error) => {
  251. // // 处理错误
  252. // console.error(error);
  253. // });
  254. // }
  255. // fileInfoStr = row.center;
  256. // fileInfoArr = JSON.parse(fileInfoStr);
  257. // for (let i = 0; i < fileInfoArr.length; i++) {
  258. // await axios
  259. // .get("http://localhost:8084/admin/online/onlineOperation/downloadDatasource/main", {
  260. // params: {
  261. // datasourceId: "1656243335922192384",
  262. // fieldName: "center",
  263. // asImage: false,
  264. // dataId: row.id,
  265. // filename: fileInfoArr[i].filename,
  266. // Authorization: getToken(),
  267. // MenuId: "1656244747347431424"
  268. // }
  269. // })
  270. // .then((response) => {
  271. // // 处理成功的响应
  272. // center.push(response.data);
  273. // })
  274. // .catch((error) => {
  275. // // 处理错误
  276. // console.error(error);
  277. // });
  278. // }
  279. // fileInfoStr = row.satellite;
  280. // fileInfoArr = JSON.parse(fileInfoStr);
  281. // for (let i = 0; i < fileInfoArr.length; i++) {
  282. // await axios
  283. // .get("http://localhost:8084/admin/online/onlineOperation/downloadDatasource/main", {
  284. // params: {
  285. // datasourceId: "1656243335922192384",
  286. // fieldName: "satellite",
  287. // asImage: false,
  288. // dataId: row.id,
  289. // filename: fileInfoArr[i].filename,
  290. // Authorization: getToken(),
  291. // MenuId: "1656244747347431424"
  292. // }
  293. // })
  294. // .then((response) => {
  295. // // 处理成功的响应
  296. // satellite.push(response.data);
  297. // })
  298. // .catch((error) => {
  299. // // 处理错误
  300. // console.error(error);
  301. // });
  302. // }
  303. // const jsonData = {}
  304. // id: row.id,
  305. // xdname: row.xdname,
  306. // type: row.type,
  307. // creator: row.creator,
  308. // createtime: row.createtime,
  309. // bluecnt: row.bluecnt,
  310. // target: row.target,
  311. // starttime: row.starttime,
  312. // steptime: row.steptime,
  313. // blueunit: blueunit,
  314. // redunit: redunit,
  315. // satellite: satellite,
  316. // center: center
  317. // };
  318. let fileInfoStr = row.xdfile;
  319. let fileInfoArr = JSON.parse(fileInfoStr);
  320. await axios
  321. .get("http://localhost:8084/admin/online/onlineOperation/downloadDatasource/main", {
  322. params: {
  323. datasourceId: "1656243335922192384",
  324. fieldName: "xdfile",
  325. asImage: false,
  326. dataId: row.id,
  327. filename: fileInfoArr[0].filename,
  328. Authorization: getToken(),
  329. MenuId: "1656244747347431424"
  330. }
  331. })
  332. .then((response) => {
  333. console.log('response.data :>> ', response.data);
  334. // // 处理成功的响应
  335. // jsonData = response.data
  336. blueunit = response.data.blueunit
  337. redunit = response.data.redunit
  338. satellite = response.data.satellite
  339. center = response.data.center
  340. this.save = true
  341. this.jsonData = {
  342. id: row.id,
  343. xdname: row.xdname,
  344. type: row.type,
  345. createtime: row.createtime,
  346. bluecnt: row.bluecnt,
  347. target: row.target,
  348. starttime: row.starttime,
  349. endtime: row.endtime,
  350. steptime: row.steptime,
  351. blueunit: blueunit,
  352. redunit: redunit,
  353. satellite: satellite,
  354. center: center
  355. }
  356. })
  357. .catch((error) => {
  358. // 处理错误
  359. console.error(error);
  360. });
  361. for(let i =0;i<blueunit.length;i++){
  362. this.markLocationbyJson(parseFloat(blueunit[i].pos.lat),parseFloat(blueunit[i].pos.lon),parseFloat(blueunit[i].pos.height),blueunit[i].name,"blue")
  363. }
  364. for(let i = 0;i<center.length;i++){
  365. let item = center[i]
  366. this.markLocationbyJson(parseFloat(item[center[i].name].properties.lat),parseFloat(item[center[i].name].properties.lon),parseFloat(item[center[i].name].properties.h),item.name,"center")
  367. }
  368. for(let i = 0;i<redunit.length;i++){
  369. this.markLocationbyJson(parseFloat(redunit[i].component_movementjson.properties.launch_lat),parseFloat(redunit[i].component_movementjson.properties.launch_lon),parseFloat(redunit[i].component_movementjson.properties.launch_h),redunit[i].name,"red")
  370. let point1 = {
  371. longitude : parseFloat(redunit[i].component_movementjson.properties.launch_lon),
  372. latitude : parseFloat(redunit[i].component_movementjson.properties.launch_lat),
  373. height :parseFloat(redunit[i].component_movementjson.properties.launch_h)
  374. }
  375. let point2 = {
  376. longitude : parseFloat(redunit[i].component_movementjson.properties.target_lon),
  377. latitude : parseFloat(redunit[i].component_movementjson.properties.target_lat),
  378. height : parseFloat(redunit[i].component_movementjson.properties.target_h)
  379. }
  380. this.markLine(point1,point2,"red")
  381. }
  382. },
  383. //获取所有数据
  384. getData() {
  385. this.getCenter();
  386. this.getSatellite();
  387. this.getUnit();
  388. this.getSituation();
  389. },
  390. // 获取场景想定数据
  391. getSituation() {
  392. let params = {
  393. datasourceId: "1656243335922192384",
  394. filterDtoList: [],
  395. pageParam: {
  396. pageNum: 1,
  397. pageSize: 10
  398. }
  399. };
  400. fireController.situation(this, params).then((res) => {
  401. this.situation = res.data.dataList;
  402. });
  403. },
  404. // 获取作战单元数据
  405. getUnit() {
  406. let params = {
  407. datasourceId: "1657931215497334784",
  408. filterDtoList: [],
  409. pageParam: {
  410. pageNum: 1,
  411. pageSize: 10
  412. }
  413. };
  414. fireController.unit(this, params).then((res) => {
  415. this.unit = res.data.dataList;
  416. });
  417. },
  418. // 获取指挥中心数据
  419. getCenter() {
  420. let params = {
  421. datasourceId: "1654421731512684544",
  422. filterDtoList: [],
  423. pageParam: {
  424. pageNum: 1,
  425. pageSize: 10
  426. }
  427. };
  428. fireController.center(this, params).then((res) => {
  429. this.center = res.data.dataList;
  430. });
  431. },
  432. // 获取预警卫星数据
  433. getSatellite() {
  434. let params = {
  435. datasourceId: "1654424480958648320",
  436. filterDtoList: [],
  437. pageParam: {
  438. pageNum: 1,
  439. pageSize: 10
  440. }
  441. };
  442. fireController.satellite(this, params).then((res) => {
  443. this.satellite = res.data.dataList;
  444. });
  445. },
  446. cesiumInit() {
  447. this.viewer2D = new this.Cesium.Viewer("2DcesiumContainer", {
  448. sceneMode: this.Cesium.SceneMode.SCENE2D,
  449. animation: false, // 是否显示时间轴动画
  450. baseLayerPicker: false,
  451. homeButton: false,
  452. geocoder: false,
  453. timeline: false,
  454. fullscreenButton: false,
  455. sceneModePicker: false,
  456. navigationHelpButton: false,
  457. selectionIndicator: false,
  458. imageryProvider: new this.Cesium.UrlTemplateImageryProvider({
  459. url: "https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",
  460. layer: "tdtVecBasicLayer",
  461. style: "default",
  462. format: "image/png",
  463. tileMatrixSetID: "GoogleMapsCompatible",
  464. show: false
  465. })
  466. });
  467. this.viewer3D = new this.Cesium.Viewer("3DcesiumContainer", {
  468. animation: false, // 是否显示时间轴动画
  469. baseLayerPicker: false,
  470. homeButton: false,
  471. geocoder: false,
  472. timeline: false,
  473. fullscreenButton: false,
  474. sceneModePicker: false,
  475. navigationHelpButton: false,
  476. selectionIndicator: false,
  477. // imageryProvider: new this.Cesium.WebMapServiceImageryProvider({
  478. // url: '/geoserver/map/wms',
  479. // // 这里是自定义的图层名称
  480. // layers: 'map',
  481. // parameters: {
  482. // service: 'WMS',
  483. // format: 'image/png',
  484. // transparent: true
  485. // }
  486. // }),
  487. imageryProvider:
  488. // new this.Cesium.WebMapTileServiceImageryProvider({
  489. // url: "http://10.170.16.95:8080/geoserver/gwc/service/wmts/rest/map:map/{style}/{TileMatrixSet}/{TileMatrixSet}:{TileMatrix}/{TileRow}/{TileCol}?format=image/png",
  490. // layer: 'map:map',
  491. // style: 'raster',
  492. // format: 'image/png',
  493. // tileMatrixSetID: 'EPSG:900913', //一般使用EPSG:3857坐标系
  494. // }),
  495. new this.Cesium.UrlTemplateImageryProvider({
  496. url: "https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",
  497. layer: "tdtVecBasicLayer",
  498. style: "default",
  499. format: "image/png",
  500. tileMatrixSetID: "GoogleMapsCompatible",
  501. show: false
  502. })
  503. });
  504. this.viewer3D._cesiumWidget._creditContainer.style.display = "none";
  505. this.viewer2D._cesiumWidget._creditContainer.style.display = "none";
  506. this.viewer3D.camera.setView({
  507. destination: new this.Cesium.Cartesian3.fromDegrees(117.918977, 25.0, 1500000)
  508. // 方向,俯视和仰视的视角
  509. // orientation:{
  510. // heading: this.Cesium.Math.toRadians(90),//坐标系旋转90度
  511. // pitch: this.Cesium.Math.toRadians(-45) ,//设置俯仰角度为-45度
  512. // }
  513. });
  514. this.viewer2D.camera.setView({
  515. destination: new this.Cesium.Cartesian3.fromDegrees(117.918977, 25.0, 1500000)
  516. // 方向,俯视和仰视的视角
  517. // orientation:{
  518. // heading: this.Cesium.Math.toRadians(90),//坐标系旋转90度
  519. // pitch: this.Cesium.Math.toRadians(-45) ,//设置俯仰角度为-45度
  520. // }
  521. });
  522. // this.viewer.scene.screenSpaceCameraController.maximumZoomDistance = 1500000; //相机高度的最大值
  523. this.viewer2D.camera.percentageChanged = 0.01;
  524. this.viewer2D.camera.changed.addEventListener(this.sync); //地图移动事件
  525. this.viewer3D.camera.percentageChanged = 0.01;
  526. this.viewer3D.camera.changed.addEventListener(this.sync); //地图移动事件
  527. this.viewer2D.camera.moveEnd.addEventListener(this.getCammeraHeightAndZoom) //地图缩放事件
  528. this.viewer3D.camera.moveEnd.addEventListener(this.getCammeraHeightAndZoom) //地图缩放事件
  529. this.handler2D = new this.Cesium.ScreenSpaceEventHandler(this.viewer2D.scene.canvas);
  530. this.handler3D = new this.Cesium.ScreenSpaceEventHandler(this.viewer3D.scene.canvas);
  531. },
  532. sync() {
  533. if (this.mousevalue == "3D") {
  534. // 三维地图中心点
  535. let center = new this.Cesium.Cartesian2(
  536. Math.floor(this.viewer3D.canvas.clientWidth / 2),
  537. Math.floor(this.viewer3D.canvas.clientHeight / 2)
  538. );
  539. // 转为世界坐标系
  540. let position = this.viewer3D.scene.camera.pickEllipsoid(center);
  541. // 判断中心点是否在椭球体上
  542. if (this.Cesium.defined(position)) {
  543. // 获取三维地图中心点与相机之间的距离
  544. let distance = this.Cesium.Cartesian3.distance(position, this.viewer3D.scene.camera.positionWC);
  545. position = this.convertWorldToCartographic(position);
  546. // 更新二维地图
  547. this.viewer2D.scene.camera.setView({
  548. destination: new this.Cesium.Cartesian3.fromDegrees(position.longitude, position.latitude, distance)
  549. });
  550. }
  551. }
  552. if (this.mousevalue == "2D") {
  553. // 二维地图中心点
  554. let center = new this.Cesium.Cartesian2(
  555. Math.floor(this.viewer2D.canvas.clientWidth / 2),
  556. Math.floor(this.viewer2D.canvas.clientHeight / 2)
  557. );
  558. // 转为世界坐标系
  559. let position = this.viewer2D.scene.camera.pickEllipsoid(center);
  560. // 判断中心点是否在椭球体上
  561. if (this.Cesium.defined(position)) {
  562. // 获取三维地图中心点与相机之间的距离
  563. let distance = this.viewer2D.scene.camera.positionCartographic.height;
  564. position = this.convertWorldToCartographic(position);
  565. // 更新三维地图
  566. this.viewer3D.scene.camera.setView({
  567. destination: new this.Cesium.Cartesian3.fromDegrees(position.longitude, position.latitude, distance)
  568. });
  569. }
  570. }
  571. },
  572. // 将世界坐标系转换为经纬度坐标系
  573. convertWorldToCartographic(worldPosition) {
  574. const ellipsoid = this.viewer2D.scene.globe.ellipsoid;
  575. const cartographic = ellipsoid.cartesianToCartographic(worldPosition);
  576. const longitude = this.Cesium.Math.toDegrees(cartographic.longitude);
  577. const latitude = this.Cesium.Math.toDegrees(cartographic.latitude);
  578. const height = cartographic.height;
  579. return { longitude, latitude, height };
  580. },
  581. // 监听地图变化
  582. changeActive(value) {
  583. this.mousevalue = value;
  584. },
  585. dimensionswitch(value) {
  586. this.dimension = value;
  587. this.selectModel();
  588. },
  589. // 全屏缩小
  590. ismax() {
  591. if (screenfull.isEnabled && screenfull.isFullscreen) {
  592. screenfull.exit();
  593. } else {
  594. screenfull.request();
  595. }
  596. },
  597. /* 获取camera中心点坐标 */
  598. getCenterPosition(is3D = false) {
  599. let viewer = is3D ? this.viewer3D : this.viewer2D;
  600. let result = viewer.camera.pickEllipsoid(
  601. new this.Cesium.Cartesian2(viewer.canvas.clientWidth / 2, viewer.canvas.clientHeight / 2)
  602. );
  603. let curPosition = this.Cesium.Ellipsoid.WGS84.cartesianToCartographic(result);
  604. let lon = (curPosition.longitude * 180) / Math.PI;
  605. let lat = (curPosition.latitude * 180) / Math.PI;
  606. let height = viewer.camera.positionCartographic.height;
  607. return {
  608. lon: lon,
  609. lat: lat,
  610. height: height
  611. };
  612. },
  613. /* 地图放大 */
  614. big() {
  615. let { lon, lat, height } = this.getCenterPosition(this.dimension === 3);
  616. let viewer = (this.dimension === 3 || this.dimension === 5)? this.viewer3D : this.viewer2D;
  617. // 镜头拉进
  618. viewer.camera.flyTo({
  619. destination: this.Cesium.Cartesian3.fromDegrees(lon, lat, height / 1.8),
  620. duration: 1.0
  621. });
  622. },
  623. /* 地图缩小 */
  624. small() {
  625. let { lon, lat, height } = this.getCenterPosition(this.dimension === 3);
  626. let viewer = (this.dimension === 3 || this.dimension === 5) ? this.viewer3D : this.viewer2D;
  627. // 镜头远离
  628. viewer.camera.flyTo({
  629. destination: this.Cesium.Cartesian3.fromDegrees(lon, lat, height * 1.2),
  630. duration: 1.0
  631. });
  632. },
  633. home() {
  634. let viewer = (this.dimension === 3 || this.dimension === 5)? this.viewer3D : this.viewer2D;
  635. viewer.camera.flyTo({
  636. destination: this.Cesium.Cartesian3.fromDegrees(117.918977, 25.0, 1500000),
  637. duration: 2.0
  638. });
  639. },
  640. // tabs 切换点击
  641. legendClick({ index }) {
  642. this.selectModel();
  643. let tab_content = document.querySelectorAll(".menu .el-tabs__content");
  644. if (this.currentLab.index == index) {
  645. tab_content[0].style.display == "none" || ""
  646. ? (tab_content[0].style.display = "block")
  647. : (tab_content[0].style.display = "none");
  648. }
  649. if (this.currentLab.index != index) {
  650. this.currentLab.index = index;
  651. tab_content[0].style.display = "block";
  652. }
  653. },
  654. mouseMove(event) {
  655. if (this.$refs.modeltooltip) {
  656. this.$refs.modeltooltip.style.left = event.pageX - 240 + "px";
  657. this.$refs.modeltooltip.style.top = event.pageY - 115 + "px";
  658. }
  659. },
  660. //显示鼠标经纬度
  661. getMouseLocation(event) {
  662. let {longitude,latitude} = this.getCoordinatesFromEvent(event);
  663. this.$store.commit("app/setMouseLocation",{longitude,latitude});
  664. },
  665. /*根据camera高度近似计算当前层级*/
  666. heightToZoom(height){
  667. var A = 40487.57;
  668. var B = 0.00007096758;
  669. var C = 91610.74;
  670. var D = -40467.74;
  671. return Math.round(D+(A-D)/(1+Math.pow(height/C, B)));
  672. },
  673. getCammeraHeightAndZoom(){
  674. let viewer = (this.dimension === 3 || this.dimension === 5) ? this.viewer3D : this.viewer2D;
  675. //获取当前相机高度
  676. let height = viewer.camera.positionCartographic.height;
  677. let zoom = this.heightToZoom(height);
  678. this.$store.commit("app/setCameraHeightAndZoom",{height,zoom});
  679. },
  680. selectModel(cursorStyle, image, info) {
  681. console.log('image :>> ', image);
  682. let earthMap = document.getElementById("earth");
  683. earthMap.style.cursor = cursorStyle || "auto";
  684. if (cursorStyle) {
  685. document.addEventListener("mousemove", this.mouseMove);
  686. this.isShow = true;
  687. this.image = image;
  688. this.modeltooltip = info;
  689. } else {
  690. document.removeEventListener("mousemove", this.mouseMove);
  691. this.isShow = false;
  692. this.image = null;
  693. this.modeltooltip = null;
  694. }
  695. },
  696. onMapClick(event) {
  697. if (this.isShow && this.modeltooltip === "左键单击确认") {
  698. const { latitude, longitude } = this.getCoordinatesFromEvent(event);
  699. this.markLocation(latitude, longitude);
  700. }
  701. },
  702. // 同时在2D和3D地图上标记坐标
  703. markLocation(latitude, longitude) {
  704. const position = this.Cesium.Cartesian3.fromDegrees(longitude, latitude);
  705. console.log('position :>> ', position);
  706. this.viewer2D.entities.add({
  707. id: this.id,
  708. position: position,
  709. // point: {
  710. // pixelSize: 12, // 调整点的大小,可以增大点的像素大小
  711. // color: this.Cesium.Color.fromCssColorString(this.image.color)
  712. // },
  713. model: {
  714. uri: satelliteModel, // 替换为你的3D模型文件路径
  715. scale: 1.0, // 调整3D模型的缩放大小
  716. minimumPixelSize: 64 // 设置3D模型的最小像素大小,确保在视图中可见
  717. },
  718. label: {
  719. text: this.image.name,
  720. show: true,
  721. font: "18px Helvetica", // 调整标签的字体样式和大小
  722. pixelOffset: new this.Cesium.Cartesian2(0, 20) // 调整标签的像素偏移,向下偏移20像素
  723. }
  724. });
  725. this.viewer3D.entities.add({
  726. id: this.id,
  727. position: position,
  728. // point: {
  729. // pixelSize: 12, // 调整点的大小,可以增大点的像素大小
  730. // color: this.Cesium.Color.fromCssColorString(this.image.color)
  731. // },
  732. model: {
  733. uri: satelliteModel, // 替换为你的3D模型文件路径
  734. scale: 1.0, // 调整3D模型的缩放大小
  735. minimumPixelSize: 64 // 设置3D模型的最小像素大小,确保在视图中可见
  736. },
  737. label: {
  738. text: this.image.name,
  739. show: true,
  740. font: "18px Helvetica", // 调整标签的字体样式和大小
  741. pixelOffset: new this.Cesium.Cartesian2(0, 20) // 调整标签的像素偏移,向下偏移20像素
  742. }
  743. });
  744. this.id++;
  745. },
  746. markLocationbyJson(latitude, longitude,height,name,type) {
  747. const position = this.Cesium.Cartesian3.fromDegrees(longitude, latitude,height);
  748. console.log('position :>> ', position);
  749. let color = ''
  750. let modelUrl = ''
  751. if(type=='red'){
  752. color = 'Red'
  753. modelUrl= missileModel
  754. }
  755. else if(type=='blue'){
  756. color = 'Blue'
  757. modelUrl = radarModel
  758. }
  759. else if(type=='center'){
  760. color = 'Blue'
  761. modelUrl = centerModel
  762. }
  763. this.viewer2D.entities.add({
  764. id: this.id,
  765. position: position,
  766. point: {
  767. pixelSize: 12, // 调整点的大小,可以增大点的像素大小
  768. color: this.Cesium.Color.fromCssColorString(color)
  769. },
  770. // model: {
  771. // uri: modelUrl, // 替换为你的3D模型文件路径
  772. // scale: 1.0, // 调整3D模型的缩放大小
  773. // minimumPixelSize: 64 // 设置3D模型的最小像素大小,确保在视图中可见
  774. // },
  775. label: {
  776. text: type+' '+name,
  777. show: true,
  778. font: "18px Helvetica", // 调整标签的字体样式和大小
  779. pixelOffset: new this.Cesium.Cartesian2(0, 20) // 调整标签的像素偏移,向下偏移20像素
  780. }
  781. });
  782. this.viewer3D.entities.add({
  783. id: this.id,
  784. position: position,
  785. point: {
  786. pixelSize: 12, // 调整点的大小,可以增大点的像素大小
  787. color: this.Cesium.Color.fromCssColorString(color)
  788. },
  789. model: {
  790. uri: modelUrl, // 替换为你的3D模型文件路径
  791. scale: 1.0, // 调整3D模型的缩放大小
  792. minimumPixelSize: 64 // 设置3D模型的最小像素大小,确保在视图中可见
  793. },
  794. label: {
  795. text: type+' '+name,
  796. show: true,
  797. font: "18px Helvetica", // 调整标签的字体样式和大小
  798. pixelOffset: new this.Cesium.Cartesian2(0, 20) // 调整标签的像素偏移,向下偏移20像素
  799. }
  800. });
  801. this.nameIdList.push({
  802. id: this.id,
  803. name: name
  804. })
  805. this.id++;
  806. console.log('this.viewer3D.entities :>> ', this.viewer3D.entities);
  807. },
  808. // 从鼠标点击事件获取坐标
  809. getCoordinatesFromEvent(event) {
  810. let viewer = this.mousevalue === "2D" ? this.viewer2D : this.viewer3D;
  811. let clickPosition;
  812. if (this.dimension === 5 && this.mousevalue === "3D") {
  813. clickPosition = new this.Cesium.Cartesian2(event.clientX - 1080, event.clientY - 160);
  814. } else {
  815. clickPosition = new this.Cesium.Cartesian2(event.clientX - 280, event.clientY - 160);
  816. }
  817. // 获取地图上的经纬度
  818. const viewerPosition = viewer.scene.camera.pickEllipsoid(clickPosition);
  819. const cartographic = viewer.scene.globe.ellipsoid.cartesianToCartographic(viewerPosition);
  820. const latitude = this.Cesium.Math.toDegrees(cartographic.latitude);
  821. const longitude = this.Cesium.Math.toDegrees(cartographic.longitude);
  822. return {
  823. latitude,
  824. longitude
  825. };
  826. },
  827. markLine(point1, point2, color) {
  828. // 从点1和点2的WGS84坐标创建Cartesian3对象
  829. const position1 = this.Cesium.Cartesian3.fromDegrees(point1.longitude, point1.latitude, point1.height || 0);
  830. const position2 = this.Cesium.Cartesian3.fromDegrees(point2.longitude, point2.latitude, point2.height || 0);
  831. // 创建一个带有箭头图标的PolylineMaterial
  832. const material = new this.Cesium.PolylineArrowMaterialProperty(
  833. this.Cesium.Color.fromCssColorString(color || "red")
  834. );
  835. // 将点1和点2之间的连线添加到Viewer中
  836. this.viewer2D.entities.add({
  837. polyline: {
  838. positions: [position1, position2],
  839. width: 5, // 设置线的宽度
  840. material: material,
  841. followSurface: false // 设置为false,使连线保持在固定的高度,不会贴地显示
  842. }
  843. });
  844. this.viewer3D.entities.add({
  845. polyline: {
  846. positions: [position1, position2],
  847. width: 5, // 设置线的宽度
  848. material: material,
  849. followSurface: false // 设置为false,使连线保持在固定的高度,不会贴地显示
  850. }
  851. });
  852. },
  853. // 鼠标点击的事件监听
  854. pointMove() {
  855. // 监听鼠标左键点击事件
  856. this.handler2D.setInputAction((event) => {
  857. if (!this.selectedMarker && !this.modeltooltip) {
  858. const screenPosition = new this.Cesium.Cartesian2(event.position.x, event.position.y);
  859. const pickedEntity = this.viewer2D.scene.pick(screenPosition);
  860. if (this.Cesium.defined(pickedEntity)) {
  861. for (const entity of this.viewer2D.entities.values) {
  862. if (pickedEntity.id.id === entity.id) {
  863. this.selectedMarker = entity;
  864. this.oldPosition = pickedEntity.id.position;
  865. // 显示提示
  866. this.selectModel("pointer", null, "右键取消");
  867. }
  868. }
  869. }
  870. } else if (this.selectedMarker && this.modeltooltip === "右键取消") {
  871. // const material = new this.Cesium.PolylineArrowMaterialProperty(this.selectedMarker.point.color);
  872. console.log('this.viewer2D.entities.values :>> ', this.viewer2D.entities.getById(this.selectedMarker.id).position._value);
  873. let position = this.convertWorldToCartographic(this.viewer2D.entities.getById(this.selectedMarker.id).position._value)
  874. let name = ''
  875. for(let i = 0;i<this.nameIdList.length;i++){
  876. if(this.nameIdList[i].id == this.selectedMarker.id){
  877. name = this.nameIdList[i].name
  878. }
  879. }
  880. for(let i = 0;i<this.jsonData.blueunit.length;i++){
  881. if(name == this.jsonData.blueunit[i].name){
  882. this.jsonData.blueunit[i].pos.lat = position.latitude.toFixed(6)
  883. this.jsonData.blueunit[i].pos.lon = position.longitude.toFixed(6)
  884. this.jsonData.blueunit[i].pos.h = position.height.toFixed(2)
  885. }
  886. }
  887. for(let i = 0;i<this.jsonData.redunit.length;i++){
  888. if(name == this.jsonData.redunit.name){
  889. this.jsonData.redunit.component_movementjson.properties.launch_lon = position.longitude.toFixed(6)
  890. this.jsonData.redunit.component_movementjson.properties.launch_lat = position.latitude.toFixed(6)
  891. this.jsonData.redunit.component_movementjson.properties.launch_h = position.height.toFixed(2)
  892. }
  893. }
  894. for(let i = 0;i<this.jsonData.center.length;i++){
  895. if(name == this.jsonData.center[i].name){
  896. this.jsonData.center[i][name].properties.lon = position.longitude.toFixed(6)
  897. this.jsonData.center[i][name].properties.lat = position.latitude.toFixed(6)
  898. this.jsonData.center[i][name].properties.h = position.height.toFixed(2)
  899. for(let j = 0;j<this.jsonData.redunit.length;j++){
  900. this.jsonData.redunit[j].component_movementjson.properties.target_lon = position.longitude.toFixed(6)
  901. this.jsonData.redunit[j].component_movementjson.properties.target_lat = position.latitude.toFixed(6)
  902. this.jsonData.redunit[j].component_movementjson.properties.target_h = position.height.toFixed(2)
  903. }
  904. // 新的终点坐标
  905. const newEndPoint = this.Cesium.Cartesian3.fromDegrees(position.longitude, position.latitude, position.height);
  906. // 遍历所有的entity对象
  907. this.viewer2D.entities.values.forEach(entity => {
  908. // 检查entity是否为Polyline类型
  909. if (entity instanceof this.Cesium.Entity && entity.polyline) {
  910. // 获取原始的Polyline坐标数组
  911. const positions = entity.polyline.positions.getValue(); // 得到一个Cartesian3数组
  912. // 修改终点坐标为新的坐标
  913. positions[positions.length - 1] = newEndPoint;
  914. // 更新entity的Polyline坐标
  915. entity.polyline.positions = new this.Cesium.CallbackProperty(time => positions, false);
  916. }
  917. });
  918. this.viewer3D.entities.values.forEach(entity => {
  919. // 检查entity是否为Polyline类型
  920. if (entity instanceof this.Cesium.Entity && entity.polyline) {
  921. // 获取原始的Polyline坐标数组
  922. const positions = entity.polyline.positions.getValue(); // 得到一个Cartesian3数组
  923. // 修改终点坐标为新的坐标
  924. positions[positions.length - 1] = newEndPoint;
  925. // 更新entity的Polyline坐标
  926. entity.polyline.positions = new this.Cesium.CallbackProperty(time => positions, false);
  927. }
  928. });
  929. }
  930. }
  931. // this.viewer2D.entities.add({
  932. // polyline: {
  933. // positions: [
  934. // this.oldPosition._value,
  935. // this.viewer2D.entities.getById(this.selectedMarker.id).position._value
  936. // ],
  937. // width: 5, // 设置线的宽度
  938. // material: material,
  939. // followSurface: false // 设置为false,使连线保持在固定的高度,不会贴地显示
  940. // }
  941. // });
  942. // this.viewer3D.entities.add({
  943. // polyline: {
  944. // positions: [
  945. // this.oldPosition._value,
  946. // this.viewer3D.entities.getById(this.selectedMarker.id).position._value
  947. // ],
  948. // width: 5, // 设置线的宽度
  949. // material: material,
  950. // followSurface: false // 设置为false,使连线保持在固定的高度,不会贴地显示
  951. // }
  952. // });
  953. console.log('this.jsonData :>> ', this.jsonData);
  954. this.selectedMarker = null;
  955. this.selectModel();
  956. }
  957. }, this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  958. // 监听鼠标移动事件,用于移动标记点
  959. this.handler2D.setInputAction((event) => {
  960. if (this.selectedMarker && this.modeltooltip === "右键取消") {
  961. const screenPosition = new this.Cesium.Cartesian2(event.endPosition.x, event.endPosition.y);
  962. const position = this.viewer2D.scene.camera.pickEllipsoid(screenPosition);
  963. this.viewer2D.entities.getById(this.selectedMarker.id).position = position;
  964. this.viewer3D.entities.getById(this.selectedMarker.id).position = position;
  965. }
  966. }, this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  967. // 监听右键
  968. this.handler2D.setInputAction(() => {
  969. if (this.selectedMarker && this.modeltooltip === "右键取消") {
  970. this.viewer2D.entities.getById(this.selectedMarker.id).position = this.oldPosition;
  971. this.selectedMarker = null;
  972. this.selectModel();
  973. }
  974. }, this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  975. this.handler3D.setInputAction((event) => {
  976. if (!this.selectedMarker && !this.modeltooltip) {
  977. const screenPosition = new this.Cesium.Cartesian2(event.position.x, event.position.y);
  978. const pickedEntity = this.viewer3D.scene.pick(screenPosition);
  979. if (this.Cesium.defined(pickedEntity)) {
  980. for (const entity of this.viewer3D.entities.values) {
  981. if (pickedEntity.id.id === entity.id) {
  982. this.selectedMarker = entity;
  983. this.oldPosition = pickedEntity.id.position;
  984. // 显示提示
  985. this.selectModel("pointer", null, "右键取消");
  986. }
  987. }
  988. }
  989. } else if (this.selectedMarker && this.modeltooltip === "右键取消") {
  990. const material = new this.Cesium.PolylineArrowMaterialProperty(this.selectedMarker.point.color);
  991. this.viewer2D.entities.add({
  992. polyline: {
  993. positions: [
  994. this.oldPosition._value,
  995. this.viewer2D.entities.getById(this.selectedMarker.id).position._value
  996. ],
  997. width: 5, // 设置线的宽度
  998. material: material,
  999. followSurface: false // 设置为false,使连线保持在固定的高度,不会贴地显示
  1000. }
  1001. });
  1002. this.viewer3D.entities.add({
  1003. polyline: {
  1004. positions: [
  1005. this.oldPosition._value,
  1006. this.viewer3D.entities.getById(this.selectedMarker.id).position._value
  1007. ],
  1008. width: 5, // 设置线的宽度
  1009. material: material,
  1010. followSurface: false // 设置为false,使连线保持在固定的高度,不会贴地显示
  1011. }
  1012. });
  1013. this.selectedMarker = null;
  1014. this.selectModel();
  1015. }
  1016. }, this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  1017. // 监听鼠标移动事件,用于移动标记点
  1018. this.handler3D.setInputAction((event) => {
  1019. if (this.selectedMarker && this.modeltooltip === "右键取消") {
  1020. const screenPosition = new this.Cesium.Cartesian2(event.endPosition.x, event.endPosition.y);
  1021. const position = this.viewer3D.scene.camera.pickEllipsoid(screenPosition);
  1022. this.viewer2D.entities.getById(this.selectedMarker.id).position = position;
  1023. this.viewer3D.entities.getById(this.selectedMarker.id).position = position;
  1024. }
  1025. }, this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  1026. // 监听右键
  1027. this.handler3D.setInputAction(() => {
  1028. if (this.selectedMarker && this.modeltooltip === "右键取消") {
  1029. this.viewer3D.entities.getById(this.selectedMarker.id).position = this.oldPosition;
  1030. this.selectedMarker = null;
  1031. this.selectModel();
  1032. }
  1033. }, this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  1034. }
  1035. }
  1036. };
  1037. </script>
  1038. <style scoped>
  1039. ::v-deep .cesium-infoBox {
  1040. display: none !important;
  1041. }
  1042. ::v-deep .cesium-infoBox-bodyless {
  1043. display: none !important;
  1044. }
  1045. ::v-deep .cesium-infoBox-visible {
  1046. display: none !important;
  1047. }
  1048. .container{
  1049. height: 100%;
  1050. }
  1051. .modeltooltip {
  1052. position: absolute;
  1053. padding: 5px;
  1054. color: #fff;
  1055. font-size: 20px;
  1056. pointer-events: none;
  1057. z-index: 999;
  1058. }
  1059. .myHeader {
  1060. background-color: #1c222b !important;
  1061. color: #fff;
  1062. height: 100%;
  1063. display: flex;
  1064. flex-direction: row;
  1065. align-items: center;
  1066. /*由于flex-direction: column,因此align-items代表的是水平方向*/
  1067. justify-content: center;
  1068. /*由于flex-direction: column,因此justify-content代表的是垂直方向*/
  1069. }
  1070. .myHeader .el-button {
  1071. width: 100px;
  1072. height: 20px;
  1073. padding: 1px 23px;
  1074. }
  1075. .box-card {
  1076. min-height: 100%;
  1077. height: 100%;
  1078. }
  1079. ::v-deep .el-card__body {
  1080. height: 100% !important;
  1081. padding: 0px !important;
  1082. }
  1083. .main-layout {
  1084. height: 100%;
  1085. width: 100%;
  1086. }
  1087. .map {
  1088. width: 100%;
  1089. height: 100%;
  1090. }
  1091. .menu {
  1092. position: absolute;
  1093. height: 400px;
  1094. z-index: 999;
  1095. left: 20px;
  1096. top: 20px;
  1097. }
  1098. ::v-deep .el-tabs--left .el-tabs__header.is-left {
  1099. margin-right: 0px !important;
  1100. }
  1101. .buttons {
  1102. display: flex;
  1103. flex-direction: column;
  1104. align-items: center;
  1105. justify-items: center;
  1106. position: absolute;
  1107. z-index: 999;
  1108. right: 20px;
  1109. top: 20px;
  1110. }
  1111. .el-button {
  1112. margin: 5px !important;
  1113. }
  1114. ::v-deep .el-tabs--border-card>.el-tabs__content {
  1115. width: 300px;
  1116. /* display: none; */
  1117. height: 100%;
  1118. overflow-y:visible;
  1119. }
  1120. .model {
  1121. display: flex;
  1122. width: 100%;
  1123. flex-wrap: wrap;
  1124. }
  1125. .model>div {
  1126. width: 50%;
  1127. height: 120px;
  1128. padding: 5px;
  1129. }
  1130. .model>div:hover {
  1131. border: 2px solid blue;
  1132. }
  1133. .model>div:active {
  1134. border: 2px solid red;
  1135. }
  1136. .active {
  1137. border: 2px solid red !important;
  1138. }
  1139. .model .el-image {
  1140. display: block !important;
  1141. }
  1142. ::v-deep .el-image .el-image__inner {
  1143. border: 1px solid #ddd;
  1144. border-radius: 5px;
  1145. }
  1146. .item {
  1147. font-size: 14px;
  1148. /* right: 20px; */
  1149. }
  1150. </style>