index.vue 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033
  1. <template>
  2. <div class="body">
  3. <div class="header">
  4. <h1 class="header_title">松花湖景区通</h1>
  5. <span class="time">2024年4月23日 星期二 上午 9:51:54</span>
  6. </div>
  7. <div class="container">
  8. <div class="left">
  9. <div class="Visitorsflowrate">
  10. <div class="all_title">
  11. <h3 class="PartTitle">景区人流量排行榜TOP5</h3>
  12. <div class="selectDate" data-objname="ticketType">
  13. <span class="_selectData">2020年04月</span>
  14. <a class="icon_more" @click="moreMeunSmalLeft_1 = !moreMeunSmalLeft_1;"> &gt; </a>
  15. <div class="_moreMenu" v-if="moreMeunSmalLeft_1">
  16. <ul >
  17. <li class="change" @click="clickTimeFindData('景区人流量排行榜TOP5',index)" v-for="(item,index) in dateList" :key="item.date" :data-date="item.date">{{ item.label }}</li>
  18. </ul>
  19. </div>
  20. </div>
  21. </div>
  22. <div class="ticketType">
  23. <div class="ticketLeft">
  24. <h4 class="tableTitle">景区名</h4>
  25. <ul>
  26. <li>
  27. <em>1</em>
  28. <span>成人票</span>
  29. </li>
  30. <li>
  31. <em>2</em>
  32. <span>儿童票</span>
  33. </li>
  34. <li>
  35. <em>3</em>
  36. <span>大门票+船票</span>
  37. </li>
  38. <li>
  39. <em>4</em>
  40. <span>免费票</span>
  41. </li>
  42. <li>
  43. <em>5</em>
  44. <span>亲子套票</span>
  45. </li>
  46. </ul>
  47. </div>
  48. <div class="ticketRight">
  49. <h4 class="tableTitle">平台占比</h4>
  50. <div class="chart">
  51. <div id="chartRankOneMb" style="width:200px;height:240px;"></div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="TouristData">
  57. <div class="all_title">
  58. <h3 class="PartTitle">景区近一个月游客排行榜TOP5</h3>
  59. <div class="selectDate" data-objname="ticketType">
  60. <span class="_selectData">2020年04月</span>
  61. <a class="icon_more" @click="moreMeunSmalLeft_2 = !moreMeunSmalLeft_2;"> &gt; </a>
  62. <div class="_moreMenu" v-if="moreMeunSmalLeft_2">
  63. <ul >
  64. <li class="change" @click="clickTimeFindData('景区近一个月游客排行榜TOP5',index)" v-for="(item,index) in dateList" :key="item.date" :data-date="item.date">{{ item.label }}</li>
  65. </ul>
  66. </div>
  67. </div>
  68. </div>
  69. <div class="Tourischart">
  70. <div id="chartRankOneMonth" style="width: 500px;height:300px;"></div>
  71. </div>
  72. </div>
  73. <div class="SalesTrend">
  74. <div class="all_title">
  75. <h3 class="PartTitle">景区近一年销售趋势排行榜TOP5</h3>
  76. <div class="selectDate" data-objname="ticketType">
  77. <span class="_selectData">2020年04月</span>
  78. <a class="icon_more" @click="moreMeunSmalLeft_3 = !moreMeunSmalLeft_3;"> &gt; </a>
  79. <div class="_moreMenu" v-if="moreMeunSmalLeft_3">
  80. <ul >
  81. <li class="change" @click="clickTimeFindData('景区近一年销售趋势排行榜TOP5',index)" v-for="(item,index) in dateList" :key="item.date" :data-date="item.date">{{ item.label }}</li>
  82. </ul>
  83. </div>
  84. </div>
  85. </div>
  86. <div class="Saleschart">
  87. <div id="chartRankOneSale" style="width: 500px;height:220px;"></div>
  88. </div>
  89. </div>
  90. </div>
  91. <div class="center">
  92. <div class="regionData">
  93. <!--通知公告选项卡开始-->
  94. <div class="region_tab2">
  95. <div class="div_tab2">
  96. <a @click="tabClick(1)" v-bind:class="regionInShowOne?'df_on':''">游船视图</a>
  97. <a @click="tabClick(2)" v-bind:class="regionInShowTwo?'df_on':''">游客视图</a>
  98. </div>
  99. <div class="regionIn_tab2 one" v-show="regionInShowOne">
  100. <div class="borp">
  101. <div class="selectDate">
  102. <div class="_moreMenu" style="display: block;top: 34px;width: 120px;margin-right: -20px">
  103. <ul id="myList">
  104. <!-- <li class="change">游船1</li>-->
  105. <!-- <li>游船2</li>-->
  106. <!-- <li>游船3</li>-->
  107. <!-- <li>游船4</li>-->
  108. <!-- <li>游船5</li>-->
  109. </ul>
  110. </div>
  111. </div>
  112. <!--游船视图页面-->
  113. <div id="map" style="margin-top: 50px; width: 740px; height: 620px"></div>
  114. <!-- <baidu-map style="margin-top: 50px" :mapStyle="{style : 'midnight'}" class="region_tab2"-->
  115. <!-- :center="{lng: 126.84031, lat: 43.658648}" :zoom="12" :scroll-wheel-zoom="true"-->
  116. <!-- @ready="handler">-->
  117. <!-- </baidu-map>-->
  118. </div>
  119. </div>
  120. <div class="regionIn_tab2 two" v-show="regionInShowTwo">
  121. <div class="wholeCountry">
  122. <h4>当日平台总成交额 </h4>
  123. <div class="money">
  124. <span>{{ getFirstDigit(0) }}</span>
  125. <span>{{ getFirstDigit(1) }}</span>
  126. <span>{{ getFirstDigit(2) }}</span>
  127. <span>{{ getFirstDigit(3) }}</span>
  128. <span>{{ getFirstDigit(4) }}</span>
  129. <span>{{ getFirstDigit(5) }}</span>
  130. <span>{{ getFirstDigit(6) }}</span>
  131. <span>{{ getFirstDigit(7) }}</span>
  132. </div>
  133. <div class="_count">当日累计总游客数
  134. <ins>{{ peopleNum }}</ins>
  135. </div>
  136. </div>
  137. <div class="map">
  138. <div id="mapByPerson" style="width: 740px;height: 426px"></div>
  139. </div>
  140. </div>
  141. </div>
  142. <!--通知公告结束-->
  143. </div>
  144. <div class="moddlebot">
  145. <div class="ProvinceData">
  146. <h3 class="PartTitle">客源地省份排名</h3>
  147. <div class="Saleschart">
  148. <div id="chartRankOneCity" style="width: 250px;height:200px;"></div>
  149. </div>
  150. </div>
  151. <div class="AgeData">
  152. <h3 class="PartTitle">游客年龄比例</h3>
  153. <div class="Saleschart">
  154. <div id="chartRankOneAge" style="width: 200px;height:200px;padding: 0"></div>
  155. </div>
  156. </div>
  157. <div class="GenderData">
  158. <h3 class="PartTitle">游客男女比例</h3>
  159. <div class="GenderChart">
  160. <div class="genderBili">
  161. <div class="man">
  162. <i class="icon_man"></i>
  163. <strong> 男士60%</strong>
  164. </div>
  165. <div class="woman">
  166. <i class="icon_woman"></i>
  167. <strong> 女士40%</strong>
  168. </div>
  169. <div class="_line">
  170. <div class="_line_man" style="width:60%;"></div>
  171. <div class="_line_woman" style="width:40%;"></div>
  172. </div>
  173. </div>
  174. </div>
  175. </div>
  176. </div>
  177. </div>
  178. <div class="right">
  179. <div class="OTA_ranking">
  180. <ul>
  181. <li>
  182. <img src="@/assets/images/piao.png"/>
  183. <em>今日售票数</em>
  184. <h2>5684</h2>
  185. <i>张</i>
  186. </li>
  187. <li>
  188. <img src="@/assets/images/piao.png"/>
  189. <em>今日退票数</em>
  190. <h2>5684</h2>
  191. <i>张</i>
  192. </li>
  193. <li>
  194. <img src="@/assets/images/people.png"/>
  195. <em>今日入园数</em>
  196. <h2>5684</h2>
  197. <i>张</i>
  198. </li>
  199. <li>
  200. <img src="@/assets/images/people.png"/>
  201. <em>今日出园数</em>
  202. <h2>5684</h2>
  203. <i>张</i>
  204. </li>
  205. </ul>
  206. </div>
  207. <div class="Forecast">
  208. <h3 class="PartTitle">停车场概况统计</h3>
  209. <div class="ForecastData">
  210. <div class="Forecastchart">
  211. <div id="chartRankOnePark" style="width: 250px;height:250px"></div>
  212. </div>
  213. <ul class="stopList">
  214. <li>
  215. <span>总车位数</span>
  216. <span>1600</span>
  217. </li>
  218. <li>
  219. <span>当日停车费营收</span>
  220. <span>600</span>
  221. </li>
  222. <li>
  223. <span>当月停车费营收</span>
  224. <span>1600</span>
  225. </li>
  226. </ul>
  227. </div>
  228. </div>
  229. <div class="paymentCount">
  230. <h3 class="PartTitle">近一个月平台购票渠道和支付方式统计</h3>
  231. <div class="Saleschart">
  232. <div id="chartRankOnePay1" style="width: 250px;height:210px;display: inline-block"></div>
  233. <div id="chartRankOnePay2" style="width: 250px;height:210px;display: inline-block"></div>
  234. </div>
  235. </div>
  236. </div>
  237. </div>
  238. </div>
  239. </template>
  240. <script>
  241. import * as echarts from 'echarts'
  242. import {getMap} from "@/api/ship/diqiu";
  243. import {getShipRoute} from "@/api/ship/shipMapping";
  244. export default {
  245. name: "songhuaIndex",
  246. data() {
  247. return {
  248. moreMeunSmalLeft_1: false,
  249. moreMeunSmalLeft_2: false,
  250. moreMeunSmalLeft_3: false,
  251. regionInShowOne: false,
  252. regionInShowTwo: true,
  253. money: 15389740,
  254. peopleNum: 234856,
  255. dataSource: [],
  256. map:[],
  257. dateList: [
  258. { date: '2020-04', label: '2020年04月' },
  259. { date: '2020-03', label: '2020年03月' },
  260. { date: '2020-02', label: '2020年02月' },
  261. { date: '2020-01', label: '2020年01月' },
  262. { date: '2019-12', label: '2019年12月' }
  263. ]
  264. }
  265. },
  266. mounted() {
  267. //近一个月排行
  268. this.chartRankOneMonthGet([
  269. ['product', '本月', '上月'],
  270. ['动物园', 100, 150],
  271. ['五龙潭', 55, 85],
  272. ['三清观', 65, 88],
  273. ['植物园', 88, 15]
  274. ])
  275. //近一年销售
  276. this.chartRankOneSaleGet();
  277. //客源地省份
  278. this.chartRankOneCityGet();
  279. //游客年龄
  280. this.chartRankOneAgeGet();
  281. //支付方式与购买渠道
  282. this.chartRankOnePayGet();
  283. //停车场
  284. this.chartRankOneParkGet();
  285. //人流量排行
  286. this.chartRankOneMbsGet([60, 35, 20, 8, 5],[100, 100, 100, 100, 100])
  287. //地图
  288. this.getMapByPerson();
  289. let _this = this;
  290. setInterval(function () {
  291. _this.money += Math.round(Math.random() * 100);
  292. _this.peopleNum += Math.round(Math.random() * 100);
  293. }, 3000)
  294. },
  295. created() {
  296. // this.selectShipRoute()
  297. this.handler();
  298. },
  299. methods: {
  300. clickTimeFindData(str,i){
  301. if (str==='景区人流量排行榜TOP5'){
  302. if (i===0){
  303. this.chartRankOneMbsGet([60, 35, 20, 8, 5],[100, 100, 100, 100, 100])
  304. }
  305. if (i===1){
  306. this.chartRankOneMbsGet([55, 50, 40, 32, 22],[100, 100, 100, 100, 100])
  307. }
  308. if (i===2){
  309. this.chartRankOneMbsGet([77, 55, 44, 32, 11],[100, 100, 100, 100, 100])
  310. }
  311. }
  312. if (str==='景区近一年销售趋势排行榜TOP5'){
  313. }
  314. if (str==='景区近一个月游客排行榜TOP5'){
  315. if (i===0){
  316. this.chartRankOneMonthGet([
  317. ['product', '本月', '上月'],
  318. ['动物园', 450, 250],
  319. ['五龙潭', 350, 210],
  320. ['三清观', 120, 456],
  321. ['植物园', 88, 555]
  322. ])
  323. }
  324. if (i===1){
  325. this.chartRankOneMonthGet([
  326. ['product', '本月', '上月'],
  327. ['动物园', 123, 423],
  328. ['五龙潭', 43, 123],
  329. ['三清观', 444, 333],
  330. ['植物园', 444, 123]
  331. ])
  332. }
  333. if (i===2){
  334. this.chartRankOneMonthGet([
  335. ['product', '本月', '上月'],
  336. ['动物园', 345, 535],
  337. ['五龙潭', 234, 423],
  338. ['三清观', 222, 333],
  339. ['植物园', 333, 222]
  340. ])
  341. }
  342. }
  343. },
  344. //地图
  345. handler() {
  346. getShipRoute().then(res => {
  347. if (res.code == 200) {
  348. this.dataSource = res.data
  349. this.map = new BMap.Map('map'); // 创建Map实例
  350. this.map.centerAndZoom(new BMap.Point(126.607589,43.802168), 11); // 初始化地图,设置中心点坐标和地图级别
  351. this.map.enableScrollWheelZoom(true);
  352. let mapStyle ={
  353. style : 'midnight',
  354. };
  355. this.map.setMapStyle(mapStyle);
  356. let marker;
  357. let polyline;
  358. let opts;
  359. let ul;
  360. let dataList = this.dataSource
  361. for (let i = 0; i < dataList.length; i++) {
  362. let pointArray = [];
  363. for (let j = 0; j < dataList[i].polylinePath.length; j++) {
  364. pointArray.push(new BMap.Point(dataList[i].polylinePath[j].lng, dataList[i].polylinePath[j].lat))
  365. }
  366. polyline = new BMap.Polyline(pointArray, {strokeColor: dataList[i].color, strokeWeight: 5, strokeOpacity: 0.5}); //创建折线
  367. // 创建小船图标
  368. var myIcon = new BMap.Icon(require("@/assets/images/ship.png"), new BMap.Size(52, 26));
  369. marker = new BMap.Marker(new BMap.Point(dataList[i].polylinePath[0].lng, dataList[i].polylinePath[0].lat),{icon:myIcon}); // 创建点
  370. opts = {
  371. width: 100, // 信息窗口宽度
  372. height: 80, // 信息窗口高度
  373. title: "游船信息", // 信息窗口标题
  374. }
  375. // marker添加点击事件
  376. marker.addEventListener('mouseover', function () {
  377. this.map.openInfoWindow(new BMap.InfoWindow("游船名称:" + dataList[i].shipName + "</br>" + "游船型号:" + dataList[i].shipType + "</br>" + "驱动类型:" + dataList[i].propulsion + "</br>", opts), new BMap.Point(dataList[i].polylinePath[0].lng, dataList[i].polylinePath[0].lat));
  378. });
  379. marker.addEventListener('mouseout', function () {
  380. this.map.closeInfoWindow();
  381. });
  382. this.map.addOverlay(polyline);
  383. this.map.addOverlay(marker);
  384. }
  385. ul = document.getElementById('myList');
  386. // 循环数组中的每个项目
  387. dataList.forEach(function(item) {
  388. // 创建一个新的li元素
  389. var li = document.createElement('li');
  390. // 设置li元素的内容
  391. li.textContent = item.shipName;
  392. li.style.transform = 'translateX(22px)';
  393. // 将li元素添加到ul中
  394. ul.appendChild(li);
  395. });
  396. } else {
  397. this.$modal.msgError("查询失败");
  398. }
  399. })
  400. },
  401. // selectShipRoute() {
  402. // getShipRoute().then(res => {
  403. // if (res.code == 200) {
  404. // this.dataSource = res.data
  405. // console.log("this.dataSource", this.dataSource)
  406. // } else {
  407. // this.$modal.msgError("查询失败");
  408. // }
  409. // })
  410. // },
  411. //https://echarts.apache.org/examples/zh/editor.html?c=line-stack
  412. chartRankOneMonthGet(source) {
  413. let option = {
  414. legend: {
  415. textStyle: {
  416. color: 'white' // Set legend text color to white
  417. },
  418. right: '0' // Align legend to the right
  419. },
  420. tooltip: {},
  421. dataset: {
  422. source: source
  423. },
  424. xAxis: {type: 'category'},
  425. yAxis: {},
  426. // Declare several bar series, each will be mapped
  427. // to a column of dataset.source by default.
  428. series: [{
  429. type: 'bar',
  430. barWidth: '15%',
  431. itemStyle: {
  432. normal: {
  433. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  434. offset: 0,
  435. color: '#fe6f66'
  436. }, {
  437. offset: 1,
  438. color: '#f09a62'
  439. }]),
  440. },
  441. },
  442. },
  443. {
  444. type: 'bar',
  445. barWidth: '15%',
  446. itemStyle: {
  447. normal: {
  448. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  449. offset: 0,
  450. color: '#4ac1d6'
  451. }, {
  452. offset: 1,
  453. color: '#50d496'
  454. }]),
  455. }
  456. },
  457. }]
  458. };
  459. let myChart = this.$echarts.init(document.getElementById("chartRankOneMonth"));
  460. myChart.setOption(option);
  461. },
  462. chartRankOneAgeGet() {
  463. let option = {
  464. series: [
  465. {
  466. name: '人员比例',
  467. type: 'pie',
  468. radius: ['40%', '70%'],
  469. avoidLabelOverlap: true,
  470. label: {
  471. show: false,
  472. position: 'center'
  473. },
  474. emphasis: {
  475. label: {
  476. show: true,
  477. fontSize: 14,
  478. fontWeight: 'bold',
  479. formatter:'{b}:{c}\n {d}%',
  480. }
  481. },
  482. labelLine: {
  483. show: false
  484. },
  485. data: [
  486. {name: '60岁以上', value: 16},
  487. {name: '40-60岁之间', value: 25},
  488. {name: '18岁之内', value: 18},
  489. {name: '18-40岁之间', value: 36}
  490. ]
  491. }
  492. ]
  493. };
  494. let myChart = this.$echarts.init(document.getElementById("chartRankOneAge"));
  495. myChart.setOption(option);
  496. },
  497. //https://echarts.apache.org/examples/zh/editor.html?c=gauge-multi-title
  498. chartRankOneParkGet() {
  499. const gaugeData = [
  500. {
  501. value: 85,
  502. name: '已占用车位数',
  503. title: {
  504. offsetCenter: ['0%', '70%']
  505. },
  506. detail: {
  507. offsetCenter: ['0%', '105%']
  508. },
  509. }
  510. ];
  511. let option = {
  512. series: [
  513. {
  514. type: 'gauge',
  515. anchor: {
  516. show: true,
  517. showAbove: true,
  518. size: 18,
  519. itemStyle: {
  520. color: '#fff'
  521. }
  522. },
  523. axisLine: {
  524. lineStyle: {
  525. width: 6,
  526. color: [
  527. [0.3, '#e3ce67'],
  528. [0.7, '#2a86b6'],
  529. [1, '#42c51d']
  530. ]
  531. }
  532. },
  533. pointer: {
  534. icon: 'path://M2.9,0.7L2.9,0.7c1.4,0,2.6,1.2,2.6,2.6v115c0,1.4-1.2,2.6-2.6,2.6l0,0c-1.4,0-2.6-1.2-2.6-2.6V3.3C0.3,1.9,1.4,0.7,2.9,0.7z',
  535. width: 8,
  536. length: '80%',
  537. offsetCenter: [0, '8%']
  538. },
  539. progress: {
  540. show: true,
  541. overlap: true,
  542. roundCap: true
  543. },
  544. data: gaugeData,
  545. title: {
  546. fontSize: 14
  547. },
  548. detail: {
  549. width: 40,
  550. height: 14,
  551. fontSize: 14,
  552. color: '#fff',
  553. backgroundColor: 'inherit',
  554. borderRadius: 3,
  555. formatter: '{value}%'
  556. }
  557. }
  558. ]
  559. };
  560. setInterval(function () {
  561. gaugeData[0].value = +(Math.random() * 100).toFixed(2);
  562. myChart.setOption({
  563. series: [
  564. {
  565. data: gaugeData
  566. }
  567. ]
  568. });
  569. }, 2000);
  570. let myChart = this.$echarts.init(document.getElementById("chartRankOnePark"));
  571. myChart.setOption(option);
  572. },
  573. chartRankOneSaleGet(xData,yData) {
  574. let option = {
  575. tooltip: {
  576. trigger: 'axis'
  577. },
  578. grid: {
  579. left: '3%',
  580. right: '4%',
  581. bottom: '3%',
  582. containLabel: true
  583. },
  584. xAxis: {
  585. type: 'category',
  586. boundaryGap: false,
  587. data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月']
  588. },
  589. yAxis: {
  590. type: 'value'
  591. },
  592. series: [
  593. {
  594. name: '景区1',
  595. type: 'line',
  596. stack: 'Total',
  597. data: [120, 132, 101, 134, 90, 230, 210]
  598. },
  599. {
  600. name: '景区2',
  601. type: 'line',
  602. stack: 'Total',
  603. data: [220, 182, 191, 234, 290, 330, 310]
  604. },
  605. {
  606. name: '景区3',
  607. type: 'line',
  608. stack: 'Total',
  609. data: [150, 232, 201, 154, 190, 330, 410]
  610. },
  611. {
  612. name: '景区4',
  613. type: 'line',
  614. stack: 'Total',
  615. data: [320, 332, 301, 334, 390, 330, 320]
  616. },
  617. {
  618. name: '景区5',
  619. type: 'line',
  620. stack: 'Total',
  621. data: [820, 932, 901, 934, 1290, 1330, 1320]
  622. }
  623. ]
  624. };
  625. let myChart = this.$echarts.init(document.getElementById("chartRankOneSale"));
  626. myChart.setOption(option);
  627. },
  628. //https://echarts.apache.org/examples/zh/editor.html?c=bar-y-category
  629. chartRankOneCityGet() {
  630. let option = {
  631. grid: {
  632. left: "2%",
  633. right: "2%",
  634. bottom: "2%",
  635. top: "2%",
  636. containLabel: true,
  637. },
  638. xAxis: {
  639. show: false,
  640. type: "value",
  641. },
  642. yAxis: [
  643. {
  644. type: "category",
  645. inverse: true,
  646. axisLabel: {
  647. show: true,
  648. textStyle: {
  649. fontSize: 20,
  650. color: "rgba(255, 255, 255, 0.8)",
  651. },
  652. formatter: function (name) {
  653. return name + ": ";
  654. },
  655. },
  656. splitLine: {
  657. show: false,
  658. },
  659. axisTick: {
  660. show: false,
  661. },
  662. axisLine: {
  663. show: false,
  664. },
  665. data: [
  666. "湖北省",
  667. "广东省",
  668. "江西省",
  669. "广西省",
  670. "湖南省",
  671. ],
  672. },
  673. {
  674. type: "category",
  675. inverse: true,
  676. axisTick: "none",
  677. axisLine: "none",
  678. show: false,
  679. axisLabel: {
  680. textStyle: {
  681. fontSize: 13,
  682. color: "rgba(255, 255, 255, 0.8)",
  683. padding: [0, 0, 0, 10],
  684. },
  685. formatter: function (value) {
  686. return value
  687. .toLocaleString()
  688. .toString()
  689. .replace(/(\d)(?=(?:\d{3}[+]?)+$)/g, "$1,");
  690. },
  691. },
  692. data: [60, 30, 10, 8, 5],
  693. },
  694. ],
  695. series: [
  696. {
  697. name: "车辆",
  698. type: "bar",
  699. zlevel: 1, //通过 zlevel 设置层级
  700. barWidth: 20,
  701. itemStyle: {
  702. normal: {
  703. barBorderRadius: 10,
  704. color: function (params) {//柱状图设置不同颜色
  705. // 给出颜色组
  706. var colorList = ["#ee6767", "#92cc76", "#fac859", "#4a77dd", "#ba77fd"];
  707. return colorList[params.dataIndex]
  708. },
  709. },
  710. },
  711. label: {
  712. show: true,
  713. position: 'right',
  714. formatter: '{c}%' // 显示数值和百分比
  715. },
  716. data: [60, 30, 10, 8, 5],
  717. },
  718. {
  719. name: "背景",
  720. type: "bar",
  721. barWidth: 20,
  722. barGap: "-100%", //两条柱状图重合
  723. data: [100, 100, 100, 100, 100],
  724. itemStyle: {
  725. normal: {
  726. color: "rgba(108, 254, 255, 0.3)",
  727. barBorderRadius: 10,
  728. },
  729. },
  730. },
  731. ],
  732. };
  733. let myChart = this.$echarts.init(document.getElementById("chartRankOneCity"));
  734. myChart.setOption(option);
  735. },
  736. //https://ppchart.com/#/今日各考场承载总考生数
  737. chartRankOnePayGet() {
  738. let result1 = this.chartRankOnePays([
  739. {
  740. value: 2154,
  741. name: "自助端",
  742. },
  743. {
  744. value: 3854,
  745. name: "微信端",
  746. },
  747. {
  748. value: 3515,
  749. name: "窗口端",
  750. },
  751. {
  752. value: 3515,
  753. name: "其他",
  754. }
  755. ],'购票渠道')
  756. let result2 = this.chartRankOnePays([
  757. {
  758. value: 1234,
  759. name: "微信",
  760. },
  761. {
  762. value: 2345,
  763. name: "现金",
  764. },
  765. {
  766. value: 3456,
  767. name: "支付宝",
  768. },
  769. {
  770. value: 1231,
  771. name: "银联",
  772. }
  773. ],'支付方式')
  774. let myChart1 = this.$echarts.init(document.getElementById("chartRankOnePay1"));
  775. let myChart2 = this.$echarts.init(document.getElementById("chartRankOnePay2"));
  776. myChart1.setOption(result1);
  777. myChart2.setOption(result2);
  778. },
  779. chartRankOnePays(data,title){
  780. let scale = 1;
  781. let echartData = data!=null?data:[];
  782. let rich = {
  783. yellow: {
  784. color: "#ffc72b",
  785. fontSize: 12 * scale,
  786. padding: [5, 4],
  787. align: "center",
  788. },
  789. total: {
  790. color: "#ffc72b",
  791. fontSize: 12 * scale,
  792. align: "center",
  793. },
  794. white: {
  795. color: "#fff",
  796. align: "center",
  797. fontSize: 12 * scale,
  798. padding: [21, 0],
  799. },
  800. blue: {
  801. color: "#49dff0",
  802. fontSize: 12 * scale,
  803. align: "center",
  804. },
  805. hr: {
  806. borderColor: "#0b5263",
  807. width: "100%",
  808. borderWidth: 1,
  809. height: 0,
  810. },
  811. };
  812. return {
  813. // backgroundColor: "#031f2d",
  814. tooltip: {},
  815. graphic: {
  816. type: 'text',
  817. left: 'center',
  818. top: 'center',
  819. style: {
  820. text: title,
  821. textAlign: 'center',
  822. fill: 'white',
  823. width: 30,
  824. height: 30,
  825. fontSize: 14
  826. }
  827. },
  828. series: [
  829. {
  830. name: title,
  831. type: "pie",
  832. radius: ["32%", "40%"],
  833. hoverAnimation: false,
  834. color: ["#c487ee", "#deb140", "#49dff0", "#034079", "#6f81da", "#00ffb4"],
  835. label: {
  836. normal: {
  837. formatter: function (params, ticket, callback) {
  838. var total = 0;
  839. var percent = 0;
  840. echartData.forEach(function (value, index, array) {
  841. total += value.value;
  842. });
  843. percent = ((params.value / total) * 100).toFixed(1);
  844. return (
  845. "{white|" +
  846. params.name +
  847. "}\n{hr|}\n{yellow|" +
  848. params.value +
  849. "}\n{blue|" +
  850. percent +
  851. "%}"
  852. );
  853. },
  854. rich: rich,
  855. },
  856. },
  857. labelLine: {
  858. normal: {
  859. length: 30 * scale,
  860. length2: 0,
  861. lineStyle: {
  862. color: "#0b5263",
  863. },
  864. },
  865. },
  866. data: echartData,
  867. },
  868. ],
  869. };
  870. },
  871. //https://blog.csdn.net/qq_43519782/article/details/118707267?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522171393938516800186569476%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=171393938516800186569476&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~first_rank_ecpm_v1~rank_v31_ecpm-9-118707267-null-null.142^v100^pc_search_result_base4&utm_term=%E6%A8%AA%E5%90%91%E6%9F%B1%E5%9B%BE%E9%87%8D%E5%90%88&spm=1018.2226.3001.4187
  872. chartRankOneMbsGet(data,maxdata) {
  873. let option = {
  874. grid: {
  875. left: "0%",
  876. right: "0%",
  877. bottom: "0%",
  878. top: "0%",
  879. containLabel: true,
  880. },
  881. // tooltip: {
  882. // trigger: "axis",
  883. // axisPointer: {
  884. // type: "shadow",
  885. // },
  886. // confine: true,
  887. // textStyle: {
  888. // fontSize: 12,
  889. // color: "rgba(255, 255, 255, 0.8)",
  890. // },
  891. // formatter: function (params) {
  892. // return (
  893. // params[0].name +
  894. // "<br/>" +
  895. // "<span style='display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background:linear-gradient(90deg, #388CFF 0% ,#6CFEFF 100%)'></span>" +
  896. // params[0].seriesName +
  897. // " : " +
  898. // params[0].value
  899. // .toLocaleString()
  900. // .toString()
  901. // .replace(/(\d)(?=(?:\d{3}[+]?)+$)/g, "$1,") +
  902. // " 辆/天"
  903. // );
  904. // },
  905. // },
  906. xAxis: {
  907. show: false,
  908. type: "value",
  909. },
  910. yAxis: [
  911. {
  912. type: "category",
  913. inverse: true,
  914. axisLabel: {
  915. show: true,
  916. textStyle: {
  917. fontSize: 12,
  918. color: "rgba(255, 255, 255, 0.8)",
  919. backgroundColor: "#061731",
  920. width: 200,
  921. height: 30,
  922. align: 'center',
  923. },
  924. formatter: function (name) {
  925. return name + " ";
  926. },
  927. },
  928. splitLine: {
  929. show: false,
  930. },
  931. axisTick: {
  932. show: false,
  933. },
  934. axisLine: {
  935. show: false,
  936. },
  937. data: [],
  938. },
  939. ],
  940. series: [
  941. {
  942. name: "车辆",
  943. type: "bar",
  944. zlevel: 1, //通过 zlevel 设置层级
  945. barWidth: 15,
  946. itemStyle: {
  947. normal: {
  948. barBorderRadius: 10,
  949. // 渐变色
  950. // color: "rgba(108, 254, 255, 0.3)",
  951. color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
  952. {
  953. offset: 0,
  954. color: "#388CFF",
  955. },
  956. {
  957. offset: 1,
  958. color: "#6CFEFF",
  959. },
  960. ]),
  961. },
  962. },
  963. label: {
  964. show: true,
  965. position: 'right',
  966. formatter: '{c}%' // 显示数值和百分比
  967. },
  968. data: data,
  969. },
  970. {
  971. name: "背景",
  972. type: "bar",
  973. barWidth: 15,
  974. barGap: "-100%", //两条柱状图重合
  975. data: maxdata,
  976. itemStyle: {
  977. normal: {
  978. color: "rgba(108, 254, 255, 0.3)",
  979. barBorderRadius: 10,
  980. },
  981. },
  982. },
  983. ],
  984. };
  985. let myChart = this.$echarts.init(document.getElementById("chartRankOneMb"));
  986. myChart.setOption(option);
  987. },
  988. getMapByPerson() {
  989. let option = getMap();
  990. let myChart = this.$echarts.init(document.getElementById("mapByPerson"));
  991. myChart.setOption(option);
  992. },
  993. tabClick(state) {
  994. let that=this
  995. if (state == 1) {
  996. this.regionInShowOne = true;
  997. this.regionInShowTwo = false;
  998. setTimeout(that.aaa(),1000
  999. )
  1000. } else {
  1001. this.regionInShowOne = false;
  1002. this.regionInShowTwo = true;
  1003. }
  1004. },
  1005. getFirstDigit(num) {
  1006. return Number(String(this.money).charAt(num));
  1007. },
  1008. aaa(){
  1009. this.map.panTo(new BMap.Point(126.607581,43.802168)); // 初始化地图,设置中心点坐标和地图级别
  1010. }
  1011. },
  1012. }
  1013. </script>
  1014. <style lang="scss" scoped>
  1015. @import "@/assets/styles/shh_body.scss";
  1016. @import "@/assets/styles/shh_index.scss";
  1017. </style>