index.vue 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200
  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: null,
  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. };
  114. },
  115. watch: {
  116. dimension: {
  117. handler: function (val, oldVal) {
  118. console.log(val)
  119. if (val == 2) {
  120. this.leftwidth = 24;
  121. } else if (val == 3) {
  122. this.leftwidth = 0;
  123. } else if (val == 5) {
  124. this.leftwidth = 12;
  125. }
  126. },
  127. },
  128. },
  129. created() {
  130. this.getData();
  131. },
  132. mounted() {
  133. this.cesiumInit();
  134. this.pointMove();
  135. this.startWebSocket();
  136. },
  137. beforeDestroy() {
  138. // 在组件销毁前,关闭WebSocket连接
  139. if (this.websocket && this.websocket.readyState === WebSocket.OPEN) {
  140. this.websocket.close();
  141. }
  142. },
  143. methods: {
  144. startWebSocket() {
  145. this.websocket = new WebSocket('ws://localhost:8765');
  146. this.websocket.onopen = () => {
  147. console.log('WebSocket连接已建立!');
  148. };
  149. this.websocket.onmessage = (event) => {
  150. // 处理从WebSocket服务器接收到的消息
  151. const data = JSON.parse(event.data);
  152. console.log('收到消息:', data);
  153. // 在这里处理接收到的数据,更新Vue组件的数据等操作
  154. };
  155. this.websocket.onerror = (error) => {
  156. console.error('WebSocket错误:', error);
  157. };
  158. this.websocket.onclose = () => {
  159. console.log('WebSocket连接已关闭!');
  160. };
  161. },
  162. async saveJson() {
  163. if(this.save){
  164. const jsonData = JSON.stringify(this.jsonData);
  165. const blob = new Blob([jsonData], { type: 'application/json' });
  166. const url = URL.createObjectURL(blob);
  167. const link = document.createElement('a');
  168. link.href = url;
  169. link.download = this.jsonData.xdname + '.json';
  170. document.body.appendChild(link);
  171. link.click();
  172. document.body.removeChild(link);
  173. }
  174. else{
  175. this.$message("请先导入想定文件!!!")
  176. }
  177. // await axios
  178. // .post("http://localhost:8084/admin/online/onlineOperation/updateDatasource/main", {
  179. // params: {
  180. // datasourceId: "1656243335922192384",
  181. // masterData: row,
  182. // slaveData: {}
  183. // }
  184. // })
  185. // .then((res) => {
  186. // console.log("update successfully ");
  187. // });
  188. // const requestData = row
  189. // if(this.websocket && this.websocket.readyState === WebSocket.OPEN){
  190. // this.websocket.send(JSON.stringify(requestData));
  191. // }
  192. // else{
  193. // this.startWebSocket();
  194. // setTimeout(() => {
  195. // this.websocket.send(JSON.stringify(requestData));
  196. // }, 2000);
  197. // }
  198. },
  199. changeItemPosition(data) {
  200. },
  201. async getJson(row) {
  202. let redunit = [];
  203. let blueunit = [];
  204. let satellite = [];
  205. let center = [];
  206. // let fileInfoStr = row.blueunit;
  207. // let fileInfoArr = JSON.parse(fileInfoStr);
  208. // for (let i = 0; i < fileInfoArr.length; i++) {
  209. // await axios
  210. // .get("http://localhost:8084/admin/online/onlineOperation/downloadDatasource/main", {
  211. // params: {
  212. // datasourceId: "1656243335922192384",
  213. // fieldName: "blueunit",
  214. // asImage: false,
  215. // dataId: row.id,
  216. // filename: fileInfoArr[i].filename,
  217. // Authorization: getToken(),
  218. // MenuId: "1656244747347431424"
  219. // }
  220. // })
  221. // .then((response) => {
  222. // // 处理成功的响应
  223. // blueunit.push(response.data);
  224. // })
  225. // .catch((error) => {
  226. // // 处理错误
  227. // console.error(error);
  228. // });
  229. // }
  230. // fileInfoStr = row.redunit;
  231. // fileInfoArr = JSON.parse(fileInfoStr);
  232. // for (let i = 0; i < fileInfoArr.length; i++) {
  233. // await axios
  234. // .get("http://localhost:8084/admin/online/onlineOperation/downloadDatasource/main", {
  235. // params: {
  236. // datasourceId: "1656243335922192384",
  237. // fieldName: "redunit",
  238. // asImage: false,
  239. // dataId: row.id,
  240. // filename: fileInfoArr[i].filename,
  241. // Authorization: getToken(),
  242. // MenuId: "1656244747347431424"
  243. // }
  244. // })
  245. // .then((response) => {
  246. // // 处理成功的响应
  247. // redunit.push(response.data);
  248. // })
  249. // .catch((error) => {
  250. // // 处理错误
  251. // console.error(error);
  252. // });
  253. // }
  254. // fileInfoStr = row.center;
  255. // fileInfoArr = JSON.parse(fileInfoStr);
  256. // for (let i = 0; i < fileInfoArr.length; i++) {
  257. // await axios
  258. // .get("http://localhost:8084/admin/online/onlineOperation/downloadDatasource/main", {
  259. // params: {
  260. // datasourceId: "1656243335922192384",
  261. // fieldName: "center",
  262. // asImage: false,
  263. // dataId: row.id,
  264. // filename: fileInfoArr[i].filename,
  265. // Authorization: getToken(),
  266. // MenuId: "1656244747347431424"
  267. // }
  268. // })
  269. // .then((response) => {
  270. // // 处理成功的响应
  271. // center.push(response.data);
  272. // })
  273. // .catch((error) => {
  274. // // 处理错误
  275. // console.error(error);
  276. // });
  277. // }
  278. // fileInfoStr = row.satellite;
  279. // fileInfoArr = JSON.parse(fileInfoStr);
  280. // for (let i = 0; i < fileInfoArr.length; i++) {
  281. // await axios
  282. // .get("http://localhost:8084/admin/online/onlineOperation/downloadDatasource/main", {
  283. // params: {
  284. // datasourceId: "1656243335922192384",
  285. // fieldName: "satellite",
  286. // asImage: false,
  287. // dataId: row.id,
  288. // filename: fileInfoArr[i].filename,
  289. // Authorization: getToken(),
  290. // MenuId: "1656244747347431424"
  291. // }
  292. // })
  293. // .then((response) => {
  294. // // 处理成功的响应
  295. // satellite.push(response.data);
  296. // })
  297. // .catch((error) => {
  298. // // 处理错误
  299. // console.error(error);
  300. // });
  301. // }
  302. // const jsonData = {}
  303. // id: row.id,
  304. // xdname: row.xdname,
  305. // type: row.type,
  306. // creator: row.creator,
  307. // createtime: row.createtime,
  308. // bluecnt: row.bluecnt,
  309. // target: row.target,
  310. // starttime: row.starttime,
  311. // steptime: row.steptime,
  312. // blueunit: blueunit,
  313. // redunit: redunit,
  314. // satellite: satellite,
  315. // center: center
  316. // };
  317. let fileInfoStr = row.xdfile;
  318. let fileInfoArr = JSON.parse(fileInfoStr);
  319. await axios
  320. .get("http://localhost:8084/admin/online/onlineOperation/downloadDatasource/main", {
  321. params: {
  322. datasourceId: "1656243335922192384",
  323. fieldName: "xdfile",
  324. asImage: false,
  325. dataId: row.id,
  326. filename: fileInfoArr[0].filename,
  327. Authorization: getToken(),
  328. MenuId: "1656244747347431424"
  329. }
  330. })
  331. .then((response) => {
  332. console.log('response.data :>> ', response.data);
  333. // // 处理成功的响应
  334. // jsonData = response.data
  335. blueunit = response.data.blueunit
  336. redunit = response.data.redunit
  337. satellite = response.data.satellite
  338. center = response.data.center
  339. this.save = true
  340. this.jsonData = {
  341. id: row.id,
  342. xdname: row.xdname,
  343. type: row.type,
  344. creator: row.creator,
  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. }
  1118. .model {
  1119. display: flex;
  1120. width: 100%;
  1121. flex-wrap: wrap;
  1122. }
  1123. .model>div {
  1124. width: 50%;
  1125. height: 120px;
  1126. padding: 5px;
  1127. }
  1128. .model>div:hover {
  1129. border: 2px solid blue;
  1130. }
  1131. .model>div:active {
  1132. border: 2px solid red;
  1133. }
  1134. .active {
  1135. border: 2px solid red !important;
  1136. }
  1137. .model .el-image {
  1138. display: block !important;
  1139. }
  1140. ::v-deep .el-image .el-image__inner {
  1141. border: 1px solid #ddd;
  1142. border-radius: 5px;
  1143. }
  1144. .item {
  1145. font-size: 14px;
  1146. /* right: 20px; */
  1147. }
  1148. </style>