center.map.ts 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. import { getImageUrl } from "@/utils/tools";
  2. const arrow = new Image();
  3. arrow.src = getImageUrl("home/map_select.png");
  4. export const optionHandle = (regionCode: string, list: object[]) => {
  5. return {
  6. backgroundColor: "rgba(0,0,0,0)",
  7. /* tooltip: {
  8. trigger: "item",
  9. position: function (
  10. point: any[],
  11. params: any,
  12. dom: any,
  13. rect: any,
  14. size: any
  15. ) {
  16. let x = 0; // x坐标位置
  17. let y = 0; // y坐标位置
  18. // 当前鼠标位置
  19. const pointX = point[0];
  20. const pointY = point[1];
  21. // 提示框大小
  22. const boxWidth = size.contentSize[0];
  23. const boxHeight = size.contentSize[1];
  24. // boxWidth > pointX 说明鼠标左边放不下提示框
  25. if (boxWidth > pointX) {
  26. x = pointX + 10;
  27. } else {
  28. // 左边放的下
  29. x = pointX - boxWidth - 10;
  30. }
  31. // boxHeight > pointY 说明鼠标上边放不下提示框
  32. if (boxHeight > pointY) {
  33. y = 5;
  34. } else {
  35. // 上边放得下
  36. y = pointY - boxHeight;
  37. }
  38. return [x, y];
  39. },
  40. show: true,
  41. textStyle: {
  42. fontSize: 14,
  43. color: "#fff",
  44. },
  45. className: "custom-tooltip-box",
  46. rich: {
  47. arrow: {
  48. backgroundColor: {
  49. image: getImageUrl("home/tool_tip_arrow.png"),
  50. },
  51. },
  52. },
  53. formatter: function (params: any) {
  54. let tipHtml = "";
  55. tipHtml = `
  56. <div class="custom-tooltip-style">
  57. <div class='custom-tooltip-name'> <span class="custom-tooltip-arrow"></span> ${params.name}</div>
  58. <div class='custom-tooltip-style-box'>
  59. <div class="custom-tooltip-style-box-text">
  60. <div class="custom-tooltip-style-box-text-item"><span class="custom-tooltip-style-box-text-item-title">工单量:</span><span class="custom-tooltip-style-box-text-item-value">${params.data.orderCountNum}</span> <b> 件</b></div>
  61. <div class="custom-tooltip-style-box-text-item"><span class="custom-tooltip-style-box-text-item-title">行政执法工单:</span><span class="custom-tooltip-style-box-text-item-value">${params.data.enforcementOrderNum}</span> <b> 件</b></div>
  62. <div class="custom-tooltip-style-box-text-item"><span class="custom-tooltip-style-box-text-item-title">线索属实工单:</span><span class="custom-tooltip-style-box-text-item-value">${params.data.theClueIsTrueNum}</span> <b> 件</b></div>
  63. <div class="custom-tooltip-style-box-text-item"><span class="custom-tooltip-style-box-text-item-title">线索不属实工单:</span><span class="custom-tooltip-style-box-text-item-value">${params.data.theClueIsNotTrueNum}</span> <b> 件</b></div>
  64. <div class="custom-tooltip-style-box-text-item"><span class="custom-tooltip-style-box-text-item-title">推诿工单:</span><span class="custom-tooltip-style-box-text-item-value">${params.data.passTheBuckOrderNum}</span> <b> 件</b></div>
  65. </div>
  66. </div>
  67. </div>
  68. `;
  69. return tipHtml;
  70. },
  71. },*/
  72. geo: [
  73. {
  74. layoutCenter: ["50%", "50%"], //位置
  75. layoutSize: "180%", //大小
  76. show: true,
  77. map: regionCode,
  78. roam: false,
  79. zoom: 0.65,
  80. aspectScale: 1,
  81. label: {
  82. show: false,
  83. },
  84. itemStyle: {
  85. areaColor: {
  86. type: "linear",
  87. x: 1200,
  88. y: 0,
  89. x2: 0,
  90. y2: 0,
  91. colorStops: [
  92. {
  93. offset: 0,
  94. color: "rgba(38,134,132,0.35)", // 0% 处的颜色
  95. },
  96. {
  97. offset: 1,
  98. color: "rgba(38,134,132,0.75)", // 50% 处的颜色
  99. },
  100. ],
  101. global: true, // 缺省为 false
  102. },
  103. borderColor: "#c0f3fb",
  104. borderWidth: 1,
  105. shadowColor: "#8cd3ef",
  106. shadowOffsetY: 10,
  107. shadowBlur: 120,
  108. },
  109. },
  110. {
  111. type: "map",
  112. map: regionCode,
  113. aspectScale: 1,
  114. zoom: 0.65,
  115. layoutCenter: ["50%", "54%"],
  116. layoutSize: "180%",
  117. roam: false,
  118. silent: true,
  119. itemStyle: {
  120. borderWidth: 2,
  121. borderColor: "rgba( 38,134,132,0.8)",
  122. shadowColor: "rgba(29, 111, 165,0.8)",
  123. shadowOffsetY: 10,
  124. shadowBlur: 2,
  125. areaColor: "rgba(5,21,35,0.2)",
  126. borderType: "dashed",
  127. },
  128. },
  129. ],
  130. geo3D: [
  131. {
  132. show: false,
  133. map: regionCode,
  134. aspectScale: 1,
  135. },
  136. ],
  137. series: [
  138. {
  139. type: "map",
  140. map: regionCode, // 自定义扩展图表类型
  141. aspectScale: 1,
  142. zoom: 0.65,
  143. showLegendSymbol: true,
  144. boxDepth: 120, //地图倾斜度
  145. regionHeight: 3, //地图厚度
  146. label: {
  147. show: false,
  148. },
  149. itemStyle: {
  150. color: "rgba( 73,122,105,.3)",
  151. borderColor: "#3CFFFD",
  152. borderWidth: 1,
  153. areaColor: {
  154. color: "rgba( 73,122,105,.3)",
  155. },
  156. },
  157. emphasis: {
  158. // 选中的样式
  159. label: {
  160. formatter: ["{b|}"].join("\n"),
  161. rich: {
  162. b: {
  163. backgroundColor: {
  164. image: arrow,
  165. },
  166. height: 60,
  167. },
  168. },
  169. },
  170. itemStyle: {
  171. /* borderColor: "rgba( 62, 254, 254,.3)",
  172. borderWidth: 2,
  173. areaColor: "rgba( 62, 254, 254,.3)",*/
  174. },
  175. },
  176. layoutCenter: ["50%", "50%"],
  177. layoutSize: "180%",
  178. data: list,
  179. selectedMode: "single", // 只允许单选
  180. },
  181. ],
  182. };
  183. };