5aed84e21ce0ceed659517b1708027db78f9ba94.svn-base 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. <template>
  2. <div class="xunheDetailContainer">
  3. <div id="xunheDetailTitle">
  4. <p style="margin:0px;color:white;">巡河记录详情</p>
  5. <i @click="closeDetailWindow" class="fa fa-times" aria-hidden="true" style="margin: 10px 10px 0px 0px;font-size: 14px;color: #dcdcdc;cursor:pointer"></i>
  6. </div>
  7. <!-- <div id="xunheDetailBody">
  8. <table style="width:100%;border-radius:5px;">
  9. <!-- <tr>
  10. <td style="width:25%;background-color:rgba(169, 169, 169, 0.267);">巡河开始时间</td>
  11. <td style="width:25%;">{{eventCode.startTime}}</td>
  12. <td style="width:25%;background-color:rgba(169, 169, 169, 0.267);;">巡河结束时间</td>
  13. <td style="width:25%;">{{eventCode.endTime}}</td>
  14. </tr>
  15. <tr>
  16. <td style="width:25%;background-color:rgba(169, 169, 169, 0.267);;">河段名称</td>
  17. <td>{{eventCode.objectName}}</td>
  18. <td style="width:25%;background-color:rgba(169, 169, 169, 0.267);;">巡河里程(km)</td>
  19. <td>{{eventCode.mileage}}</td>
  20. </tr>
  21. <tr>
  22. <td style="width:25%;background-color:rgba(169, 169, 169, 0.267);;">巡河人员</td>
  23. <td>{{eventCode.userName}}</td>
  24. <td style="width:25%;background-color:rgba(169, 169, 169, 0.267);;">联系电话</td>
  25. <td></td>
  26. </tr>
  27. <tr>
  28. <td style="width:25%;background-color:rgba(169, 169, 169, 0.267);;" >上报问题</td>
  29. <td>0</td>
  30. <td style="width:25%;background-color:rgba(169, 169, 169, 0.267);;" >记录事件</td>
  31. <td>0</td>
  32. </tr>
  33. </table>
  34. </div>
  35. <div id="xunheDetailFooter"><p style="margin:0px;">巡河路径</p></div> -->
  36. <div id="xunheDetailMap">
  37. <div id="mapWindowNode" style="width:100%;height:100%;" > </div>
  38. </div>
  39. <div id="xunheInformation" style="position:absolute;top:7%;right:1%;height:20%;width:50%;display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-end;">
  40. <p style="margin:0px;color:white;font-weight:bold;background-color:rgba(0,0,0,0.5);padding:2px;">河段:{{eventCode.objectName}}</p>
  41. <p style="margin:0px;color:white;font-weight:bold;background-color:rgba(0,0,0,0.5);padding:2px;">巡河人员:{{eventCode.userName}}</p>
  42. <p style="margin:0px;color:white;font-weight:bold;background-color:rgba(0,0,0,0.5);padding:2px;">巡河里程:{{eventCode.mileage}} km</p>
  43. <p style="margin:0px;color:white;font-weight:bold;background-color:rgba(0,0,0,0.5);padding:2px;">巡河时间:{{eventCode.startTime}}</p>
  44. </div>
  45. <div id="xunheModuleToggle" style="position:absolute;bottom:10px;left:1%;min-height:30%;width:30%;display:flex;flex-direction:column;justify-content:flex-end;align-items:flex-start;">
  46. <!-- <el-button type="primary" plain style="margin:0;margin-top:5px;" icon="el-icon-edit">巡河日志</el-button> -->
  47. <el-button type="success" plain style="margin:0;margin-top:5px;" icon="el-icon-share">关联事件({{eventCount}})</el-button>
  48. </div>
  49. </div>
  50. </template>
  51. <script>
  52. const options = {
  53. url: '/src/arcgisAPI/init.js'
  54. };
  55. import * as esriLoader from 'esri-loader'
  56. export default{
  57. components:{
  58. },
  59. props:['eventCode'],
  60. data(){
  61. return{
  62. eventCount:0,
  63. eventInforMation:{
  64. adCode:'',
  65. adName:'',
  66. createDate:'',
  67. endTime:'',
  68. id:'',
  69. mileage:'',
  70. objectId:'',
  71. objectName:'',
  72. objectType:'',
  73. ord:'',
  74. patrolState:'',
  75. patrolTrackJson:'',
  76. startTime:'',
  77. userName:'',
  78. },
  79. contIntervalTime:10,
  80. tianditu_yingxiang:null,
  81. supermap_yingxiangzhuji:null,
  82. supermap_river_r:null,
  83. mapObject:null,
  84. viewObject:null,
  85. imageData:[],
  86. }
  87. },
  88. mounted:function(){
  89. this.getEventListByCode();
  90. },
  91. watch: {
  92. eventCode:{
  93. handler(newValue,oldValue){
  94. this.pathAnimate(this.eventCode);
  95. },
  96. deep:true
  97. },
  98. },
  99. methods: {
  100. getEventListByCode:function(){
  101. var _self = this;
  102. _self.$http.post('/pdcApi/event/findList',{'patrolId':this.eventCode.id}).then((response)=>{
  103. var data = response.body;
  104. _self.eventCount = data.length;
  105. _self.imageData = data;
  106. this.initMap();
  107. },(response)=>{
  108. });
  109. },
  110. initEsriLoader:function(){
  111. esriLoader.bootstrap((err) => {
  112. if (err) {
  113. console.error(err);
  114. } else {
  115. }
  116. }, {
  117. url: '/src/arcgisAPI/init.js'
  118. });
  119. },
  120. initMap:function(){
  121. var _self = this;
  122. this.initEsriLoader();
  123. esriLoader.dojoRequire(["esri/Map","esri/views/MapView","esri/views/SceneView","esri/views/3d/externalRenderers","esri/geometry/SpatialReference","esri/geometry/Extent","esri/request","esri/layers/MapImageLayer","esri/Basemap","esri/layers/FeatureLayer","esri/layers/GraphicsLayer","esri/layers/testLayer","esri/layers/waterRSLayer","esri/layers/TimeImageLayer","esri/layers/superMapZhuji","esri/layers/BaseTileLayer","esri/layers/support/TileInfo","esri/Color","esri/config","dojo/domReady!"],
  124. (Map,MapView,SceneView,externalRenderers,SpatialReference,Extent,esriRequest,MapImageLayer,Basemap,FeatureLayer,GraphicsLayer,testLayer,waterRSLayer,TimeImageLayer,superMapZhuji,BaseTileLayer,TileInfo,Color,esriConfig,) => {
  125. var options_yingxiang = {
  126. "id": "tianDiTu_yingxiang",
  127. "label": "天地图影像地图",
  128. "visible": true,
  129. "opacity": 1,
  130. "style": "default",
  131. "wmtslayer": "vec",
  132. "tileMatrixSet": "c",
  133. "format": "tiles",
  134. "urlTemplate": "http://{subDomain}.mwr.gov.cn:81/img_c/wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAYER=img&STYLE=default&FORMAT=tiles&TILEMATRIXSET=c&TILEMATRIX={level}&TILEROW={row}&TILECOL={col}",
  135. "copyright": "TiandituWMTS",
  136. "subDomains": ["tdt"]
  137. };
  138. var options_supermap_yingxiangzhuji = {
  139. "id": "supermap_yingxiangzhuji",
  140. "label": "超图影像注记",
  141. "visible": true,
  142. "opacity": 1,
  143. "style": "default",
  144. "wmtslayer": "vec",
  145. "tileMatrixSet": "satImage",
  146. "format": "image/png",
  147. "urlTemplate":"http://{subDomain}.mwr.gov.cn/iserver/services/XZQH_HZZR/wmts100?&SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAYER=XZQH_HZZR&STYLE=Default&FORMAT=image/png&TILEMATRIXSET=Custom_XZQH_HZZR&TILEMATRIX={level}&TILEROW={row}&TILECOL={col}",
  148. "copyright": "TiandituWMTS",
  149. "subDomains": ["map"]
  150. };
  151. var options_river_r = {
  152. "id": "supermap_river_r",
  153. "label": "超图影像水系图",
  154. "visible": true,
  155. "opacity": 1,
  156. "style": "default",
  157. "wmtslayer": "vec",
  158. "tileMatrixSet": "Custom_RIVER_R",
  159. "format": "image/png",
  160. "urlTemplate":"http://{subDomain}.1.3.140/iserver/services/RIVER_R/wmts100?&SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAYER=RIVER_R&STYLE=Default&FORMAT=image/png&TILEMATRIXSET=Custom_RIVER_R&TILEMATRIX={level}&TILEROW={row}&TILECOL={col}",
  161. "copyright": "TiandituWMTS",
  162. "subDomains": ["10"]
  163. };
  164. _self.tianditu_yingxiang = new testLayer(options_yingxiang);
  165. _self.supermap_yingxiangzhuji = new superMapZhuji(options_supermap_yingxiangzhuji);
  166. _self.supermap_river_r = new superMapZhuji(options_river_r);
  167. _self.mapObject = new Map({});
  168. _self.mapObject.add(_self.tianditu_yingxiang);
  169. _self.mapObject.add(_self.supermap_yingxiangzhuji);
  170. _self.mapObject.add(_self.supermap_river_r);
  171. _self.viewObject = new MapView({
  172. container: "mapWindowNode",
  173. map: _self.mapObject,
  174. viewingMode: "global",
  175. constraints:{
  176. rotationEnabled: false
  177. }
  178. });
  179. // _self.viewObject.ui.empty("top-left");
  180. _self.viewObject.when(function(){
  181. // alert("OK");
  182. var hdHightLightLayer = new GraphicsLayer({id:"hdHightLightLayer"});//河段高亮layer
  183. _self.mapObject.add(hdHightLightLayer);
  184. _self.viewObject.on("click", function(event) {
  185. //@author:wxcwater 对event的button做区分 右键应当报事件
  186. var eventIndex = event;
  187. if(event.button==2){
  188. //右键
  189. // _self.$emit("openMapWIndow","");//弹出地图小窗口 测试
  190. }
  191. var screenPoint = {
  192. x: event.x,
  193. y: event.y
  194. };
  195. // if(event.x==_self.domMouseMoveObject.pageX&&event.y==_self.domMouseMoveObject.pageY){
  196. // console.log('get');
  197. // }else{
  198. // console.log('x:'+event.x+" : "+_self.domMouseMoveObject.screenX);
  199. // console.log('y:'+event.y+" : "+_self.domMouseMoveObject.screenY);
  200. // }
  201. // Search for graphics at the clicked location
  202. _self.viewObject.hitTest(screenPoint).then(function(response) {
  203. if(eventIndex.button == 0){
  204. //左键
  205. var result = response.results;
  206. if(result){
  207. //点击河段高亮layer 下钻
  208. _self.$emit('openEventDetail',{'eventInformation':result[0].graphic.attributes});
  209. }
  210. }
  211. });
  212. });
  213. if(_self.eventCode.patrolTrackJson){
  214. _self.pathAnimate(_self.eventCode);
  215. }else{
  216. alert("暂无巡河路径数据!")
  217. }
  218. },function(error){
  219. console.log("The view's resources failed to load: ", error);
  220. });
  221. });
  222. },
  223. //定位河段
  224. locateEvent:function(item){
  225. var _self = this;
  226. esriLoader.dojoRequire(["esri/Graphic","esri/geometry/Point","esri/geometry/SpatialReference","esri/layers/GraphicsLayer","esri/geometry/Polygon","esri/geometry/Polyline","esri/tasks/QueryTask", "esri/tasks/support/Query",
  227. ],(Graphic,Point,SpatialReference,GraphicsLayer,Polygon,Polyline,QueryTask, Query,)=>{
  228. var hdHightLightLayer = _self.mapObject.findLayerById("hdHightLightLayer");
  229. var pt = new Point(item.eventLongitude,item.eventLatitude,new SpatialReference(4326));
  230. var sym;
  231. var gra;
  232. var attributes = {
  233. 'userName':item.userName,
  234. 'adCode':item.adCode,
  235. 'adName':item.adName,
  236. 'eventName':item.eventName,
  237. 'eventSrc':item.eventSrc,
  238. 'eventSrcName':item.eventSrcName,
  239. 'eventAddress':item.eventAddress,
  240. 'eventState':item.eventState,
  241. 'eventStateName':item.eventStateName,
  242. 'objectType':item.objectType,
  243. 'objectName':item.objectName,
  244. 'startTime':item.startTime,
  245. 'endTime':item.endTime,
  246. 'event_udName':item.event_udName,
  247. 'eventFiles':item.eventFiles,
  248. 'memo':item.memo,
  249. };
  250. if(item.eventTypes == '水环境'){
  251. sym = {type: "picture-marker",url: "../assets/event_six_environment.png",width: "20px",height: "20px"};
  252. gra = new Graphic({geometry:pt,symbol:sym,attributes:attributes});
  253. }else if(item.eventTypes == '执法监督'){
  254. sym = {type: "picture-marker",url: "../assets/event_six_justice.png",width: "20px",height: "20px"};
  255. gra = new Graphic({geometry:pt,symbol:sym,attributes:attributes});
  256. }else if(item.eventTypes == '水域岸线'){
  257. sym = {type: "picture-marker",url: "../assets/event_six_bank.png",width: "20px",height: "20px"};
  258. gra = new Graphic({geometry:pt,symbol:sym,attributes:attributes});
  259. }else if(item.eventTypes == '水资源'){
  260. sym = {type: "picture-marker",url: "../assets/event_six_resource.png",width: "20px",height: "20px"};
  261. gra = new Graphic({geometry:pt,symbol:sym,attributes:attributes});
  262. }else if(item.eventTypes == '水生态'){
  263. sym = {type: "picture-marker",url: "../assets/event_six_ecology.png",width: "20px",height: "20px"};
  264. gra = new Graphic({geometry:pt,symbol:sym,attributes:attributes});
  265. }else if(item.eventTypes == '水污染'){
  266. sym = {type: "picture-marker",url: "../assets/event_six_pollution.png",width: "20px",height: "20px"};
  267. gra = new Graphic({geometry:pt,symbol:sym,attributes:attributes});
  268. }
  269. hdHightLightLayer.add(gra);
  270. });
  271. },
  272. pathAnimate:function(params){
  273. //先zoom过去
  274. var _self = this;
  275. esriLoader.dojoRequire(["esri/Graphic","esri/geometry/Point","esri/geometry/SpatialReference","esri/layers/GraphicsLayer","esri/geometry/Polygon","esri/geometry/Polyline","esri/tasks/QueryTask", "esri/tasks/support/Query",
  276. ],(Graphic,Point,SpatialReference,GraphicsLayer,Polygon,Polyline,QueryTask, Query,)=>{
  277. var hdHightLightLayer = _self.mapObject.findLayerById("hdHightLightLayer");
  278. hdHightLightLayer.removeAll();
  279. var symbolLine = {type: "simple-line",color: [ 255,0, 0, 1 ],width:"5px",style: "solid"};
  280. // var paths = response.body.pointList;
  281. var line = new Polyline({
  282. paths: JSON.parse(params.patrolTrackJson),
  283. spatialReference: { wkid: 4326 }
  284. });
  285. _self.contIntervalTime = Math.round(5000/JSON.parse(params.patrolTrackJson)[0].length);
  286. var hehuTempGra = new Graphic({
  287. geometry:line,
  288. symbol:symbolLine,
  289. attributes:null
  290. });
  291. _self.viewObject.extent = hehuTempGra.geometry.extent;
  292. var lod = Number(_self.viewObject.zoom);
  293. var lod1 = Number(lod - 2);
  294. _self.viewObject.goTo({
  295. target:hehuTempGra,
  296. zoom:lod1,
  297. }).then(function(){
  298. // alert('zoom完了');
  299. let realPathArray = JSON.parse(params.patrolTrackJson)[0];
  300. console.log('realPathArray ');
  301. _self.realAnimateFun(realPathArray,0);
  302. });
  303. });
  304. },
  305. realAnimateFun:function(pathsArray,startIndex){
  306. console.log('realAnimateFun'+startIndex);
  307. let currentIndex = startIndex;
  308. var _self = this;
  309. let currentPaths = [];
  310. if(currentIndex+1>=pathsArray.length){
  311. return ;
  312. }
  313. currentPaths.push(pathsArray[currentIndex]);
  314. currentPaths.push(pathsArray[currentIndex+1]);
  315. esriLoader.dojoRequire(["esri/Graphic","esri/geometry/Point","esri/geometry/SpatialReference","esri/layers/GraphicsLayer","esri/geometry/Polygon","esri/geometry/Polyline","esri/tasks/QueryTask", "esri/tasks/support/Query",
  316. ],(Graphic,Point,SpatialReference,GraphicsLayer,Polygon,Polyline,QueryTask, Query,)=>{
  317. let hdHightLightLayer = _self.mapObject.findLayerById("hdHightLightLayer");
  318. // hdHightLightLayer.removeAll();
  319. var symbolLine = {type: "simple-line",color: [ 255,0, 0, 1 ],width:"5px",style: "solid"};
  320. // var paths = response.body.pointList;
  321. let line = new Polyline({
  322. paths: [currentPaths],
  323. spatialReference: { wkid: 4326 }
  324. });
  325. let hehuTempGra = new Graphic({
  326. geometry:line,
  327. symbol:symbolLine,
  328. attributes:null
  329. });
  330. hdHightLightLayer.add(hehuTempGra);
  331. _self.imageData.forEach(function(item){
  332. if(currentPaths[1][0]==item.eventLongitude&&currentPaths[1][1]==item.eventLatitude){
  333. // alert('有图片');
  334. _self.locateEvent(item);
  335. currentIndex++;
  336. }
  337. })
  338. });
  339. setTimeout(() => {
  340. _self.realAnimateFun(pathsArray,currentIndex+1);
  341. }, this.contIntervalTime);
  342. },
  343. closeDetailWindow:function(){
  344. this.$emit('closeXzqXunHeDetailWindow',{});
  345. }
  346. }
  347. }
  348. </script>
  349. <style>
  350. @import url('/src/arcgisAPI/esri/css/main.css');
  351. .xunheDetailContainer{
  352. position: fixed;
  353. top:15%;
  354. left:55%;
  355. height:60%;
  356. width:40%;
  357. background-color: white;
  358. border-radius:5px;
  359. display: flex;
  360. flex-direction:column;
  361. justify-content: flex-start;
  362. align-items: stretch;
  363. z-index: 10;
  364. }
  365. #xunheDetailTitle{
  366. padding:5px;
  367. flex-basis:5%;
  368. background-color: rgb(62,123,246);
  369. border-radius:5px 5px 0px 0px ;
  370. display: flex;
  371. flex-direction: row;
  372. justify-content: space-between;
  373. align-items: center;
  374. }
  375. #xunheDetailBody{
  376. flex-basis:25%;
  377. }
  378. #xunheDetailMap{
  379. flex-basis:100%;
  380. }
  381. #xunheDetailFooter{
  382. flex-basis:5%;
  383. display: flex;
  384. flex-direction: row;
  385. justify-content: center;
  386. align-items: center;
  387. background-color:rgba(169, 169, 169, 0.267);
  388. }
  389. /*屏蔽esri标注*/
  390. .esri-ui .esri-attribution{
  391. display: none;
  392. }
  393. </style>