CehicleOperation.vue 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562
  1. <template>
  2. <Layout>
  3. <template #left>
  4. <div class="left">
  5. <Box
  6. :width="560"
  7. :height="1224"
  8. :name="'线路基本情况'"
  9. class="left-left"
  10. >
  11. <div class="linebase">
  12. <div class="car">
  13. <div class="top">
  14. <Icon
  15. name="1-1"
  16. :size="80"
  17. style="margin-right: 20px;"
  18. />
  19. <div class="name bold">
  20. {{ store.currentLineCode }}
  21. </div>
  22. <div class="road">
  23. </div>
  24. </div>
  25. <div class="current">
  26. 当前线路
  27. </div>
  28. </div>
  29. <div class="info">
  30. <div>
  31. <div class="label">
  32. 线路类型:
  33. </div> <div class="val">
  34. {{ typeMap[busLineData?.type??0] }}
  35. </div>
  36. </div>
  37. <div>
  38. <div class="label">
  39. 车辆总数:
  40. </div> <div class="val">
  41. {{ busLineData?.totalCar }}辆
  42. </div>
  43. </div>
  44. <div>
  45. <div class="label">
  46. 运 营 中:
  47. </div> <div class="val">
  48. {{ busLineData?.operateNum }}辆
  49. </div>
  50. </div>
  51. <div>
  52. <div class="label">
  53. 非 运 营:
  54. </div> <div class="val">
  55. {{ busLineData?.nonOperateNum }}辆
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. <div class="header">
  61. <div>
  62. <Icon
  63. name="1-2"
  64. :size="30"
  65. />
  66. 起讫点
  67. </div>
  68. <div>
  69. <Icon
  70. name="1-3"
  71. :size="30"
  72. />
  73. 运营时间
  74. </div>
  75. </div>
  76. <div class="detail">
  77. <div>
  78. <div class="row">
  79. <div class="type orange">
  80. 上行
  81. </div>
  82. <div class="name">
  83. {{ busLineData?.upStartStation }} → {{ busLineData?.upEndStation }}
  84. </div>
  85. <div class="value">
  86. {{ busLineData?.upStartTime }}~{{ busLineData?.upEndTime }}
  87. </div>
  88. </div>
  89. <div class="row">
  90. <div class="type">
  91. 下行
  92. </div>
  93. <div class="name">
  94. {{ busLineData?.downStartStation }} → {{ busLineData?.downEndStation }}
  95. </div>
  96. <div class="value">
  97. {{ busLineData?.downStartTime }}~{{ busLineData?.downEndTime }}
  98. </div>
  99. </div>
  100. </div>
  101. <div>
  102. <div class="row">
  103. <div class="type orange">
  104. </div>
  105. <div class="name">
  106. 线路上行里程
  107. </div>
  108. <div class="value">
  109. {{ busLineData?.upMileage }}km
  110. </div>
  111. </div>
  112. <div class="row">
  113. <div class="type">
  114. </div>
  115. <div class="name">
  116. 线路下行里程
  117. </div>
  118. <div class="value">
  119. {{ busLineData?.downMileage }}km
  120. </div>
  121. </div>
  122. <div class="row">
  123. <Icon
  124. name="1-4"
  125. :size="38"
  126. />
  127. <div class="name">
  128. 票价
  129. </div>
  130. <div class="value">
  131. {{ busLineData?.fare }}元
  132. </div>
  133. </div>
  134. </div>
  135. <div>
  136. <div class="title">
  137. <div class="flex">
  138. <Icon
  139. name="1-5"
  140. :size="30"
  141. />
  142. <div class="name">
  143. 驾驶员数量
  144. </div>
  145. </div>
  146. <div class="value">
  147. <div
  148. class="bold"
  149. style="font-size: 40px"
  150. >
  151. {{ driverTotal }}
  152. </div>
  153. <div class="">
  154. </div>
  155. </div>
  156. </div>
  157. <div class="starlist">
  158. <div
  159. v-for="item in starlist"
  160. :key="item.label"
  161. class="star"
  162. >
  163. <div>{{ item.label }}</div>
  164. <div class="flex">
  165. <span class="num bold">{{ item.value }}</span>人
  166. </div>
  167. </div>
  168. </div>
  169. </div>
  170. <div style="border: 0;">
  171. <div class="title">
  172. <div class="flex">
  173. <Icon
  174. name="1-1"
  175. :size="30"
  176. />
  177. <div class="name">
  178. 车辆数占比
  179. </div>
  180. </div>
  181. <div class="value">
  182. <div
  183. class="bold"
  184. style="font-size: 40px"
  185. >
  186. {{ carTotal }}
  187. </div>
  188. </div>
  189. </div>
  190. <Echart
  191. style="width: 560px;height:318px"
  192. :option="leftContent.leftOp"
  193. />
  194. </div>
  195. </div>
  196. </Box>
  197. <Box
  198. :width="560"
  199. :height="1224"
  200. :name="'线路发班情况'"
  201. class="left-right"
  202. >
  203. <div class="filter">
  204. <div class="name bold">
  205. 筛选
  206. </div>
  207. <div class="odds">
  208. <div
  209. v-for="item in odds"
  210. :key="item.label"
  211. class="odd"
  212. :class="{ checkd: curOdd === item.key }"
  213. @click="curOdd = item.key"
  214. >
  215. {{ item.label }} {{ item.value }}
  216. </div>
  217. </div>
  218. </div>
  219. <div class="frequency">
  220. <div class="title bold">
  221. 上行
  222. </div>
  223. <div class="content">
  224. <div
  225. v-for="item in upData"
  226. :key="item.id"
  227. class="bus"
  228. >
  229. <img
  230. src="../../../../assets/img/1-1.png"
  231. alt="bus"
  232. >
  233. <div
  234. :class="item.type"
  235. class="status"
  236. >
  237. {{ findlabel(odds,item.type) }}
  238. </div>
  239. <div class="info">
  240. <div>
  241. <div class="bold">
  242. {{ item.lineName }}
  243. </div>
  244. <div class="busNum">
  245. {{ item.licensePlate }}
  246. </div>
  247. </div>
  248. <div>司机:{{ item.driver }} </div>
  249. <div>电量:{{ item.electricity }} </div>
  250. </div>
  251. <div class="table">
  252. <div>
  253. <div class="label">
  254. 调度时间
  255. </div>
  256. <div class="value">
  257. {{ item.dispatchTime }}
  258. </div>
  259. </div>
  260. <div>
  261. <div class="label">
  262. 实际发车时间
  263. </div>
  264. <div class="value">
  265. {{ item.realityTime }}
  266. </div>
  267. </div>
  268. <div>
  269. <div class="label">
  270. 发车间隔
  271. </div>
  272. <div class="value">
  273. {{ item.intervalTime }}分钟
  274. </div>
  275. </div>
  276. </div>
  277. </div>
  278. </div>
  279. <div class="page">
  280. <n-pagination
  281. v-model:page="upOption.page"
  282. :page-size="upOption.pageSize"
  283. :item-count="upBusLineOperate.length"
  284. >
  285. <template #prefix="{ itemCount }">
  286. 总共 {{ itemCount }} 个项目
  287. </template>
  288. </n-pagination>
  289. </div>
  290. </div>
  291. <div class="frequency">
  292. <div class="title bold">
  293. 下行
  294. </div>
  295. <div class="content">
  296. <div
  297. v-for="item in downData"
  298. :key="item.id"
  299. class="bus"
  300. >
  301. <img
  302. src="../../../../assets/img/1-1.png"
  303. alt="bus"
  304. >
  305. <div
  306. :class="item"
  307. class="status"
  308. >
  309. {{ findlabel(odds,item.type) }}
  310. </div>
  311. <div class="info">
  312. <div>
  313. <div class="bold">
  314. {{ item.lineName }}
  315. </div>
  316. <div class="busNum">
  317. {{ item.licensePlate }}
  318. </div>
  319. </div>
  320. <div>司机:{{ item.driver }} </div>
  321. <div>电量:{{ item.electricity }} </div>
  322. </div>
  323. <div class="table">
  324. <div>
  325. <div class="label">
  326. 调度时间
  327. </div>
  328. <div class="value">
  329. {{ item.dispatchTime }}
  330. </div>
  331. </div>
  332. <div>
  333. <div class="label">
  334. 实际发车时间
  335. </div>
  336. <div class="value">
  337. {{ item.realityTime }}
  338. </div>
  339. </div>
  340. <div>
  341. <div class="label">
  342. 发车间隔
  343. </div>
  344. <div class="value">
  345. {{ item.intervalTime }}分钟
  346. </div>
  347. </div>
  348. </div>
  349. </div>
  350. </div>
  351. <div class="page">
  352. <n-pagination :item-count="downBusLineOperate.length">
  353. <template #prefix="{ itemCount }">
  354. 总共 {{ itemCount }} 个项目
  355. </template>
  356. </n-pagination>
  357. </div>
  358. </div>
  359. </Box>
  360. </div>
  361. </template>
  362. <template #right>
  363. <div class="right">
  364. <div class="right-top">
  365. <Box
  366. v-for="(item, index) in rightContent?.top"
  367. :key="index"
  368. :width="438"
  369. :height="570"
  370. :name="item.name"
  371. >
  372. <Echart :option="item.option" />
  373. </Box>
  374. </div>
  375. <div class="right-bottom">
  376. <Box
  377. :width="663"
  378. :height="570"
  379. :name="'车辆监控'"
  380. >
  381. <div class="carmonitor">
  382. <div class="control">
  383. <div class="item">
  384. <div class="label">
  385. 状态:
  386. </div>
  387. <n-select
  388. v-model:value="statusVal"
  389. :on-update:value="statusChange"
  390. :bordered="false"
  391. size="large"
  392. :options=" [
  393. { label: '全部', value: '' },
  394. { label: '运营中', value: 1 },
  395. { label: '非运营', value: 2 }
  396. ]"
  397. />
  398. </div>
  399. <div class="item">
  400. <div class="label">
  401. 情景:
  402. </div>
  403. <n-select
  404. v-model:value="sceneVal"
  405. :bordered="false"
  406. size="large"
  407. :on-update:value="sceneChange"
  408. :options=" [
  409. { label: '全部', value: '' },
  410. { label: '行驶中', value: 1 },
  411. { label: '维保', value: 2 },
  412. { label: '固定包车', value: 3 },
  413. { label: '临时包车', value: 4 },
  414. { label: '充电', value: 5 },
  415. { label: '公务', value: 6 },
  416. ]"
  417. />
  418. </div>
  419. </div>
  420. <n-table
  421. striped
  422. size="large"
  423. :bordered="false"
  424. single-column
  425. :bottom-bordered="false"
  426. class="table"
  427. >
  428. <thead>
  429. <tr>
  430. <th> 状态 </th>
  431. <th> 车牌号 </th>
  432. <th> 驾驶员 </th>
  433. <th> 拥挤度 </th>
  434. <th> 情景 </th>
  435. </tr>
  436. </thead>
  437. <tbody>
  438. <tr
  439. v-for="item,index in vehicleMonitorData"
  440. :key="item"
  441. :class="{ no: index === 0 }"
  442. >
  443. <td style="width: 120px; text-align: left;padding-left: 30px;">
  444. <div class="index" /> {{ findlabel(vehicleStatus,item.carStatus) }}
  445. </td>
  446. <td> {{ item?.licensePlate }} </td>
  447. <td> {{ item?.driver }}</td>
  448. <td> {{ item.congestion }} </td>
  449. <td>{{ findlabel(passengerOption,item.carScene) }} </td>
  450. </tr>
  451. </tbody>
  452. </n-table>
  453. </div>
  454. </Box>
  455. <Box
  456. :width="663"
  457. :height="570"
  458. :name="'车辆状态'"
  459. >
  460. <div class="carstatus">
  461. <div
  462. v-for="item,index in vehicleStatusData"
  463. :key="index+1000"
  464. :class="item.direction===1 ? 'up' :'down'"
  465. >
  466. <div class="title">
  467. {{ item.direction===1?'上行' :'下行' }}
  468. </div>
  469. <div class="content">
  470. <template v-for="value,key in item">
  471. <div
  472. v-if="!['id','direction'].includes(key+'')"
  473. :key="key"
  474. >
  475. <div class="label">
  476. {{ carstatusMap[key] }}
  477. </div>
  478. <div class="value">
  479. {{ value }}
  480. </div>
  481. </div>
  482. </template>
  483. </div>
  484. </div>
  485. <div class="line" />
  486. </div>
  487. </Box>
  488. </div>
  489. </div>
  490. </template>
  491. </Layout>
  492. </template>
  493. <script setup lang='ts'>
  494. import Layout from '@/components/layout.vue'
  495. import Box from '@/components/box.vue'
  496. import Echart from '@/components/chart.vue'
  497. import {
  498. computed, onUnmounted, ref, watch
  499. } from 'vue'
  500. import { graphic } from 'echarts'
  501. import CehicleOperationService from '../services/cehicleOperation.service'
  502. import useStore from '@/pages/store'
  503. const store = useStore()
  504. const cehicleOperationService = new CehicleOperationService()
  505. const typeMap :any = {
  506. 0: '干线公交',
  507. 1: '主线公交'
  508. }
  509. /* 线路类型:干线公交 车辆总数: 运 营 中:9 辆 非 运 营:1 辆 */
  510. const starlist:any = ref([
  511. { label: '五星', value: '1' },
  512. { label: '四星', value: '2' },
  513. { label: '三星', value: '3' },
  514. { label: '二星', value: '4' },
  515. { label: '一星', value: '5' }
  516. ])
  517. const odds = ref([
  518. { label: '全部', value: '', key: '' },
  519. { label: '已完成', value: 1, key: 1 },
  520. { label: '执行中', value: 2, key: 2 },
  521. { label: '已处理', value: 3, key: 3 },
  522. { label: '已下发', value: 4, key: 4 },
  523. { label: '待发', value: 5, key: 5 },
  524. { label: '调停', value: 6, key: 6 },
  525. { label: '非运营', value: 7, key: 7 }
  526. ])
  527. const curOdd = ref('' as any)
  528. function findlabel(arr: any[], val: any) {
  529. return arr.find((item: { value: any }) => item.value === val)?.label
  530. }
  531. // 1已完成2执行中3已处理4已下发5待发6调停7非运营
  532. const status = [ 'success', 'warning', 'error' ]
  533. const upBusLineOperate = ref([] as any[])
  534. const upOption = ref({
  535. pageSize: 3,
  536. page: 1
  537. })
  538. const upData = computed(() => upBusLineOperate.value.slice((upOption.value.page - 1) * upOption.value.pageSize, upOption.value.page * upOption.value.pageSize))
  539. const downBusLineOperate = ref([] as any[])
  540. const downOption = ref({
  541. pageSize: 3,
  542. page: 1
  543. })
  544. const downData = computed(() => downBusLineOperate.value.slice((downOption.value.page - 1) * downOption.value.pageSize, downOption.value.page * downOption.value.pageSize))
  545. const carstatusMap:any = {
  546. avgSpacing: '平均间距',
  547. minSpacing: '最小间距',
  548. averageTime: '平峰平均时间',
  549. singleAvgTime: '单程平均时间',
  550. maxSpacing: '最大间距',
  551. peakAvgTime: '高峰平均时间',
  552. maxSpeed: '最大车速',
  553. minSpeed: '最小车速',
  554. avgSpeed: '平均车速'
  555. }
  556. const leftContent = ref({
  557. leftOp: {
  558. grid: {
  559. containLabel: true
  560. },
  561. tooltip: {
  562. show: true,
  563. formatter: '{b}: {c}辆 ,占比: {d}%'
  564. },
  565. // 图表图例
  566. legend: {
  567. show: true,
  568. type: 'scroll',
  569. orient: 'horizontal', // 图例排列方向
  570. icon: 'circle', // 图例样式为圆形
  571. itemWidth: 10, // 图例图形的宽度
  572. itemHeight: 16, // 图例图形的高度
  573. itemGap: 10, // 图例项之间的间隔
  574. left: 'center', // 图例距离容器右侧的距离
  575. bottom: 0, // 图例垂直居中
  576. textStyle: {
  577. color: 'white', // 图例文字颜色
  578. fontSize: 16
  579. }
  580. },
  581. series: [
  582. {
  583. type: 'pie', // 图表类型为饼图
  584. radius: '60%', // 控制内外圆环的半径,30%代表内圆,60%代表外圆
  585. avoidLabelOverlap: true, // 是否启用防止标签重叠策略
  586. showEmptyCircle: true, // 是否在无数据的时候显示一个占位圆
  587. label: {
  588. show: true,
  589. fontSize: 16,
  590. formatter: '{b}: {c}辆',
  591. color: 'white'
  592. },
  593. data: [
  594. { name: '2023', value: 0 },
  595. { name: '2022', value: 0 },
  596. { name: '2021', value: 0 },
  597. { name: '2020', value: 0 },
  598. { name: '2019', value: 0 }
  599. ]
  600. }
  601. ]
  602. }
  603. })
  604. const rightContent = ref({
  605. top: [
  606. {
  607. name: '乘客类型',
  608. option: {
  609. title: {
  610. text: '总', // 图标内容文本
  611. subtext: '196000',
  612. left: 'center', // 图标内容水平居中
  613. top: 'center', // 图标内容垂直居中
  614. // 文本样式
  615. textStyle: {
  616. color: '#fff', // 图标内容文字颜色
  617. fontSize: '16px', // 图标内容文字大小
  618. fontWeight: 'normal'
  619. },
  620. subtextStyle: {
  621. color: '#fff', // 图标内容文字颜色
  622. fontSize: '20px', // 图标内容文字大小
  623. fontWeight: 'normal'
  624. }
  625. },
  626. grid: {
  627. containLabel: true
  628. },
  629. tooltip: {
  630. show: true,
  631. formatter: '{b}: {c}次 , 占比: {d}%'
  632. },
  633. // 图表图例
  634. legend: {
  635. show: true,
  636. type: 'scroll',
  637. orient: 'horizontal', // 图例排列方向
  638. icon: 'circle', // 图例样式为圆形
  639. itemWidth: 10, // 图例图形的宽度
  640. itemHeight: 16, // 图例图形的高度
  641. itemGap: 40, // 图例项之间的间隔
  642. left: 'center', // 图例距离容器右侧的距离
  643. bottom: 0, // 图例垂直居中
  644. textStyle: {
  645. color: 'white', // 图例文字颜色
  646. fontSize: 14
  647. }
  648. },
  649. series: [
  650. {
  651. type: 'pie', // 图表类型为饼图
  652. radius: [ '45%', '60%' ], // 控制内外圆环的半径,30%代表内圆,60%代表外圆
  653. avoidLabelOverlap: true, // 是否启用防止标签重叠策略
  654. showEmptyCircle: true, // 是否在无数据的时候显示一个占位圆
  655. label: {
  656. show: true,
  657. formatter: '{d}%',
  658. color: 'white'
  659. },
  660. data: [
  661. { name: '老年卡', value: 180 },
  662. { name: '电子钱包', value: 50 },
  663. { name: '现金', value: 30 },
  664. { name: '学生卡', value: 20 },
  665. { name: '成人次卡', value: 10 },
  666. { name: '其他', value: 10 },
  667. { name: '免费人次', value: 10 }
  668. ]
  669. }
  670. ]
  671. }
  672. },
  673. {
  674. name: '客流情况',
  675. option: {
  676. grid: {
  677. containLabel: true,
  678. right: 30,
  679. left: 50
  680. },
  681. tooltip: {
  682. trigger: 'axis',
  683. formatter: '{b}<br /> {a0}:{c0}人次',
  684. axisPointer: {
  685. type: 'shadow'
  686. }
  687. },
  688. legend: {
  689. show: true,
  690. left: 'center',
  691. top: '10',
  692. icon: 'stack',
  693. itemWidth: 15,
  694. itemHeight: 10,
  695. textStyle: {
  696. color: '#646464',
  697. fontSize: 18
  698. }
  699. },
  700. xAxis: [ {
  701. type: 'category',
  702. axisLine: {
  703. show: false
  704. },
  705. axisLabel: {
  706. color: '#fff',
  707. fontSize: 18
  708. // formatter: (value: number) => format( 1'时')
  709. },
  710. splitLine: {
  711. show: false
  712. },
  713. axisTick: {
  714. show: false
  715. },
  716. data: [ '1时', '2时', '3时', '4时', '5时', '6时', '7时', '8时', '9时', '10时', '11时', '12时' ]
  717. } ],
  718. yAxis: [ {
  719. name: '客流量/人次',
  720. nameLocation: 'center',
  721. nameGap: 50,
  722. nameTextStyle: {
  723. color: '#fff',
  724. fontSize: 18
  725. },
  726. padding: 5,
  727. // max: 1000,
  728. splitLine: {
  729. show: true,
  730. lineStyle: {
  731. color: '#A1A7B3'
  732. // type: 'dashed'
  733. }
  734. },
  735. axisLine: {
  736. show: false
  737. },
  738. axisLabel: {
  739. show: true,
  740. margin: 10,
  741. textStyle: {
  742. color: '#fff'
  743. }
  744. },
  745. axisTick: {
  746. show: false
  747. }
  748. }
  749. ],
  750. series: [ {
  751. name: '客流量',
  752. type: 'line',
  753. smooth: true,
  754. symbolSize: 0,
  755. itemStyle: {
  756. normal: {
  757. // color: '#FFD35D',
  758. lineStyle: {
  759. color: new graphic.LinearGradient(0, 0, 0, 1, [
  760. {
  761. offset: 0,
  762. color: '#FFD35D66'
  763. },
  764. {
  765. offset: 0.5,
  766. color: '#7ec2f366'
  767. },
  768. {
  769. offset: 1,
  770. color: '#1890ff'
  771. }
  772. ], false),
  773. width: 1
  774. }
  775. }
  776. },
  777. areaStyle: {
  778. normal: {
  779. color: new graphic.LinearGradient(0, 0, 0, 1, [
  780. {
  781. offset: 0,
  782. color: '#FFD35D66'
  783. },
  784. {
  785. offset: 0.5,
  786. color: '#7ec2f366'
  787. },
  788. {
  789. offset: 1,
  790. color: '#1890ff'
  791. }
  792. ], false)
  793. }
  794. },
  795. data: [ 120, 132, 101, 134, 90, 230, 210, 182, 191, 234, 290, 330 ]
  796. } ],
  797. dataZoom: {}
  798. }
  799. },
  800. {
  801. name: '里程情况',
  802. option: {
  803. grid: {
  804. containLabel: true,
  805. right: 30,
  806. left: 50
  807. },
  808. tooltip: {
  809. trigger: 'axis',
  810. formatter: '{b}<br /> {a0}:{c0}km',
  811. axisPointer: {
  812. type: 'shadow'
  813. }
  814. },
  815. legend: {
  816. show: true,
  817. left: 'center',
  818. top: '10',
  819. icon: 'stack',
  820. itemWidth: 15,
  821. itemHeight: 10,
  822. textStyle: {
  823. color: '#646464',
  824. fontSize: 18
  825. }
  826. },
  827. xAxis: [ {
  828. type: 'category',
  829. axisLine: {
  830. show: false
  831. },
  832. axisLabel: {
  833. color: '#fff',
  834. fontSize: 18
  835. // formatter: (value: number) => format( 1'时')
  836. },
  837. splitLine: {
  838. show: false
  839. },
  840. axisTick: {
  841. show: false
  842. },
  843. data: [ '1时', '2时', '3时', '4时', '5时', '6时', '7时', '8时', '9时', '10时', '11时', '12时' ]
  844. } ],
  845. yAxis: [ {
  846. name: '里程/km',
  847. nameLocation: 'center',
  848. nameGap: 50,
  849. nameTextStyle: {
  850. color: '#fff',
  851. fontSize: 18
  852. },
  853. padding: 5,
  854. // max: 1000,
  855. splitLine: {
  856. show: true,
  857. lineStyle: {
  858. color: '#A1A7B3'
  859. // type: 'dashed'
  860. }
  861. },
  862. axisLine: {
  863. show: false
  864. },
  865. axisLabel: {
  866. show: true,
  867. margin: 10,
  868. textStyle: {
  869. color: '#fff'
  870. }
  871. },
  872. axisTick: {
  873. show: false
  874. }
  875. }
  876. ],
  877. series: [ {
  878. name: '里程',
  879. type: 'line',
  880. smooth: true,
  881. symbolSize: 0,
  882. itemStyle: {
  883. normal: {
  884. // color: '#4293FD',
  885. lineStyle: {
  886. // color: '#FFD35D',
  887. width: 1,
  888. color: new graphic.LinearGradient(0, 0, 0, 1, [
  889. {
  890. offset: 0,
  891. color: '#6A5BF066'
  892. },
  893. {
  894. offset: 0.5,
  895. color: '#7ec2f366'
  896. },
  897. {
  898. offset: 1,
  899. color: '#1890ff'
  900. }
  901. ], false)
  902. }
  903. }
  904. },
  905. areaStyle: {
  906. normal: {
  907. color: new graphic.LinearGradient(0, 0, 0, 1, [
  908. {
  909. offset: 0,
  910. color: '#6A5BF066'
  911. },
  912. {
  913. offset: 0.5,
  914. color: '#7ec2f366'
  915. },
  916. {
  917. offset: 1,
  918. color: '#1890ff'
  919. }
  920. ], false)
  921. }
  922. },
  923. data: [ 120, 132, 101, 134, 90, 230, 210, 182, 191, 234, 290, 330 ]
  924. } ],
  925. dataZoom: {}
  926. }
  927. }
  928. ],
  929. bottom: {
  930. }
  931. })
  932. const currentLineId = computed(() => store.currentLineId)
  933. const busLineData = ref({
  934. type: '0', // 线路类型
  935. totalCar: 0, // 车辆总数
  936. operateNum: 0, // 运营数量
  937. nonOperateNum: 0, // 非运营数量
  938. upStartStation: '', // 上行起点站
  939. downStartStation: '', // 下行起点站
  940. upEndStation: '', // 上行终点站
  941. downEndStation: '', // 下行结束时间
  942. upStartTime: '00:00', // 上行开始时间
  943. upEndTime: '00:00', // 上行结束时间
  944. downStartTime: '00:00', // 下行开始始时间
  945. downEndTime: '00:00', // 下行结束时间
  946. upMileage: 0, // 上行里程
  947. downMileage: 0, // 下行里程
  948. fare: 0 // 票价
  949. })
  950. const driverTotal = ref(0)
  951. const carTotal = ref(0)
  952. async function getBusLineDetail() {
  953. busLineData.value = await cehicleOperationService.getBusLineDetail(currentLineId.value)
  954. }
  955. getBusLineDetail()
  956. async function getBusLineDriver() {
  957. const driverArr = await cehicleOperationService.getBusLineDriver(currentLineId.value)
  958. let total = 0
  959. driverArr.forEach((item: { total: string | number; starType: number }) => {
  960. total += +item.total
  961. starlist.value.at(-item.starType).value = +item.total
  962. })
  963. driverTotal.value = total
  964. }
  965. getBusLineDriver()
  966. async function getBusLineCar() {
  967. const carArr = await cehicleOperationService.getBusLineCar(currentLineId.value)
  968. let total = 0
  969. carArr.forEach((item: { total: string | number; starType: number }) => {
  970. total += +item.total
  971. })
  972. leftContent.value.leftOp.series[0].data = carArr.map((item:any) => ({
  973. name: item.year, value: item.total
  974. }))
  975. carTotal.value = total
  976. }
  977. getBusLineCar()
  978. async function getBusLineOperate() {
  979. const params = {
  980. lineId: currentLineId.value,
  981. type: curOdd.value
  982. }
  983. const carArr = await cehicleOperationService.getBusLineOperate(params)
  984. upBusLineOperate.value = carArr.filter((item: { direction: number }) => item.direction === 1)
  985. downBusLineOperate.value = carArr.filter((item: { direction: number }) => item.direction === 2)
  986. }
  987. watch(() => curOdd.value, () => {
  988. getBusLineOperate()
  989. })
  990. getBusLineOperate()
  991. watch(() => store.currentLineId, () => {
  992. getBusLineOperate()
  993. getBusLineCar()
  994. getBusLineDriver()
  995. getBusLineDetail()
  996. })
  997. const timer = setInterval(() => {
  998. getBusLineCar()
  999. }, 5 * 1000)
  1000. onUnmounted(() => {
  1001. clearInterval(timer)
  1002. })
  1003. const nameMap:any = {
  1004. 1: '老年卡',
  1005. 2: '学生卡',
  1006. 3: '电子钱包',
  1007. 4: '现金',
  1008. 5: '其他'
  1009. }
  1010. async function getPassengerPercent() {
  1011. const res = await cehicleOperationService.getPassengerPercent()
  1012. rightContent.value.top[0].option.series[0].data = res.map((item:any) => ({
  1013. name: nameMap[item.passengerType], value: item.percent
  1014. }))
  1015. rightContent.value.top[0].option.title!.subtext = res.reduce((prev: any, item: { percent: number }) => {
  1016. prev += item.percent
  1017. return prev
  1018. }, 0)
  1019. }
  1020. getPassengerPercent()
  1021. const passengerOption = [
  1022. { value: 1, label: '行驶中' },
  1023. { value: 2, label: '维保' },
  1024. { value: 3, label: '固定包车' },
  1025. { value: 4, label: '临时包车' },
  1026. { value: 5, label: '充电' },
  1027. { value: 6, label: '公务' }
  1028. ]
  1029. // 状态下拉框
  1030. const vehicleStatus = [
  1031. { value: 1, label: '运营' },
  1032. { value: 2, label: '非运营' }
  1033. ]
  1034. const statusVal = ref('' as any)
  1035. const sceneVal = ref('' as any)
  1036. const vehicleMonitorData = ref([] as any[])
  1037. function sceneChange(val: number) {
  1038. sceneVal.value = val
  1039. getVehicleMonitorService()
  1040. }
  1041. function statusChange(val: number) {
  1042. statusVal.value = val
  1043. getVehicleMonitorService()
  1044. }
  1045. async function getVehicleMonitorService() {
  1046. const params = {
  1047. carStatus: statusVal.value,
  1048. carScene: sceneVal.value
  1049. }
  1050. vehicleMonitorData.value = await cehicleOperationService.getVehicleMonitorService(params)
  1051. }
  1052. getVehicleMonitorService()
  1053. const vehicleStatusData = ref([] as any[])
  1054. async function getVehicleStatusService() {
  1055. vehicleStatusData.value = await cehicleOperationService.getVehicleStatusService()
  1056. }
  1057. getVehicleStatusService()
  1058. </script>
  1059. <style lang="scss" scoped>
  1060. .left {
  1061. display: flex;
  1062. justify-content: space-between;
  1063. gap: 10px;
  1064. color: #fff;
  1065. font-size: 18px;
  1066. &-left {
  1067. .linebase {
  1068. height: 216px;
  1069. padding: 20px 60px 35px 60px;
  1070. display: flex;
  1071. align-items: center;
  1072. gap: 70px;
  1073. .car {
  1074. .top {
  1075. display: flex;
  1076. position: relative;
  1077. font-size: 18px;
  1078. .name {
  1079. width: 78px;
  1080. height: 74px;
  1081. line-height: 74px;
  1082. text-align: center;
  1083. border: 2px solid #2185E8;
  1084. font-size: 50px;
  1085. border-radius: 10px;
  1086. background: rgba(33, 133, 232, 0.298);
  1087. }
  1088. .road {
  1089. position: absolute;
  1090. bottom: 0;
  1091. right: -25px;
  1092. }
  1093. }
  1094. .current {
  1095. text-align: center;
  1096. text-shadow: 1px 1px 10px rgba(0, 255, 255, 0.698);
  1097. margin-top: 10px;
  1098. }
  1099. }
  1100. .info {
  1101. width: 100%;
  1102. >div {
  1103. display: flex;
  1104. gap: 10px;
  1105. margin: 15.2px 0;
  1106. .label {
  1107. color: #80FFFF
  1108. }
  1109. }
  1110. }
  1111. }
  1112. .header {
  1113. height: 50px;
  1114. background: rgba(33, 133, 232, 0.298);
  1115. display: flex;
  1116. >div {
  1117. width: 50%;
  1118. display: flex;
  1119. align-items: center;
  1120. justify-content: center;
  1121. gap: 10px;
  1122. }
  1123. }
  1124. .detail {
  1125. padding: 0 20px 0 30px;
  1126. >div {
  1127. border-bottom: 1px solid rgba(128, 255, 255, 0.298);
  1128. padding-bottom: 30px;
  1129. padding-top: 16px;
  1130. .value {
  1131. color: #80FFFF;
  1132. width: 200px;
  1133. text-align: center;
  1134. }
  1135. .row {
  1136. height: 50px;
  1137. display: flex;
  1138. align-items: center;
  1139. .type {
  1140. border: 1px solid #80FFFF;
  1141. background: rgba(128, 255, 255, 0.098);
  1142. border-radius: 5px;
  1143. color: #80FFFF;
  1144. padding: 5px 9px;
  1145. &.orange {
  1146. border: 1px solid #FAAD0E;
  1147. background: rgba(250, 173, 14, 0.098);
  1148. color: #FAAD0E;
  1149. }
  1150. }
  1151. .name {
  1152. flex: 1;
  1153. margin-left: 10px;
  1154. }
  1155. }
  1156. .title {
  1157. display: flex;
  1158. justify-content: space-between;
  1159. align-items: center;
  1160. .name {
  1161. font-size: 24px;
  1162. margin-left: 10px;
  1163. }
  1164. .value {
  1165. display: flex;
  1166. justify-content: center;
  1167. align-items: baseline;
  1168. gap: 10px;
  1169. }
  1170. }
  1171. .starlist {
  1172. display: flex;
  1173. justify-content: space-around;
  1174. margin-top: 17px;
  1175. .star {
  1176. color: #80FFFF;
  1177. .num {
  1178. font-size: 24px;
  1179. }
  1180. }
  1181. }
  1182. }
  1183. }
  1184. }
  1185. &-right {
  1186. flex: 1;
  1187. font-size: 18px;
  1188. .filter {
  1189. display: flex;
  1190. align-items: center;
  1191. padding: 20px 40px;
  1192. .name {
  1193. width: 120px;
  1194. }
  1195. .odds {
  1196. display: flex;
  1197. gap: 10px;
  1198. flex-wrap: wrap;
  1199. .odd {
  1200. border-radius: 5px;
  1201. border: 1px solid #2185E8;
  1202. background: rgba(0, 191, 191, 0);
  1203. padding: 2px 8px;
  1204. min-width: 90px;
  1205. text-align: center;
  1206. &.checkd {
  1207. background: #2185E8;
  1208. }
  1209. }
  1210. }
  1211. }
  1212. .frequency {
  1213. margin-top: 15px;
  1214. .title {
  1215. background: rgba(24, 145, 255, 0.498);
  1216. height: 40px;
  1217. line-height: 40px;
  1218. font-size: 20px;
  1219. text-align: center;
  1220. text-shadow: 1px 1px 10px rgba(0, 255, 255, 0.698);
  1221. }
  1222. .content {
  1223. display: flex;
  1224. justify-content: flex-start;
  1225. gap: 10px;
  1226. padding: 10px 13px;
  1227. min-height: 421px;
  1228. .bus {
  1229. width: 236px;
  1230. height: 401px;
  1231. border: 1px solid #1891FF;
  1232. background: rgba(27, 175, 255, 0.098);
  1233. overflow: hidden;
  1234. position: relative;
  1235. .status {
  1236. position: absolute;
  1237. height: 31px;
  1238. line-height: 31px;
  1239. text-align: right;
  1240. width: 100%;
  1241. top: 119px;
  1242. padding-right: 10px;
  1243. background: linear-gradient(90deg, rgba(0, 0, 0, 0) 1%, #333333 100%);
  1244. &.success {
  1245. background: linear-gradient(90deg, rgba(0, 238, 200, 0) 4%, #00EEC8 100%);
  1246. }
  1247. &.warning {
  1248. background: linear-gradient(90deg, rgba(250, 173, 14, 0) 1%, #FAAD0E 100%);
  1249. }
  1250. &.error {
  1251. background: linear-gradient(90deg, rgba(231, 61, 65, 0) 1%, #E73D41 100%);
  1252. }
  1253. }
  1254. img {
  1255. height: 150px;
  1256. width: 100%;
  1257. }
  1258. .info {
  1259. padding: 10px;
  1260. >div {
  1261. display: flex;
  1262. height: 35px;
  1263. align-items: center;
  1264. .bold {
  1265. font-size: 24px;
  1266. }
  1267. .busNum {
  1268. border: 2px solid #FFFFFF;
  1269. border-radius: 3px;
  1270. background: #1891FF;
  1271. padding: 2px 5px;
  1272. margin-left: 10px;
  1273. }
  1274. }
  1275. }
  1276. .table {
  1277. >div {
  1278. display: flex;
  1279. height: 40px;
  1280. align-items: center;
  1281. .label {
  1282. width: 135px;
  1283. height: 40px;
  1284. line-height: 40px;
  1285. background: rgba(33, 133, 232, 0.298);
  1286. color: #80FFFF;
  1287. text-align: right;
  1288. padding-right: 10px;
  1289. }
  1290. .value {
  1291. text-align: center;
  1292. flex: 1;
  1293. }
  1294. }
  1295. }
  1296. }
  1297. }
  1298. .page {
  1299. display: flex;
  1300. justify-content: flex-end;
  1301. margin-top: 25px;
  1302. }
  1303. }
  1304. }
  1305. .flex {
  1306. display: flex;
  1307. gap: 10px;
  1308. align-items: center;
  1309. }
  1310. .bold {
  1311. color: #fff;
  1312. font-weight: bold;
  1313. font-family: Impact Normal;
  1314. }
  1315. }
  1316. .right {
  1317. &-top {
  1318. color: #fff;
  1319. display: flex;
  1320. gap: 10px;
  1321. justify-content: space-between;
  1322. }
  1323. &-bottom {
  1324. color: #fff;
  1325. gap: 10px;
  1326. display: flex;
  1327. justify-content: space-between;
  1328. .carmonitor {
  1329. padding: 10px;
  1330. .control {
  1331. display: flex;
  1332. font-size: 20px;
  1333. gap: 20px;
  1334. :deep(.n-select){
  1335. .n-base-selection{
  1336. height: 40px;
  1337. }
  1338. }
  1339. .item {
  1340. display: flex;
  1341. width: 33%;
  1342. align-items: center;
  1343. gap: 20px;
  1344. .label {
  1345. min-width: 60px;
  1346. }
  1347. :deep(.n-base-selection-label){
  1348. background: none;
  1349. }
  1350. }
  1351. }
  1352. .table {
  1353. margin-top: 20px;
  1354. text-align: center;
  1355. th {
  1356. border: 0;
  1357. background: rgba(33, 133, 232, 0.6);
  1358. text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.6471);
  1359. font-weight: bold;
  1360. }
  1361. tr {
  1362. td {
  1363. color: #fff;
  1364. }
  1365. .index {
  1366. width: 14px;
  1367. height: 14px;
  1368. line-height: 14px;
  1369. background: #8DFF53;
  1370. border-radius: 50%;
  1371. display: inline-block;
  1372. color: #333333;
  1373. }
  1374. &.no {
  1375. td {
  1376. background: linear-gradient(180deg, #00A8F0 0%, #02B3B3 100%);
  1377. }
  1378. .index {
  1379. background: #D7D7D7;
  1380. }
  1381. }
  1382. }
  1383. }
  1384. }
  1385. .carstatus {
  1386. display: flex;
  1387. align-items: center;
  1388. justify-content: center;
  1389. position: relative;
  1390. .line{
  1391. position: absolute;
  1392. width: 1px;
  1393. height: 397px;
  1394. background-color: rgba(128, 255, 255, 0.298);
  1395. left: 50%;
  1396. top: 120px;
  1397. }
  1398. >div {
  1399. flex: 1;
  1400. display: flex;
  1401. flex-wrap: wrap;
  1402. justify-content: center;
  1403. >div{
  1404. width: 100%;
  1405. }
  1406. .title {
  1407. width: 136px;
  1408. height: 59px;
  1409. line-height: 59px;
  1410. border-radius: 5px;
  1411. text-align: center;
  1412. font-size: 24px;
  1413. text-shadow: 1px 1px 5px rgba(0, 255, 255, 0.6471);
  1414. margin: 30px 0 ;
  1415. }
  1416. }
  1417. .up .title {
  1418. background: rgba(27, 175, 255, 0.298);
  1419. border: 1px solid #81D3F8;
  1420. box-shadow: 5px 5px 5px 0px rgba(0, 0, 0, 0.349), inset 0px 0px 30px 1px rgba(24, 145, 255, 0.9961);
  1421. }
  1422. .down .title {
  1423. background: rgba(231, 61, 65, 0.298);
  1424. border: 1px solid #F9A15A;
  1425. box-shadow: 5px 5px 5px 0px rgba(0, 0, 0, 0.349), inset 0px 0px 30px 1px rgba(231, 61, 65, 0.9882);
  1426. }
  1427. .content{
  1428. display: flex;
  1429. flex-wrap: wrap;
  1430. justify-content: center;
  1431. gap: 20px;
  1432. >div{
  1433. width: 100%;
  1434. display: flex;
  1435. justify-content: center;
  1436. align-items: center;
  1437. gap: 20px;
  1438. >div{
  1439. flex: 1;
  1440. }
  1441. .label{
  1442. font-size: 18px;
  1443. color: #81D3F8;
  1444. text-align: right;
  1445. text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.6471);
  1446. }
  1447. .value{
  1448. font-size: 24px;
  1449. text-shadow: 1px 1px 5px rgba(0, 255, 255, 0.6471);
  1450. }
  1451. }
  1452. }
  1453. }
  1454. }
  1455. }
  1456. .changeLine{
  1457. position: absolute;
  1458. top: -100px;
  1459. z-index: 9999;
  1460. }
  1461. </style>