123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327 |
- <template>
- <div class="box">
- <div class="overbtn" v-if="value==1">
- <div class="arrowbtn act">
- <img src="@/assets/images/up.png" @click="oarrowClick('left')" />
- </div>
- <el-carousel ref="overcardShow" height="100%" direction='vertical' :autoplay='false' indicator-position='none' arrow="never">
- <el-carousel-item v-for="(cite,cidx) in annexList">
- <div class="arrowbox" v-for="(ite,idx) in cite" :key="idx">
- <div class="adrbox " :class="annexId==ite.id?'act':''" @click="getVrFn(ite.id)">
- <div class="tit">{{ite.tit}}</div>
- </div>
- </div>
- </el-carousel-item>
- </el-carousel>
- <div class="arrowbtn">
-
- <img src="@/assets/images/down.png" @click="oarrowClick('right')" />
- </div>
- </div>
- <div class="box-content">
- <div class="pr" v-show="value==1">
- <img src="@/assets/images/centbg.png" class="centbg"/>
- <div class="boxa">
- <img src="@/assets/images/jzicoa.png" class="cira"/>
- <img src="@/assets/images/jzicob.png" class="cirb"/>
- <div class="tit">财务室红外探测器</div>
- </div>
- <div class="boxb">
- <img src="@/assets/images/jziconf.png" class="cira"/>
- <img src="@/assets/images/jzicoc.png" class="cirb"/>
- <div class="tit">2号仓库半球摄像头</div>
- </div>
- <div class="boxc">
- <img src="@/assets/images/jzicoe.png" class="cira"/>
- <div class="line"></div>
- <div class="cirbox">
- <div class="tit">2号仓库半球摄像头</div>
- <img src="@/assets/images/jzicod.png" class="cirb"/>
- </div>
- <div class="cirbox cirboxa">
- <div class="tit">2号仓库半球摄像头</div>
- <img src="@/assets/images/jzicod.png" class="cirb"/>
- </div>
- </div>
- </div>
-
- <div v-show="value==2">
- <div id="container" style="width: 711px;height: 421px">
- </div>
- </div>
-
-
- </div>
-
- <div class="chosebtn">
- <el-select v-model="value" placeholder="请选择">
- <el-option
- v-for="item in mapoptiops"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </div>
- </div>
- </template>
- <script>
- import AMapLoader from '@amap/amap-jsapi-loader'
- window._AMapSecurityConfig = {
- securityJsCode: ''
- }
-
- export default {
- props: {
- annexList: {
- type: [],
- default: []
- },
- mapoptiops:{
- type: [],
- default: []
- }
- },
- data(){
- return{
- annexId:0,
- value: '1',
- map: null,
- mapfalg:true,
-
- mapData: [
- {
- name: '水域告警',
- type:2,
- longitude: '117.211954',
- latitude: '31.839676',
- content:'SYS-463520',
- img:'https://n.sinaimg.cn/spider20220702/290/w1080h810/20220702/bdee-24bda60bf8b6cf30b658f25de78e12de.jpg'
- },
- {
- name: '正常位置',
- type:1,
- longitude: '117.210150',
- latitude: '31.839670',
- content:'好吃是好吃,吃完必上火,把子肉嘎嘎香',
- img:'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2F25fac10a-1e66-4a6d-a4a1-4bf07d2666a1%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1690684148&t=c2560eb44f5348fc210f74ccd4552555'
- }
- ],
- }
- },
- watch:{
- value(val){
- if(val==2&&this.mapfalg){
-
- this.initMap()
- this.mapfalg=false;
- }
- }
- },
- mounted() {
-
- },
- methods:{
- getVrFn(id){
- this.annexId=id
- },
- oarrowClick(val) {
- if(val === 'right') {
- this.$refs.overcardShow.next()
- } else {
- this.$refs.overcardShow.prev()
- }
- },
- initMap() {
- AMapLoader.reset()
- AMapLoader.load({
- key: "8de52b560193f01932ad997dba3e76c0",
- version: "2.0",
- plugins: ['AMap.AutoComplete', 'AMap.Marker', 'AMap.PlaceSearch', 'AMap.Geolocation'],
- }).then((AMap) => {
- console.log(AMap)
- this.map = new AMap.Map("container", {
- mapStyle: 'amap://styles/darkblue',
- viewMode: "3D",
- zoom: 17.8,
- center: [117.211954, 31.839676],
- pitch: 40,
- terrain: true,
-
- buildingAnimation: true,
- });
-
-
- this.markPoints()
- this.latitude()
- }).catch(e => {
- console.log(e);
- })
- },
-
- getCenter(){
- AMap.plugin('AMap.Geolocation', () => {
- const geolocation = new AMap.Geolocation({
- enableHighAccuracy: true,
-
- buttonOffset: new AMap.Pixel(10, 20),
- zoomToAccuracy: true
- });
-
- this.map.addControl(geolocation);
-
- geolocation.getCurrentPosition((status, result) => {
- if (status === 'complete') {
-
- const lnglat = result.position;
- console.log('当前位置:', lnglat);
-
-
-
- } else {
- console.error('定位失败:', result.message);
- }
- });
- });
- },
-
- markPoints() {
- const icon = new AMap.Icon({
- image: require('@/assets/images/gjicob.png'),
-
-
- });
- const icona = new AMap.Icon({
- image: require('@/assets/images/zcicob.png'),
-
-
- });
- this.mapData.forEach(item => {
-
- const marker = new AMap.Marker({
- position: new AMap.LngLat(item.longitude, item.latitude),
- icon: item.type==1?icona:icon,
- offset: new AMap.Pixel(-25, -10),
- });
-
- this.map.add(marker);
-
-
- marker.on('click', (e) => {
- this.setInfoWindows(e, item)
- })
- });
- },
-
- setInfoWindows(e, item) {
-
- let content = [
-
- `<div class="fixbox" style='\'padding:0px' 0px = '' 4px; \'=''><h1>${item.name}</h1>`,
- `<div class="fixtit">设备id :${item.content}</div>`,
- `<div class="fixtit">告警内容:未成年入水</div>`,
-
-
- ];
-
- let infoWindow = new AMap.InfoWindow({
-
- content: content.join(" ")
- });
-
- let dd = this.map.getCenter()
-
- dd.lat = item.latitude
- dd.lng = item.longitude
- console.log(dd)
- if(item.type==2){
- infoWindow.open(this.map, dd);
- }
- },
-
- latitude() {
- this.map.on('click', function (ev) {
-
-
- let target = ev.target;
-
- let lnglat = ev.lnglat;
-
- let pixel = ev.pixel;
-
- let type = ev.type;
- console.log(target, lnglat, pixel, type)
- });
- },
- }
-
- };
- </script>
- <style>
- .fixbox{font-size: 14px;color: #FFFFFF;line-height: 18px;padding-top: 2px;}
- .fixbox h1{font-weight: bold;font-size: 16px;color: #FFBB37;font-style: italic;line-height: 36px;margin-bottom: 4px;}
- .fixtit{font-size: 14px;color: #FFFFFF;}
- </style>
- <style lang="scss" scoped>
- ::v-deep .amap-info-sharp{display: none;}
- .flexc{display: flex;align-items: center;}
- .box{position: relative;width: 100%;height: 100%;}
- .overbtn{width: 83px;height: 112px;display: flex;flex-direction: column;align-items: center;box-sizing: border-box;position: absolute;left:16px;top:20px;z-index: 3;background-color: rgba(27,130,183,0.12);;
- .arrowbtn{width:100%;height: 28px;display: flex;align-items: center;justify-content: center;
- &.act{background-color: rgba(27,130,183,0.22);}
-
- img{width: 12px;height: 6px;}
- }
- .arrowbox{display: flex;flex-direction: column;
- &:nth-of-type(2n){background-color: rgba(27,130,183,0.22);}
- }
- ::v-deep .el-carousel{flex:1;width:82px;}
- .adrbox{position: relative;width: 100%;height: 28px;line-height: 28px;
- &.act{
- .tit{color: #99F17A;}
- }
- .tit{font-size: 14px;font-weight: 500;text-align: center;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;
- color: #B9CCDF;box-sizing: border-box;padding: 0 10px;}
- }
- }
- .chosebtn{position: absolute;right: 19px;top: 19px;}
- .box-content{width: 100%;height: 100%;display: flex;align-items: center;justify-content: center;}
- .centbg{width: 628px;height: 349px;}
- // 弹窗
- ::v-deep .amap-info-content{width:200px;height: 112px;background: url('~@/assets/images/fixedbg.png') no-repeat;background-size: 100% 100%;}
- .pr{position: relative;}
- // 建筑
- .boxa{
- position: absolute;left: 46px;top: 146px;border-top: 1px dashed #FFBA00;
- border-left: 1px dashed #FFBA00;width: 178px;height: 40px;
- .cira{position: absolute;width: 24px;height: 24px;right: -12px;top: -12px;}
- .cirb{width: 52px;height: 53px;position: absolute;bottom: -30px;left: -26px;}
- .tit{background: rgba(255, 187, 55, 0.9);font-size: 12px;padding: 3px 10px;color: #FFFFFF;position: absolute;bottom: -46px;transform: translateX(-50%);}
- }
- .boxb{
- position: absolute;right: 35px;top: 107px;border-bottom: 1px dashed #06C4AC;
- border-right: 1px dashed #06C4AC;width: 87px;height: 24px;
- .cira{position: absolute;width: 8px;height: 8px;left: -4px;bottom: -4px;}
- .cirb{width: 53px;height: 53px;position: absolute;bottom: 9px;right: -26px;}
- .tit{background: rgba(15, 232, 153, 0.5);font-size: 12px;padding: 3px 10px;color: #FFFFFF;position: absolute;bottom: 58px;transform: translateX(50%);word-break: keep-all;right: 0;}
- }
- .boxc{
- position: absolute;left: 144px;bottom: 36px;border: 1px dashed #16D0FF;border-left: none;width: 15px;height: 51px;
- .line{width: 110px;height: 1px;position: absolute;left: 15px;bottom: 26px;border-bottom:1px dashed #16D0FF ;}
- .cira{position: absolute;width: 9px;height: 9px;right: -113px;bottom: 21px;z-index: 1;}
-
- .cirbox{
- position: absolute;top: -23px;right: 0px;display: flex;align-items: center;
- &.cirboxa{top: 23px;}
- .cirb{width: 47px;height: 47px;}
- .tit{background: rgba(50, 155, 235, 0.7);font-size: 12px;padding: 3px 10px;color: #FFFFFF;word-break: keep-all;}
- }
- }
- </style>
|