| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131 |
- <template>
- <div id="mapToolBarContainer_hhjc">
- <div id="mapTopToolBar">
- <div style="padding-left: 10px;display: flex;flex-direction: row;justify-content: space-between;align-items: center;">
- <!-- <p style="margin-left:0%;margin-right:10px;display:inline;color:rgb(129, 131, 135);">
- 导航:
- </p> -->
- <img src="../assets/qg.png" style="width: 14px;">
- <el-button @click="showPanel('navi')" style="border-radius: 5px;padding: 5px 5px;color:#2C9EFF;margin-left: 5px;border: 0px;" size="medium ">
- {{currentStatus.currentTitle}}
- <i :class="this.showXzqPanel ?'el-icon-arrow-up':'el-icon-arrow-down'"></i>
- </el-button>
- </div>
- <div style="width: 1px;height: 10px;background: rgb(190, 190, 190);margin-left: 10px;margin-right: 10px;"></div>
- <div style="display: flex;flex-direction: row;justify-content: space-between;align-items: center;">
- <img src="../assets/tool1.png" style="width: 14px;">
- <el-button @click="showToolPanelHandler()" style="border-radius: 5px;padding: 5px 5px;color:#2C9EFF;margin-left: 5px;border: 0px;" size="medium ">
- 工具箱
- <i :class="this.showToolPanel ?'el-icon-arrow-up':'el-icon-arrow-down'"></i>
- </el-button>
- </div>
- <div style="width: 1px;height: 10px;background: rgb(190, 190, 190);margin-left: 10px;margin-right: 10px;"></div>
- <!-- <div style="width: 70px;margin-left:40px;display: flex;flex-direction: row;justify-content: space-between;align-items: center;">
- <p style="margin-left:0%;margin-right:10px;display:inline;color:rgb(129, 131, 135);">
- <i class="el-icon-location"></i>地图工具:
- </p>
- <img src="../assets/distance.png" class="imgClass" title="测距" @click="mapToolHandler('distance')">
- <img src="../assets/area.png" class="imgClass" title="测面" @click="mapToolHandler('area')">
- <img src="../assets/clear.png" class="imgClass" title="清除" @click="mapToolHandler('clear')">
- </div> -->
- </div>
- <div class="xzqPanelClass">
- <div v-if="showXzqPanel" style="width: 314px;background: white;">
- <div style="min-height:30px;display:flex;flex-direction:row;justify-content:space-between;align-items:center;border-bottom:1px solid rgb(240,240,240)">
- <div style="display:flex;flex-direction:row;">
- <p style="font-size:14px;margin-left:10px;padding-top: 5px;color:rgb(173,177,192)">当前:</p>
- <p class="naviClickableLink" v-for="(step,index) in naviStateStack" :key="index" @click="backToStep(step)" style="color:#2C9EFF;font-size:14px;padding-left:5px;">{{step.title}}</p>
- </div>
- <!-- <div style="display:flex;flex-direction:row;padding-right: 5px;cursor: pointer;">
- <span class="el-icon-circle-close-outline" @click="closeNavigationPanel"></span>
- </div> -->
- </div>
- <div style="display:flex;flex-direction:row;margin-top:5px;">
- <p style="font-size:small;color:rgb(173,177,192);margin-left:10px;">行政区列表:</p>
- </div>
- <div style="display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:wrap;border-bottom:1px solid rgb(240,240,240);max-height:300px;overflow:auto;">
- <p class="naviClickableLink" style="flex-shrink:1;flex-grow:0;color:#2C9EFF;" v-for="nextxzq in nextLevelXzq" :key="nextxzq.adCode" @click="clickAd(nextxzq)">{{nextxzq.adName}}</p>
- </div>
- </div>
- </div>
- <div class="toolPanelClass">
- <div v-if=showToolPanel>
- <transition name="el-zoom-in-top">
- <ul role="menu" id="cascader-menu-1602" class="mapRightMenu" style="margin-left: 118px;width: 80px;">
- <li tabindex="-1" role="menuitem" aria-haspopup="true" aria-owns="menu-8696-1"
- class="menuItem" @click="click('fullExtent')">
- <img src="../assets/fullExtent.png" alt="" style="height:17px;margin-right:5px;">
- <p class="pClass">全图</p>
- </li>
- <li tabindex="-1" role="menuitem" aria-haspopup="true" aria-owns="menu-8696-1"
- class="menuItem" @click="click('biaoji')">
- <img src="../assets/bjR.png" alt="" style="height:17px;margin-right: 9px;margin-left: 5px;">
- <p class="pClass">标记</p>
- </li>
- <!-- <li tabindex="-1" role="menuitem" aria-haspopup="true" aria-owns="menu-8696-1"
- class="menuItem" @click="click('jietu')">
- <img src="../assets/bjR.png" alt="" style="height:17px;margin-right: 9px;margin-left: 5px;">
- <p class="pClass">截图</p>
- </li> -->
- <li tabindex="-1" role="menuitem" aria-haspopup="true" aria-owns="menu-8696-1"
- class="menuItem" @click="click('lushu')">
- <img src="../assets/location.png" alt="" style="height:17px;margin-right: 5px;">
- <p class="pClass">路书</p>
- </li>
- <li tabindex="-1" role="menuitem" aria-haspopup="true" aria-owns="menu-8696-1"
- class="menuItem" @click="click('daohang')">
- <img src="../assets/daohang1.png" alt="" style="height:17px;margin-right:5px;">
- <p class="pClass">导航</p>
- </li>
- <li tabindex="-1" role="menuitem" aria-haspopup="true" aria-owns="menu-8696-1"
- class="menuItem" @click="click('chaxun')">
- <img src="../assets/chaxun.png" alt="" style="height:17px;margin-right:5px;">
- <p class="pClass">查询</p>
- </li>
- <li tabindex="-1" role="menuitem" aria-haspopup="true" aria-owns="menu-8696-1"
- class="menuItem" @click="click('measureDistance')">
- <img src="../assets/distance.png" alt="" style="height:17px;margin-right:5px;">
- <p class="pClass">测距</p>
- </li>
- <li tabindex="-1" role="menuitem" aria-haspopup="true" aria-owns="menu-8696-1"
- class="menuItem" @click="click('measureArea')">
- <img src="../assets/area.png" alt="" style="height:17px;margin-right:5px;">
- <p class="pClass">测面</p>
- </li>
- <li tabindex="-1" role="menuitem" aria-haspopup="true" aria-owns="menu-8696-1"
- class="menuItem" @click="click('clear')">
- <img src="../assets/clear.png" alt="" style="height:17px;margin-right:5px;">
- <p class="pClass">清除</p>
- </li>
- </ul>
- </transition>
- </div>
- </div>
- <div id="daohangContainer" class="daohangContainerClass" v-if="showDaoHangPanel">
- <div style="height:30px;float:right;">
- <i class="el-icon-close" @click="closeDaoHangPanel" style="padding-right: 5px;color: #dbdbdb;cursor:pointer;"></i>
- <!-- <ul class="tabs dir_tab col3 z-depth-1 clearfix" id="trafficTab"> -->
- <!-- <li :class="{'trafficActivity':showDaoHanButton=='car'}" style="display: flex;align-items: center;justify-content: center;">
- <img src="../assets/car.png" alt="" @click="chooseTraffic('car')" style="height:19px;width:19px;cursor:pointer;">
- </li> -->
- <!-- <li :class="{'trafficActivity':showDaoHanButton=='bus'}" style="display: flex;align-items: center;justify-content: center;">
- <img src="../assets/bus.png" alt="" @click="chooseTraffic('bus')" style="height:20px;width:19px;cursor:pointer;">
- </li>
- <li :class="{'trafficActivity':showDaoHanButton=='walk'}" style="display: flex;align-items: center;justify-content: center;">
- <img src="../assets/walk.png" alt="" @click="chooseTraffic('walk')" style="height:19px;width:24px;cursor:pointer;">
- </li> -->
- <!-- </ul> -->
- </div>
- <div style="display: flex;width: 100%;align-items: center;padding-top: 10px;">
- <div>
- <img src="../assets/jiaohuan.png" alt="" @click="startChangeEndHandler" style="height:40px;width:40px;cursor:pointer;">
- </div>
- <div>
- <el-input placeholder="请输入起点" v-model="startText" clearable @focus="startFocusHandler"
- style="padding-bottom: 5px;width: 250px;height: 35px;"></el-input>
- <el-input placeholder="请输入终点" v-model="endText" clearable @focus="endFocusHandler"
- style="padding-bottom: 5px;width: 250px;height: 35px;"></el-input>
- </div>
- </div>
- <div style="float: right;padding-top: 10px;padding-right: 30px;">
- <el-button type="primary" v-show="showDaoHanButton == 'car'" @click="trafficButtonClick('car')" size="mini">导航</el-button>
- <el-button type="primary" v-show="showDaoHanButton == 'bus'" @click="trafficButtonClick('bus')" size="mini">公交</el-button>
- <el-button type="primary" v-show="showDaoHanButton == 'walk'" @click="trafficButtonClick('walk')" size="mini">步行</el-button>
- </div>
- </div>
- <div id="poiContainer" class="poiClass" v-if="showPoiList">
- <div class="poiListClass" v-for="(item,index) in pois" :key="index" @click="poiListClick(item)">
- <span style="color: blue;">{{item.name}}</span>
- <!-- <span style="font-size: small;color: #aaaaaa;padding-left: 10px;">{{item.cityname}}{{item.adname}}</span> -->
- <span style="font-size: small;color: #aaaaaa;padding-left: 10px;">{{item.district}}</span>
- </div>
- </div>
- <div id="stepContainer" class="stepClass" v-if="showStepPanel">
- <div style="display:flex;justify-content: space-around;">
- <div style="padding: 5px;padding-top: 10px;">
- <span>约</span>
- <span style="color:blue;">{{(trafficSteps.duration/3600).toFixed(1)}}</span>
- <span>个小时</span>
- </div>
- <div style="margin-top: 13px;width: 2px;height: 15px;background: #000;"></div>
- <div style="padding: 5px;padding-top: 10px;">
- <span style="color:blue;">{{(trafficSteps.distance/1000).toFixed(1)}}</span>
- <span>公里</span>
- </div>
- <!-- <div style="margin-top: 13px;width: 1.5px;height: 15px;background: #000;"></div>
- <div style="padding: 5px;padding-top: 10px;">
- <span>红绿灯</span>
- <span style="color:red;">{{trafficSteps.traffic_lights}}</span>
- <span>个</span>
- </div> -->
- </div>
- <div style="padding-left: 20px;">
- <el-collapse accordion>
- <el-collapse-item v-for="(item,index) in trafficSteps.steps" :key="index">
- <template slot="title">
- {{typeof(item.road) == "undefined"?"无名路":item.road}}<span style="padding-left: 20px;color: #938f8f;">{{(item.distance/1000).toFixed(1)}}km</span>
- </template>
- <div style="cursor:pointer;" @click="detailRouteOnMap(item)">{{item.instruction}}</div>
- </el-collapse-item>
- </el-collapse>
- </div>
- </div>
- <div id="biaojiContainer" class="stepClass" v-if="showBiaoJiPanel">
- <div style="padding-left: 20px;">
- <el-collapse accordion>
- <el-collapse-item v-for="(item,index) in tableResultData" :key="index">
- <template slot="title">
- {{item.inteName}}
- </template>
- <div style="cursor:pointer;" @click="clickBiaoJiHandler(item)">{{item.des}}</div>
- </el-collapse-item>
- </el-collapse>
- </div>
- </div>
- <!-- 路书列表 -->
- <div id="luShuListContainer" v-if="showLushuList" style="position: fixed;left: 50px;top: 100px;
- height: 80%;width: 360px;background: #ffffffcc;">
- <div style="height: 30px;background: rgba(0, 126, 246, 0.76);display: flex;justify-content: space-between;
- align-items: center;">
- <p style="color: #fff3f3;padding-left: 5px;">路书列表</p>
- <i @click="closeLushu" style="color: white;padding-right: 5px;cursor: pointer;" class="el-icon-close"></i>
- </div>
- <el-tabs v-model="curRoadbook" @tab-click="roadbookChange" :stretch="true">
- <el-tab-pane label="我的路书" name="first">
- <div :style="{'height':lushuHeight+'px'}" style="overflow-y: auto;">
- <div @click="showLushuDetailFun(item)" v-for="(item,index) in lushuList" :key="index" style="display: flex;border: 1px dashed rgb(0, 156, 250);margin: 5px;cursor: pointer;">
- <div style="width: 90px;height: 90px;background: #4993fc;margin: 5px;display: flex;align-items: baseline;justify-content: center;">
- <p style="font-size: 50px;color: white;padding-top: 10px;">{{item.dayCount}}</p>
- <p style="color: white;">天</p>
- </div>
- <div style="width:200px;display: flex;flex-direction: column;justify-content: space-around;">
- <p style="color: #565151;">{{item.title}}<span style="margin-left: 20px;color: #4295df;font-size:12px;cursor:pointer" @click.stop="connectToPlan(item)">关联到计划</span></p>
- <p style="color: #4295df;">{{item.pass}}</p>
- <div style="justify-content: space-between;display:flex;">
- <p style="min-width: 146px;color: #aaa2a2;font-size: 12px;">{{dateFormate(item.sttm)}} / {{dateFormate(item.entm)}}</p>
- <el-tooltip class="item" effect="light" content="收藏" placement="top" v-if="item.isCollect == '0'">
- <i class="el-icon-star-off" style="padding:0 5px;" @click.stop="collectRoadbook(item)"></i>
- </el-tooltip>
- <!-- <el-tooltip class="item" effect="light" content="取消收藏" placement="top" v-else> -->
- <i class="el-icon-star-on" style="padding:0 5px;color: #0094fd;" @click.stop="cancelCollect(item)"></i>
- <!-- </el-tooltip> -->
- <el-tooltip class="item" effect="light" content="删除" placement="top">
- <i class="el-icon-delete" style="padding-right: 5px;" @click.stop="deleteLuShuFun(item)"></i>
- </el-tooltip>
- <el-tooltip class="item" effect="light" content="下载" placement="top">
- <i class="el-icon-download" style="padding-right: 5px;" @click.stop="downloadLuShuFun(item)"></i>
- </el-tooltip>
- </div>
- </div>
- </div>
- </div>
- <div style="height:80px;display: flex;justify-content: center;">
- <div @click="addLushu" style="width: 95%;height: 100%;align-items: center;display: flex;cursor:pointer;
- justify-content: center;flex-direction: column;border: 1px dashed #009cfa;">
- <i class="el-icon-plus"></i>
- <p>添加路书</p>
- </div>
- </div>
- </el-tab-pane>
- <el-tab-pane label="分享给我的路书" name="second">
- <div :style="{'height':lushuHeight+'px'}" style="overflow-y: auto;">
- <div @click="showLushuDetailFun(item)" v-for="(item,index) in lushuShareList" :key="index" style="display: flex;border: 1px dashed rgb(0, 156, 250);margin: 5px;cursor: pointer;">
- <div style="width: 90px;height: 90px;background: #4993fc;margin: 5px;display: flex;align-items: baseline;justify-content: center;">
- <p style="font-size: 50px;color: white;padding-top: 10px;">{{item.dayCount}}</p>
- <p style="color: white;">天</p>
- </div>
- <div style="width:200px;display: flex;flex-direction: column;justify-content: space-around;">
- <p style="color: #565151;">{{item.travelPlanTitle}}</p>
- <p style="color: #4295df;">{{item.pass}}</p>
- <div style="justify-content: space-between;display:flex;">
- <p style="color: #aaa2a2;font-size: 12px;">{{item.stDate}} / {{item.enDate}}</p>
- </div>
- </div>
- </div>
- </div>
- </el-tab-pane>
- </el-tabs>
- </div>
- <!-- 路书详情 -->
- <div id="luShuListContainer" v-if="showLushuDetail" style="position: fixed;left: 50px;top: 100px;
- height: 80%;width: 360px;background: #ffffffcc;">
- <div style="height: 100px;background: #22bdac;display: flex;justify-content: space-between;">
- <i @click="lushuBackFun" style="color: white;padding: 10px;cursor: pointer;" class="el-icon-back"></i>
- <div style="padding: 10px;text-align:center;">
- <p style="color:white;font-size:20px;">{{this.currentLushuBaseInfo.title}}</p>
- <p style="color: #000;font-size: 12px;">{{dateFormate(this.currentLushuBaseInfo.sttm)}} / {{dateFormate(this.currentLushuBaseInfo.entm)}}</p>
- </div>
- <div>
- <el-tooltip class="item" effect="light" content="编辑" placement="top" v-if="onlyView">
- <i @click="editLushu" style="color: white;padding: 10px;cursor: pointer;" class="el-icon-edit"></i>
- </el-tooltip>
- <el-tooltip class="item" effect="light" content="分享" placement="top">
- <i @click="shareRoadbook('checkbox')" style="color: white;padding: 10px;cursor: pointer;" class="el-icon-share"></i>
- </el-tooltip>
- </div>
- </div>
- <div :style="{'height':lushuDetailHeight+'px'}" style="overflow-y: auto;">
- <el-collapse v-model="activeNames" accordion @change="lushuDayChangeFun">
- <el-collapse-item v-for="(item,index) in lushuDayList" :key="index" :name="(index+1).toString()">
- <template slot="title" style="">
- <div id="dd" style="display: flex;justify-content: space-between;width: 100%;align-items: center;">
- <p style="padding-left:5px;font-size:16px;">第{{index+1}}天</p>
- <div>
- <p style="color: #4295df;"><i class="el-icon-location-information" style="padding-right: 5px;"></i>{{item.title}}</p>
- </div>
- <el-tooltip class="item" effect="light" content="删除" placement="top">
- <i @click="deleteDayFun(item)" class="el-icon-delete" style="padding-right: 5px;"></i>
- </el-tooltip>
- </div>
- </template>
- <div id="timeLineContainer" style="border: 1px solid rgb(205, 205, 205);background: #eaf7f6;padding: 10px;">
- <el-timeline>
- <el-timeline-item v-for="(obj, index1) in lushuDayDetailList" :key="index1"
- color="#4295df" size="large" timestamp="">
- <div style="justify-content: space-between;display: flex;">
- {{index1+1}}.{{obj.name}}
- <span style="font-size:12px;color:#333;" v-if="obj.sttm && obj.entm">{{obj.sttm | timeFilter}} -{{obj.entm | timeFilter}}</span>
- <el-tooltip class="item" effect="light" content="删除" placement="top">
- <i class="el-icon-close" style="cursor:pointer;" @click="deletePointFun(obj,index1)"></i>
- </el-tooltip>
- </div>
- <div v-if="obj.distance" @mouseover="showTwoPointRouteOnMap(obj)" @mouseout="clearLayer" style="padding-left: 20px;padding-top: 10px;display: flex;
- justify-content: space-between;width: 180px;align-items: center;">
- <img style="width: 16px;height: 16px;" src="../assets/car.png" alt="">
- <p style="color: #4295df;font-size: 12px;">{{obj.distance>1000?(obj.distance/1000).toFixed(2)+'公里':obj.distance+'米'}}</p>
- <p style="color: #4295df;font-size: 12px;">{{'约'+(obj.consuming/3600).toFixed(1)+'小时'}}</p>
- </div>
- </el-timeline-item>
- <el-timeline-item color="#4295df" size="large" timestamp="">
- <div style="display: flex;height: 100%;align-items: center;cursor:pointer;
- font-size: 14px;color: #4295df;" @click="showSearchWidgetFun">
- <i class="el-icon-search"></i>
- <p>搜索添加新的目的地</p>
- </div>
- </el-timeline-item>
- </el-timeline>
- <!-- <div style="display: flex;height: 100%;align-items: center;cursor:pointer;
- justify-content: center;font-size: 14px;color: #4295df;" @click="showSearchWidgetFun(obj)">
- <i class="el-icon-search"></i>
- <p>搜索添加新的目的地</p>
- </div> -->
- </div>
- </el-collapse-item>
- </el-collapse>
- </div>
- <div style="height:35px;display: flex;justify-content: center;">
- <div @click="addDayToLushuFun" style="width: 95%;height: 100%;align-items: center;display: flex;cursor:pointer;
- justify-content: center;flex-direction: row;border: 1px dashed #009cfa;">
- <i class="el-icon-plus"></i>
- <p>添加一天</p>
- </div>
- </div>
- </div>
- <!-- 添加路书 -->
- <el-dialog title="添加路书" :visible.sync="showAddLushuDialog" width="30%" :modal-append-to-body="false">
- <el-form :model="form">
- <el-form-item label="路书名称:" :label-width="formLabelWidth">
- <el-input v-model="lushuName" autocomplete="off" style="width:220px;"></el-input>
- </el-form-item>
- <el-form-item label="出发时间:" :label-width="formLabelWidth">
- <el-date-picker v-model="lushuDate" type="date" placeholder="选择出发日期" value-format="yyyy-MM-dd"></el-date-picker>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="showAddLushuDialog = false">取 消</el-button>
- <el-button type="primary" @click="addLushuHandlerFun">确 定</el-button>
- </div>
- </el-dialog>
- <!-- 编辑路书 -->
- <el-dialog title="编辑路书" :visible.sync="showEditLushuDialog" width="30%" :modal-append-to-body="false">
- <el-form :model="form">
- <el-form-item label="路书名称:" :label-width="formLabelWidth">
- <el-input v-model="lushuName_edit" autocomplete="off" style="width:220px;"></el-input>
- </el-form-item>
- <el-form-item label="出发时间:" :label-width="formLabelWidth">
- <el-date-picker v-model="lushuDate_edit" type="date" placeholder="选择出发日期" value-format="yyyy-MM-dd"></el-date-picker>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="showEditLushuDialog = false">取 消</el-button>
- <el-button type="primary" @click="editLushuHandlerFun">确 定</el-button>
- </div>
- </el-dialog>
- <div id="searchWidgetContainer" v-if="showSearchWidget" style="position: fixed;left: 412px;top: 100px;">
- <el-input placeholder="请输入内容" v-model="searchWidgetInput" clearable class="input-with-select" size="medium">
- <!-- <i slot="append" style="cursor:pointer;" class="el-icon-search"></i> -->
- <i slot="append" style="cursor:pointer;" class="el-icon-close" @click="closeSearchWidgetFun"></i>
- </el-input>
- <div id="lushuPoiContainer" style="background-color: #ffffff;margin-top: 5px;" v-if="showLushuPoiList">
- <div class="poiListClass" style="cursor:pointer;" v-for="(item,index) in lushuPois" :key="index" @click="showLushuPoiDetailFun(item)">
- <i class="el-icon-location-outline"></i>
- <span style="color: #4295df;">{{item.name}}</span>
- <!-- <span style="font-size: small;color: #aaaaaa;padding-left: 10px;">{{item.cityname}}{{item.adname}}</span> -->
- <span style="font-size: small;color: #aaaaaa;padding-left: 10px;">{{item.district}}</span>
- </div>
- </div>
- <div id="lushuPoiDetailContainer" style="background-color: #ffffff;margin-top: 5px;display: flex;
- width: 350px;justify-content: space-between;" v-if="showLushuPoiDetail">
- <div style="width: 84px;height: 84px;padding: 15px;">
- <img v-if="lushuPoiDetail.photos.length>0" :src="lushuPoiDetail.photos[0].url" alt="" style="width: 100%;height: 100%;">
- </div>
- <div style="width: 186px;">
- <p style="padding-top: 15px;">1.{{lushuPoiDetail.name}}</p>
- <p style="padding: 5px;color: #b8b2b2;font-size: 14px;">{{lushuPoiDetail.address}}</p>
- </div>
- <div style="width: 50px;align-items: center;display: flex;justify-content: center;">
- <!-- <el-button @click="addPoiToLushuDayFun" style="color:white;" size='mini' icon="el-icon-plus"></el-button> -->
- <el-button @click="showTimeSelectDialog(false)" style="color:white;" size='mini' icon="el-icon-plus"></el-button>
- </div>
- </div>
- </div>
- <el-dialog
- title="填写行程时间和备注"
- :visible.sync="journeyTimeDialog"
- append-to-body
- top="25vh"
- width="40%">
- <el-form ref="form" label-width="120px">
- <el-form-item label="行程时间">
- <el-time-picker
- is-range
- v-model="journeyTime"
- range-separator="至"
- value-format="yyyy-MM-dd HH:mm:ss"
- start-placeholder="开始时间"
- end-placeholder="结束时间"
- placeholder="选择时间范围">
- </el-time-picker>
- </el-form-item>
- <el-form-item label="备注">
- <el-input type="textarea" v-model="roadbookNote"></el-input>
- </el-form-item>
- </el-form>
- <span slot="footer" class="dialog-footer">
- <el-button @click="journeyTimeDialog = false">取 消</el-button>
- <el-button type="primary" @click="addPoiToLushuDayFun">确 定</el-button>
- </span>
- </el-dialog>
- <!-- 关联到督查计划弹窗 -->
- <own-all-groups :roadbookId="roadbookId" v-if="showGroupsDialog" @closeGroupsDialog="showGroupsDialog = false"></own-all-groups>
- <!-- 通过机构筛选人员 人员单选时 memberType == 'radio' 多选时 memberType == 'checkbox'-->
- <organ-member v-if="chooseMemberShowOrgan && (orgId == '027' || orgId == '029')" :members="allInfo" :type="memberType" :title="'选择分享人员'" @sendPersonInfoOrgan="sendPersonInfoOrgan" @closeMember="closeMemberOrgan"></organ-member>
- <organ-member-organ v-if="chooseMemberShowOrgan && orgId != '027' && orgId != '029'" :members="allInfo" :type="memberType" :title="'选择分享人员'" @sendPersonInfoOrgan="sendPersonInfoOrgan" @closeMember="closeMemberOrgan"></organ-member-organ>
- </div>
- </template>
- <script>
- import {mapExtent} from '../config/lyrConfig.js'
- import { getAdData,getCurrentAdData} from "../../../api/duChaAPI.js";
- import {getMyBiaoJi,getLushuList,addLushuHandler,deleteLushuHandler,getLushuDetail,shareRoadbookHandler,getShareLushuList,collectRoadbookHandler,editLushuHandler,getLushuDayList,
- addPointToDay,addDayToLushu,getPointByDayId,deletePoint,updatePoint,deleteDay,downloadRoadbook} from '../../../api/zhxxAPI.js'
- import {_longLatTransform} from '../js/mercatorToLngLat'
- import request from "../../../utils/gw_ajax_request.js"
- import {dateFormat} from "../../../utils/gw_date.js"
- import ownAllGroups from "../components/ownAllGroups.vue"
- import organMemberOrgan from "../../xiTongGuanLi/Conference/organMemberForOrgan.vue"
- import axios from 'axios'
- import {mapConfig} from '../config/mapConfig.js'
- export default {
- components: {
- ownAllGroups,
- organMemberOrgan
- },
- props:['view','map','fullExtent'],
- data () {
- return {
- curRoadbook: 'first', //当前为我的路书列表 还是 分享给我的路书列表
- lushuShareList: [], //分享到我的路书列表
- showGroupsDialog: '',
- roadbookNote:'',
- journeyTimeDialog: false, //行程时间选择弹窗是否显示
- journeyTime: '', //行程时间
- form:{},
- formLabelWidth:'180px',
- currentCityCode:'',//当前城市编码
- currentText:'',//当前输入的是 起点还是终点
- currentStartLocation:'',//起点经纬度 字符串
- currentEndLocation:'',//终点经纬度
- showDaoHangPanel:false,
- showDaoHanButton:'car',
- allInfo: [],
- startText:'',
- endText:'',
- currentStatus:{
- currentType:'global',
- currentTitle:'全国',
- currentCode:'000000000000',
- },
- naviStateStack:[{title:'全国',type:'global',code:'000000000000'}],
- currentAdCode:'',
- currentAdName:'',
- nextLevelXzq:[],
- showXzqPanel:false,
- showToolPanel:false,
- viewObject:null,
- mapObject:null,
- fullExtent1:null,
- measureGraphicLayer:null,
- measureLengthGraphicLayer_lable:null,
- draw:null,//测量对象
- helpTooltipElement:null,
- measureTooltipElement:null,
- continuePolygonMsg: 'Click to continue drawing the polygon',
- continueLineMsg :'Click to continue drawing the line',
- sketch:null,
- helpTooltip:null,
- measureTooltip:null,
- pois:[],
- showPoiList:false,
- trafficSteps:{},//交通路线
- showStepPanel:false,
- showBiaoJiPanel:false,//标记list
- tableResultData:[],//标记列表
- currentFocus:'',//当前focus位置 起点还是终点
- lushuList:[],//路书列表
- showLushuList:false,//显示路书列表
- lushuHeight:window.innerHeight * 0.8 - 170,
- lushuDetailHeight:window.innerHeight * 0.8 - 140,
- showAddLushuDialog:false,//显示添加路书对话框
- lushuDate:'',//新建路书 出发时间
- lushuName:'',//新建路书 名称
- showLushuDetail:false,//显示路书详情
- currentLushuBaseInfo:{},//当前路书基本信息
- showEditLushuDialog:false,//显示编辑路书对话框
- lushuName_edit:'',
- lushuDate_edit:'',
- lushuDayList:[],//路书日程列表
- activeNames:'1',
- lushuDayDetailList:[],//路书单日行程列表
- showSearchWidget:false,
- searchWidgetInput:'',
- showLushuPoiList:false,//显示路书POI列表
- lushuPois:[],//路书POI列表
- showLushuPoiDetail:false,//显示路书单个POI详情
- lushuPoiDetail:{},//路书POI详情对象 通过高德接口获取
- currentOpenLushuDay:{},//当前打开的路书当中的某一天
- firstLoad: true,
- roadbookId: '',
- memberType: 'checkbox',
- // 路书分享人员选择
- chooseMemberShowOrgan: false,
- }
- },
- computed:{
- userId: function () {
- return localStorage.getItem("userid") ?localStorage.getItem("userid") : "1098101939614724096";
- },
- onlyView(){
- return this.curRoadbook == 'first' ? true : false
- }
- },
- mounted:function() {
- this.currentAdCode = localStorage.getItem('areacode') ? localStorage.getItem('areacode') : '000000000000';
- this.currentAdName = localStorage.getItem('areaname') ? localStorage.getItem('areaname') : '全国';
- if(this.currentAdCode == "undefined"){
- this.currentAdCode = '000000000000';
- }
- this.currentStatus.currentCode = localStorage.getItem('currentRlcode') ? localStorage.getItem('currentRlcode') : '000000000000';
- this.currentStatus.currentTitle = localStorage.getItem('currentOrgNm') ? localStorage.getItem('currentOrgNm') : '全国';
- this.getAdData();
- this.mapObject = this.map;
- this.startText = '';
- this.endText = '';
- },
- watch: {
- map(n,o){
- this.mapObject = n;
- },
- fullExtent(n,o){
- this.fullExtent1 = n;
- },
- startText(n,o){
- this.inputChange(n,'start')
- },
- endText(n,o){
- this.inputChange(n,'end')
- },
- searchWidgetInput(n,o){
- this.searchWidgetInputChange(n);
- }
- },
- methods: {
- dateFormate(d){
- if(d!=null && d!=""){
- var date = new Date(d);
- return date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate();
- }
- return "";
- },
- //关闭督查机构人员弹窗
- closeMemberOrgan(){
- this.chooseMemberShowOrgan = false
- },
- sendPersonInfoOrgan(info){
- console.log(info)
- let _this = this
- let data = []
- if(info.allInfo.length){
- info.allInfo.forEach(ele=>{
- let dataItem = {acptPersId: ele.guid,acptPersName:ele.persName,persId:_this.userId,persName:_this.persName,travelPlanId:_this.currentLushuBaseInfo.id,travelPlanTitle:_this.currentLushuBaseInfo.title}
- data.push(dataItem)
- })
- }
- shareRoadbookHandler(data).then((res)=>{
- if(res.success){
- this.$message({
- message: '分享成功',
- type: 'success'
- });
- this.chooseMemberShowOrgan = false
- }else{
- this.$message.warning(res.message)
- }
- })
- },
- //展示督查机构人员弹窗
- shareRoadbook(type){
- this.memberType = type
- this.chooseMemberShowOrgan = true
- },
- //获取分享给我的路书列表
- getShareLushuListFun(){
- var _self = this;
- let data = {
- acptPersId: this.userId
- }
- getShareLushuList(data).then((res)=>{
- if(res.success){
- _self.lushuShareList = res.data;
- _self.activeNames = '1';
- _self.lushuShareList.forEach((item)=>{
- if(item.sttm){
- item['stDate'] = dateFormat(item.sttm,'yyyy-MM-dd');
- }
- if(item.entm){
- item['enDate'] = dateFormat(item.entm,'yyyy-MM-dd');
- }
- })
- }
- })
- },
- // 收藏路书
- collectRoadbook(item){
- this.$confirm('确认收藏该路书吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- let data = {
- persId: this.userId,
- travelPlanId: item.id
- }
- if(this.curRoadbook == 'second'){
- data.travelPlanId = item.travelPlanId
- }
- collectRoadbookHandler(data).then((res)=>{
- if(res.success){
- this.$message({
- message: '收藏成功',
- type: 'success'
- });
- this.getLushuListFun();
- }
- })
- }).catch(() => {
- });
- },
- roadbookChange(val){
- if(this.curRoadbook == 'second'){
- this.getShareLushuListFun()
- }
- },
- cancelCollect(){
- this.$message.warning('该路书已收藏')
- },
- // 下载路书行程
- downloadLuShuFun(item){
- this.$confirm('确认下载该路书行程吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- let data = {
- travelPlanId: item.id
- }
- downloadRoadbook(data).then((res)=>{
- if(res.success){
- window.open(`${hostUrl}/upload/tempDocx/${res.data.key}`)
- }else{
- this.$message.warning(res.message)
- }
- })
- }).catch(() => {
- });
- },
- // 展示关联到计划弹窗
- connectToPlan(item){
- this.roadbookId = item.id
- this.showGroupsDialog = true
- },
- // 添加点时增加时间段和备注
- showTimeSelectDialog(objData,collectionInfo){
- if(!this.currentOpenLushuDay || !this.currentOpenLushuDay.id){
- this.$message.warning('请先在路书中选择要添加到哪天的行程中')
- return
- }
- if(objData){
- this.objDataToRoadbook = objData
- }else{
- this.objDataToRoadbook = null
- }
- if(collectionInfo){
- this.lushuPoiDetail = collectionInfo
- }
- this.journeyTimeDialog = true
- },
- hide(){
- this.showXzqPanel = false;
- this.showToolPanel = false;
- },
- closeDaoHangPanel(){
- this.showDaoHangPanel = false;
- this.showPoiList = false;
- this.showStepPanel = false;
- this.showBiaoJiPanel = false;
- this.clearHandler();
- },
- detailRouteOnMap(item){//定位具体路线
- var _self = this;
- var ol = _self.$ol;
- var arr1 = item.tmcs;
- var vertices = [];
- for(var n=0;n<arr1.length;n++){
- var str = arr1[n].polyline;
- var arr2 = str.split(";");
- for(var j=0;j<arr2.length;j++){
- var arr3 = arr2[j].split(",");
- var arr4 = [];
- for(var m=0;m<arr3.length;m++){
- arr4.push(parseFloat(arr3[m]));
- }
- // vertices.push(ol.proj.transform(arr4, "EPSG:4326", "EPSG:3857"));
- vertices.push(_self.geometryTransform(arr4,mapConfig.wkid));
- }
- }
- var polyline = new ol.geom.LineString(vertices)
- _self.mapObject.getView().fit(polyline.getExtent())
- },
- showRouteOnMap(){//地图上展示导航路线
- var _self = this;
- var ol = _self.$ol;
- _self.clearHandler();
- var iconStyle_start = new ol.style.Style({
- image: new ol.style.Icon(({
- anchor: [0.5, 0.5],
- scale:1,
- src: '/src/views/zongHeXinXiOl/assets/xhstart.png'
- }))
- });
- var iconStyle_end = new ol.style.Style({
- image: new ol.style.Icon(({
- anchor: [0.5, 0.5],
- scale:1,
- src: '/src/views/zongHeXinXiOl/assets/xhend.png'
- }))
- });
- var symbol_green = new ol.style.Style({
- stroke:new ol.style.Stroke({
- color: '#00ff00',
- width: 7,
- lineCap:'round'
- })
- })
- var symbol_yellow = new ol.style.Style({
- stroke:new ol.style.Stroke({
- color: '#ffff00',
- width: 7,
- lineCap:'round'
- })
- })
- var symbol_red = new ol.style.Style({
- stroke:new ol.style.Stroke({
- color: '#ff0000',
- width: 7,
- lineCap:'round'
- })
- })
- var symbol_red1 = new ol.style.Style({
- stroke:new ol.style.Stroke({
- color: '#700000',
- width: 7,
- lineCap:'round'
- })
- })
- var iconFeature,symbolFeature;
- var features = [];
- var ext = [];
- if(_self.currentStartLocation && _self.currentEndLocation){
- var arr3 = _self.currentStartLocation.split(",");
- var arr4 = [];
- for(var m1=0;m1<arr3.length;m1++){
- arr4.push(parseFloat(arr3[m1]));
- }
- iconFeature = new ol.Feature({
- // geometry: new ol.geom.Point(ol.proj.transform([arr4[0],arr4[1]], "EPSG:4326", "EPSG:3857")),
- geometry:_self.projTransform(new ol.geom.Point([Number(arr4[0]), Number(arr4[1])]),mapConfig.wkid),
- name: '导航起点'
- });
- iconFeature.setStyle(iconStyle_start);
- features.push(iconFeature);
- var arr5 = _self.currentEndLocation.split(",");
- var arr6 = [];
- for(var m2=0;m2<arr5.length;m2++){
- arr6.push(parseFloat(arr5[m2]));
- }
- ext = [arr4[0],arr4[1],arr6[0],arr6[1]]
- iconFeature = new ol.Feature({
- // geometry: new ol.geom.Point(ol.proj.transform([arr6[0],arr6[1]], "EPSG:4326", "EPSG:3857")),
- geometry:_self.projTransform(new ol.geom.Point([Number(arr6[0]), Number(arr6[1])]),mapConfig.wkid),
- name: '导航终点'
- });
- iconFeature.setStyle(iconStyle_end);
- features.push(iconFeature);
- }
- var arr = _self.trafficSteps.steps;
- for(var i=0;i<arr.length;i++){
- var arr1 = arr[i].tmcs;
- for(var n=0;n<arr1.length;n++){
- var str = arr1[n].polyline;
- var arr2 = str.split(";");
- var vertices = [];
- for(var j=0;j<arr2.length;j++){
- var arr3 = arr2[j].split(",");
- var arr4 = [];
- for(var m=0;m<arr3.length;m++){
- arr4.push(parseFloat(arr3[m]));
- }
- // vertices.push(ol.proj.transform(arr4, "EPSG:4326", "EPSG:3857"));
- vertices.push(_self.geometryTransform(arr4,mapConfig.wkid));
- }
- var polyline = new ol.geom.LineString(vertices)
- var symbol;
- if(arr1[n].status == "缓行"){
- symbol = symbol_yellow
- }else if(arr1[n].status == "拥堵"){
- symbol = symbol_red
- }else if(arr1[n].status == "严重拥堵"){
- symbol = symbol_red1
- }else{
- symbol = symbol_green
- }
- var routeFeature = new ol.Feature({
- name: '导航路线',
- geometry: polyline
- });
- routeFeature.setStyle(symbol);
- features.push(routeFeature)
- }
- }
- var vectorSource = new ol.source.Vector({
- features: features
- });
- var vectorLayer = new ol.layer.Vector({
- source: vectorSource,
- id:'ls_route'
- });
- _self.mapObject.addLayer(vectorLayer);
- _self.mapObject.getView().fit(vectorLayer.getSource().getExtent())
- },
- showDaoHang(){
- this.showDaoHangPanel = true;
- },
- getLocationFromMap(type,longLat){
- var _self = this;
- _self.startText = '';
- _self.endText = '';
- var ol = _self.$ol;
- if(type == 'start'){
- // var arr = ol.proj.transform(longLat, "EPSG:3857", "EPSG:4326")
- var arr = _self.geometryTransform(longLat,mapConfig.wkid);
- _self.currentEndLocation = arr.join(",");
- _self.getAddressByLongLat(type,_self.currentEndLocation);
- }else{
- // var arr = ol.proj.transform(longLat, "EPSG:3857", "EPSG:4326")
- var arr = _self.geometryTransform(longLat,mapConfig.wkid);
- _self.currentEndLocation = arr.join(",");
- _self.getAddressByLongLat(type,_self.currentEndLocation);
- }
- },
- //根据经纬度获取地理位置描述
- getAddressByLongLat(type,location){
- var _self = this;
- axios.get('https://restapi.amap.com/v3/geocode/regeo?parameters',{
- params: {
- location:location,
- output:'json',
- key:'481d08235e1dc266e0f979db1d86162c',
- }
- }).then((res)=>{
- console.log('car');
- if(res.data.status == "1"){
- if(type == 'start'){
- _self.startText = res.data.regeocode.formatted_address;
- }else{
- _self.endText = res.data.regeocode.formatted_address;
- }
- }
- })
- },
- trafficButtonClick(val){//驾车 公交 步行
- var _self = this;
- if(_self.startText == ''){
- if(_self.showPoiList){
- _self.$message.warning('请选择起点!');
- }else{
- _self.$message.warning('请输入起点!');
- }
- return;
- }
- if(_self.endText == ''){
- if(_self.showPoiList){
- _self.$message.warning('请选择终点!');
- }else{
- _self.$message.warning('请输入终点!');
- }
- return;
- }
- if(val == "car"){
- axios.get('https://restapi.amap.com/v3/direction/driving',{
- // axios.get('/GDAPI/v3/direction/driving',{
- params: {
- origin:_self.currentStartLocation,
- destination:_self.currentEndLocation,
- output:'json',
- key:'481d08235e1dc266e0f979db1d86162c',
- }
- }).then((res)=>{
- console.log('car');
- if(res.data.status == "1"){
- _self.showStepPanel = true;
- _self.trafficSteps = res.data.route.paths[0];
- _self.showRouteOnMap();
- }
- })
- }else if(val == "bus"){
- axios.get('/GDAPI/v3/direction/transit/integrated',{
- params: {
- origin:_self.currentStartLocation,
- destination:_self.currentEndLocation,
- output:'json',
- key:'481d08235e1dc266e0f979db1d86162c',
- }
- }).then((res)=>{
- console.log('bus');
- if(res.data.status == "1"){
- }
- })
- }else if(val == "walk"){
- }
- },
- poiListClick(item){//模糊查询列表 点击
- var _self = this;
- if(_self.currentText == "start"){
- _self.startText = item.name;
- _self.currentStartLocation = item.location;
- }else{
- _self.endText = item.name;
- _self.currentEndLocation = item.location;
- }
- _self.showPoiList = false;
- },
- inputChange(val,type){//input输入内后后 关键字模糊查询
- var _self = this;
- _self.showPoiList = true;//打开poi
- _self.showBiaoJiPanel = false;//关闭标记
- _self.showStepPanel = false;//关闭详情路线
- _self.currentText = type;
- // if(type == "start"){
- // _self.currentStartLocation = '';
- // }else{
- // _self.currentEndLocation = '';
- // }
- // axios.get('https://restapi.amap.com/v3/place/text',{
- // axios.get('/GDAPI/v3/assistant/inputtips',{
- axios.get('https://restapi.amap.com/v3/assistant/inputtips',{
- params: {
- keywords:val,
- output:'json',
- offset:20,
- page:1,
- city:_self.currentCityCode,
- key:'481d08235e1dc266e0f979db1d86162c',
- }
- }).then((res)=>{
- console.log('succ');
- if(res.data.status =='1'){
- // _self.pois = res.data.pois;
- _self.pois = res.data.tips;
- }
- })
- },
- clickBiaoJiHandler(item){//点击标记列表 给起点终点赋值
- var _self = this;
- var ol = _self.$ol;
- var lgtd84 = item.lgtd;
- var lttd84 = item.lttd;
- // var lgtd102100 = ol.proj.transform([lgtd84,lttd84], "EPSG:4326", "EPSG:3857")[0]
- // var lttd102100 = ol.proj.transform([lgtd84,lttd84], "EPSG:4326", "EPSG:3857")[1];
- if(_self.currentFocus == 'start'){
- _self.currentStartLocation = String(lgtd84.toFixed(6))+","+String(lttd84.toFixed(6));
- _self.startText = item.inteName;
- }else if(_self.currentFocus == 'end'){
- _self.currentEndLocation = String(lgtd84.toFixed(6))+","+String(lttd84.toFixed(6));
- _self.endText = item.inteName;
- }
- },
- startFocusHandler(evt){
- var _self = this;
- console.log('开始 标记');
- _self.currentFocus = 'start';
- getMyBiaoJi(_self.userId,'','','',1,1000).then((res)=>{
- if(res.success){
- console.log('biaoji')
- _self.tableResultData = res.data.list;
- _self.showPoiList = false;//关闭poi
- _self.showBiaoJiPanel = true;//打开标记
- _self.showStepPanel = false;//关闭详情路线
- }
- });
- },
- endFocusHandler(evt){
- var _self = this;
- console.log(evt);
- _self.currentFocus = 'end';
- getMyBiaoJi(_self.userId,'','','',1,1000).then((res)=>{
- if(res.success){
- console.log('biaoji')
- _self.tableResultData = res.data.list;
- _self.showPoiList = false;//关闭poi
- _self.showBiaoJiPanel = true;//打开标记
- _self.showStepPanel = false;//关闭详情路线
- }
- });
- },
- chooseTraffic(val){//选择交通工具
- this.showDaoHanButton = val;
- },
- startChangeEndHandler(){
- var str = this.startText;
- this.startText = this.endText;
- this.endText = str;
- var str1 = this.currentStartLocation;
- this.currentStartLocation = this.currentEndLocation;
- this.currentEndLocation = str1;
- },
- mapToolHandler:function(item){
- this.$emit("mapToolHandler",item);
- },
- showToolPanelHandler(){
- this.showToolPanel = !this.showToolPanel;
- if(this.showToolPanel){
- this.showXzqPanel = false;
- this.$emit('hide')
- }
- },
- showPanel:function(){
- this.showXzqPanel = !this.showXzqPanel;
- if(this.showXzqPanel){
- this.$emit('hide')
- this.showToolPanel = false;
- }
- },
- getAdData:function(){
- var _self = this;
- getAdData(_self.currentAdCode).then((response)=>{
- _self.nextLevelXzq = response.data;
- if(_self.firstLoad){
- if(_self.nextLevelXzq.length){
- let item = _self.nextLevelXzq[0];
- if(item.adCode!=localStorage.getItem('currentRlcode')){
- getCurrentAdData(localStorage.getItem('currentRlcode')).then((response)=>{
- if(response.data){
- _self.$emit("clickAd",response.data);
- }
- });
- }else{
- _self.$emit("clickAd",item);
- }
- }
- _self.firstLoad = false;
- }
- });
- },
- backToStep:function(item){
- this.currentStatus={
- currentType:item.type,
- currentTitle:item.title,
- currentCode:item.code,
- };
- var arr = [];
- for(var i=0;i<this.naviStateStack.length;i++){
- if(this.naviStateStack[i].code == item.code){
- for(var j=0;j<=i;j++){
- arr.push(this.naviStateStack[j]);
- }
- this.naviStateStack = arr;
- }
- }
- this.currentAdCode = item.code;
- this.getAdData();
- this.$emit("clickAd",{'adCode':item.code,"adName":item.title,"adGrad":item.adGrad});
- },
- closeNavigationPanel:function(item){
- this.showXzqPanel = false;
- },
- clickAd:function(item){
- this.currentStatus={
- currentType:'xzq',
- currentTitle:item.adName,
- currentCode:item.adCode,
- currentAdGrad:item.adGrad
- };
- this.naviStateStack.push({
- title:item.adName,
- type:'xzq',
- code:item.adCode,
- adGrad:item.adGrad
- });
- this.currentAdCode = item.adCode;
- this.getAdData();
- this.$emit("clickAd",item);
- // this.showXzqPanel = false;
- },
- click:function(item){
- var _self = this;
- var ol = _self.$ol;
- _self.showToolPanel = false;
- if(item == "fullExtent"){
- var view = new ol.View({
- center:mapExtent.center,
- zoom:mapExtent.zoom
- });
- _self.mapObject.setView(view);
- }else if(item == "clear"){
- _self.clearHandler();
- }else if(item == "measureDistance"){
- _self.measureHandler('LineString');
- }else if(item == "measureArea"){
- _self.measureHandler('Polygon');
- }else if(item == "biaoji"){
- _self.bjHandler();
- }else if(item == "daohang"){
- _self.showDaoHangPanel = !_self.showDaoHangPanel;
- if(!_self.showDaoHangPanel){
- _self.showStepPanel = false;
- }
- }else if(item == "chaxun"){
- _self.$emit('eventHandler',item);//一张图查询
- }else if(item == "lushu"){
- _self.showLushuList = !_self.showLushuList;
- if(_self.showLushuList){
- _self.getLushuListFun();
- }
- }else if(item == 'jietu'){
- _self.$emit('eventHandler',item);
- }
- },
- //获取路书列表
- getLushuListFun(){
- var _self = this;
- getLushuList(_self.userId).then((res)=>{
- if(res.success){
- _self.lushuList = res.data;
- _self.activeNames = '1';
- // _self.lushuList.forEach((item)=>{
- // if(item.sttm){
- // item['stDate'] = dateFormat(item.sttm,'yyyy-MM-dd');
- // }
- // if(item.entm){
- // item['enDate'] = dateFormat(item.entm,'yyyy-MM-dd');
- // }
- // })
- }
- })
- },
- //关闭路书
- closeLushu(){
- this.showLushuList = false;
- this.clearHandler();
- },
- //点击添加路书按钮 弹出添加对话框
- addLushu(){
- this.lushuName = '';
- this.lushuDate = '';
- this.showAddLushuDialog = true;
- },
- //添加路书
- addLushuHandlerFun(){
- var obj = {
- persId:this.userId,
- title:this.lushuName,
- sttm:this.lushuDate
- }
- addLushuHandler(obj).then((res)=>{
- if(res.success){
- this.$message({
- message: '添加成功',
- type: 'success'
- });
- this.getLushuListFun();
- this.showAddLushuDialog = false;
- }
- })
- },
- //编辑路书保存
- editLushuHandlerFun(){
- var obj = {
- id:this.currentLushuBaseInfo.id,
- persId:this.userId,
- title:this.lushuName_edit,
- sttm:this.lushuDate_edit
- }
- editLushuHandler(obj).then((res)=>{
- if(res.success){
- this.$message({
- message: '编辑成功',
- type: 'success'
- });
- this.showLushuDetailFun(this.currentLushuBaseInfo);
- this.showEditLushuDialog = false;
- }
- })
- },
- //删除路书
- deleteLuShuFun(item){
- this.$confirm('确认删除该信息吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- deleteLushuHandler(item.id).then((res)=>{
- if(res.success){
- this.$message({
- message: '删除成功',
- type: 'success'
- });
- this.getLushuListFun();
- }
- })
- }).catch(() => {
- });
- },
- //查看路书详情
- showLushuDetailFun(item){
- //查询路书基本信息
- let travelPlanId = this.curRoadbook == 'first' ? item.id : item.travelPlanId
- getLushuDetail(travelPlanId).then((res)=>{
- if(res.success){
- this.currentLushuBaseInfo = res.data;
- this.showLushuDetail = true;
- this.showLushuList = false;
- }
- })
- this.getLushuDayListFun(item);
- },
- //查询路书日程列表
- getLushuDayListFun(item){
- var _self = this;
- //查询路书日程列表
- let travelPlanId = this.curRoadbook == 'first' ? item.id : item.travelPlanId
- getLushuDayList(travelPlanId).then((res)=>{
- if(res.success){
- _self.lushuDayList = res.data;
- _self.activeNames = '1';
- if(_self.lushuDayList.length == 0){
- //如果路书日程为空 则调用一遍添加日程接口 默认自带一天日程
- _self.addDayToLushuFun();
- }else{
- _self.currentOpenLushuDay = _self.lushuDayList[0];
- //查询第一天途径点信息
- _self.getPointByDayIdFun();
- }
- }
- })
- },
- //查询第一天途径点信息
- getPointByDayIdFun(){
- var _self = this;
- _self.clearHandler();
- getPointByDayId(_self.currentOpenLushuDay.id).then((res)=>{
- if(res.success){
- _self.lushuDayDetailList = res.data;
- var temp = _self.lushuDayDetailList;
- if(temp.length == 1){//只有一个点 地图上显示点
- _self.addPointToMap(temp[0].lgtd,temp[0].lttd);
- }else if(temp.length > 1){//两个点及以上 地图上显示点和线
- for(var i=0;i<temp.length-1;i++){
- _self.addPointAndRouteToMap({x:temp[i].lgtd,y:temp[i].lttd},{x:temp[i+1].lgtd,y:temp[i+1].lttd},i+1)
- }
- }
- }
- })
- },
- //添加点和线到地图上
- addPointAndRouteToMap(obj1,obj2,index){
- var _self = this;
- var ol = _self.$ol;
- // var pt1 = new ol.geom.Point(ol.proj.transform([obj1.x,obj1.y], "EPSG:4326", "EPSG:3857"));
- var pt1 = _self.projTransform(new ol.geom.Point([Number(obj1.x), Number(obj1.y)]),mapConfig.wkid)
- // var pt2 = new ol.geom.Point(ol.proj.transform([obj2.x,obj2.y], "EPSG:4326", "EPSG:3857"));
- var pt2 = _self.projTransform(new ol.geom.Point([Number(obj2.x), Number(obj2.y)]),mapConfig.wkid)
- axios.get('https://restapi.amap.com/v3/direction/driving',{
- params: {
- origin:String(obj1.x.toFixed(6))+","+String(obj1.y.toFixed(6)),
- destination:String(obj2.x.toFixed(6))+","+String(obj2.y.toFixed(6)),
- output:'json',
- key:'481d08235e1dc266e0f979db1d86162c',
- }
- }).then((res)=>{
- console.log('car');
- if(res.data.status == "1"){
- var iconStyle1 = new ol.style.Style({
- image: new ol.style.Icon(({
- anchor: [0.5, 0.5],
- scale:0.8,
- src: '/src/views/zongHeXinXiOl/assets/location/location'+index+'.png'
- }))
- });
- var iconStyle2 = new ol.style.Style({
- image: new ol.style.Icon(({
- anchor: [0.5, 0.5],
- scale:0.8,
- src: '/src/views/zongHeXinXiOl/assets/location/location'+(index+1)+'.png'
- }))
- });
- var symbol_green = new ol.style.Style({
- stroke:new ol.style.Stroke({
- color: '#00ff00',
- width: 7,
- lineCap:'round'
- })
- })
- var symbol_yellow = new ol.style.Style({
- stroke:new ol.style.Stroke({
- color: '#ffff00',
- width: 7,
- lineCap:'round'
- })
- })
- var symbol_red = new ol.style.Style({
- stroke:new ol.style.Stroke({
- color: '#ff0000',
- width: 7,
- lineCap:'round'
- })
- })
- var symbol_red1 = new ol.style.Style({
- stroke:new ol.style.Stroke({
- color: '#700000',
- width: 7,
- lineCap:'round'
- })
- })
- var features1 = [];
- var arr = res.data.route.paths[0].steps;
- for(var i=0;i<arr.length;i++){
- var arr1 = arr[i].tmcs;
- for(var n=0;n<arr1.length;n++){
- var str = arr1[n].polyline;
- var arr2 = str.split(";");
- var vertices = [];
- for(var j=0;j<arr2.length;j++){
- var arr3 = arr2[j].split(",");
- var arr4 = [];
- for(var m=0;m<arr3.length;m++){
- arr4.push(parseFloat(arr3[m]));
- }
- // vertices.push(ol.proj.transform(arr4, "EPSG:4326", "EPSG:3857"));
- vertices.push(_self.geometryTransform(arr4,mapConfig.wkid));
- }
- var polyline = new ol.geom.LineString(vertices)
- var symbol;
- if(arr1[n].status == "缓行"){
- symbol = symbol_yellow
- }else if(arr1[n].status == "拥堵"){
- symbol = symbol_red
- }else if(arr1[n].status == "严重拥堵"){
- symbol = symbol_red1
- }else{
- symbol = symbol_green
- }
- var routeFeature = new ol.Feature({
- name: '导航路线',
- geometry: polyline
- });
- routeFeature.setStyle(symbol);
- features1.push(routeFeature)
- }
- }
- var vectorSource1 = new ol.source.Vector({
- features: features1
- });
- var vectorLayer1 = new ol.layer.Vector({
- source: vectorSource1,
- id:'ls_lushuRoute'
- });
- _self.mapObject.addLayer(vectorLayer1);
- _self.mapObject.getView().fit(vectorLayer1.getSource().getExtent())
- _self.mapObject.getView().setZoom(_self.mapObject.getView().getZoom()-1)
- var features = [];
- var iconFeature1 = new ol.Feature({
- geometry: pt1,
- name: '路书日程点'
- });
- iconFeature1.setStyle(iconStyle1);
- features.push(iconFeature1);
- var iconFeature2 = new ol.Feature({
- geometry: pt2,
- name: '路书日程点'
- });
- iconFeature2.setStyle(iconStyle2);
- features.push(iconFeature2);
- var vectorSource = new ol.source.Vector({
- features: features
- });
- var vectorLayer = new ol.layer.Vector({
- source: vectorSource,
- id:'ls_lushuPoint'
- });
- _self.mapObject.addLayer(vectorLayer);
- }
- })
- },
- //地图上添加点
- addPointToMap(x,y){
- var _self = this;
- var ol = _self.$ol;
- _self.clearHandler();
- var iconStyle = new ol.style.Style({
- image: new ol.style.Icon(({
- anchor: [0.5, 0.5],
- scale:0.8,
- src: '/src/views/zongHeXinXiOl/assets/location.png'
- }))
- });
- var features = [];
- var iconFeature = new ol.Feature({
- // geometry: new ol.geom.Point(ol.proj.transform([x,y], "EPSG:4326", "EPSG:3857")),
- geometry:_self.projTransform(new ol.geom.Point([Number(x), Number(y)]),mapConfig.wkid),
- name: '路书日程点'
- });
- iconFeature.setStyle(iconStyle);
- features.push(iconFeature);
- var vectorSource = new ol.source.Vector({
- features: features
- });
- var vectorLayer;
- _self.mapObject.getLayers().forEach((val)=>{
- if(val){
- if(val.getProperties().id == 'ls_lushuPoint'){
- vectorLayer = val;
- vectorLayer.getSource().getFeatures().push(vectorSource);
- }
- }
- });
- if(!vectorLayer){
- vectorLayer = new ol.layer.Vector({
- source: vectorSource,
- id:'ls_lushuPoint'
- });
- _self.mapObject.addLayer(vectorLayer);
- }
- // _self.mapObject.getView().setCenter(ol.proj.transform([x,y], "EPSG:4326", "EPSG:3857"))
- _self.mapObject.getView().setCenter(_self.geometryTransform([x,y],mapConfig.wkid))
- },
- //添加日程到路书
- addDayToLushuFun(){
- var _self = this;
- var obj = {
- "travelPlanId": this.currentLushuBaseInfo.id,
- }
- addDayToLushu(obj).then((res)=>{
- if(res.success){
- _self.getLushuDayListFun(_self.currentLushuBaseInfo);
- }
- })
- },
- //后退至路书列表
- lushuBackFun(){
- this.showLushuDetail = false;
- this.showLushuList = true;
- this.getLushuListFun();
- this.clearHandler();
- },
- //编辑路书基本信息
- editLushu(item){
- this.lushuName_edit = this.currentLushuBaseInfo.title;
- this.lushuDate_edit = this.currentLushuBaseInfo.sttm;
- this.showEditLushuDialog = true;
- },
- //显示搜索框
- showSearchWidgetFun(item){
- this.showSearchWidget = true;
- },
- //路书poi
- searchWidgetInputChange(val){
- var _self = this;
- axios.get('https://restapi.amap.com/v3/assistant/inputtips',{
- params: {
- keywords:val,
- output:'json',
- offset:20,
- page:1,
- city:_self.currentCityCode,
- key:'481d08235e1dc266e0f979db1d86162c',
- }
- }).then((res)=>{
- console.log('succ');
- if(res.data.status =='1'){
- // _self.pois = res.data.pois;
- _self.lushuPois = res.data.tips;
- _self.showLushuPoiList = true;
- _self.showLushuPoiDetail = false;
- }
- })
- },
- //点击POI列表 显示单个POI详情
- showLushuPoiDetailFun(item){
- var _self = this;
- axios.get('https://restapi.amap.com/v3/place/detail',{
- params: {
- id:item.id,
- output:'json',
- key:'481d08235e1dc266e0f979db1d86162c',
- }
- }).then((res)=>{
- console.log('getLushuPoiDetailScc');
- if(res.data.status =='1'){
- _self.lushuPoiDetail = res.data.pois[0];
- _self.showLushuPoiList = false;
- _self.showLushuPoiDetail = true;
- }
- })
- },
- //关闭路书搜索框 同时关闭路书POIlist及poiDetail
- closeSearchWidgetFun(){
- this.showSearchWidget = false;
- this.showLushuPoiList = false;
- this.showLushuPoiDetail = false;
- this.lushuPoiDetail = {};
- this.lushuPois = [];
- },
- //打开某一天 查询该天 点 详细信息
- lushuDayChangeFun(val){
- this.currentOpenLushuDay = this.lushuDayList[Number(val)-1];
- console.log(this.currentOpenLushuDay);
- this.getPointByDayIdFun();
- },
- //从某一天当中删除点
- deletePointFun(item,index){
- var _self = this;
- this.$confirm('确认删除该信息吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- deletePoint(item.id).then((res)=>{
- if(res.success){
- if(_self.lushuDayDetailList.length > 1 && _self.lushuDayDetailList.length == index+1){
- //如果删除的是最后一个点 则把上一个点的距离和时间 清空
- var obj1 = {
- "consuming": null,
- "distance": null,
- "id": _self.lushuDayDetailList[index-1].id
- }
- updatePoint(obj1).then((res2)=>{
- if(res2.success){
- _self.getPointByDayIdFun();
- }
- })
- }else if(index != 0){
- //如果删除的是中间某一点,则重新计算上一个点和下一个点之间的距离和时间
- _self.calculateDistanceAndTime(_self.lushuDayDetailList[index-1],_self.lushuDayDetailList[index+1]);
- }
- _self.getLushuDayListFun({id:_self.currentLushuBaseInfo.id});
- }
- })
- }).catch(() => {
- });
- },
- //从日程列表中删除某一天
- deleteDayFun(item){
- this.$confirm('确认删除该信息吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- deleteDay(item.id).then((res)=>{
- if(res.success){
- //删除成功之后 刷新日行程列表
- this.getLushuDayListFun({id:item.travelPlanId});
- }
- })
- }).catch(() => {
- });
- },
- //添加poi到路书某一天中
- addPoiToLushuDayFun(){//ysea
- // this.lushuPoiDetail
- // this.currentOpenLushuDay
- var _self = this;
- var arr = this.lushuPoiDetail.location.split(',');
- var obj = {
- "addvcd": this.lushuPoiDetail.adcode,
- "addvnm": this.lushuPoiDetail.adname,
- "lgtd": Number(arr[0]),
- "lttd": Number(arr[1]),
- "sttm": this.journeyTime[0],
- "entm": this.journeyTime[1],
- "name": this.lushuPoiDetail.name,
- "planDayId": this.currentOpenLushuDay.id,
- }
- addPointToDay(obj).then((res)=>{
- if(res.success){
- //添加成功之后 刷新
- getPointByDayId(_self.currentOpenLushuDay.id).then((res)=>{
- if(res.success){
- _self.lushuDayDetailList = res.data;
- _self.searchWidgetInput = '';
- _self.showLushuPoiDetail = false;
- _self.journeyTimeDialog = false;
- //如果添加点之后 大于两个点 则计算两点之间的距离及驾车所需时间 并调用更新接口
- if(_self.lushuDayDetailList.length>=2){
- var stDestination = _self.lushuDayDetailList[_self.lushuDayDetailList.length-2];
- var endDestination = _self.lushuDayDetailList[_self.lushuDayDetailList.length-1];
- _self.calculateDistanceAndTime(stDestination,endDestination);
- _self.getLushuDayListFun({id:_self.currentLushuBaseInfo.id});
- }
- }
- })
- }
- })
- },
- //计算两点之间距离和时间 并更新点接口
- calculateDistanceAndTime(stDestination,endDestination){
- var _self = this;
- axios.get('https://restapi.amap.com/v3/direction/driving',{
- params: {
- origin:String(stDestination.lgtd.toFixed(6))+","+String(stDestination.lttd.toFixed(6)),
- destination:String(endDestination.lgtd.toFixed(6))+","+String(endDestination.lttd.toFixed(6)),
- output:'json',
- key:'481d08235e1dc266e0f979db1d86162c',
- }
- }).then((res1)=>{
- console.log('car');
- if(res1.data.status == "1"){
- var result = res1.data.route.paths[0];
- var obj1 = {
- "consuming": result.duration,
- "distance": result.distance,
- "id": stDestination.id
- }
- updatePoint(obj1).then((res2)=>{
- if(res2.success){
- _self.getPointByDayIdFun();
- }
- })
- }
- })
- },
- //鼠标移入日程中某一段 地图上显示线路
- showTwoPointRouteOnMap(obj){
- var _self = this;
- var ol = _self.$ol;
- _self.clearLayer();
- for(var i=0;i<_self.lushuDayDetailList.length-1;i++){
- if(_self.lushuDayDetailList[i].id == obj.id){
- var obj2 = _self.lushuDayDetailList[i+1];
- axios.get('https://restapi.amap.com/v3/direction/driving',{
- params: {
- origin:String(obj.lgtd.toFixed(6))+","+String(obj.lttd.toFixed(6)),
- destination:String(obj2.lgtd.toFixed(6))+","+String(obj2.lttd.toFixed(6)),
- output:'json',
- key:'481d08235e1dc266e0f979db1d86162c',
- }
- }).then((res)=>{
- if(res.data.status == "1"){
- var symbol = new ol.style.Style({
- stroke:new ol.style.Stroke({
- color: '#00ffff',
- width: 7,
- lineCap:'round'
- })
- })
- var features = [];
- var arr = res.data.route.paths[0].steps;
- for(var i=0;i<arr.length;i++){
- var arr1 = arr[i].tmcs;
- for(var n=0;n<arr1.length;n++){
- var str = arr1[n].polyline;
- var arr2 = str.split(";");
- var vertices = [];
- for(var j=0;j<arr2.length;j++){
- var arr3 = arr2[j].split(",");
- var arr4 = [];
- for(var m=0;m<arr3.length;m++){
- arr4.push(parseFloat(arr3[m]));
- }
- // vertices.push(ol.proj.transform(arr4, "EPSG:4326", "EPSG:3857"));
- vertices.push(_self.geometryTransform(arr4,mapConfig.wkid));
- }
- var polyline = new ol.geom.LineString(vertices)
- var routeFeature = new ol.Feature({
- name: '两点之间路线',
- geometry: polyline
- });
- routeFeature.setStyle(symbol);
- features.push(routeFeature)
- }
- }
- var vectorSource = new ol.source.Vector({
- features: features
- });
- var vectorLayer = new ol.layer.Vector({
- source: vectorSource,
- id:'ls_twoPointRoute'
- });
- _self.mapObject.addLayer(vectorLayer);
- }
- })
- }
- }
- },
- //鼠标移除 则清除相关图层
- clearLayer(){
- var _self = this;
- _self.mapObject.getLayers().forEach((val)=>{
- if(val){
- if(val.getProperties().id == 'ls_twoPointRoute'){
- val.getSource().clear();
- _self.mapObject.removeLayer(val);
- }
- }
- });
- },
- clearHandler(){
- var _self = this;
- document.getElementById("mapNode").style.cursor = "default";
- if(document.getElementById("measureToolTipDivId")){
- document.getElementById("measureToolTipDivId").style.display="none";
- }
- _self.mapObject.getLayers().forEach((val)=>{
- if(val){
- if(val.getProperties().id == 'ls_lushuRoute'){
- _self.mapObject.removeLayer(val);
- val.getSource().clear();
- }
- }
- });
- _self.mapObject.getLayers().forEach((val)=>{
- if(val){
- if(val.getProperties().id == 'ls_twoPointRoute'){
- _self.mapObject.removeLayer(val);
- val.getSource().clear();
- }
- }
- });
- _self.mapObject.getLayers().forEach((val)=>{
- if(val){
- if(val.getProperties().id == 'ls_lushuPoint'){
- _self.mapObject.removeLayer(val);
- val.getSource().clear();
- }
- }
- });
- _self.mapObject.getLayers().forEach((val)=>{
- if(val){
- if(val.getProperties().id.substring(0,3) == 'ls_'){
- _self.mapObject.removeLayer(val);
- val.getSource().clear();
- }
- }
- });
- if(_self.draw){
- _self.mapObject.removeInteraction(_self.draw);
- }
- },
- bjHandler(){
- var _self = this;
- this.$emit('eventHandler','biaoji');
- document.getElementById("mapNode").style.cursor = "crosshair";
- },
- measureHandler(type){
- var _self = this;
- document.getElementById("mapNode").style.cursor = "crosshair";
- if(document.getElementById("measureToolTipDivId")){
- document.getElementById("measureToolTipDivId").style.display="none";
- }
- _self.mapObject.getLayers().forEach((val)=>{
- if(val && val.getProperties().id){
- if(val.getProperties().id == "ls_measureLayer" || val.getProperties().id == "ls_measureOverLayId"){
- val.getSource().clear();
- _self.mapObject.removeLayer(val);
- }
- }
- });
- var ol = _self.$ol;
- var source = new ol.source.Vector();
- var vector = new ol.layer.Vector({
- id:'ls_measureLayer',
- source: source,
- style: new ol.style.Style({
- fill: new ol.style.Fill({
- color: 'rgba(255, 255, 255, 0.2)'
- }),
- stroke: new ol.style.Stroke({
- color: '#ffcc33',
- width: 3
- }),
- image: new ol.style.Circle({
- radius: 7,
- fill: new ol.style.Fill({
- color: '#ffcc33'
- })
- })
- })
- });
- _self.mapObject.addLayer(vector);
- _self.draw = new ol.interaction.Draw({
- source: source,
- type: type,
- stopClick:true,
- style: new ol.style.Style({
- fill: new ol.style.Fill({
- color: 'rgba(255, 255, 255, 0.2)'
- }),
- stroke: new ol.style.Stroke({
- color: 'rgba(255, 204, 51, 1)',
- lineDash: [10, 10],
- width: 3
- }),
- image: new ol.style.Circle({
- radius: 8,
- stroke: new ol.style.Stroke({
- color: 'rgba(255, 204, 51, 0.7)'
- }),
- fill: new ol.style.Fill({
- color: '#ffcc33'
- })
- })
- })
- });
- _self.mapObject.addInteraction(_self.draw);
- _self.createMeasureTooltip();
- _self.createHelpTooltip();
- var listener;
- _self.draw.on('drawstart',function(evt) {
- // set sketch
- _self.sketch = evt.feature;
- var tooltipCoord = evt.coordinate;
- listener = _self.sketch.getGeometry().on('change', function(evt) {
- var geom = evt.target;
- var output;
- if (geom instanceof ol.geom.Polygon) {
- output = _self.formatArea(geom);
- tooltipCoord = geom.getInteriorPoint().getCoordinates();
- } else if (geom instanceof ol.geom.LineString) {
- output = _self.formatLength(geom);
- tooltipCoord = geom.getLastCoordinate();
- }
- _self.measureTooltipElement.innerHTML = output;
- _self.measureTooltip.setPosition(tooltipCoord);
- });
- }, this);
- _self.draw.on('drawend', function() {
- _self.measureTooltipElement.className = 'tooltip tooltip-static';
- _self.measureTooltip.setOffset([0, -7]);
- // unset sketch
- _self.sketch = null;
- // unset tooltip so that a new one can be created
- _self.measureTooltipElement = null;
- _self.createMeasureTooltip();
- ol.Observable.unByKey(listener);
- _self.mapObject.removeInteraction(_self.draw);
- document.getElementById("mapNode").style.cursor = "default";
- if (_self.measureTooltipElement) {
- _self.measureTooltipElement.parentNode.removeChild(_self.measureTooltipElement);
- }
- }, this);
- },
- createMeasureTooltip() {
- var _self = this;
- var ol = _self.$ol;
- _self.measureTooltipElement = document.createElement('div');
- _self.measureTooltipElement.id = "measureToolTipDivId";
- _self.measureTooltipElement.className = 'tooltip tooltip-measure';
- _self.measureTooltip = new ol.Overlay({
- id:'ls_measureOverLayId',
- element: _self.measureTooltipElement,
- offset: [0, -15],
- positioning: 'bottom-center'
- });
- _self.mapObject.addOverlay(_self.measureTooltip);
- },
- createHelpTooltip() {
- var _self = this;
- var ol = _self.$ol;
- if (_self.helpTooltipElement) {
- _self.helpTooltipElement.parentNode.removeChild(_self.helpTooltipElement);
- }
- _self.helpTooltipElement = document.createElement('div');
- _self.helpTooltipElement.className = 'tooltip hidden';
- _self.helpTooltip = new ol.Overlay({
- id:'ls_measureOverLayId',
- element: _self.helpTooltipElement,
- offset: [15, 0],
- positioning: 'center-left'
- });
- _self.mapObject.addOverlay(_self.helpTooltip);
- },
- formatLength(line) {
- var ol = this.$ol;
- var length = ol.Sphere.getLength(line,{projection:mapConfig.projection});
- var output;
- if (length > 100) {
- output = (Math.round(length / 1000 * 100) / 100) + ' ' + 'km';
- } else {
- output = (Math.round(length * 100) / 100) + ' ' + 'm';
- }
- return output;
- },
- formatArea(polygon) {
- var ol = this.$ol;
- var area = ol.Sphere.getArea(polygon,{projection:mapConfig.projection});
- var output;
- if (area > 10000) {
- output = (Math.round(area / 1000000 * 100) / 100) + ' ' + 'km<sup>2</sup>';
- } else {
- output = (Math.round(area * 100) / 100) + ' ' + 'm<sup>2</sup>';
- }
- return output;
- },
- },
- filters:{
- timeFilter(val){
- if(val){
- return val.substr(val.indexOf(' '),val.length - 1)
- }else{
- return ''
- }
- }
- }
- }
- </script>
- <style>
- #mapToolBarContainer_hhjc{
- position: fixed;
- top: 96px;
- right: 5px;
- }
- #mapTopToolBar{
- display: flex;
- background-color: white;
- height: 46px;
- border-radius: 3px;
- width: 314px;
- z-index: 1;
- align-items: center;
- box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.5);
- background: rgba(255,255,255,1);
- border-radius: 4px;
- }
- .xzqPanelClass{
- margin-top: 5px;
- background-color: white;
- width: 280px;
- margin-right: 10px;
- }
- .naviClickableLink{
- padding: 5px;
- padding-left: 10px;
- /* margin: 3px !important; */
- text-align: center;
- font-size: small;
- color: #000000b0;
- font-weight: normal;
- cursor: pointer;
- }
- .naviClickableLink:hover{
- text-decoration: underline;
- }
- .imgClass{
- width:17px;
- height: 17px;
- margin-right:5px;
- cursor:pointer;
- }
- .imgClass:hover{
- background-color: rgb(200,200,200);
- }
- .mapRightMenu{
- background-color: white;
- padding-left: 0px;
- /* padding-left:10px;
- padding-right:10px;
- padding-bottom:5px;
- padding-top:5px; */
- border: 1px solid rgba(142, 142, 142, 0.3);
- box-shadow: rgba(0, 0, 0, 0.23) 4px 3px 3px 0px;
- }
- .mapRightMenu .menuItem{
- padding: 10px;
- border-bottom: 1px solid rgba(154, 154, 154, 0.36);
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- align-items: center;
- }
- .mapRightMenu .menuItem:hover{
- cursor: pointer;
- background-color: rgba(154, 154, 154, 0.082);
- }
- .mapRightMenu:last-child{
- border-bottom:0px solid rgba(102, 102, 102, 0.507) !important;
- }
- ul.tabs.dir_tab {
- padding-top: 10px;
- width: 200px;
- border: 0;
- border-radius: 0;
- background: none;
- height: 30px;
- margin: 0 auto;
- white-space: nowrap;
- }
- ul.tabs.dir_tab li {
- height: 30px;
- width: 33.3333%;
- line-height: 30px;
- position: relative;
- display: block;
- float: left;
- text-align: center;
- margin: 0;
- text-transform: uppercase;
- letter-spacing: .8px;
- }
- ul.tabs.dir_tab li:active {
- background-color:#dbdbe7;
- }
- .trafficActivity{
- background-color: #dbdbe7;
- }
- .daohangContainerClass{
- height: 170px;
- background-color: #4993fc;
- right: 20px;
- position: fixed;
- width: 320px;
- }
- .poiClass{
- background-color: #ffffff;
- position: fixed;
- top: 310px;
- right: 20px;
- width: 320px;
- max-height: 350px;
- overflow: auto;
- }
- .poiClass :hover{
- background: #ece9e9;
- cursor:pointer;
- }
- .poiListClass{
- padding: 5px;
- padding-left: 15px;
- }
- .stepClass{
- position: fixed;
- top: 310px;
- right: 20px;
- width: 320px;
- max-height: 350px;
- background: #f4f9fd;
- overflow: auto;
- min-height: 70px;
- }
- .stepClass .el-collapse-item__header{
- color:blue;
- }
- .tooltip {
- position: relative;
- background: rgba(0, 0, 0, 0.5);
- border-radius: 4px;
- color: white;
- padding: 4px 8px;
- opacity: 0.7;
- white-space: nowrap;
- }
- .tooltip-measure {
- opacity: 1;
- font-weight: bold;
- }
- .tooltip-static {
- background-color: #ffcc33;
- color: black;
- border: 1px solid white;
- }
- .tooltip-measure:before,
- .tooltip-static:before {
- border-top: 6px solid rgba(0, 0, 0, 0.5);
- border-right: 6px solid transparent;
- border-left: 6px solid transparent;
- content: "";
- position: absolute;
- bottom: -6px;
- margin-left: -7px;
- left: 50%;
- }
- .tooltip-static:before {
- border-top-color: #ffcc33;
- }
- #timeLineContainer .el-timeline-item{
- padding-bottom: 10px;
- }
- </style>
|