da81f66c66752aebb047e7f0624c85b280ec8d8f.svn-base 82 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865
  1. <template>
  2. <div id="mapToolBarContainer_hhjc">
  3. <div id="mapTopToolBar">
  4. <div style="padding-left: 10px;display: flex;flex-direction: row;justify-content: space-between;align-items: center;">
  5. <!-- <p style="margin-left:0%;margin-right:10px;display:inline;color:rgb(129, 131, 135);">
  6. 导航:
  7. </p> -->
  8. <img src="../assets/qg.png" style="width: 14px;">
  9. <el-button @click="showPanel('navi')" style="border-radius: 5px;padding: 5px 5px;color:#2C9EFF;margin-left: 5px;border: 0px;" size="medium ">
  10. {{currentStatus.currentTitle}}
  11. <i :class="this.showXzqPanel ?'el-icon-arrow-up':'el-icon-arrow-down'"></i>
  12. </el-button>
  13. </div>
  14. <div style="width: 1px;height: 10px;background: rgb(190, 190, 190);margin-left: 10px;margin-right: 10px;"></div>
  15. <div style="display: flex;flex-direction: row;justify-content: space-between;align-items: center;">
  16. <img src="../assets/tool1.png" style="width: 14px;">
  17. <el-button @click="showToolPanelHandler()" style="border-radius: 5px;padding: 5px 5px;color:#2C9EFF;margin-left: 5px;border: 0px;" size="medium ">
  18. 工具箱
  19. <i :class="this.showToolPanel ?'el-icon-arrow-up':'el-icon-arrow-down'"></i>
  20. </el-button>
  21. </div>
  22. <div style="width: 1px;height: 10px;background: rgb(190, 190, 190);margin-left: 10px;margin-right: 10px;"></div>
  23. <!-- <div style="width: 70px;margin-left:40px;display: flex;flex-direction: row;justify-content: space-between;align-items: center;">
  24. <p style="margin-left:0%;margin-right:10px;display:inline;color:rgb(129, 131, 135);">
  25. <i class="el-icon-location"></i>地图工具:
  26. </p>
  27. <img src="../assets/distance.png" class="imgClass" title="测距" @click="mapToolHandler('distance')">
  28. <img src="../assets/area.png" class="imgClass" title="测面" @click="mapToolHandler('area')">
  29. <img src="../assets/clear.png" class="imgClass" title="清除" @click="mapToolHandler('clear')">
  30. </div> -->
  31. </div>
  32. <div class="xzqPanelClass">
  33. <div v-if="showXzqPanel" style="width: 314px;background: white;">
  34. <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)">
  35. <div style="display:flex;flex-direction:row;">
  36. <p style="font-size:14px;margin-left:10px;padding-top: 5px;color:rgb(173,177,192)">当前:</p>
  37. <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>
  38. </div>
  39. <!-- <div style="display:flex;flex-direction:row;padding-right: 5px;cursor: pointer;">
  40. <span class="el-icon-circle-close-outline" @click="closeNavigationPanel"></span>
  41. </div> -->
  42. </div>
  43. <div style="display:flex;flex-direction:row;margin-top:5px;">
  44. <p style="font-size:small;color:rgb(173,177,192);margin-left:10px;">行政区列表:</p>
  45. </div>
  46. <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;">
  47. <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>
  48. </div>
  49. </div>
  50. </div>
  51. <div class="toolPanelClass">
  52. <div v-if=showToolPanel>
  53. <transition name="el-zoom-in-top">
  54. <ul role="menu" id="cascader-menu-1602" class="mapRightMenu" style="margin-left: 118px;width: 80px;">
  55. <li tabindex="-1" role="menuitem" aria-haspopup="true" aria-owns="menu-8696-1"
  56. class="menuItem" @click="click('fullExtent')">
  57. <img src="../assets/fullExtent.png" alt="" style="height:17px;margin-right:5px;">
  58. <p class="pClass">全图</p>
  59. </li>
  60. <li tabindex="-1" role="menuitem" aria-haspopup="true" aria-owns="menu-8696-1"
  61. class="menuItem" @click="click('biaoji')">
  62. <img src="../assets/bjR.png" alt="" style="height:17px;margin-right: 9px;margin-left: 5px;">
  63. <p class="pClass">标记</p>
  64. </li>
  65. <li tabindex="-1" role="menuitem" aria-haspopup="true" aria-owns="menu-8696-1"
  66. class="menuItem" @click="click('jietu')">
  67. <img src="../assets/bjR.png" alt="" style="height:17px;margin-right: 9px;margin-left: 5px;">
  68. <p class="pClass">截图</p>
  69. </li>
  70. <li tabindex="-1" role="menuitem" aria-haspopup="true" aria-owns="menu-8696-1"
  71. class="menuItem" @click="click('lushu')">
  72. <img src="../assets/location.png" alt="" style="height:17px;margin-right: 5px;">
  73. <p class="pClass">路书</p>
  74. </li>
  75. <li tabindex="-1" role="menuitem" aria-haspopup="true" aria-owns="menu-8696-1"
  76. class="menuItem" @click="click('daohang')">
  77. <img src="../assets/daohang1.png" alt="" style="height:17px;margin-right:5px;">
  78. <p class="pClass">导航</p>
  79. </li>
  80. <li tabindex="-1" role="menuitem" aria-haspopup="true" aria-owns="menu-8696-1"
  81. class="menuItem" @click="click('chaxun')">
  82. <img src="../assets/chaxun.png" alt="" style="height:17px;margin-right:5px;">
  83. <p class="pClass">查询</p>
  84. </li>
  85. <li tabindex="-1" role="menuitem" aria-haspopup="true" aria-owns="menu-8696-1"
  86. class="menuItem" @click="click('measureDistance')">
  87. <img src="../assets/distance.png" alt="" style="height:17px;margin-right:5px;">
  88. <p class="pClass">测距</p>
  89. </li>
  90. <li tabindex="-1" role="menuitem" aria-haspopup="true" aria-owns="menu-8696-1"
  91. class="menuItem" @click="click('measureArea')">
  92. <img src="../assets/area.png" alt="" style="height:17px;margin-right:5px;">
  93. <p class="pClass">测面</p>
  94. </li>
  95. <li tabindex="-1" role="menuitem" aria-haspopup="true" aria-owns="menu-8696-1"
  96. class="menuItem" @click="click('clear')">
  97. <img src="../assets/clear.png" alt="" style="height:17px;margin-right:5px;">
  98. <p class="pClass">清除</p>
  99. </li>
  100. </ul>
  101. </transition>
  102. </div>
  103. </div>
  104. <div id="daohangContainer" class="daohangContainerClass" v-if="showDaoHangPanel">
  105. <div style="height:30px;float:right;">
  106. <i class="el-icon-close" @click="closeDaoHangPanel" style="padding-right: 5px;color: #dbdbdb;cursor:pointer;"></i>
  107. <!-- <ul class="tabs dir_tab col3 z-depth-1 clearfix" id="trafficTab"> -->
  108. <!-- <li :class="{'trafficActivity':showDaoHanButton=='car'}" style="display: flex;align-items: center;justify-content: center;">
  109. <img src="../assets/car.png" alt="" @click="chooseTraffic('car')" style="height:19px;width:19px;cursor:pointer;">
  110. </li> -->
  111. <!-- <li :class="{'trafficActivity':showDaoHanButton=='bus'}" style="display: flex;align-items: center;justify-content: center;">
  112. <img src="../assets/bus.png" alt="" @click="chooseTraffic('bus')" style="height:20px;width:19px;cursor:pointer;">
  113. </li>
  114. <li :class="{'trafficActivity':showDaoHanButton=='walk'}" style="display: flex;align-items: center;justify-content: center;">
  115. <img src="../assets/walk.png" alt="" @click="chooseTraffic('walk')" style="height:19px;width:24px;cursor:pointer;">
  116. </li> -->
  117. <!-- </ul> -->
  118. </div>
  119. <div style="display: flex;width: 100%;align-items: center;padding-top: 10px;">
  120. <div>
  121. <img src="../assets/jiaohuan.png" alt="" @click="startChangeEndHandler" style="height:40px;width:40px;cursor:pointer;">
  122. </div>
  123. <div>
  124. <el-input placeholder="请输入起点" v-model="startText" clearable @focus="startFocusHandler"
  125. style="padding-bottom: 5px;width: 250px;height: 35px;"></el-input>
  126. <el-input placeholder="请输入终点" v-model="endText" clearable @focus="endFocusHandler"
  127. style="padding-bottom: 5px;width: 250px;height: 35px;"></el-input>
  128. </div>
  129. </div>
  130. <div style="float: right;padding-top: 10px;padding-right: 30px;">
  131. <el-button type="primary" v-show="showDaoHanButton == 'car'" @click="trafficButtonClick('car')" size="mini">导航</el-button>
  132. <el-button type="primary" v-show="showDaoHanButton == 'bus'" @click="trafficButtonClick('bus')" size="mini">公交</el-button>
  133. <el-button type="primary" v-show="showDaoHanButton == 'walk'" @click="trafficButtonClick('walk')" size="mini">步行</el-button>
  134. </div>
  135. </div>
  136. <div id="poiContainer" class="poiClass" v-if="showPoiList">
  137. <div class="poiListClass" v-for="(item,index) in pois" :key="index" @click="poiListClick(item)">
  138. <span style="color: blue;">{{item.name}}</span>
  139. <!-- <span style="font-size: small;color: #aaaaaa;padding-left: 10px;">{{item.cityname}}{{item.adname}}</span> -->
  140. <span style="font-size: small;color: #aaaaaa;padding-left: 10px;">{{item.district}}</span>
  141. </div>
  142. </div>
  143. <div id="stepContainer" class="stepClass" v-if="showStepPanel">
  144. <div style="display:flex;justify-content: space-around;">
  145. <div style="padding: 5px;padding-top: 10px;">
  146. <span>约</span>
  147. <span style="color:blue;">{{(trafficSteps.duration/3600).toFixed(1)}}</span>
  148. <span>个小时</span>
  149. </div>
  150. <div style="margin-top: 13px;width: 2px;height: 15px;background: #000;"></div>
  151. <div style="padding: 5px;padding-top: 10px;">
  152. <span style="color:blue;">{{(trafficSteps.distance/1000).toFixed(1)}}</span>
  153. <span>公里</span>
  154. </div>
  155. <!-- <div style="margin-top: 13px;width: 1.5px;height: 15px;background: #000;"></div>
  156. <div style="padding: 5px;padding-top: 10px;">
  157. <span>红绿灯</span>
  158. <span style="color:red;">{{trafficSteps.traffic_lights}}</span>
  159. <span>个</span>
  160. </div> -->
  161. </div>
  162. <div style="padding-left: 20px;">
  163. <el-collapse accordion>
  164. <el-collapse-item v-for="(item,index) in trafficSteps.steps" :key="index">
  165. <template slot="title">
  166. {{typeof(item.road) == "undefined"?"无名路":item.road}}<span style="padding-left: 20px;color: #938f8f;">{{(item.distance/1000).toFixed(1)}}km</span>
  167. </template>
  168. <div style="cursor:pointer;" @click="detailRouteOnMap(item)">{{item.instruction}}</div>
  169. </el-collapse-item>
  170. </el-collapse>
  171. </div>
  172. </div>
  173. <div id="biaojiContainer" class="stepClass" v-if="showBiaoJiPanel">
  174. <div style="padding-left: 20px;">
  175. <el-collapse accordion>
  176. <el-collapse-item v-for="(item,index) in tableResultData" :key="index">
  177. <template slot="title">
  178. {{item.inteName}}
  179. </template>
  180. <div style="cursor:pointer;" @click="clickBiaoJiHandler(item)">{{item.des}}</div>
  181. </el-collapse-item>
  182. </el-collapse>
  183. </div>
  184. </div>
  185. <!-- 路书列表 -->
  186. <div id="luShuListContainer" v-if="showLushuList" style="position: fixed;left: 50px;top: 100px;
  187. height: 80%;width: 300px;background: #ffffffcc;">
  188. <div style="height: 30px;background: rgba(0, 126, 246, 0.76);display: flex;justify-content: space-between;
  189. align-items: center;">
  190. <p style="color: #fff3f3;padding-left: 5px;">路书列表</p>
  191. <i @click="closeLushu" style="color: white;padding-right: 5px;cursor: pointer;" class="el-icon-close"></i>
  192. </div>
  193. <div :style="{'height':lushuHeight+'px'}" style="overflow-y: auto;">
  194. <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;">
  195. <div style="width: 90px;height: 90px;background: #4993fc;margin: 5px;display: flex;align-items: baseline;justify-content: center;">
  196. <p style="font-size: 50px;color: white;padding-top: 10px;">{{item.dayCount}}</p>
  197. <p style="color: white;">天</p>
  198. </div>
  199. <div style="width:190px;display: flex;flex-direction: column;justify-content: space-around;">
  200. <p style="color: #565151;">{{item.title}}</p>
  201. <p style="color: #4295df;">{{item.pass}}</p>
  202. <div style="justify-content: space-between;display:flex;">
  203. <p style="color: #aaa2a2;font-size: 12px;">{{item.stDate}} / {{item.enDate}}</p>
  204. <el-tooltip class="item" effect="light" content="删除" placement="top">
  205. <i class="el-icon-delete" style="padding-right: 5px;" @click.stop="deleteLuShuFun(item)"></i>
  206. </el-tooltip>
  207. </div>
  208. </div>
  209. </div>
  210. </div>
  211. <div style="height:80px;display: flex;justify-content: center;">
  212. <div @click="addLushu" style="width: 95%;height: 100%;align-items: center;display: flex;cursor:pointer;
  213. justify-content: center;flex-direction: column;border: 1px dashed #009cfa;">
  214. <i class="el-icon-plus"></i>
  215. <p>添加路书</p>
  216. </div>
  217. </div>
  218. </div>
  219. <!-- 路书详情 -->
  220. <div id="luShuListContainer" v-if="showLushuDetail" style="position: fixed;left: 50px;top: 100px;
  221. height: 80%;width: 300px;background: #ffffffcc;">
  222. <div style="height: 100px;background: #22bdac;display: flex;justify-content: space-between;">
  223. <i @click="lushuBackFun" style="color: white;padding: 10px;cursor: pointer;" class="el-icon-back"></i>
  224. <div style="padding: 10px;">
  225. <p style="color:white;font-size:20px;">{{this.currentLushuBaseInfo.title}}</p>
  226. <p style="color: #aaa2a2;font-size: 12px;">{{this.currentLushuBaseInfo.stDate}} / {{this.currentLushuBaseInfo.enDate}}</p>
  227. </div>
  228. <el-tooltip class="item" effect="light" content="编辑" placement="top">
  229. <i @click="editLushu" style="color: white;padding: 10px;cursor: pointer;" class="el-icon-edit"></i>
  230. </el-tooltip>
  231. </div>
  232. <div :style="{'height':lushuDetailHeight+'px'}" style="overflow-y: auto;">
  233. <el-collapse v-model="activeNames" accordion @change="lushuDayChangeFun">
  234. <el-collapse-item v-for="(item,index) in lushuDayList" :key="index" :name="(index+1).toString()">
  235. <template slot="title" style="">
  236. <div id="dd" style="display: flex;justify-content: space-between;width: 100%;align-items: center;">
  237. <p style="padding-left:5px;font-size:16px;">第{{index+1}}天</p>
  238. <div>
  239. <p style="color: #4295df;"><i class="el-icon-location-information" style="padding-right: 5px;"></i>{{item.title}}</p>
  240. </div>
  241. <el-tooltip class="item" effect="light" content="删除" placement="top">
  242. <i @click="deleteDayFun(item)" class="el-icon-delete" style="padding-right: 5px;"></i>
  243. </el-tooltip>
  244. </div>
  245. </template>
  246. <div id="timeLineContainer" style="border: 1px solid rgb(205, 205, 205);background: #eaf7f6;padding: 10px;">
  247. <el-timeline>
  248. <el-timeline-item v-for="(obj, index1) in lushuDayDetailList" :key="index1"
  249. color="#4295df" size="large" timestamp="">
  250. <div style="justify-content: space-between;display: flex;">
  251. {{index1+1}}.{{obj.name}}
  252. <el-tooltip class="item" effect="light" content="删除" placement="top">
  253. <i class="el-icon-close" style="cursor:pointer;" @click="deletePointFun(obj,index1)"></i>
  254. </el-tooltip>
  255. </div>
  256. <div v-if="obj.distance" @mouseover="showTwoPointRouteOnMap(obj)" @mouseout="clearLayer" style="padding-left: 20px;padding-top: 10px;display: flex;
  257. justify-content: space-between;width: 180px;align-items: center;">
  258. <img style="width: 16px;height: 16px;" src="../assets/car.png" alt="">
  259. <p style="color: #4295df;font-size: 12px;">{{obj.distance>1000?(obj.distance/1000).toFixed(2)+'公里':obj.distance+'米'}}</p>
  260. <p style="color: #4295df;font-size: 12px;">{{'约'+(obj.consuming/3600).toFixed(1)+'小时'}}</p>
  261. </div>
  262. </el-timeline-item>
  263. <el-timeline-item color="#4295df" size="large" timestamp="">
  264. <div style="display: flex;height: 100%;align-items: center;cursor:pointer;
  265. font-size: 14px;color: #4295df;" @click="showSearchWidgetFun">
  266. <i class="el-icon-search"></i>
  267. <p>搜索添加新的目的地</p>
  268. </div>
  269. </el-timeline-item>
  270. </el-timeline>
  271. <!-- <div style="display: flex;height: 100%;align-items: center;cursor:pointer;
  272. justify-content: center;font-size: 14px;color: #4295df;" @click="showSearchWidgetFun(obj)">
  273. <i class="el-icon-search"></i>
  274. <p>搜索添加新的目的地</p>
  275. </div> -->
  276. </div>
  277. </el-collapse-item>
  278. </el-collapse>
  279. </div>
  280. <div style="height:35px;display: flex;justify-content: center;">
  281. <div @click="addDayToLushuFun" style="width: 95%;height: 100%;align-items: center;display: flex;cursor:pointer;
  282. justify-content: center;flex-direction: row;border: 1px dashed #009cfa;">
  283. <i class="el-icon-plus"></i>
  284. <p>添加一天</p>
  285. </div>
  286. </div>
  287. </div>
  288. <!-- 添加路书 -->
  289. <el-dialog title="添加路书" :visible.sync="showAddLushuDialog" width="30%" :modal-append-to-body="false">
  290. <el-form :model="form">
  291. <el-form-item label="路书名称:" :label-width="formLabelWidth">
  292. <el-input v-model="lushuName" autocomplete="off" style="width:220px;"></el-input>
  293. </el-form-item>
  294. <el-form-item label="出发时间:" :label-width="formLabelWidth">
  295. <el-date-picker v-model="lushuDate" type="date" placeholder="选择出发日期" value-format="yyyy-MM-dd"></el-date-picker>
  296. </el-form-item>
  297. </el-form>
  298. <div slot="footer" class="dialog-footer">
  299. <el-button @click="showAddLushuDialog = false">取 消</el-button>
  300. <el-button type="primary" @click="addLushuHandlerFun">确 定</el-button>
  301. </div>
  302. </el-dialog>
  303. <!-- 编辑路书 -->
  304. <el-dialog title="编辑路书" :visible.sync="showEditLushuDialog" width="30%" :modal-append-to-body="false">
  305. <el-form :model="form">
  306. <el-form-item label="路书名称:" :label-width="formLabelWidth">
  307. <el-input v-model="lushuName_edit" autocomplete="off" style="width:220px;"></el-input>
  308. </el-form-item>
  309. <el-form-item label="出发时间:" :label-width="formLabelWidth">
  310. <el-date-picker v-model="lushuDate_edit" type="date" placeholder="选择出发日期" value-format="yyyy-MM-dd"></el-date-picker>
  311. </el-form-item>
  312. </el-form>
  313. <div slot="footer" class="dialog-footer">
  314. <el-button @click="showEditLushuDialog = false">取 消</el-button>
  315. <el-button type="primary" @click="editLushuHandlerFun">确 定</el-button>
  316. </div>
  317. </el-dialog>
  318. <div id="searchWidgetContainer" v-if="showSearchWidget" style="position: fixed;left: 365px;top: 100px;">
  319. <el-input placeholder="请输入内容" v-model="searchWidgetInput" clearable class="input-with-select" size="medium">
  320. <!-- <i slot="append" style="cursor:pointer;" class="el-icon-search"></i> -->
  321. <i slot="append" style="cursor:pointer;" class="el-icon-close" @click="closeSearchWidgetFun"></i>
  322. </el-input>
  323. <div id="lushuPoiContainer" style="background-color: #ffffff;margin-top: 5px;" v-if="showLushuPoiList">
  324. <div class="poiListClass" style="cursor:pointer;" v-for="(item,index) in lushuPois" :key="index" @click="showLushuPoiDetailFun(item)">
  325. <i class="el-icon-location-outline"></i>
  326. <span style="color: #4295df;">{{item.name}}</span>
  327. <!-- <span style="font-size: small;color: #aaaaaa;padding-left: 10px;">{{item.cityname}}{{item.adname}}</span> -->
  328. <span style="font-size: small;color: #aaaaaa;padding-left: 10px;">{{item.district}}</span>
  329. </div>
  330. </div>
  331. <div id="lushuPoiDetailContainer" style="background-color: #ffffff;margin-top: 5px;display: flex;
  332. width: 350px;justify-content: space-between;" v-if="showLushuPoiDetail">
  333. <div style="width: 84px;height: 84px;padding: 15px;">
  334. <img v-if="lushuPoiDetail.photos.length>0" :src="lushuPoiDetail.photos[0].url" alt="" style="width: 100%;height: 100%;">
  335. </div>
  336. <div style="width: 186px;">
  337. <p style="padding-top: 15px;">1.{{lushuPoiDetail.name}}</p>
  338. <p style="padding: 5px;color: #b8b2b2;font-size: 14px;">{{lushuPoiDetail.address}}</p>
  339. </div>
  340. <div style="width: 50px;align-items: center;display: flex;justify-content: center;">
  341. <el-button @click="addPoiToLushuDayFun" style="color:white;" size='mini' icon="el-icon-plus"></el-button>
  342. </div>
  343. </div>
  344. </div>
  345. </div>
  346. </template>
  347. <script>
  348. import {mapExtent} from '../config/lyrConfig.js'
  349. import { getAdData} from "../../../api/duChaAPI.js";
  350. import {getMyBiaoJi,getLushuList,addLushuHandler,deleteLushuHandler,getLushuDetail,editLushuHandler,getLushuDayList,
  351. addPointToDay,addDayToLushu,getPointByDayId,deletePoint,updatePoint,deleteDay} from '../../../api/zhxxAPI.js'
  352. import {_getLngLat} from '../js/mercatorToLngLat'
  353. import request from "../../../utils/gw_ajax_request.js"
  354. import {dateFormat} from "../../../utils/gw_date.js"
  355. import axios from 'axios'
  356. export default {
  357. components: {
  358. },
  359. props:['view','map','fullExtent'],
  360. data () {
  361. return {
  362. form:{},
  363. formLabelWidth:'180px',
  364. currentCityCode:'',//当前城市编码
  365. currentText:'',//当前输入的是 起点还是终点
  366. currentStartLocation:'',//起点经纬度 字符串
  367. currentEndLocation:'',//终点经纬度
  368. showDaoHangPanel:false,
  369. showDaoHanButton:'car',
  370. startText:'',
  371. endText:'',
  372. currentStatus:{
  373. currentType:'global',
  374. currentTitle:'全国',
  375. currentCode:'000000000000',
  376. },
  377. naviStateStack:[{title:'全国',type:'global',code:'000000000000'}],
  378. currentAdCode:'',
  379. currentAdName:'',
  380. nextLevelXzq:[],
  381. showXzqPanel:false,
  382. showToolPanel:false,
  383. viewObject:null,
  384. mapObject:null,
  385. fullExtent1:null,
  386. measureGraphicLayer:null,
  387. measureLengthGraphicLayer_lable:null,
  388. draw:null,//测量对象
  389. helpTooltipElement:null,
  390. measureTooltipElement:null,
  391. continuePolygonMsg: 'Click to continue drawing the polygon',
  392. continueLineMsg :'Click to continue drawing the line',
  393. sketch:null,
  394. helpTooltip:null,
  395. measureTooltip:null,
  396. pois:[],
  397. showPoiList:false,
  398. trafficSteps:{},//交通路线
  399. showStepPanel:false,
  400. showBiaoJiPanel:false,//标记list
  401. tableResultData:[],//标记列表
  402. currentFocus:'',//当前focus位置 起点还是终点
  403. lushuList:[],//路书列表
  404. showLushuList:false,//显示路书列表
  405. lushuHeight:window.innerHeight * 0.8 - 120,
  406. lushuDetailHeight:window.innerHeight * 0.8 - 140,
  407. showAddLushuDialog:false,//显示添加路书对话框
  408. lushuDate:'',//新建路书 出发时间
  409. lushuName:'',//新建路书 名称
  410. showLushuDetail:false,//显示路书详情
  411. currentLushuBaseInfo:{},//当前路书基本信息
  412. showEditLushuDialog:false,//显示编辑路书对话框
  413. lushuName_edit:'',
  414. lushuDate_edit:'',
  415. lushuDayList:[],//路书日程列表
  416. activeNames:'1',
  417. lushuDayDetailList:[],//路书单日行程列表
  418. showSearchWidget:false,
  419. searchWidgetInput:'',
  420. showLushuPoiList:false,//显示路书POI列表
  421. lushuPois:[],//路书POI列表
  422. showLushuPoiDetail:false,//显示路书单个POI详情
  423. lushuPoiDetail:{},//路书POI详情对象 通过高德接口获取
  424. currentOpenLushuDay:{},//当前打开的路书当中的某一天
  425. }
  426. },
  427. computed:{
  428. userId: function () {
  429. return localStorage.getItem("userid") ?localStorage.getItem("userid") : "1098101939614724096";
  430. },
  431. },
  432. mounted:function() {
  433. this.currentAdCode = localStorage.getItem('areacode') ? localStorage.getItem('areacode') : '000000000000';
  434. this.currentAdName = localStorage.getItem('areaname') ? localStorage.getItem('areaname') : '全国';
  435. if(this.currentAdCode == "undefined"){
  436. this.currentAdCode = '000000000000';
  437. }
  438. this.currentStatus.currentCode = this.currentAdCode;
  439. this.currentStatus.currentTitle = this.currentAdName;
  440. this.getAdData();
  441. this.mapObject = this.map;
  442. this.startText = '';
  443. this.endText = '';
  444. },
  445. watch: {
  446. map(n,o){
  447. this.mapObject = n;
  448. },
  449. fullExtent(n,o){
  450. this.fullExtent1 = n;
  451. },
  452. startText(n,o){
  453. this.inputChange(n,'start')
  454. },
  455. endText(n,o){
  456. this.inputChange(n,'end')
  457. },
  458. searchWidgetInput(n,o){
  459. this.searchWidgetInputChange(n);
  460. }
  461. },
  462. methods: {
  463. hide(){
  464. this.showXzqPanel = false;
  465. this.showToolPanel = false;
  466. },
  467. closeDaoHangPanel(){
  468. this.showDaoHangPanel = false;
  469. this.showPoiList = false;
  470. this.showStepPanel = false;
  471. this.showBiaoJiPanel = false;
  472. this.clearHandler();
  473. },
  474. detailRouteOnMap(item){//定位具体路线
  475. var _self = this;
  476. var ol = _self.$ol;
  477. var arr1 = item.tmcs;
  478. var vertices = [];
  479. for(var n=0;n<arr1.length;n++){
  480. var str = arr1[n].polyline;
  481. var arr2 = str.split(";");
  482. for(var j=0;j<arr2.length;j++){
  483. var arr3 = arr2[j].split(",");
  484. var arr4 = [];
  485. for(var m=0;m<arr3.length;m++){
  486. arr4.push(parseFloat(arr3[m]));
  487. }
  488. vertices.push(ol.proj.transform(arr4, "EPSG:4326", "EPSG:3857"));
  489. }
  490. }
  491. var polyline = new ol.geom.LineString(vertices)
  492. _self.mapObject.getView().fit(polyline.getExtent())
  493. },
  494. showRouteOnMap(){//地图上展示导航路线
  495. var _self = this;
  496. var ol = _self.$ol;
  497. _self.clearHandler();
  498. var iconStyle_start = new ol.style.Style({
  499. image: new ol.style.Icon(({
  500. anchor: [0.5, 0.5],
  501. scale:1,
  502. src: '/src/views/zongHeXinXiOl/assets/xhstart.png'
  503. }))
  504. });
  505. var iconStyle_end = new ol.style.Style({
  506. image: new ol.style.Icon(({
  507. anchor: [0.5, 0.5],
  508. scale:1,
  509. src: '/src/views/zongHeXinXiOl/assets/xhend.png'
  510. }))
  511. });
  512. var symbol_green = new ol.style.Style({
  513. stroke:new ol.style.Stroke({
  514. color: '#00ff00',
  515. width: 7,
  516. lineCap:'round'
  517. })
  518. })
  519. var symbol_yellow = new ol.style.Style({
  520. stroke:new ol.style.Stroke({
  521. color: '#ffff00',
  522. width: 7,
  523. lineCap:'round'
  524. })
  525. })
  526. var symbol_red = new ol.style.Style({
  527. stroke:new ol.style.Stroke({
  528. color: '#ff0000',
  529. width: 7,
  530. lineCap:'round'
  531. })
  532. })
  533. var symbol_red1 = new ol.style.Style({
  534. stroke:new ol.style.Stroke({
  535. color: '#700000',
  536. width: 7,
  537. lineCap:'round'
  538. })
  539. })
  540. var iconFeature,symbolFeature;
  541. var features = [];
  542. var ext = [];
  543. if(_self.currentStartLocation && _self.currentEndLocation){
  544. var arr3 = _self.currentStartLocation.split(",");
  545. var arr4 = [];
  546. for(var m1=0;m1<arr3.length;m1++){
  547. arr4.push(parseFloat(arr3[m1]));
  548. }
  549. iconFeature = new ol.Feature({
  550. geometry: new ol.geom.Point(ol.proj.transform([arr4[0],arr4[1]], "EPSG:4326", "EPSG:3857")),
  551. name: '导航起点'
  552. });
  553. iconFeature.setStyle(iconStyle_start);
  554. features.push(iconFeature);
  555. var arr5 = _self.currentEndLocation.split(",");
  556. var arr6 = [];
  557. for(var m2=0;m2<arr5.length;m2++){
  558. arr6.push(parseFloat(arr5[m2]));
  559. }
  560. ext = [arr4[0],arr4[1],arr6[0],arr6[1]]
  561. iconFeature = new ol.Feature({
  562. geometry: new ol.geom.Point(ol.proj.transform([arr6[0],arr6[1]], "EPSG:4326", "EPSG:3857")),
  563. name: '导航终点'
  564. });
  565. iconFeature.setStyle(iconStyle_end);
  566. features.push(iconFeature);
  567. }
  568. var arr = _self.trafficSteps.steps;
  569. for(var i=0;i<arr.length;i++){
  570. var arr1 = arr[i].tmcs;
  571. for(var n=0;n<arr1.length;n++){
  572. var str = arr1[n].polyline;
  573. var arr2 = str.split(";");
  574. var vertices = [];
  575. for(var j=0;j<arr2.length;j++){
  576. var arr3 = arr2[j].split(",");
  577. var arr4 = [];
  578. for(var m=0;m<arr3.length;m++){
  579. arr4.push(parseFloat(arr3[m]));
  580. }
  581. vertices.push(ol.proj.transform(arr4, "EPSG:4326", "EPSG:3857"));
  582. }
  583. var polyline = new ol.geom.LineString(vertices)
  584. var symbol;
  585. if(arr1[n].status == "缓行"){
  586. symbol = symbol_yellow
  587. }else if(arr1[n].status == "拥堵"){
  588. symbol = symbol_red
  589. }else if(arr1[n].status == "严重拥堵"){
  590. symbol = symbol_red1
  591. }else{
  592. symbol = symbol_green
  593. }
  594. var routeFeature = new ol.Feature({
  595. name: '导航路线',
  596. geometry: polyline
  597. });
  598. routeFeature.setStyle(symbol);
  599. features.push(routeFeature)
  600. }
  601. }
  602. var vectorSource = new ol.source.Vector({
  603. features: features
  604. });
  605. var vectorLayer = new ol.layer.Vector({
  606. source: vectorSource,
  607. id:'ls_route'
  608. });
  609. _self.mapObject.addLayer(vectorLayer);
  610. _self.mapObject.getView().fit(vectorLayer.getSource().getExtent())
  611. },
  612. showDaoHang(){
  613. this.showDaoHangPanel = true;
  614. },
  615. getLocationFromMap(type,longLat){
  616. var _self = this;
  617. _self.startText = '';
  618. _self.endText = '';
  619. var ol = _self.$ol;
  620. if(type == 'start'){
  621. var arr = ol.proj.transform(longLat, "EPSG:3857", "EPSG:4326")
  622. _self.currentEndLocation = arr.join(",");
  623. _self.getAddressByLongLat(type,_self.currentEndLocation);
  624. }else{
  625. var arr = ol.proj.transform(longLat, "EPSG:3857", "EPSG:4326")
  626. _self.currentEndLocation = arr.join(",");
  627. _self.getAddressByLongLat(type,_self.currentEndLocation);
  628. }
  629. },
  630. //根据经纬度获取地理位置描述
  631. getAddressByLongLat(type,location){
  632. var _self = this;
  633. axios.get('https://restapi.amap.com/v3/geocode/regeo?parameters',{
  634. params: {
  635. location:location,
  636. output:'json',
  637. key:'481d08235e1dc266e0f979db1d86162c',
  638. }
  639. }).then((res)=>{
  640. console.log('car');
  641. if(res.data.status == "1"){
  642. if(type == 'start'){
  643. _self.startText = res.data.regeocode.formatted_address;
  644. }else{
  645. _self.endText = res.data.regeocode.formatted_address;
  646. }
  647. }
  648. })
  649. },
  650. trafficButtonClick(val){//驾车 公交 步行
  651. var _self = this;
  652. if(_self.startText == ''){
  653. if(_self.showPoiList){
  654. _self.$message.warning('请选择起点!');
  655. }else{
  656. _self.$message.warning('请输入起点!');
  657. }
  658. return;
  659. }
  660. if(_self.endText == ''){
  661. if(_self.showPoiList){
  662. _self.$message.warning('请选择终点!');
  663. }else{
  664. _self.$message.warning('请输入终点!');
  665. }
  666. return;
  667. }
  668. if(val == "car"){
  669. axios.get('https://restapi.amap.com/v3/direction/driving',{
  670. // axios.get('/GDAPI/v3/direction/driving',{
  671. params: {
  672. origin:_self.currentStartLocation,
  673. destination:_self.currentEndLocation,
  674. output:'json',
  675. key:'481d08235e1dc266e0f979db1d86162c',
  676. }
  677. }).then((res)=>{
  678. console.log('car');
  679. if(res.data.status == "1"){
  680. _self.showStepPanel = true;
  681. _self.trafficSteps = res.data.route.paths[0];
  682. _self.showRouteOnMap();
  683. }
  684. })
  685. }else if(val == "bus"){
  686. axios.get('/GDAPI/v3/direction/transit/integrated',{
  687. params: {
  688. origin:_self.currentStartLocation,
  689. destination:_self.currentEndLocation,
  690. output:'json',
  691. key:'481d08235e1dc266e0f979db1d86162c',
  692. }
  693. }).then((res)=>{
  694. console.log('bus');
  695. if(res.data.status == "1"){
  696. }
  697. })
  698. }else if(val == "walk"){
  699. }
  700. },
  701. poiListClick(item){//模糊查询列表 点击
  702. var _self = this;
  703. if(_self.currentText == "start"){
  704. _self.startText = item.name;
  705. _self.currentStartLocation = item.location;
  706. }else{
  707. _self.endText = item.name;
  708. _self.currentEndLocation = item.location;
  709. }
  710. _self.showPoiList = false;
  711. },
  712. inputChange(val,type){//input输入内后后 关键字模糊查询
  713. var _self = this;
  714. _self.showPoiList = true;//打开poi
  715. _self.showBiaoJiPanel = false;//关闭标记
  716. _self.showStepPanel = false;//关闭详情路线
  717. _self.currentText = type;
  718. // if(type == "start"){
  719. // _self.currentStartLocation = '';
  720. // }else{
  721. // _self.currentEndLocation = '';
  722. // }
  723. // axios.get('https://restapi.amap.com/v3/place/text',{
  724. // axios.get('/GDAPI/v3/assistant/inputtips',{
  725. axios.get('https://restapi.amap.com/v3/assistant/inputtips',{
  726. params: {
  727. keywords:val,
  728. output:'json',
  729. offset:20,
  730. page:1,
  731. city:_self.currentCityCode,
  732. key:'481d08235e1dc266e0f979db1d86162c',
  733. }
  734. }).then((res)=>{
  735. console.log('succ');
  736. if(res.data.status =='1'){
  737. // _self.pois = res.data.pois;
  738. _self.pois = res.data.tips;
  739. }
  740. })
  741. },
  742. clickBiaoJiHandler(item){//点击标记列表 给起点终点赋值
  743. var _self = this;
  744. var ol = _self.$ol;
  745. var lgtd84 = item.lgtd;
  746. var lttd84 = item.lttd;
  747. // var lgtd102100 = ol.proj.transform([lgtd84,lttd84], "EPSG:4326", "EPSG:3857")[0]
  748. // var lttd102100 = ol.proj.transform([lgtd84,lttd84], "EPSG:4326", "EPSG:3857")[1];
  749. if(_self.currentFocus == 'start'){
  750. _self.currentStartLocation = String(lgtd84.toFixed(6))+","+String(lttd84.toFixed(6));
  751. _self.startText = item.inteName;
  752. }else if(_self.currentFocus == 'end'){
  753. _self.currentEndLocation = String(lgtd84.toFixed(6))+","+String(lttd84.toFixed(6));
  754. _self.endText = item.inteName;
  755. }
  756. },
  757. startFocusHandler(evt){
  758. var _self = this;
  759. console.log('开始 标记');
  760. _self.currentFocus = 'start';
  761. getMyBiaoJi(_self.userId,'','','',1,1000).then((res)=>{
  762. if(res.success){
  763. console.log('biaoji')
  764. _self.tableResultData = res.data.list;
  765. _self.showPoiList = false;//关闭poi
  766. _self.showBiaoJiPanel = true;//打开标记
  767. _self.showStepPanel = false;//关闭详情路线
  768. }
  769. });
  770. },
  771. endFocusHandler(evt){
  772. var _self = this;
  773. console.log(evt);
  774. _self.currentFocus = 'end';
  775. getMyBiaoJi(_self.userId,'','','',1,1000).then((res)=>{
  776. if(res.success){
  777. console.log('biaoji')
  778. _self.tableResultData = res.data.list;
  779. _self.showPoiList = false;//关闭poi
  780. _self.showBiaoJiPanel = true;//打开标记
  781. _self.showStepPanel = false;//关闭详情路线
  782. }
  783. });
  784. },
  785. chooseTraffic(val){//选择交通工具
  786. this.showDaoHanButton = val;
  787. },
  788. startChangeEndHandler(){
  789. var str = this.startText;
  790. this.startText = this.endText;
  791. this.endText = str;
  792. var str1 = this.currentStartLocation;
  793. this.currentStartLocation = this.currentEndLocation;
  794. this.currentEndLocation = str1;
  795. },
  796. mapToolHandler:function(item){
  797. this.$emit("mapToolHandler",item);
  798. },
  799. showToolPanelHandler(){
  800. this.showToolPanel = !this.showToolPanel;
  801. if(this.showToolPanel){
  802. this.showXzqPanel = false;
  803. this.$emit('hide')
  804. }
  805. },
  806. showPanel:function(){
  807. this.showXzqPanel = !this.showXzqPanel;
  808. if(this.showXzqPanel){
  809. this.$emit('hide')
  810. this.showToolPanel = false;
  811. }
  812. },
  813. getAdData:function(){
  814. var _self = this;
  815. getAdData(_self.currentAdCode).then((response)=>{
  816. _self.nextLevelXzq = response.data;
  817. });
  818. },
  819. backToStep:function(item){
  820. this.currentStatus={
  821. currentType:item.type,
  822. currentTitle:item.title,
  823. currentCode:item.code,
  824. };
  825. var arr = [];
  826. for(var i=0;i<this.naviStateStack.length;i++){
  827. if(this.naviStateStack[i].code == item.code){
  828. for(var j=0;j<=i;j++){
  829. arr.push(this.naviStateStack[j]);
  830. }
  831. this.naviStateStack = arr;
  832. }
  833. }
  834. this.currentAdCode = item.code;
  835. this.getAdData();
  836. this.$emit("clickAd",{'adCode':item.code,"adName":item.title,"adGrad":item.adGrad});
  837. },
  838. closeNavigationPanel:function(item){
  839. this.showXzqPanel = false;
  840. },
  841. clickAd:function(item){
  842. this.currentStatus={
  843. currentType:'xzq',
  844. currentTitle:item.adName,
  845. currentCode:item.adCode,
  846. currentAdGrad:item.adGrad
  847. };
  848. this.naviStateStack.push({
  849. title:item.adName,
  850. type:'xzq',
  851. code:item.adCode,
  852. adGrad:item.adGrad
  853. });
  854. this.currentAdCode = item.adCode;
  855. this.getAdData();
  856. this.$emit("clickAd",item);
  857. // this.showXzqPanel = false;
  858. },
  859. click:function(item){
  860. var _self = this;
  861. var ol = _self.$ol;
  862. _self.showToolPanel = false;
  863. if(item == "fullExtent"){
  864. var view = new ol.View({
  865. center:mapExtent.center,
  866. zoom:mapExtent.zoom
  867. });
  868. _self.mapObject.setView(view);
  869. }else if(item == "clear"){
  870. _self.clearHandler();
  871. }else if(item == "measureDistance"){
  872. _self.measureHandler('LineString');
  873. }else if(item == "measureArea"){
  874. _self.measureHandler('Polygon');
  875. }else if(item == "biaoji"){
  876. _self.bjHandler();
  877. }else if(item == "daohang"){
  878. _self.showDaoHangPanel = !_self.showDaoHangPanel;
  879. if(!_self.showDaoHangPanel){
  880. _self.showStepPanel = false;
  881. }
  882. }else if(item == "chaxun"){
  883. _self.$emit('eventHandler',item);//一张图查询
  884. }else if(item == "lushu"){
  885. _self.showLushuList = !_self.showLushuList;
  886. if(_self.showLushuList){
  887. _self.getLushuListFun();
  888. }
  889. }else if(item == 'jietu'){
  890. _self.$emit('eventHandler',item);
  891. }
  892. },
  893. //获取路书列表
  894. getLushuListFun(){
  895. var _self = this;
  896. getLushuList(_self.userId).then((res)=>{
  897. if(res.success){
  898. _self.lushuList = res.data;
  899. _self.activeNames = '1';
  900. _self.lushuList.forEach((item)=>{
  901. if(item.sttm){
  902. item['stDate'] = dateFormat(item.sttm,'yyyy-MM-dd');
  903. }
  904. if(item.entm){
  905. item['enDate'] = dateFormat(item.entm,'yyyy-MM-dd');
  906. }
  907. })
  908. }
  909. })
  910. },
  911. //关闭路书
  912. closeLushu(){
  913. this.showLushuList = false;
  914. this.clearHandler();
  915. },
  916. //点击添加路书按钮 弹出添加对话框
  917. addLushu(){
  918. this.lushuName = '';
  919. this.lushuDate = '';
  920. this.showAddLushuDialog = true;
  921. },
  922. //添加路书
  923. addLushuHandlerFun(){
  924. var obj = {
  925. persId:this.userId,
  926. title:this.lushuName,
  927. sttm:this.lushuDate
  928. }
  929. addLushuHandler(obj).then((res)=>{
  930. if(res.success){
  931. this.$message({
  932. message: '添加成功',
  933. type: 'success'
  934. });
  935. this.getLushuListFun();
  936. this.showAddLushuDialog = false;
  937. }
  938. })
  939. },
  940. //编辑路书保存
  941. editLushuHandlerFun(){
  942. var obj = {
  943. id:this.currentLushuBaseInfo.id,
  944. persId:this.userId,
  945. title:this.lushuName_edit,
  946. sttm:this.lushuDate_edit
  947. }
  948. editLushuHandler(obj).then((res)=>{
  949. if(res.success){
  950. this.$message({
  951. message: '编辑成功',
  952. type: 'success'
  953. });
  954. this.showLushuDetailFun(this.currentLushuBaseInfo);
  955. this.showEditLushuDialog = false;
  956. }
  957. })
  958. },
  959. //删除路书
  960. deleteLuShuFun(item){
  961. this.$confirm('确认删除该信息吗?', '提示', {
  962. confirmButtonText: '确定',
  963. cancelButtonText: '取消',
  964. type: 'warning'
  965. }).then(() => {
  966. deleteLushuHandler(item.id).then((res)=>{
  967. if(res.success){
  968. this.$message({
  969. message: '删除成功',
  970. type: 'success'
  971. });
  972. this.getLushuListFun();
  973. }
  974. })
  975. }).catch(() => {
  976. });
  977. },
  978. //查看路书详情
  979. showLushuDetailFun(item){
  980. //查询路书基本信息
  981. getLushuDetail(item.id).then((res)=>{
  982. if(res.success){
  983. this.currentLushuBaseInfo = res.data;
  984. this.showLushuDetail = true;
  985. this.showLushuList = false;
  986. }
  987. })
  988. this.getLushuDayListFun(item);
  989. },
  990. //查询路书日程列表
  991. getLushuDayListFun(item){
  992. var _self = this;
  993. //查询路书日程列表
  994. getLushuDayList(item.id).then((res)=>{
  995. if(res.success){
  996. _self.lushuDayList = res.data;
  997. _self.activeNames = '1';
  998. if(_self.lushuDayList.length == 0){
  999. //如果路书日程为空 则调用一遍添加日程接口 默认自带一天日程
  1000. _self.addDayToLushuFun();
  1001. }else{
  1002. _self.currentOpenLushuDay = _self.lushuDayList[0];
  1003. //查询第一天途径点信息
  1004. _self.getPointByDayIdFun();
  1005. }
  1006. }
  1007. })
  1008. },
  1009. //查询第一天途径点信息
  1010. getPointByDayIdFun(){
  1011. var _self = this;
  1012. _self.clearHandler();
  1013. getPointByDayId(_self.currentOpenLushuDay.id).then((res)=>{
  1014. if(res.success){
  1015. _self.lushuDayDetailList = res.data;
  1016. var temp = _self.lushuDayDetailList;
  1017. if(temp.length == 1){//只有一个点 地图上显示点
  1018. _self.addPointToMap(temp[0].lgtd,temp[0].lttd);
  1019. }else if(temp.length > 1){//两个点及以上 地图上显示点和线
  1020. for(var i=0;i<temp.length-1;i++){
  1021. _self.addPointAndRouteToMap({x:temp[i].lgtd,y:temp[i].lttd},{x:temp[i+1].lgtd,y:temp[i+1].lttd},i+1)
  1022. }
  1023. }
  1024. }
  1025. })
  1026. },
  1027. //添加点和线到地图上
  1028. addPointAndRouteToMap(obj1,obj2,index){
  1029. var _self = this;
  1030. var ol = _self.$ol;
  1031. var pt1 = new ol.geom.Point(ol.proj.transform([obj1.x,obj1.y], "EPSG:4326", "EPSG:3857"));
  1032. var pt2 = new ol.geom.Point(ol.proj.transform([obj2.x,obj2.y], "EPSG:4326", "EPSG:3857"));
  1033. axios.get('https://restapi.amap.com/v3/direction/driving',{
  1034. params: {
  1035. origin:String(obj1.x.toFixed(6))+","+String(obj1.y.toFixed(6)),
  1036. destination:String(obj2.x.toFixed(6))+","+String(obj2.y.toFixed(6)),
  1037. output:'json',
  1038. key:'481d08235e1dc266e0f979db1d86162c',
  1039. }
  1040. }).then((res)=>{
  1041. console.log('car');
  1042. if(res.data.status == "1"){
  1043. var iconStyle1 = new ol.style.Style({
  1044. image: new ol.style.Icon(({
  1045. anchor: [0.5, 0.5],
  1046. scale:0.8,
  1047. src: '/src/views/zongHeXinXiOl/assets/location/location'+index+'.png'
  1048. }))
  1049. });
  1050. var iconStyle2 = new ol.style.Style({
  1051. image: new ol.style.Icon(({
  1052. anchor: [0.5, 0.5],
  1053. scale:0.8,
  1054. src: '/src/views/zongHeXinXiOl/assets/location/location'+(index+1)+'.png'
  1055. }))
  1056. });
  1057. var symbol_green = new ol.style.Style({
  1058. stroke:new ol.style.Stroke({
  1059. color: '#00ff00',
  1060. width: 7,
  1061. lineCap:'round'
  1062. })
  1063. })
  1064. var symbol_yellow = new ol.style.Style({
  1065. stroke:new ol.style.Stroke({
  1066. color: '#ffff00',
  1067. width: 7,
  1068. lineCap:'round'
  1069. })
  1070. })
  1071. var symbol_red = new ol.style.Style({
  1072. stroke:new ol.style.Stroke({
  1073. color: '#ff0000',
  1074. width: 7,
  1075. lineCap:'round'
  1076. })
  1077. })
  1078. var symbol_red1 = new ol.style.Style({
  1079. stroke:new ol.style.Stroke({
  1080. color: '#700000',
  1081. width: 7,
  1082. lineCap:'round'
  1083. })
  1084. })
  1085. var features1 = [];
  1086. var arr = res.data.route.paths[0].steps;
  1087. for(var i=0;i<arr.length;i++){
  1088. var arr1 = arr[i].tmcs;
  1089. for(var n=0;n<arr1.length;n++){
  1090. var str = arr1[n].polyline;
  1091. var arr2 = str.split(";");
  1092. var vertices = [];
  1093. for(var j=0;j<arr2.length;j++){
  1094. var arr3 = arr2[j].split(",");
  1095. var arr4 = [];
  1096. for(var m=0;m<arr3.length;m++){
  1097. arr4.push(parseFloat(arr3[m]));
  1098. }
  1099. vertices.push(ol.proj.transform(arr4, "EPSG:4326", "EPSG:3857"));
  1100. }
  1101. var polyline = new ol.geom.LineString(vertices)
  1102. var symbol;
  1103. if(arr1[n].status == "缓行"){
  1104. symbol = symbol_yellow
  1105. }else if(arr1[n].status == "拥堵"){
  1106. symbol = symbol_red
  1107. }else if(arr1[n].status == "严重拥堵"){
  1108. symbol = symbol_red1
  1109. }else{
  1110. symbol = symbol_green
  1111. }
  1112. var routeFeature = new ol.Feature({
  1113. name: '导航路线',
  1114. geometry: polyline
  1115. });
  1116. routeFeature.setStyle(symbol);
  1117. features1.push(routeFeature)
  1118. }
  1119. }
  1120. var vectorSource1 = new ol.source.Vector({
  1121. features: features1
  1122. });
  1123. var vectorLayer1 = new ol.layer.Vector({
  1124. source: vectorSource1,
  1125. id:'ls_lushuRoute'
  1126. });
  1127. _self.mapObject.addLayer(vectorLayer1);
  1128. _self.mapObject.getView().fit(vectorLayer1.getSource().getExtent())
  1129. _self.mapObject.getView().setZoom(_self.mapObject.getView().getZoom()-1)
  1130. var features = [];
  1131. var iconFeature1 = new ol.Feature({
  1132. geometry: pt1,
  1133. name: '路书日程点'
  1134. });
  1135. iconFeature1.setStyle(iconStyle1);
  1136. features.push(iconFeature1);
  1137. var iconFeature2 = new ol.Feature({
  1138. geometry: pt2,
  1139. name: '路书日程点'
  1140. });
  1141. iconFeature2.setStyle(iconStyle2);
  1142. features.push(iconFeature2);
  1143. var vectorSource = new ol.source.Vector({
  1144. features: features
  1145. });
  1146. var vectorLayer = new ol.layer.Vector({
  1147. source: vectorSource,
  1148. id:'ls_lushuPoint'
  1149. });
  1150. _self.mapObject.addLayer(vectorLayer);
  1151. }
  1152. })
  1153. },
  1154. //地图上添加点
  1155. addPointToMap(x,y){
  1156. var _self = this;
  1157. var ol = _self.$ol;
  1158. _self.clearHandler();
  1159. var iconStyle = new ol.style.Style({
  1160. image: new ol.style.Icon(({
  1161. anchor: [0.5, 0.5],
  1162. scale:0.8,
  1163. src: '/src/views/zongHeXinXiOl/assets/location.png'
  1164. }))
  1165. });
  1166. var features = [];
  1167. var iconFeature = new ol.Feature({
  1168. geometry: new ol.geom.Point(ol.proj.transform([x,y], "EPSG:4326", "EPSG:3857")),
  1169. name: '路书日程点'
  1170. });
  1171. iconFeature.setStyle(iconStyle);
  1172. features.push(iconFeature);
  1173. var vectorSource = new ol.source.Vector({
  1174. features: features
  1175. });
  1176. var vectorLayer;
  1177. _self.mapObject.getLayers().forEach((val)=>{
  1178. if(val){
  1179. if(val.getProperties().id == 'ls_lushuPoint'){
  1180. vectorLayer = val;
  1181. vectorLayer.getSource().getFeatures().push(vectorSource);
  1182. }
  1183. }
  1184. });
  1185. if(!vectorLayer){
  1186. vectorLayer = new ol.layer.Vector({
  1187. source: vectorSource,
  1188. id:'ls_lushuPoint'
  1189. });
  1190. _self.mapObject.addLayer(vectorLayer);
  1191. }
  1192. _self.mapObject.getView().setCenter(ol.proj.transform([x,y], "EPSG:4326", "EPSG:3857"))
  1193. },
  1194. //添加日程到路书
  1195. addDayToLushuFun(){
  1196. var _self = this;
  1197. var obj = {
  1198. "travelPlanId": this.currentLushuBaseInfo.id,
  1199. }
  1200. addDayToLushu(obj).then((res)=>{
  1201. if(res.success){
  1202. _self.getLushuDayListFun(_self.currentLushuBaseInfo);
  1203. }
  1204. })
  1205. },
  1206. //后退至路书列表
  1207. lushuBackFun(){
  1208. this.showLushuDetail = false;
  1209. this.showLushuList = true;
  1210. this.getLushuListFun();
  1211. this.clearHandler();
  1212. },
  1213. //编辑路书基本信息
  1214. editLushu(item){
  1215. this.lushuName_edit = this.currentLushuBaseInfo.title;
  1216. this.lushuDate_edit = this.currentLushuBaseInfo.sttm;
  1217. this.showEditLushuDialog = true;
  1218. },
  1219. //显示搜索框
  1220. showSearchWidgetFun(item){
  1221. this.showSearchWidget = true;
  1222. },
  1223. //路书poi
  1224. searchWidgetInputChange(val){
  1225. var _self = this;
  1226. axios.get('https://restapi.amap.com/v3/assistant/inputtips',{
  1227. params: {
  1228. keywords:val,
  1229. output:'json',
  1230. offset:20,
  1231. page:1,
  1232. city:_self.currentCityCode,
  1233. key:'481d08235e1dc266e0f979db1d86162c',
  1234. }
  1235. }).then((res)=>{
  1236. console.log('succ');
  1237. if(res.data.status =='1'){
  1238. // _self.pois = res.data.pois;
  1239. _self.lushuPois = res.data.tips;
  1240. _self.showLushuPoiList = true;
  1241. _self.showLushuPoiDetail = false;
  1242. }
  1243. })
  1244. },
  1245. //点击POI列表 显示单个POI详情
  1246. showLushuPoiDetailFun(item){
  1247. var _self = this;
  1248. axios.get('https://restapi.amap.com/v3/place/detail',{
  1249. params: {
  1250. id:item.id,
  1251. output:'json',
  1252. key:'481d08235e1dc266e0f979db1d86162c',
  1253. }
  1254. }).then((res)=>{
  1255. console.log('getLushuPoiDetailScc');
  1256. if(res.data.status =='1'){
  1257. _self.lushuPoiDetail = res.data.pois[0];
  1258. _self.showLushuPoiList = false;
  1259. _self.showLushuPoiDetail = true;
  1260. }
  1261. })
  1262. },
  1263. //关闭路书搜索框 同时关闭路书POIlist及poiDetail
  1264. closeSearchWidgetFun(){
  1265. this.showSearchWidget = false;
  1266. this.showLushuPoiList = false;
  1267. this.showLushuPoiDetail = false;
  1268. this.lushuPoiDetail = {};
  1269. this.lushuPois = [];
  1270. },
  1271. //打开某一天 查询该天 点 详细信息
  1272. lushuDayChangeFun(val){
  1273. this.currentOpenLushuDay = this.lushuDayList[Number(val)-1];
  1274. console.log(this.currentOpenLushuDay);
  1275. this.getPointByDayIdFun();
  1276. },
  1277. //从某一天当中删除点
  1278. deletePointFun(item,index){
  1279. var _self = this;
  1280. this.$confirm('确认删除该信息吗?', '提示', {
  1281. confirmButtonText: '确定',
  1282. cancelButtonText: '取消',
  1283. type: 'warning'
  1284. }).then(() => {
  1285. deletePoint(item.id).then((res)=>{
  1286. if(res.success){
  1287. if(_self.lushuDayDetailList.length > 1 && _self.lushuDayDetailList.length == index+1){
  1288. //如果删除的是最后一个点 则把上一个点的距离和时间 清空
  1289. var obj1 = {
  1290. "consuming": null,
  1291. "distance": null,
  1292. "id": _self.lushuDayDetailList[index-1].id
  1293. }
  1294. updatePoint(obj1).then((res2)=>{
  1295. if(res2.success){
  1296. _self.getPointByDayIdFun();
  1297. }
  1298. })
  1299. }else if(index != 0){
  1300. //如果删除的是中间某一点,则重新计算上一个点和下一个点之间的距离和时间
  1301. _self.calculateDistanceAndTime(_self.lushuDayDetailList[index-1],_self.lushuDayDetailList[index+1]);
  1302. }
  1303. _self.getLushuDayListFun({id:_self.currentLushuBaseInfo.id});
  1304. }
  1305. })
  1306. }).catch(() => {
  1307. });
  1308. },
  1309. //从日程列表中删除某一天
  1310. deleteDayFun(item){
  1311. this.$confirm('确认删除该信息吗?', '提示', {
  1312. confirmButtonText: '确定',
  1313. cancelButtonText: '取消',
  1314. type: 'warning'
  1315. }).then(() => {
  1316. deleteDay(item.id).then((res)=>{
  1317. if(res.success){
  1318. //删除成功之后 刷新日行程列表
  1319. this.getLushuDayListFun({id:item.travelPlanId});
  1320. }
  1321. })
  1322. }).catch(() => {
  1323. });
  1324. },
  1325. //添加poi到路书某一天中
  1326. addPoiToLushuDayFun(){
  1327. // this.lushuPoiDetail
  1328. // this.currentOpenLushuDay
  1329. var _self = this;
  1330. var arr = this.lushuPoiDetail.location.split(',');
  1331. var obj = {
  1332. "addvcd": this.lushuPoiDetail.adcode,
  1333. "addvnm": this.lushuPoiDetail.adname,
  1334. "lgtd": Number(arr[0]),
  1335. "lttd": Number(arr[1]),
  1336. "name": this.lushuPoiDetail.name,
  1337. "planDayId": this.currentOpenLushuDay.id,
  1338. }
  1339. addPointToDay(obj).then((res)=>{
  1340. if(res.success){
  1341. //添加成功之后 刷新
  1342. getPointByDayId(_self.currentOpenLushuDay.id).then((res)=>{
  1343. if(res.success){
  1344. _self.lushuDayDetailList = res.data;
  1345. _self.searchWidgetInput = '';
  1346. _self.showLushuPoiDetail = false;
  1347. //如果添加点之后 大于两个点 则计算两点之间的距离及驾车所需时间 并调用更新接口
  1348. if(_self.lushuDayDetailList.length>=2){
  1349. var stDestination = _self.lushuDayDetailList[_self.lushuDayDetailList.length-2];
  1350. var endDestination = _self.lushuDayDetailList[_self.lushuDayDetailList.length-1];
  1351. _self.calculateDistanceAndTime(stDestination,endDestination);
  1352. _self.getLushuDayListFun({id:_self.currentLushuBaseInfo.id});
  1353. }
  1354. }
  1355. })
  1356. }
  1357. })
  1358. },
  1359. //计算两点之间距离和时间 并更新点接口
  1360. calculateDistanceAndTime(stDestination,endDestination){
  1361. var _self = this;
  1362. axios.get('https://restapi.amap.com/v3/direction/driving',{
  1363. params: {
  1364. origin:String(stDestination.lgtd.toFixed(6))+","+String(stDestination.lttd.toFixed(6)),
  1365. destination:String(endDestination.lgtd.toFixed(6))+","+String(endDestination.lttd.toFixed(6)),
  1366. output:'json',
  1367. key:'481d08235e1dc266e0f979db1d86162c',
  1368. }
  1369. }).then((res1)=>{
  1370. console.log('car');
  1371. if(res1.data.status == "1"){
  1372. var result = res1.data.route.paths[0];
  1373. var obj1 = {
  1374. "consuming": result.duration,
  1375. "distance": result.distance,
  1376. "id": stDestination.id
  1377. }
  1378. updatePoint(obj1).then((res2)=>{
  1379. if(res2.success){
  1380. _self.getPointByDayIdFun();
  1381. }
  1382. })
  1383. }
  1384. })
  1385. },
  1386. //鼠标移入日程中某一段 地图上显示线路
  1387. showTwoPointRouteOnMap(obj){
  1388. var _self = this;
  1389. var ol = _self.$ol;
  1390. _self.clearLayer();
  1391. for(var i=0;i<_self.lushuDayDetailList.length-1;i++){
  1392. if(_self.lushuDayDetailList[i].id == obj.id){
  1393. var obj2 = _self.lushuDayDetailList[i+1];
  1394. axios.get('https://restapi.amap.com/v3/direction/driving',{
  1395. params: {
  1396. origin:String(obj.lgtd.toFixed(6))+","+String(obj.lttd.toFixed(6)),
  1397. destination:String(obj2.lgtd.toFixed(6))+","+String(obj2.lttd.toFixed(6)),
  1398. output:'json',
  1399. key:'481d08235e1dc266e0f979db1d86162c',
  1400. }
  1401. }).then((res)=>{
  1402. if(res.data.status == "1"){
  1403. var symbol = new ol.style.Style({
  1404. stroke:new ol.style.Stroke({
  1405. color: '#00ffff',
  1406. width: 7,
  1407. lineCap:'round'
  1408. })
  1409. })
  1410. var features = [];
  1411. var arr = res.data.route.paths[0].steps;
  1412. for(var i=0;i<arr.length;i++){
  1413. var arr1 = arr[i].tmcs;
  1414. for(var n=0;n<arr1.length;n++){
  1415. var str = arr1[n].polyline;
  1416. var arr2 = str.split(";");
  1417. var vertices = [];
  1418. for(var j=0;j<arr2.length;j++){
  1419. var arr3 = arr2[j].split(",");
  1420. var arr4 = [];
  1421. for(var m=0;m<arr3.length;m++){
  1422. arr4.push(parseFloat(arr3[m]));
  1423. }
  1424. vertices.push(ol.proj.transform(arr4, "EPSG:4326", "EPSG:3857"));
  1425. }
  1426. var polyline = new ol.geom.LineString(vertices)
  1427. var routeFeature = new ol.Feature({
  1428. name: '两点之间路线',
  1429. geometry: polyline
  1430. });
  1431. routeFeature.setStyle(symbol);
  1432. features.push(routeFeature)
  1433. }
  1434. }
  1435. var vectorSource = new ol.source.Vector({
  1436. features: features
  1437. });
  1438. var vectorLayer = new ol.layer.Vector({
  1439. source: vectorSource,
  1440. id:'ls_twoPointRoute'
  1441. });
  1442. _self.mapObject.addLayer(vectorLayer);
  1443. }
  1444. })
  1445. }
  1446. }
  1447. },
  1448. //鼠标移除 则清除相关图层
  1449. clearLayer(){
  1450. var _self = this;
  1451. _self.mapObject.getLayers().forEach((val)=>{
  1452. if(val){
  1453. if(val.getProperties().id == 'ls_twoPointRoute'){
  1454. val.getSource().clear();
  1455. _self.mapObject.removeLayer(val);
  1456. }
  1457. }
  1458. });
  1459. },
  1460. clearHandler(){
  1461. var _self = this;
  1462. document.getElementById("mapNode").style.cursor = "default";
  1463. if(document.getElementById("measureToolTipDivId")){
  1464. document.getElementById("measureToolTipDivId").style.display="none";
  1465. }
  1466. _self.mapObject.getLayers().forEach((val)=>{
  1467. if(val){
  1468. if(val.getProperties().id == 'ls_lushuRoute'){
  1469. _self.mapObject.removeLayer(val);
  1470. val.getSource().clear();
  1471. }
  1472. }
  1473. });
  1474. _self.mapObject.getLayers().forEach((val)=>{
  1475. if(val){
  1476. if(val.getProperties().id == 'ls_twoPointRoute'){
  1477. _self.mapObject.removeLayer(val);
  1478. val.getSource().clear();
  1479. }
  1480. }
  1481. });
  1482. _self.mapObject.getLayers().forEach((val)=>{
  1483. if(val){
  1484. if(val.getProperties().id == 'ls_lushuPoint'){
  1485. _self.mapObject.removeLayer(val);
  1486. val.getSource().clear();
  1487. }
  1488. }
  1489. });
  1490. _self.mapObject.getLayers().forEach((val)=>{
  1491. if(val){
  1492. if(val.getProperties().id.substring(0,3) == 'ls_'){
  1493. _self.mapObject.removeLayer(val);
  1494. val.getSource().clear();
  1495. }
  1496. }
  1497. });
  1498. if(_self.draw){
  1499. _self.mapObject.removeInteraction(_self.draw);
  1500. }
  1501. },
  1502. bjHandler(){
  1503. var _self = this;
  1504. this.$emit('eventHandler','biaoji');
  1505. document.getElementById("mapNode").style.cursor = "crosshair";
  1506. },
  1507. measureHandler(type){
  1508. var _self = this;
  1509. document.getElementById("mapNode").style.cursor = "crosshair";
  1510. if(document.getElementById("measureToolTipDivId")){
  1511. document.getElementById("measureToolTipDivId").style.display="none";
  1512. }
  1513. _self.mapObject.getLayers().forEach((val)=>{
  1514. if(val && val.getProperties().id){
  1515. if(val.getProperties().id == "ls_measureLayer" || val.getProperties().id == "ls_measureOverLayId"){
  1516. val.getSource().clear();
  1517. _self.mapObject.removeLayer(val);
  1518. }
  1519. }
  1520. });
  1521. var ol = _self.$ol;
  1522. var source = new ol.source.Vector();
  1523. var vector = new ol.layer.Vector({
  1524. id:'ls_measureLayer',
  1525. source: source,
  1526. style: new ol.style.Style({
  1527. fill: new ol.style.Fill({
  1528. color: 'rgba(255, 255, 255, 0.2)'
  1529. }),
  1530. stroke: new ol.style.Stroke({
  1531. color: '#ffcc33',
  1532. width: 3
  1533. }),
  1534. image: new ol.style.Circle({
  1535. radius: 7,
  1536. fill: new ol.style.Fill({
  1537. color: '#ffcc33'
  1538. })
  1539. })
  1540. })
  1541. });
  1542. _self.mapObject.addLayer(vector);
  1543. _self.draw = new ol.interaction.Draw({
  1544. source: source,
  1545. type: type,
  1546. stopClick:true,
  1547. style: new ol.style.Style({
  1548. fill: new ol.style.Fill({
  1549. color: 'rgba(255, 255, 255, 0.2)'
  1550. }),
  1551. stroke: new ol.style.Stroke({
  1552. color: 'rgba(255, 204, 51, 1)',
  1553. lineDash: [10, 10],
  1554. width: 3
  1555. }),
  1556. image: new ol.style.Circle({
  1557. radius: 8,
  1558. stroke: new ol.style.Stroke({
  1559. color: 'rgba(255, 204, 51, 0.7)'
  1560. }),
  1561. fill: new ol.style.Fill({
  1562. color: '#ffcc33'
  1563. })
  1564. })
  1565. })
  1566. });
  1567. _self.mapObject.addInteraction(_self.draw);
  1568. _self.createMeasureTooltip();
  1569. _self.createHelpTooltip();
  1570. var listener;
  1571. _self.draw.on('drawstart',function(evt) {
  1572. // set sketch
  1573. _self.sketch = evt.feature;
  1574. var tooltipCoord = evt.coordinate;
  1575. listener = _self.sketch.getGeometry().on('change', function(evt) {
  1576. var geom = evt.target;
  1577. var output;
  1578. if (geom instanceof ol.geom.Polygon) {
  1579. output = _self.formatArea(geom);
  1580. tooltipCoord = geom.getInteriorPoint().getCoordinates();
  1581. } else if (geom instanceof ol.geom.LineString) {
  1582. output = _self.formatLength(geom);
  1583. tooltipCoord = geom.getLastCoordinate();
  1584. }
  1585. _self.measureTooltipElement.innerHTML = output;
  1586. _self.measureTooltip.setPosition(tooltipCoord);
  1587. });
  1588. }, this);
  1589. _self.draw.on('drawend', function() {
  1590. _self.measureTooltipElement.className = 'tooltip tooltip-static';
  1591. _self.measureTooltip.setOffset([0, -7]);
  1592. // unset sketch
  1593. _self.sketch = null;
  1594. // unset tooltip so that a new one can be created
  1595. _self.measureTooltipElement = null;
  1596. _self.createMeasureTooltip();
  1597. ol.Observable.unByKey(listener);
  1598. _self.mapObject.removeInteraction(_self.draw);
  1599. document.getElementById("mapNode").style.cursor = "default";
  1600. if (_self.measureTooltipElement) {
  1601. _self.measureTooltipElement.parentNode.removeChild(_self.measureTooltipElement);
  1602. }
  1603. }, this);
  1604. },
  1605. createMeasureTooltip() {
  1606. var _self = this;
  1607. var ol = _self.$ol;
  1608. _self.measureTooltipElement = document.createElement('div');
  1609. _self.measureTooltipElement.id = "measureToolTipDivId";
  1610. _self.measureTooltipElement.className = 'tooltip tooltip-measure';
  1611. _self.measureTooltip = new ol.Overlay({
  1612. id:'ls_measureOverLayId',
  1613. element: _self.measureTooltipElement,
  1614. offset: [0, -15],
  1615. positioning: 'bottom-center'
  1616. });
  1617. _self.mapObject.addOverlay(_self.measureTooltip);
  1618. },
  1619. createHelpTooltip() {
  1620. var _self = this;
  1621. var ol = _self.$ol;
  1622. if (_self.helpTooltipElement) {
  1623. _self.helpTooltipElement.parentNode.removeChild(_self.helpTooltipElement);
  1624. }
  1625. _self.helpTooltipElement = document.createElement('div');
  1626. _self.helpTooltipElement.className = 'tooltip hidden';
  1627. _self.helpTooltip = new ol.Overlay({
  1628. id:'ls_measureOverLayId',
  1629. element: _self.helpTooltipElement,
  1630. offset: [15, 0],
  1631. positioning: 'center-left'
  1632. });
  1633. _self.mapObject.addOverlay(_self.helpTooltip);
  1634. },
  1635. formatLength(line) {
  1636. var ol = this.$ol;
  1637. var length = ol.Sphere.getLength(line);
  1638. var output;
  1639. if (length > 100) {
  1640. output = (Math.round(length / 1000 * 100) / 100) + ' ' + 'km';
  1641. } else {
  1642. output = (Math.round(length * 100) / 100) + ' ' + 'm';
  1643. }
  1644. return output;
  1645. },
  1646. formatArea(polygon) {
  1647. var ol = this.$ol;
  1648. var area = ol.Sphere.getArea(polygon);
  1649. var output;
  1650. if (area > 10000) {
  1651. output = (Math.round(area / 1000000 * 100) / 100) + ' ' + 'km<sup>2</sup>';
  1652. } else {
  1653. output = (Math.round(area * 100) / 100) + ' ' + 'm<sup>2</sup>';
  1654. }
  1655. return output;
  1656. },
  1657. }
  1658. }
  1659. </script>
  1660. <style>
  1661. #mapToolBarContainer_hhjc{
  1662. position: fixed;
  1663. top: 96px;
  1664. right: 5px;
  1665. }
  1666. #mapTopToolBar{
  1667. display: flex;
  1668. background-color: white;
  1669. height: 46px;
  1670. border-radius: 3px;
  1671. width: 314px;
  1672. z-index: 1;
  1673. align-items: center;
  1674. box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.5);
  1675. background: rgba(255,255,255,1);
  1676. border-radius: 4px;
  1677. }
  1678. .xzqPanelClass{
  1679. margin-top: 5px;
  1680. background-color: white;
  1681. width: 280px;
  1682. margin-right: 10px;
  1683. }
  1684. .naviClickableLink{
  1685. padding: 5px;
  1686. padding-left: 10px;
  1687. /* margin: 3px !important; */
  1688. text-align: center;
  1689. font-size: small;
  1690. color: #000000b0;
  1691. font-weight: normal;
  1692. cursor: pointer;
  1693. }
  1694. .naviClickableLink:hover{
  1695. text-decoration: underline;
  1696. }
  1697. .imgClass{
  1698. width:17px;
  1699. height: 17px;
  1700. margin-right:5px;
  1701. cursor:pointer;
  1702. }
  1703. .imgClass:hover{
  1704. background-color: rgb(200,200,200);
  1705. }
  1706. .mapRightMenu{
  1707. background-color: white;
  1708. padding-left: 0px;
  1709. /* padding-left:10px;
  1710. padding-right:10px;
  1711. padding-bottom:5px;
  1712. padding-top:5px; */
  1713. border: 1px solid rgba(142, 142, 142, 0.3);
  1714. box-shadow: rgba(0, 0, 0, 0.23) 4px 3px 3px 0px;
  1715. }
  1716. .mapRightMenu .menuItem{
  1717. padding: 10px;
  1718. border-bottom: 1px solid rgba(154, 154, 154, 0.36);
  1719. display: flex;
  1720. flex-direction: row;
  1721. justify-content: flex-start;
  1722. align-items: center;
  1723. }
  1724. .mapRightMenu .menuItem:hover{
  1725. cursor: pointer;
  1726. background-color: rgba(154, 154, 154, 0.082);
  1727. }
  1728. .mapRightMenu:last-child{
  1729. border-bottom:0px solid rgba(102, 102, 102, 0.507) !important;
  1730. }
  1731. ul.tabs.dir_tab {
  1732. padding-top: 10px;
  1733. width: 200px;
  1734. border: 0;
  1735. border-radius: 0;
  1736. background: none;
  1737. height: 30px;
  1738. margin: 0 auto;
  1739. white-space: nowrap;
  1740. }
  1741. ul.tabs.dir_tab li {
  1742. height: 30px;
  1743. width: 33.3333%;
  1744. line-height: 30px;
  1745. position: relative;
  1746. display: block;
  1747. float: left;
  1748. text-align: center;
  1749. margin: 0;
  1750. text-transform: uppercase;
  1751. letter-spacing: .8px;
  1752. }
  1753. ul.tabs.dir_tab li:active {
  1754. background-color:#dbdbe7;
  1755. }
  1756. .trafficActivity{
  1757. background-color: #dbdbe7;
  1758. }
  1759. .daohangContainerClass{
  1760. height: 170px;
  1761. background-color: #4993fc;
  1762. right: 20px;
  1763. position: fixed;
  1764. width: 320px;
  1765. }
  1766. .poiClass{
  1767. background-color: #ffffff;
  1768. position: fixed;
  1769. top: 310px;
  1770. right: 20px;
  1771. width: 320px;
  1772. max-height: 350px;
  1773. overflow: auto;
  1774. }
  1775. .poiClass :hover{
  1776. background: #ece9e9;
  1777. cursor:pointer;
  1778. }
  1779. .poiListClass{
  1780. padding: 5px;
  1781. padding-left: 15px;
  1782. }
  1783. .stepClass{
  1784. position: fixed;
  1785. top: 310px;
  1786. right: 20px;
  1787. width: 320px;
  1788. max-height: 350px;
  1789. background: #f4f9fd;
  1790. overflow: auto;
  1791. min-height: 70px;
  1792. }
  1793. .stepClass .el-collapse-item__header{
  1794. color:blue;
  1795. }
  1796. .tooltip {
  1797. position: relative;
  1798. background: rgba(0, 0, 0, 0.5);
  1799. border-radius: 4px;
  1800. color: white;
  1801. padding: 4px 8px;
  1802. opacity: 0.7;
  1803. white-space: nowrap;
  1804. }
  1805. .tooltip-measure {
  1806. opacity: 1;
  1807. font-weight: bold;
  1808. }
  1809. .tooltip-static {
  1810. background-color: #ffcc33;
  1811. color: black;
  1812. border: 1px solid white;
  1813. }
  1814. .tooltip-measure:before,
  1815. .tooltip-static:before {
  1816. border-top: 6px solid rgba(0, 0, 0, 0.5);
  1817. border-right: 6px solid transparent;
  1818. border-left: 6px solid transparent;
  1819. content: "";
  1820. position: absolute;
  1821. bottom: -6px;
  1822. margin-left: -7px;
  1823. left: 50%;
  1824. }
  1825. .tooltip-static:before {
  1826. border-top-color: #ffcc33;
  1827. }
  1828. #timeLineContainer .el-timeline-item{
  1829. padding-bottom: 10px;
  1830. }
  1831. </style>