main.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  1. <template>
  2. <div class="main-data data-official">
  3. <div class="left">
  4. <div class="left-cont" v-if="leftShow">
  5. <div
  6. class="left-top"
  7. @mouseover="showDialog(1)"
  8. >
  9. <div class="cont-title-area">
  10. <img
  11. class="cont-title-bg"
  12. src="@/assets/images/main/cont_title_bg.png"
  13. alt=""
  14. />
  15. <div class="cont-title">资源台账</div>
  16. </div>
  17. <div class="components-item bg2">
  18. <terminal-data :key="appOrg" :resourceData="resourceData" :carTypeNum="carTypeNum" :carActivationNum="carActivationNum" :carUseNum="carUseNum"></terminal-data>
  19. </div>
  20. </div>
  21. <div class="left-bottom"
  22. @mouseover="showDialog(2)"
  23. >
  24. <div class="cont-title-area">
  25. <img
  26. class="cont-title-bg"
  27. src="@/assets/images/main/cont_title_bg.png"
  28. alt=""
  29. />
  30. <div class="cont-title">监控管理</div>
  31. </div>
  32. <div class="components-item bg2">
  33. <car-stock :key="appOrg" :monitorData="monitorData"></car-stock>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. <div class="middle">
  39. <img src="@/assets/zhang/publicCar/officialCar.png" width="50" style="position: absolute;top: 125px;left: 20px;cursor: pointer">
  40. <MapTwo @transmit="transmit" :mapData="mapData" ref="map"></MapTwo>
  41. </div>
  42. <div class="right">
  43. <div class="right-cont" v-if="rightShow">
  44. <div class="cont-title-area">
  45. <img
  46. class="cont-title-bg"
  47. src="@/assets/images/main/cont_title_bg.png"
  48. alt=""
  49. />
  50. <div class="cont-title">运行管理</div>
  51. </div>
  52. <div class="components-item bg3">
  53. <car-warning :key="appOrg" :manageTopHalf="manageTopHalf" :manageLastHalf="manageLastHalf" v-if="this.flag >= 2"></car-warning>
  54. </div>
  55. </div>
  56. </div>
  57. <!--弹出层-->
  58. <div
  59. :class="dialogType < 3 ? 'dialog' : 'dialog-r'"
  60. v-if="dialogShow"
  61. >
  62. <terminal-data-dialog
  63. v-if="dialogType === 1"
  64. :resourceData="resourceData" :carTypeNum="carTypeNum" :carActivationNum="carActivationNum" :carUseNum="carUseNum"
  65. @chooseX="chooseCost"
  66. @chooseY="chooseHealth"
  67. @closeDialog="closeDialog"
  68. ></terminal-data-dialog>
  69. <car-warning-dialog
  70. v-if="dialogType === 4"
  71. @choose="chooseCost"
  72. @closeDialog="closeDialog"
  73. ></car-warning-dialog>
  74. <car-stock-dialog
  75. v-if="dialogType === 2"
  76. :monitorData="monitorData"
  77. @chooseX="chooseOp('未带工单预警数', '未带工单报警')"
  78. @chooseY="chooseOp('超速预警数', '超速报警')"
  79. @chooseZ="chooseOp('节假日预警数', '节假日用车报警')"
  80. @closeDialog="closeDialog"
  81. ></car-stock-dialog>
  82. </div>
  83. <div v-if="showC" class="dialog-2">
  84. <div class="dialog-center">
  85. <resource-list
  86. v-if="showRes === 1"
  87. :op = "op"
  88. :total = "total"
  89. :dataList = "dataList"
  90. @close="onCloseRes"
  91. @handlePageChange="handlePageChangeZ"
  92. ></resource-list>
  93. <car-cost
  94. :dataList = "dataList"
  95. :total = "total"
  96. v-if="showCost === 1"
  97. @close="onCloseCost"
  98. @handlePageChange="handlePageChangeY"
  99. ></car-cost>
  100. <car-health
  101. :total = "total"
  102. :dataList = "dataList"
  103. v-if="showHealth === 1"
  104. @close="onCloseHealth"
  105. @handlePageChange="handlePageChangeX"
  106. ></car-health>
  107. </div>
  108. </div>
  109. </div>
  110. </template>
  111. <script>
  112. import ResourceList from '@/views/screen/official/resourceList.vue'
  113. import Province from "../map/province.vue";
  114. import TerminalData from "./terminalData.vue";
  115. import TerminalDataDialog from "./terminalDataDialog.vue";
  116. import TerminalOnline from "./terminalOnline.vue";
  117. import CarWarning from "./carWarning.vue";
  118. import CarWarningDialog from "./carWarningDialog.vue";
  119. import CarStock from "../logistics/car/carStock.vue";
  120. import CarTerminal from "../logistics/car/carTerminal.vue";
  121. import company from "@/views/screen/data/company.json";
  122. import CarCost from '@/views/screen/official/carCost.vue'
  123. import CarHealth from '@/views/screen/official/carHealth.vue'
  124. import CarStockDialog from "@/views/screen/logistics/car/carStockDialog.vue";
  125. import MapTwo from '@/views/screen/map/mapTwo.vue'
  126. import {
  127. getCarDetail,
  128. getMonitor,
  129. getOperationManageLastHalf,
  130. getOperationManageTopHalf,
  131. getResource,
  132. getSelfCarNum, getWarnDetail
  133. } from '@/api/screen/service'
  134. export default {
  135. name: "OfficialMain",
  136. components: {
  137. MapTwo,
  138. CarHealth,
  139. CarCost,
  140. ResourceList,
  141. Province,
  142. TerminalData,
  143. TerminalOnline,
  144. CarWarning,
  145. CarStock,
  146. CarTerminal,
  147. TerminalDataDialog,
  148. CarWarningDialog,
  149. CarStockDialog,
  150. },
  151. data() {
  152. return {
  153. total: 0,
  154. dataList: [],
  155. mapData:[],
  156. flag: 0,
  157. carActivationNum:[],
  158. carUseNum:[],
  159. carTypeNum:[],
  160. resourceData:{},
  161. monitorData:{},
  162. manageTopHalf:{},
  163. manageLastHalf:{},
  164. op:'',
  165. showC:false,
  166. showRes:0,
  167. showCost:0,
  168. showHealth:0,
  169. leftShow: true,
  170. rightShow: true,
  171. dialogShow: false,
  172. dialogType: 1,
  173. curDeep: 1,
  174. showBack: false,
  175. showMap: true,
  176. showLocal: false,
  177. appOrg: "10001",
  178. alertType: null,
  179. curCompany: [],
  180. company: company,
  181. };
  182. },
  183. created() {
  184. this.resource();
  185. this.monitor();
  186. this.operationManage();
  187. this.getMapData()
  188. },
  189. destroyed() {},
  190. beforeDestroy() {},
  191. mounted() {},
  192. methods: {
  193. handlePageChangeX(page, pageSize){
  194. getCarDetail(this.appOrg, 1, pageSize, page).then(res => {
  195. if (Number(res.code) === 200) {
  196. this.dataList = res.data.list
  197. this.showC = true
  198. this.showHealth = 1
  199. }
  200. })
  201. },
  202. handlePageChangeY(page, pageSize){
  203. getCarDetail(this.appOrg, 0, pageSize, page).then(res => {
  204. if (Number(res.code) === 200) {
  205. this.dataList = res.data.list
  206. this.showC = true
  207. this.showCost = 1
  208. }
  209. })
  210. },
  211. handlePageChangeZ(page, pageSize){
  212. getWarnDetail(this.appOrg, this.alertType, pageSize, page).then(res => {
  213. if (Number(res.code) === 200) {
  214. this.dataList = res.data.list
  215. this.showC = true
  216. this.showRes = 1
  217. }
  218. })
  219. },
  220. transmit(appOrg){
  221. this.appOrg = appOrg
  222. this.resource();
  223. this.monitor();
  224. this.operationManageTopHalf();
  225. },
  226. getMapData(){
  227. getSelfCarNum().then(res => {
  228. if (Number(res.code) === 200) {
  229. this.mapData = res.data
  230. this.$refs.map.start()
  231. }
  232. })
  233. },
  234. resource(){
  235. getResource(this.appOrg).then(res => {
  236. if (Number(res.code) === 200) {
  237. this.resourceData = res.data
  238. this.resourceData.cd = 5 - this.resourceData.totalCarNum.toString().length
  239. this.resourceData.totalCarNum = this.resourceData.totalCarNum.toString().padStart(5, '0');
  240. this.resourceData.percentageLack = (this.resourceData.totalCarNum !== 0) ? Math.round(((this.resourceData.totalCarNum - this.resourceData.establishmentsCarNum) / this.resourceData.totalCarNum) * 100) : 0;
  241. this.resourceData.percentagePosess = (this.resourceData.totalCarNum !== 0) ? Math.round((this.resourceData.establishmentsCarNum / this.resourceData.totalCarNum) * 100) : 0;
  242. this.carTypeNum = [
  243. {
  244. type: "商务车",
  245. num: this.resourceData.carNumOne
  246. },
  247. {
  248. type: "越野车",
  249. num: this.resourceData.carNumTwo
  250. },
  251. {
  252. type: "小轿车",
  253. num: this.resourceData.carNumThree
  254. },
  255. {
  256. type: "小型客车",
  257. num: this.resourceData.carNumFour
  258. },
  259. {
  260. type: "大型客车",
  261. num: this.resourceData.carNumFive
  262. }
  263. ]
  264. this.carUseNum = [
  265. {
  266. type: "企业用车",
  267. num: this.resourceData.enterpriseCarNum
  268. },
  269. {
  270. type: "企业负责人用车",
  271. num: this.resourceData.headCarNum
  272. }
  273. ]
  274. this.carActivationNum = [
  275. {
  276. type: "燃油汽车",
  277. num: this.resourceData.oilCarNum
  278. },
  279. {
  280. type: "新能源汽车",
  281. num: this.resourceData.newPowerCarNum
  282. }
  283. ]
  284. }
  285. })
  286. },
  287. monitor(){
  288. getMonitor(this.appOrg).then(res => {
  289. if (Number(res.code) === 200) {
  290. this.monitorData = res.data
  291. this.monitorData.percentageInstall = (this.monitorData.terminalTotal !== 0) ? Math.round((this.monitorData.terminalInstall / this.monitorData.terminalTotal) * 100) : 0;
  292. this.monitorData.percentageOnline = (this.monitorData.terminalTotal !== 0) ? Math.round((this.monitorData.terminalOnline / this.monitorData.terminalTotal) * 100) : 0;
  293. }
  294. })
  295. },
  296. operationManageTopHalf(){
  297. getOperationManageTopHalf(this.appOrg).then(res => {
  298. if (Number(res.code) === 200) {
  299. this.manageTopHalf = res.data
  300. this.flag++
  301. }
  302. })
  303. },
  304. operationManageLastHalf(){
  305. getOperationManageLastHalf().then(res => {
  306. if (Number(res.code) === 200) {
  307. this.manageLastHalf = res.data
  308. this.flag++
  309. }
  310. })
  311. },
  312. operationManage(){
  313. this.operationManageTopHalf()
  314. this.operationManageLastHalf()
  315. },
  316. chooseOp(title, alertType){
  317. this.op = title
  318. this.closeDialog()
  319. this.alertType = alertType
  320. getWarnDetail(this.appOrg, alertType, 10, 0).then(res => {
  321. if (Number(res.code) === 200) {
  322. this.dataList = res.data.list
  323. this.total = res.data.total
  324. this.showC = true
  325. this.showRes = 1
  326. }
  327. })
  328. },
  329. chooseRes(){
  330. this.closeDialog()
  331. this.showC = true
  332. this.showRes = 1
  333. },
  334. onCloseRes(){
  335. this.showC = false
  336. this.showRes = 0
  337. },
  338. chooseCost(){
  339. this.closeDialog()
  340. getCarDetail(this.appOrg, 0, 10, 0).then(res => {
  341. if (Number(res.code) === 200) {
  342. this.dataList = res.data.list
  343. this.total = res.data.total
  344. this.showC = true
  345. this.showCost = 1
  346. }
  347. })
  348. },
  349. onCloseCost(){
  350. this.showC = false
  351. this.showCost = 0
  352. },
  353. chooseHealth(){
  354. this.closeDialog()
  355. getCarDetail(this.appOrg, 1, 10, 0).then(res => {
  356. if (Number(res.code) === 200) {
  357. this.dataList = res.data.list
  358. this.total = res.data.total
  359. this.showC = true
  360. this.showHealth = 1
  361. }
  362. })
  363. },
  364. onCloseHealth(){
  365. this.showC = false
  366. this.showHealth = 0
  367. },
  368. showDialog(type) {
  369. console.log("触发了:" + type)
  370. if (type < 4) {
  371. this.leftShow = false;
  372. this.rightShow = true;
  373. } else {
  374. this.rightShow = false;
  375. this.leftShow = true;
  376. }
  377. this.dialogShow = true;
  378. this.dialogType = type;
  379. },
  380. closeDialog() {
  381. this.leftShow = true;
  382. this.rightShow = true;
  383. this.dialogShow = false;
  384. },
  385. //点击地图事件
  386. onMapClick(e) {
  387. this.curDeep = e.deep;
  388. if (e.deep > 1) {
  389. this.showBack = true;
  390. } else {
  391. this.showBack = false;
  392. }
  393. //点击山西省本部
  394. if (e.name == "山西省公司(本部)") {
  395. this.showMap = false;
  396. this.showLocal = true;
  397. this.curCompany = ["10001", "10001"];
  398. this.appOrg = "10001";
  399. } else {
  400. this.showMap = true;
  401. this.showLocal = false;
  402. this.curCompany = e.curCompany;
  403. }
  404. //判断是否点击了子单位
  405. if (e.curCompany && e.curCompany.length > 0) {
  406. let appOrg = e.curCompany[e.curCompany.length - 1];
  407. this.appOrg = appOrg;
  408. }
  409. },
  410. //返回操作
  411. onBack() {
  412. this.curDeep = 1;
  413. if (this.curDeep <= 1) {
  414. this.showBack = false;
  415. this.showMap = true;
  416. this.showLocal = false;
  417. this.curCompany = [];
  418. }
  419. this.appOrg = "0000";
  420. this.$refs.province.reloadMap(this.curDeep);
  421. },
  422. //选择公司
  423. handleCompanyChange(e) {
  424. console.log(e);
  425. if (e && e.length > 0) {
  426. if (e[1] == "10001") {
  427. this.showMap = false;
  428. this.showLocal = true;
  429. this.showBack = true;
  430. } else {
  431. this.showMap = true;
  432. this.showLocal = false;
  433. }
  434. let appOrg = e[e.length - 1];
  435. this.appOrg = appOrg;
  436. }
  437. if(e[1] == "1A001" || e[1] == "1A002" || e[1] == "1A004" || e[1] == "1A005"){
  438. this.showMap = true;
  439. this.showLocal = false;
  440. this.showBack = true;
  441. // return;
  442. }
  443. this.$refs.province.chooseUnit(e);
  444. },
  445. },
  446. };
  447. </script>
  448. <style lang="scss">
  449. .data-official {
  450. width: 100%;
  451. height: 100%;
  452. margin: 0 auto;
  453. // background-image: url("../../../assets/images/official_car/bg.jpg");
  454. // background-size: cover;
  455. display: flex;
  456. flex-direction: row;
  457. justify-content: space-between;
  458. .left {
  459. margin: 125px 0 0 40px;
  460. width: 580px;
  461. .left-cont {
  462. width: 100%;
  463. height: 920px;
  464. padding-top: 19px;
  465. background: url("../../../assets/images/main/main_bg.png") no-repeat;
  466. background-size: cover;
  467. }
  468. .components-item {
  469. width: 550px;
  470. height: 389px;
  471. background: url("../../../assets/images/main/components_mid_bg.png")
  472. no-repeat;
  473. background-size: cover;
  474. margin-bottom: 28px;
  475. margin-left: 15px;
  476. overflow: hidden;
  477. }
  478. .components-item.bg2 {
  479. background: url("../../../assets/images/main/components_mid_bg2.png")
  480. no-repeat;
  481. background-size: cover;
  482. }
  483. .left-top {
  484. // width: 550px;
  485. // height: 444px;
  486. // background: url("../../../assets/images/service_new/left_top_2.png")
  487. // no-repeat;
  488. // background-size: cover;
  489. // margin-bottom: 21px;
  490. }
  491. .left-bottom {
  492. // width: 550px;
  493. // height: 444px;
  494. // background: url("../../../assets/images/service_new/left_top_2.png")
  495. // no-repeat;
  496. // background-size: cover;
  497. }
  498. }
  499. .middle {
  500. //background: url('../../../assets/zhang/public_map.png') no-repeat center;
  501. display: flex;
  502. flex: 1;
  503. align-items: center;
  504. justify-content: center;
  505. padding: 125px 0 0 0px;
  506. position: relative;
  507. .bottom-area {
  508. position: absolute;
  509. right: 50px;
  510. left: 50px;
  511. bottom: 50px;
  512. .bottom-left {
  513. .left-item {
  514. width: 180px;
  515. height: 30px;
  516. background: url("../../../assets/images/main/choose_bg_long.png")
  517. no-repeat;
  518. background-size: cover;
  519. input {
  520. background: rgba(255, 255, 255, 0);
  521. border: none;
  522. color: #00ffff;
  523. }
  524. .el-input__icon {
  525. color: #00ffff;
  526. }
  527. }
  528. .office {
  529. margin-left: 10px;
  530. width: 180px;
  531. height: 30px;
  532. line-height: 30px;
  533. padding-left: 15px;
  534. color: #898989;
  535. background: url("../../../assets/images/main/choose_bg_long.png")
  536. no-repeat;
  537. background-size: cover;
  538. font-size: 14px;
  539. }
  540. }
  541. .bottom-right {
  542. .back {
  543. width: 34px;
  544. height: 30px;
  545. cursor: pointer;
  546. }
  547. }
  548. }
  549. }
  550. .right {
  551. margin: 125px 40px 0 0px;
  552. width: 580px;
  553. .right-cont {
  554. width: 100%;
  555. height: 920px;
  556. padding-top: 19px;
  557. background: url("../../../assets/images/main/main_bg.png") no-repeat;
  558. background-size: cover;
  559. }
  560. .components-item {
  561. width: 550px;
  562. height: 389px;
  563. background: url("../../../assets/images/main/components_mid_bg.png")
  564. no-repeat;
  565. background-size: cover;
  566. margin-bottom: 28px;
  567. margin-left: 15px;
  568. overflow: hidden;
  569. }
  570. .components-item.bg2 {
  571. background: url("../../../assets/images/main/components_mid_bg2.png")
  572. no-repeat;
  573. background-size: cover;
  574. }
  575. .components-item.bg3 {
  576. height: 849px;
  577. background: url("../../../assets/images/main/components_long_bg.png")
  578. no-repeat;
  579. background-size: cover;
  580. }
  581. .right-top {
  582. // width: 550px;
  583. // height: 444px;
  584. // background: url("../../../assets/images/service_new/left_top_2.png")
  585. // no-repeat;
  586. // background-size: cover;
  587. // margin-bottom: 21px;
  588. }
  589. .right-bottom {
  590. // width: 550px;
  591. // height: 444px;
  592. // background: url("../../../assets/images/service_new/left_top_2.png")
  593. // no-repeat;
  594. // background-size: cover;
  595. }
  596. }
  597. .cont-title-area {
  598. display: flex;
  599. flex-direction: row;
  600. align-items: center;
  601. justify-content: center;
  602. position: relative;
  603. margin-bottom: 10px;
  604. img {
  605. width: 284px;
  606. height: 32px;
  607. }
  608. .cont-title {
  609. font-size: 20px;
  610. font-weight: 900;
  611. font-family: "PingFangSC";
  612. width: 100%;
  613. position: absolute;
  614. display: flex;
  615. align-items: center;
  616. justify-content: center;
  617. top: -5px;
  618. color: #fff;
  619. }
  620. }
  621. .dialog {
  622. position: fixed;
  623. top: 125px;
  624. left: 40px;
  625. z-index: 10;
  626. width: 100%;
  627. }
  628. .dialog-r {
  629. position: fixed;
  630. top: 125px;
  631. right: 40px;
  632. z-index: 10;
  633. width: 100%;
  634. display: flex;
  635. justify-content: flex-end;
  636. }
  637. .dialog-2 {
  638. position: fixed;
  639. left: 0;
  640. top: 0;
  641. right: 0;
  642. bottom: 0;
  643. z-index: 9999;
  644. display: flex;
  645. flex-direction: row;
  646. align-items: center;
  647. justify-content: center;
  648. background: rgba(0, 0, 0, 0.7);
  649. }
  650. .build {
  651. margin: 0 auto;
  652. width: 90%;
  653. height: auto;
  654. object-fit: contain;
  655. }
  656. ::-webkit-scrollbar {
  657. width: 3px;
  658. height: 3px;
  659. }
  660. ::-webkit-scrollbar-thumb {
  661. //滑块部分
  662. // border-radius: 5px;
  663. background-color: #58cbbb;
  664. }
  665. ::-webkit-scrollbar-track {
  666. //轨道部分
  667. // box-shadow: inset 0 0 5px #ddd;
  668. background: #ddd;
  669. // border-radius: 5px;
  670. }
  671. }
  672. </style>