gcmsEvents.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. /**
  2. * [ONEMAP.M.gcmsEvents]
  3. * @return {[object]}
  4. */
  5. define(function(){
  6. //显示详情
  7. function showDetail(articleId){
  8. require(['modDir/gcms/gcmsDetail'],function(gcmsDetail){
  9. gcmsDetail.init({
  10. column_name:ONEMAP.D.gcmsCurColumnData['name'] || '图层',
  11. article_id:articleId
  12. });
  13. });
  14. }
  15. //自定义详情
  16. function showDetailDiy(articleId,column){
  17. $.ajax({
  18. url: onemapUrlConfig.gcmsServiceUrl+'/show/'+column,
  19. type:"GET",
  20. dataType:"json"
  21. })
  22. .done(function(data){
  23. // console.log(data)
  24. var li_html = data.data[0].list_html;
  25. var qian = li_html.split("(")[0];
  26. var hou = li_html.split(")")[1];
  27. var xin = qian+"("+articleId+")"+hou;
  28. // console.log(xin);
  29. ONEMAP.D.gcmsCurColumnData = {};
  30. ONEMAP.D.gcmsCurColumnData['name'] = column;
  31. li_html = xin;
  32. $(li_html).click();
  33. })
  34. }
  35. //绘制点
  36. function showDrawPoint(articleId,fieldName){
  37. require(['modDir/gcms/gcmsDrawPoint'],function(gcmsDrawPoint){
  38. gcmsDrawPoint.init({
  39. column_name:ONEMAP.D.gcmsCurColumnData['name'],
  40. article_id:articleId,
  41. field_name:fieldName
  42. });
  43. });
  44. }
  45. //绘制面
  46. function showDrawPolyline(articleId,fieldName){
  47. require(['modDir/gcms/gcmsDrawPolyline'],function(gcmsDrawPolyline){
  48. gcmsDrawPolyline.init({
  49. column_name:ONEMAP.D.gcmsCurColumnData['name'],
  50. article_id:articleId,
  51. field_name:fieldName
  52. });
  53. });
  54. }
  55. //绘制线
  56. function showDrawPolygon(articleId,fieldName){
  57. require(['modDir/gcms/gcmsDrawPolygon'],function(gcmsDrawPolygon){
  58. gcmsDrawPolygon.init({
  59. column_name:ONEMAP.D.gcmsCurColumnData['name'],
  60. article_id:articleId,
  61. field_name:fieldName
  62. });
  63. });
  64. }
  65. //显示轨迹
  66. function showTrajectory(articleId,fieldName,showMarker,type){
  67. require(['modDir/gcms/gcmsTrajectory'],function(gcmsTrajectory){
  68. gcmsTrajectory.init({
  69. column_name:ONEMAP.D.gcmsCurColumnData['name'],
  70. article_id:articleId,
  71. field_name:fieldName,
  72. showMarker:showMarker,
  73. type:type
  74. });
  75. });
  76. };
  77. //多选
  78. function showMultipleCheck(articleId,fieldName){
  79. require(['modDir/gcms/gcmsMultipleCheck'],function(gcmsMultipleCheck){
  80. gcmsMultipleCheck.init({
  81. column_name:ONEMAP.D.gcmsCurColumnData['name'],
  82. article_id:articleId,
  83. field_name:fieldName
  84. });
  85. });
  86. }
  87. //布尔值
  88. function showBoolean(articleId,fieldName){
  89. require(['modDir/gcms/gcmsBoolean'],function(gcmsBoolean){
  90. gcmsBoolean.init({
  91. column_name:ONEMAP.D.gcmsCurColumnData['name'],
  92. article_id:articleId,
  93. field_name:fieldName
  94. });
  95. });
  96. }
  97. //显示简单点
  98. function showSimplePoint(articleId,fieldName,type){
  99. require(['modDir/gcms/gcmsPoint'],function(gcmsPoint){
  100. gcmsPoint.init({
  101. column_name:ONEMAP.D.gcmsCurColumnData['name'],
  102. article_id:articleId,
  103. field_name:fieldName,
  104. type:type
  105. });
  106. });
  107. }
  108. //显示简单线
  109. function showSimplePolyline(articleId,fieldName,type){
  110. require(['modDir/gcms/gcmsPolyline'],function(Polyline){
  111. Polyline.init({
  112. column_name:ONEMAP.D.gcmsCurColumnData['name'],
  113. article_id:articleId,
  114. field_name:fieldName,
  115. type:type
  116. });
  117. });
  118. }
  119. //显示简单面
  120. function showSimplePolygon(articleId,fieldName,type){
  121. require(['modDir/gcms/gcmsPolygon'],function(Polygon){
  122. Polygon.init({
  123. column_name:ONEMAP.D.gcmsCurColumnData['name'],
  124. article_id:articleId,
  125. field_name:fieldName,
  126. type:type
  127. });
  128. });
  129. }
  130. //显示带坐标的视频
  131. function showPointVideo(articleId,fieldName){
  132. require(['modDir/gcms/gcmsPointAVideo'],function(gcmsPointAVideo){
  133. gcmsPointAVideo.init({
  134. column_name:ONEMAP.D.gcmsCurColumnData['name'],
  135. article_id:articleId,
  136. field_name:fieldName
  137. });
  138. });
  139. }
  140. //显示带坐标的音频
  141. function showPointAudio(articleId,fieldName){
  142. require(['modDir/gcms/gcmsPointAAudio'],function(gcmsPointAAudio){
  143. gcmsPointAAudio.init({
  144. column_name:ONEMAP.D.gcmsCurColumnData['name'],
  145. article_id:articleId,
  146. field_name:fieldName
  147. });
  148. });
  149. }
  150. //显示带坐标的图片
  151. function showPointPicture(articleId,fieldName){
  152. require(['modDir/gcms/gcmsPointAPicture'],function(gcmsPointAPicture){
  153. gcmsPointAPicture.init({
  154. column_name:ONEMAP.D.gcmsCurColumnData['name'],
  155. article_id:articleId,
  156. field_name:fieldName,
  157. });
  158. });
  159. }
  160. //显示地图中心点
  161. function showMapCenter(lat,lng,zoom,style){
  162. require(['modDir/gcms/gcmsMapCenter'],function(gcmsMapCenter){
  163. gcmsMapCenter.init({
  164. data:{
  165. lat:lat,
  166. lng:lng,
  167. zoom:zoom,
  168. style:style
  169. }
  170. });
  171. });
  172. }
  173. //下载
  174. function showFiles(articleId,fieldName){
  175. require(['modDir/gcms/gcmsFiles'],function(gcmsFiles){
  176. gcmsFiles.init({
  177. column_name:ONEMAP.D.gcmsCurColumnData['name'],
  178. article_id:articleId,
  179. field_name:fieldName
  180. });
  181. });
  182. }
  183. //显示问卷
  184. function showQuestionnaire(articleId,fieldName){
  185. require(['modDir/gcms/gcmsQuestionnaire'],function(gcmsQuestionnaire){
  186. gcmsQuestionnaire.init({
  187. column_name:ONEMAP.D.gcmsCurColumnData['name'],
  188. article_id:articleId,
  189. field_name:fieldName
  190. });
  191. });
  192. }
  193. //显示标注
  194. function showMapDraw(articleId,fieldName){
  195. require(['modDir/gcms/gcmsMapDraw'],function(gcmsMapDraw){
  196. gcmsMapDraw.init({
  197. column_name:ONEMAP.D.gcmsCurColumnData['name'],
  198. article_id:articleId,
  199. field_name:fieldName
  200. });
  201. });
  202. }
  203. //显示地图标记
  204. function showMapMarker(articleId,fieldName){
  205. require(['modDir/gcms/gcmsMapMarker'],function(gcmsMapMarker){
  206. gcmsMapMarker.init({
  207. column_name:ONEMAP.D.gcmsCurColumnData['name'],
  208. article_id:articleId,
  209. field_name:fieldName
  210. });
  211. });
  212. }
  213. //显示图片
  214. function showPicture(articleId,fieldName,name,creater,phone_num,ext){
  215. require(['modDir/gcms/gcmsPicture'],function(gcmsPicture){
  216. gcmsPicture.init({
  217. column_name:ONEMAP.D.gcmsCurColumnData['name'],
  218. article_id:articleId,
  219. field_name:fieldName,
  220. name:name,
  221. creater:creater,
  222. phone_num:phone_num,
  223. ext:ext
  224. });
  225. });
  226. }
  227. //显示图册
  228. function showPictures(articleId,fieldName,name,creater,phone_num,ext){
  229. require(['modDir/gcms/gcmsPictures'],function(gcmsPictures){
  230. gcmsPictures.init({
  231. column_name:ONEMAP.D.gcmsCurColumnData['name'],
  232. article_id:articleId,
  233. field_name:fieldName,
  234. name:name,
  235. creater:creater,
  236. phone_num:phone_num,
  237. ext:ext
  238. });
  239. });
  240. }
  241. //显示专题图
  242. function showThematic(articleId,fieldName){
  243. require(['modDir/gcms/gcmsThematic'],function(gcmsThematic){
  244. gcmsThematic.init({
  245. column_name:ONEMAP.D.gcmsCurColumnData['name'],
  246. article_id:articleId,
  247. field_name:fieldName
  248. });
  249. });
  250. }
  251. //显示视频
  252. function showVideo(articleId,fieldName){
  253. require(['modDir/gcms/gcmsVideo'],function(gcmsVideo){
  254. gcmsVideo.init({
  255. column_name:ONEMAP.D.gcmsCurColumnData['name'],
  256. article_id:articleId,
  257. field_name:fieldName
  258. });
  259. });
  260. }
  261. //显示音频
  262. function showAudio(articleId,fieldName){
  263. require(['modDir/gcms/gcmsAudio'],function(gcmsAudio){
  264. gcmsAudio.init({
  265. column_name:ONEMAP.D.gcmsCurColumnData['name'],
  266. article_id:articleId,
  267. field_name:fieldName
  268. });
  269. });
  270. }
  271. //根据序号定位到中心点并弹出冒泡窗
  272. function showMapCenterPopup(index){
  273. var markerArray = ONEMAP.M.gcmsList.getMarkerObj();
  274. if(markerObj.hasOwnProperty(index)){
  275. var marker = map2DViewer.markers[markerObj[index]];
  276. map23DControl.setView({
  277. center:{
  278. lat:marker.getLatLng().lat,
  279. lng:marker.getLatLng().lng
  280. },
  281. zoom:map23DData.view.zoom
  282. })
  283. setTimeout(function(){
  284. marker.openPopup();
  285. },1000)
  286. }
  287. }
  288. //根据id定位到中心点并弹出冒泡窗
  289. function showMapCenterByGcmsId(id){
  290. var markerObj = ONEMAP.M.gcmsList.getMarkerObj();
  291. if(markerObj.hasOwnProperty(id)){
  292. var marker = map2DViewer.markers[markerObj[id]];
  293. map23DControl.setView({
  294. center:{
  295. lat:marker.getLatLng().lat,
  296. lng:marker.getLatLng().lng
  297. },
  298. zoom:map23DData.view.zoom
  299. })
  300. setTimeout(function(){
  301. marker.openPopup();
  302. },1000)
  303. }
  304. }
  305. return ONEMAP.M.gcmsEvents = {
  306. showDetail:showDetail,
  307. showMapCenter:showMapCenter,
  308. showMapDraw:showMapDraw,
  309. showMapMarker:showMapMarker,
  310. showPicture:showPicture,
  311. showPictures:showPictures,
  312. showThematic:showThematic,
  313. showVideo:showVideo,
  314. showMapCenterPopup:showMapCenterPopup,
  315. showMapCenterByGcmsId:showMapCenterByGcmsId,
  316. showFiles:showFiles,
  317. showAudio:showAudio,
  318. showQuestionnaire:showQuestionnaire,
  319. showSimplePoint:showSimplePoint,
  320. showSimplePolyline:showSimplePolyline,
  321. showSimplePolygon:showSimplePolygon,
  322. showPointVideo:showPointVideo,
  323. showPointAudio:showPointAudio,
  324. showPointPicture:showPointPicture,
  325. showBoolean:showBoolean,
  326. showTrajectory:showTrajectory,
  327. showDrawPoint:showDrawPoint,
  328. showDrawPolyline:showDrawPolyline,
  329. showDrawPolygon:showDrawPolygon,
  330. showDetailDiy:showDetailDiy
  331. }
  332. });