other_analyse.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. <template>
  2. <div class="body-wrapper">
  3. <div class="charts">
  4. <div style="width: 50%;height: 220px">
  5. <h5 style="color: white">区域分析</h5>
  6. <br>
  7. <barchart
  8. class="side-chart"
  9. :autoStop="false"
  10. :colorArr="[ '#5d78ff']"
  11. legendIcon="react"
  12. :bottom="30"
  13. :xlabelFormat="xLabelFormat1"
  14. :top="60"
  15. :left="80"
  16. yAxisName="(停车次数)"
  17. :tooltip="tooltipFormat1"
  18. :dataset="bardata"
  19. :encode="[
  20. {x: 'month', y: 'hs'},
  21. ]"
  22. :labelSize="12"
  23. id="qyfx"
  24. />
  25. </div>
  26. <div style="width: 50%;height: 220px;">
  27. <h5 style="color: white">车场数量</h5>
  28. <br>
  29. <piechart
  30. class="model-pie-body"
  31. id="ccsl"
  32. :radiusArr="['30%', '50%']"
  33. :roseType = "false"
  34. :labelFormat="['{name|{b}}', '{sub|{@value}个 {d}%}', '{hr|}']"
  35. :dataset="ccslvalue"
  36. :encode="{ itemName: 'name', value: 'value' }"
  37. />
  38. </div>
  39. <br>
  40. </div>
  41. <br>
  42. <br>
  43. <br>
  44. <div class="charts">
  45. <div style="width: 50%;height: 220px;">
  46. <h5 style="color: white">停车分布分析</h5>
  47. <br>
  48. <barchart
  49. class="side-chart"
  50. :autoStop="false"
  51. :colorArr="[ '#5d78ff','#00ff83']"
  52. legendIcon="react"
  53. :bottom="30"
  54. :xlabelFormat="xLabelFormat1"
  55. :top="60"
  56. yAxisName="(辆)"
  57. :tooltip="tooltipFormat2"
  58. :dataset="tcfbfx"
  59. :encode="[
  60. {x: 'mouth', y: 'cs', seriesName: '路外停车'},
  61. {x: 'mouth', y: 'hs', seriesName: '路内停车'},
  62. ]"
  63. :labelSize="12"
  64. id="tcfbfx"
  65. />
  66. </div>
  67. <div style="width: 50%;height: 220px;">
  68. <h5 style="color: white">余位分析</h5>
  69. <br>
  70. <barchart
  71. class="side-chart"
  72. :autoStop="false"
  73. :colorArr="[ '#5d78ff','#00ff83']"
  74. legendIcon="react"
  75. :bottom="30"
  76. :xlabelFormat="xLabelFormat1"
  77. :top="60"
  78. yAxisName="(泊位)"
  79. :tooltip="tooltipFormat3"
  80. :dataset="ywfx"
  81. :encode="[
  82. {x: 'mouth', y: 'cs', seriesName: '路外余位'},
  83. {x: 'mouth', y: 'hs', seriesName: '路内余位'},
  84. ]"
  85. :labelSize="12"
  86. id="ywfx"
  87. />
  88. </div>
  89. <br>
  90. </div>
  91. <br>
  92. <br>
  93. <br>
  94. <br>
  95. <br>
  96. <div class="charts">
  97. <div style="width: 50%;height: 220px;">
  98. <h5 style="color: white">停车热点分析</h5>
  99. <br>
  100. <div class="bottom" id="map"></div>
  101. </div>
  102. <div style="width: 50%;height: 220px;">
  103. <h5 style="color: white">车流量分析</h5>
  104. <br>
  105. <linechart
  106. :autoStop="false"
  107. :top="30"
  108. :bottom="30"
  109. :left="50"
  110. :legendTop="0"
  111. yAxisName=""
  112. :dataset="cllfx"
  113. :tooltipFormat="lineTooltipFormat4"
  114. :encode="[
  115. { x: 'month', y: 'lastAmount', seriesName: '车流量' ,bool:'true'},
  116. ]"
  117. id="cllfx"
  118. />
  119. </div>
  120. <br>
  121. </div>
  122. <br>
  123. <br>
  124. <br>
  125. <br>
  126. <br>
  127. <div class="charts">
  128. <div style="width: 50%;height:220px;">
  129. <h5 style="color: white">低利用率停车场分析</h5>
  130. <br>
  131. <barchart
  132. class="side-chart"
  133. :autoStop="false"
  134. :colorArr="[ '#5d78ff']"
  135. legendIcon="react"
  136. :bottom="30"
  137. :xlabelFormat="xLabelFormat1"
  138. :top="60"
  139. yAxisName=""
  140. :tooltip="lineTooltipFormat5"
  141. :dataset="dlyltcc"
  142. :encode="[
  143. {x: 'mouth', y: 'hs'},
  144. ]"
  145. :labelSize="12"
  146. id="dlyltcc"
  147. />
  148. </div>
  149. <div style="width: 50%;height: 220px;">
  150. <h5 style="color: white">高峰路线分析</h5>
  151. <br>
  152. <div id="ChinaLineMap"></div>
  153. </div>
  154. <br>
  155. </div>
  156. <br>
  157. <br>
  158. <br>
  159. <br>
  160. <br>
  161. <div class="charts">
  162. <div style="width: 50%;height: 220px;">
  163. <h5 style="color: white">车辆进场占比</h5>
  164. <br>
  165. <piechart
  166. class="model-pie-body"
  167. id="chart1"
  168. :roseType="false"
  169. :radiusArr="['30%', '70%']"
  170. :colorArr="modelPieColor"
  171. :labelFormat="['{name|{b}}', '{sub|{@value} {d}%}', '{hr|}']"
  172. :dataset="zdcljcfx"
  173. :encode="{ itemName: 'name', value: 'value' }"
  174. />
  175. </div>
  176. <!-- <div style="width: 50%;height: 500px;">-->
  177. <!-- <h5 style="color: white">重点车辆追踪</h5>-->
  178. <!-- <br>-->
  179. <!-- <div id="ChinaLineMap2"></div>-->
  180. <!-- </div>-->
  181. </div>
  182. </div>
  183. </template>
  184. <script>
  185. import api from "@/api/audit.js";
  186. import piechart from "@/components/pieChart";
  187. import linechart from "@/components/lineChart";
  188. import barchart from "@/components/barChart";
  189. import * as echarts from 'echarts'
  190. import * as geoJson from '@/util/411100.json'
  191. export default {
  192. name: "chinaLineMap",
  193. components: {
  194. piechart,
  195. linechart,
  196. barchart
  197. },
  198. data() {
  199. return {
  200. ccslvalue: [],
  201. bardata: [],
  202. tcfbfx: [],
  203. ywfx: [],
  204. cllfx: [],
  205. dlyltcc: [],
  206. tableData: [],
  207. tableData2: [],
  208. tableData3: [],
  209. tableData4: [],
  210. dqIndex: -1,
  211. timer: null,
  212. option: {
  213. visualMap: {
  214. show: true,
  215. type: "continuous",
  216. left: "0%",
  217. bottom: "0%",
  218. calculable: true,
  219. textStyle: {
  220. color: "white",
  221. },
  222. text: ["(次)"],
  223. min: 0,
  224. max: 100,
  225. inRange: {
  226. color: ["#4FC9FB","#36ADFC","#1788D1","#0E6BAE","#1871A2","#0D4D7D"],
  227. },
  228. },
  229. geo: {
  230. map: "luohe",
  231. // aspectScale: 1,
  232. roam: false,
  233. itemStyle: {
  234. normal: {
  235. borderColor: "#2ab8ff",
  236. borderWidth: 2.5,
  237. areaColor: "#12235c",
  238. },
  239. emphasis: {
  240. areaColor: "#2AB8FF",
  241. shadowColor: "rgba(42,184,255, 0.7)",
  242. shadowOffsetY: 5,
  243. shadowOffsetX: 5,
  244. shadowBlur: 5,
  245. },
  246. },
  247. },
  248. tooltip: {
  249. confine: true,
  250. formatter: this.mapTooltip,
  251. position: "inside",
  252. backgroundColor: "transparent",
  253. },
  254. series: [
  255. {
  256. type: "map",
  257. // roam: true,
  258. label: {
  259. normal: {
  260. textStyle: {
  261. color: "#fff",
  262. },
  263. },
  264. emphasis: {
  265. show: false,
  266. textStyle: {
  267. color: "#fff",
  268. },
  269. },
  270. },
  271. itemStyle: {
  272. normal: {
  273. borderColor: "#76bef5",
  274. borderWidth: 1.5,
  275. areaColor: "#4282de",
  276. },
  277. emphasis: {
  278. areaColor: "#002aff",
  279. borderWidth: 0,
  280. color: "green",
  281. },
  282. },
  283. roam: false,
  284. map: "luohe", //使用
  285. data: [],
  286. },
  287. ],
  288. },
  289. total: 0,
  290. pageSize: 10,
  291. pageNum: 1,
  292. radio: '2',
  293. dialogVisible: false,
  294. selRow: {},
  295. searchWords: undefined,
  296. searchWords2: undefined,
  297. searchWords3: undefined,
  298. modelPieColor: ["#4382f6", "#9078f8", "#79a7db", "#FF9800"],
  299. zdcljcfx: [],
  300. }
  301. },
  302. mounted() {
  303. this.getQyfx()
  304. this.getCcsl()
  305. this.getTcfbfx()
  306. this.getYwfx()
  307. this.getCllfx()
  308. this.getDlyltcc()
  309. this.getZdcljcfx()
  310. this.loadChinaLineMap()
  311. this.loadMap()
  312. },
  313. watch: {
  314. },
  315. methods: {
  316. setIntervalMap(chart) {
  317. this.timer = setInterval(() => {
  318. chart.dispatchAction({
  319. type: "showTip",
  320. seriesIndex: 0,
  321. dataIndex: this.dqIndex + 1,
  322. });
  323. this.dqIndex++;
  324. if (this.dqIndex > 7) {
  325. this.dqIndex = -1;
  326. }
  327. }, 3000);
  328. },
  329. getQyfx() {
  330. api.qyfx().then(res => {
  331. this.bardata = res.data || []
  332. })
  333. },
  334. getCcsl() {
  335. api.ccsl().then(res => {
  336. this.ccslvalue = res.data || []
  337. })
  338. },
  339. getTcfbfx() {
  340. api.tcfbfx().then(res => {
  341. this.tcfbfx = res.data || []
  342. })
  343. },
  344. getYwfx() {
  345. api.ywfx().then(res => {
  346. this.ywfx = res.data || []
  347. })
  348. },
  349. getCllfx() {
  350. api.cllfx().then(res => {
  351. this.cllfx = res.data || []
  352. })
  353. },
  354. getDlyltcc() {
  355. api.dlyltcc().then(res => {
  356. this.dlyltcc = res.data || []
  357. })
  358. },
  359. getZdcljcfx() {
  360. api.zdcljcfx().then(res => {
  361. this.zdcljcfx = res.data || []
  362. })
  363. },
  364. xLabelFormat1(name) {
  365. const nameArr = []
  366. for(let i=0; i<name.length; i+=7) {
  367. nameArr.push(name.substring(i, i+7))
  368. }
  369. return nameArr.join('\n');
  370. },
  371. tooltipFormat1(params) {
  372. const data = params[0].data;
  373. return `<div class="bar-tooltip-dz">${data.hs || "--"}次</div>`;
  374. },
  375. tooltipFormat2(params) {
  376. const data = params[0].data;
  377. return `<div class="line-tooltip">
  378. <div style="color: ${params[0].color}">${params[0].seriesName}: ${
  379. params[0].data.cs || 0
  380. }(辆)</div>
  381. <div style="color: ${params[1].color}">${params[1].seriesName}: ${
  382. params[0].data.hs || 0
  383. }(辆)</div>
  384. </div>`;
  385. },
  386. tooltipFormat3(params) {
  387. const data = params[0].data;
  388. return `<div class="line-tooltip">
  389. <div style="color: ${params[0].color}">${params[0].seriesName}: ${
  390. params[0].data.cs || "--"
  391. }(辆)</div>
  392. <div style="color: ${params[1].color}">${params[1].seriesName}: ${
  393. params[0].data.hs || "--"
  394. }(辆)</div>
  395. </div>`;
  396. },
  397. lineTooltipFormat4(params) {
  398. const data = params[0].data;
  399. return `<div class="bar-tooltip-dz">${data.lastAmount || "--"}次</div>`;
  400. },
  401. lineTooltipFormat5(params) {
  402. const data = params[0].data;
  403. return `<div class="bar-tooltip-dz">${data.hs || "--"}</div>`;
  404. },
  405. mapTooltip(data) {
  406. return `<div class="map-tooltip">
  407. <div class="map-tooltip-name">${data.name}:<span class="map-tooltip-value">${data.value}次</span></div>
  408. </div>`;
  409. },
  410. loadMap() {
  411. api.tcrdfx().then(res => {
  412. let arr = []
  413. let dataSoure = res.data || {}
  414. for (const key in dataSoure) {
  415. if (key !== '411100') {
  416. arr.push({
  417. name: dataSoure[key].quyuName,
  418. value: Number(dataSoure[key].zb),
  419. });
  420. }
  421. }
  422. let mapMax = Math.max(...arr.map(item => item.value))
  423. let mapMin = Math.min(...arr.map(item => item.value))
  424. let chart = echarts.init(document.getElementById("map"));
  425. echarts.registerMap("luohe", geoJson);
  426. this.option.series[0].data = arr;
  427. this.option.visualMap.min = mapMin;
  428. this.option.visualMap.max = mapMax;
  429. chart.setOption(this.option);
  430. this.dqIndex = -1;
  431. this.setIntervalMap(chart);
  432. //鼠标移入静止播放
  433. chart.on("mouseover", (e) => {
  434. clearInterval(this.timer);
  435. chart.dispatchAction({
  436. type: "showTip",
  437. seriesIndex: 0,
  438. dataIndex: e.dataIndex,
  439. });
  440. });
  441. chart.on("mouseout", (e) => {
  442. clearInterval(this.timer);
  443. //鼠标移出后先把上次的高亮取消
  444. chart.dispatchAction({
  445. type: "downplay",
  446. seriesIndex: 0,
  447. dataIndex: e.dataIndex,
  448. });
  449. this.setIntervalMap(chart);
  450. });
  451. })
  452. },
  453. //加载轨迹地图
  454. loadChinaLineMap() {
  455. api.gflxfx().then(res => {
  456. echarts.registerMap('河南', geoJson);
  457. var myCharts = echarts.init(document.getElementById('ChinaLineMap'));
  458. // var myCharts2 = echarts.init(document.getElementById('ChinaLineMap2'));
  459. var geoCoordMap = res.data.geoCoordMap || {};
  460. var chinaDatas = (res.data.chinaDatas || []).map(item => ([{name: item.from, value: item.value}, {name: item.to, value: 0}]));
  461. var convertData = function (data) {
  462. var res = [];
  463. for (var i = 0; i < data.length; i++) {
  464. var dataItem = data[i];
  465. var fromCoord = geoCoordMap[dataItem[0].name];
  466. // var toCoord = [114.026405, 33.575855];
  467. var toCoord = geoCoordMap[dataItem[1].name];
  468. if (fromCoord && toCoord) {
  469. res.push([{
  470. coord: fromCoord,
  471. value: dataItem[0].value
  472. }, {
  473. coord: toCoord,
  474. }]);
  475. }
  476. }
  477. return res;
  478. };
  479. //飞线数据
  480. var series = [];
  481. [['漯河市', chinaDatas]].forEach(function (item, i) {
  482. console.log(item)
  483. series.push({
  484. type: 'lines',
  485. zlevel: 2,
  486. effect: {
  487. show: true,
  488. period: 4, //箭头指向速度,值越小速度越快
  489. trailLength: 0.02, //特效尾迹长度[0,1]值越大,尾迹越长重
  490. symbol: 'arrow', //箭头图标
  491. symbolSize: 5, //图标大小
  492. },
  493. lineStyle: {
  494. normal: {
  495. color:'#EE5652',
  496. width: 1, //尾迹线条宽度
  497. opacity: 1, //尾迹线条透明度
  498. curveness: .3 //尾迹线条曲直度
  499. }
  500. },
  501. data: convertData(item[1])
  502. }, {
  503. type: 'effectScatter',
  504. coordinateSystem: 'geo',
  505. zlevel: 2,
  506. rippleEffect: { //涟漪特效
  507. period: 4, //动画时间,值越小速度越快
  508. brushType: 'stroke', //波纹绘制方式 stroke, fill
  509. scale: 4 //波纹圆环最大限制,值越大波纹越大
  510. },
  511. label: {
  512. normal: {
  513. show: false,
  514. position: 'right', //显示位置
  515. offset: [5, 0], //偏移设置
  516. formatter: function (params) {//圆环显示文字
  517. return params.data.name;
  518. },
  519. color:'#FFD200',
  520. fontSize: 16
  521. },
  522. emphasis: {
  523. show: true
  524. }
  525. },
  526. symbol: 'circle',
  527. // symbolSize: function (val) {
  528. // return 5 + val[2] * 5; //圆环大小
  529. // },
  530. itemStyle: {
  531. normal: {
  532. show: true,
  533. color: '#ffffff'
  534. }
  535. },
  536. data: item[1].map(function (dataItem) {
  537. return {
  538. name: dataItem[0].name,
  539. value: geoCoordMap[dataItem[0].name].concat([dataItem[0].value])
  540. };
  541. }),
  542. },
  543. );
  544. });
  545. let option = {
  546. backgroundColor: "#0c0c0c",
  547. geo: [
  548. {
  549. map: '河南',
  550. aspectScale: 1,
  551. roam: false, // 是否允许缩放
  552. zoom: 1.2, // 默认显示级别
  553. layoutSize: '95%',
  554. layoutCenter: ['55%', '51.5%'],
  555. itemStyle: {
  556. areaColor: 'rgba(0,27,95,0.4)',
  557. borderColor: '#004db5',
  558. borderWidth: 1
  559. },
  560. zlevel: 1,
  561. silent: true
  562. }
  563. ],
  564. series: series
  565. };
  566. //var max = Math.max.apply(Math, newarray);
  567. //option.visualMap.max = max;
  568. myCharts.clear();
  569. myCharts.setOption(option);
  570. // myCharts2.clear();
  571. // myCharts2.setOption(option);
  572. // myChart.setOption(option);
  573. })
  574. }
  575. }
  576. }
  577. </script>
  578. <style lang="scss" scoped>
  579. .body-wrapper {
  580. .button-block{
  581. text-align: right;
  582. margin-bottom: 20px;
  583. }
  584. .search-card{
  585. font-size: 24px;
  586. font-weight: bold;
  587. color: #3498db;
  588. margin-bottom: 20px;
  589. .input-wrapper{
  590. width: 36%;
  591. }
  592. }
  593. }
  594. #ChinaLineMap{
  595. width: 100%;
  596. height:calc(100% - 7vh);
  597. }
  598. #ChinaLineMap2{
  599. width: 100%;
  600. height:calc(100% - 7vh);
  601. }
  602. .charts{
  603. width: 100%;
  604. display: flex;
  605. justify-content: space-between;
  606. }
  607. .btn_save{
  608. background-color: #3498db;
  609. color: #ffffff;
  610. padding: 10px 20px;
  611. cursor: pointer;
  612. border: none;
  613. border-radius: 4px;
  614. font-size: 16px;
  615. height: 30px;
  616. }
  617. .sel{
  618. height: 200px;
  619. margin-right: 10px;
  620. }
  621. .input-search{
  622. width: 100%;
  623. padding: 10px;
  624. margin-bottom: 20px;
  625. box-sizing: border-box;
  626. background-color: #2a2a2a;
  627. border: 1px solid #333;
  628. color: #ffffff;
  629. }
  630. .bottom {
  631. height: 90%;
  632. width: 100%;
  633. }
  634. .audit-dialog{
  635. .mg-bt{
  636. margin-bottom: 24px;
  637. }
  638. .label{
  639. text-align: right;
  640. }
  641. }
  642. /deep/.map-tooltip {
  643. font-size: 18px;
  644. padding: 10px 20px;
  645. background: url("../../../../static/img/u231.png");
  646. background-size: 100% 100%;
  647. .map-tooltip-name {
  648. color: #00e4ff;
  649. }
  650. .map-tooltip-value {
  651. color: white;
  652. margin-left: 20px;
  653. }
  654. }
  655. .model-pie-body {
  656. width: 100%;
  657. height: 99%;
  658. }
  659. .bar-tooltip-dz {
  660. padding: 5px 10px;
  661. background: url("../../../../static/img/u261.png");
  662. background-size: 100% 100%;
  663. color: #333;
  664. position: absolute;
  665. top: 0;
  666. }
  667. </style>