park_guidance.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <div>
  3. <div style="color: #d5d3d3" class="middle-map">
  4. <div align="center" style="color: #3498db;font-size: 23px;margin-bottom: 20px">实施停车饱和度</div>
  5. <div style="height: 450px">
  6. <div class="bottom" id="map"></div>
  7. </div>
  8. </div>
  9. <div class="body-wrapper" style="height: 300px">
  10. <div align="center" style="color: #3498db;font-size: 23px;margin-bottom: 20px">停车建议</div>
  11. <el-table :data="tableData" style="background: #2a2a2a;border-color: #333;">
  12. <el-table-column v-for="(item, index) in columns" :key="index" :label="item.label" :prop="item.key">
  13. </el-table-column>
  14. </el-table>
  15. <div class="table-pagination">
  16. <el-pagination :background="false" layout="total, prev, pager, next" :total="total" @current-change="handlePageChange"
  17. :current-page.sync="pageNum" :page-size.sync="pageSize">
  18. </el-pagination>
  19. </div>
  20. </div>
  21. </div>
  22. </template>
  23. <script>
  24. import * as echarts from 'echarts'
  25. import * as geoJson from '@/util/411100.json'
  26. import linechart from "@/components/lineChart";
  27. import api from '@/api/audit'
  28. export default {
  29. components: {
  30. linechart,
  31. },
  32. data() {
  33. return {
  34. columns: [
  35. {
  36. label: '区域',
  37. key: 'regionName'
  38. },
  39. {
  40. label: '建议',
  41. key: 'detail'
  42. }
  43. ],
  44. tableData: [],
  45. pageNum: 1,
  46. pageSize: 10,
  47. total: 1,
  48. dqIndex: -1,
  49. timer: null,
  50. option: {
  51. visualMap: {
  52. show: true,
  53. type: "continuous",
  54. left: "0%",
  55. bottom: "0%",
  56. calculable: true,
  57. textStyle: {
  58. color: "white",
  59. },
  60. text: ["(%)"],
  61. min: 0,
  62. max: 100,
  63. inRange: {
  64. color: ["#4FC9FB","#36ADFC","#1788D1","#0E6BAE","#1871A2","#0D4D7D"],
  65. },
  66. },
  67. geo: {
  68. map: "luohe",
  69. // aspectScale: 1,
  70. roam: false,
  71. itemStyle: {
  72. normal: {
  73. borderColor: "#2ab8ff",
  74. borderWidth: 2.5,
  75. areaColor: "#12235c",
  76. },
  77. emphasis: {
  78. areaColor: "#2AB8FF",
  79. shadowColor: "rgba(42,184,255, 0.7)",
  80. shadowOffsetY: 5,
  81. shadowOffsetX: 5,
  82. shadowBlur: 5,
  83. },
  84. },
  85. },
  86. tooltip: {
  87. confine: true,
  88. formatter: this.mapTooltip,
  89. position: "inside",
  90. backgroundColor: "transparent",
  91. },
  92. series: [
  93. {
  94. type: "map",
  95. // roam: true,
  96. label: {
  97. normal: {
  98. textStyle: {
  99. color: "#fff",
  100. },
  101. },
  102. emphasis: {
  103. show: false,
  104. textStyle: {
  105. color: "#fff",
  106. },
  107. },
  108. },
  109. itemStyle: {
  110. normal: {
  111. borderColor: "#76bef5",
  112. borderWidth: 1.5,
  113. areaColor: "#4282de",
  114. },
  115. emphasis: {
  116. areaColor: "#002aff",
  117. borderWidth: 0,
  118. color: "green",
  119. },
  120. },
  121. roam: false,
  122. map: "luohe", //使用
  123. data: [],
  124. },
  125. ],
  126. },
  127. curData: {},
  128. dataSource: null,
  129. };
  130. },
  131. methods: {
  132. handlePageChange() {
  133. this.getTableData()
  134. },
  135. getTableData() {
  136. const {pageNum, pageSize} = this
  137. api.nyzstjListByPage({current: pageNum, size: pageSize}).then(res => {
  138. this.tableData = res.data.records || []
  139. this.total = res.data.total
  140. })
  141. },
  142. setIntervalMap(chart) {
  143. this.timer = setInterval(() => {
  144. chart.dispatchAction({
  145. type: "showTip",
  146. seriesIndex: 0,
  147. dataIndex: this.dqIndex + 1,
  148. });
  149. this.dqIndex++;
  150. if (this.dqIndex > 4) {
  151. this.dqIndex = -1;
  152. }
  153. }, 3000);
  154. },
  155. mapTooltip(data) {
  156. return `<div class="map-tooltip">
  157. <div class="map-tooltip-name">${data.name}:<span class="map-tooltip-value">${data.value}%</span></div>
  158. </div>`;
  159. },
  160. },
  161. mounted() {
  162. this.getTableData()
  163. api.nyzs().then(res => {
  164. let arr = []
  165. let dataSoure = res.data
  166. for (const key in dataSoure) {
  167. if (key !== 411100) {
  168. arr.push({
  169. name: dataSoure[key].quyuName,
  170. value: Number(dataSoure[key].zb),
  171. });
  172. }
  173. }
  174. let mapMax = Math.max(...arr.map(item => item.value))
  175. let mapMin = Math.min(...arr.map(item => item.value))
  176. let chart = echarts.init(document.getElementById("map"));
  177. echarts.registerMap("luohe", geoJson);
  178. this.option.series[0].data = arr;
  179. this.option.visualMap.min = mapMin;
  180. this.option.visualMap.max = mapMax;
  181. chart.setOption(this.option);
  182. this.dqIndex = -1;
  183. this.setIntervalMap(chart);
  184. //鼠标移入静止播放
  185. chart.on("mouseover", (e) => {
  186. clearInterval(this.timer);
  187. chart.dispatchAction({
  188. type: "showTip",
  189. seriesIndex: 0,
  190. dataIndex: e.dataIndex,
  191. });
  192. });
  193. chart.on("mouseout", (e) => {
  194. clearInterval(this.timer);
  195. //鼠标移出后先把上次的高亮取消
  196. chart.dispatchAction({
  197. type: "downplay",
  198. seriesIndex: 0,
  199. dataIndex: e.dataIndex,
  200. });
  201. this.setIntervalMap(chart);
  202. });
  203. })
  204. },
  205. };
  206. </script>
  207. <style lang="scss" scoped>
  208. .body-wrapper {
  209. width: 100%;
  210. height: 100%;
  211. box-sizing: border-box;
  212. background: #0c0c0c;
  213. .table-pagination{
  214. text-align: right;
  215. }
  216. }
  217. </style>
  218. <style lang="less" scoped>
  219. .middle-map {
  220. width: 100%;
  221. height: 100%;
  222. .bottom {
  223. height: 90%;
  224. width: 100%;
  225. }
  226. /deep/.map-tooltip {
  227. font-size: 18px;
  228. padding: 10px 20px;
  229. background: url("../../../../static/img/u231.png");
  230. background-size: 100% 100%;
  231. .map-tooltip-name {
  232. color: #00e4ff;
  233. }
  234. .map-tooltip-value {
  235. color: white;
  236. margin-left: 20px;
  237. }
  238. }
  239. }
  240. </style>