f321a8833d5e016e66bf265e630b9ff69c6e32e9.svn-base 95 KB

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