Built files from Bizgaze WebServer
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

triplocationviewer.js 9.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  2. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  3. return new (P || (P = Promise))(function (resolve, reject) {
  4. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  5. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  6. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  7. step((generator = generator.apply(thisArg, _arguments || [])).next());
  8. });
  9. };
  10. var Bizgaze;
  11. (function (Bizgaze) {
  12. let Apps;
  13. (function (Apps) {
  14. let Routes;
  15. (function (Routes) {
  16. let Map;
  17. (function (Map) {
  18. class TripLocationViewer extends Unibase.Platform.Core.BaseComponent {
  19. cssFiles() {
  20. return [];
  21. }
  22. jsFiles() {
  23. return ['apps/crm/employees/managers/gpslocationmanager.js'];
  24. }
  25. html(id, containerid) {
  26. let html = `<div class="modal-header pa-10 text-dark"><strong>Trip GPS Location</strong></div><div data-simplebar class="modal-body simple-scrollbar"><div id="tripGpsLocationMap" class="h-600p"></div></div><div class="modal-footer pa-10"><a href="javascript:;" class="btn btn-outline-danger btn-sm mr-auto" id="closeMapBtn"> Close</a></div>`;
  27. return html;
  28. }
  29. load(id, containerid, callback) {
  30. const instance = this;
  31. $('#closeMapBtn').click(function () {
  32. instance.navigationHelper.closePopUp();
  33. });
  34. }
  35. getgpslocations(userid, tripgroupid, tracktime) {
  36. if (userid != 0 || tripgroupid != 0) {
  37. this.fileCacheHelper.loadJsFile('apps/crm/employees/managers/gpslocationmanager.js', function () {
  38. return __awaiter(this, void 0, void 0, function* () {
  39. var lat_lng = new Array();
  40. var latlngbounds = new google.maps.LatLngBounds();
  41. var infoWindow = new google.maps.InfoWindow();
  42. var markPoints = [];
  43. var addressobj = new Array();
  44. debugger;
  45. if (userid != 0) {
  46. const userLocations = yield Bizgaze.Apps.Crm.Employees.Managers.GpsLocationmanager.Instance().getuserlocationsbyuseridanddatetime(userid, tracktime);
  47. if (userLocations.result.length) {
  48. markPoints['users'] = userLocations.result;
  49. }
  50. if (tripgroupid != 0) {
  51. const customerLocations = yield Bizgaze.Apps.Crm.Employees.Managers.GpsLocationmanager.Instance().GetCustomerLocationsByTripGroupId(tripgroupid);
  52. if (customerLocations.result.length) {
  53. markPoints['customers'] = customerLocations.result;
  54. }
  55. }
  56. var infoWindow = new google.maps.InfoWindow({
  57. pixelOffset: new google.maps.Size(0, -5)
  58. });
  59. var mapOptions = {
  60. center: new google.maps.LatLng(0, 0),
  61. zoom: 1,
  62. mapTypeId: google.maps.MapTypeId.ROADMAP
  63. };
  64. var map = new google.maps.Map(document.getElementById('tripGpsLocationMap'), mapOptions);
  65. for (const contact in markPoints) {
  66. debugger;
  67. const isUser = contact === 'users';
  68. for (let i = 0; i <= markPoints[contact].length - 1; i++) {
  69. var data = markPoints[contact][i];
  70. const latitude = isUser ? data.Latitude : data.latitude;
  71. const longitude = isUser ? data.Longitude : data.longitude;
  72. var myLatlng = new google.maps.LatLng(latitude, longitude);
  73. if (isUser) {
  74. lat_lng.push(myLatlng);
  75. }
  76. var icon = data.color;
  77. var lineSymbol = {
  78. path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW
  79. };
  80. icon = "https://maps.google.com/mapfiles/ms/icons/" + icon + ".png";
  81. var marker;
  82. if (isUser) {
  83. marker = new google.maps.Marker({
  84. position: myLatlng,
  85. map: map,
  86. draggable: false,
  87. title: data.Address,
  88. label: {
  89. fontSize: '12px', fontWeight: '200', text: '.',
  90. }
  91. });
  92. }
  93. else {
  94. marker = new google.maps.Marker({
  95. position: myLatlng,
  96. map: map,
  97. draggable: false,
  98. title: data.address,
  99. label: {
  100. fontSize: '12px', fontWeight: '200', text: '.',
  101. }
  102. });
  103. }
  104. google.maps.event.addListener(marker, 'mouseout', function (c) {
  105. infoWindow.close();
  106. });
  107. marker.setIcon({
  108. path: google.maps.SymbolPath.CIRCLE,
  109. fillOpacity: 1,
  110. fillColor: isUser ? 'red' : 'Orange',
  111. strokeOpacity: 1,
  112. strokeWeight: 1,
  113. strokeColor: '#333',
  114. scale: 6,
  115. scaledSize: new google.maps.Size(65, 80),
  116. });
  117. var poly = new google.maps.Polyline({
  118. map: map, strokeColor: '#FF0000', geodesic: true, strokeOpacity: 1.0,
  119. strokeWeight: 2, path: lat_lng
  120. });
  121. marker.setMap(map);
  122. latlngbounds.extend(marker.position);
  123. map.fitBounds(latlngbounds);
  124. }
  125. }
  126. }
  127. });
  128. });
  129. }
  130. }
  131. static Instance() {
  132. if (this.instance === undefined) {
  133. this.instance = new TripLocationViewer();
  134. }
  135. return this.instance;
  136. }
  137. }
  138. Map.TripLocationViewer = TripLocationViewer;
  139. })(Map = Routes.Map || (Routes.Map = {}));
  140. })(Routes = Apps.Routes || (Apps.Routes = {}));
  141. })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
  142. })(Bizgaze || (Bizgaze = {}));