indexOut.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. <template>
  2. <div class="dashboard">
  3. <ComHead :tabs-index="2" />
  4. <div class="dashboard-content">
  5. <div class="dashboard-content-top flex">
  6. <div class="dashboard-content-top-left">
  7. <div class="dashboard-content-top-left-item">
  8. <div class="dashboard-content-top-left-item-top">
  9. <div class="dashboard-content-top-left-item-top-title">
  10. 小时峰值分析
  11. </div>
  12. <div class="dashboard-content-top-left-item-top-time" @click="showDatePicker(showTimeMsg.HourlyPeak)">
  13. <el-icon color="#ffffff" size="18">
  14. <Calendar />
  15. </el-icon>
  16. <el-icon color="#ffffff">
  17. <CaretBottom />
  18. </el-icon>
  19. </div>
  20. </div>
  21. <div v-loading="loading1" element-loading-text="数据加载中..." element-loading-svg-view-box="-10, -10, 50, 50" element-loading-background="rgba(0,0,0, 0.3)" class="dashboard-content-top-left-item-bottom">
  22. <Echarts id="ww1" :option="hourlyPeakObj" />
  23. </div>
  24. </div>
  25. <div class="dashboard-content-top-left-item">
  26. <div class="dashboard-content-top-left-item-top">
  27. <div class="dashboard-content-top-left-item-top-title">
  28. 日趋势分析
  29. </div>
  30. <div class="dashboard-content-top-left-item-top-time" @click="showDatePicker(showTimeMsg.WaybillTrend)">
  31. <el-icon color="#ffffff" size="18">
  32. <Calendar />
  33. </el-icon>
  34. <el-icon color="#ffffff">
  35. <CaretBottom />
  36. </el-icon>
  37. </div>
  38. </div>
  39. <div v-loading="loading2" element-loading-text="数据加载中..." element-loading-svg-view-box="-10, -10, 50, 50" element-loading-background="rgba(0,0,0, 0.3)" class="dashboard-content-top-left-item-bottom">
  40. <Echarts id="ww12" :option="waybillTrendObj" />
  41. </div>
  42. </div>
  43. <div class="dashboard-content-top-left-item">
  44. <div class="dashboard-content-top-left-item-top">
  45. <div class="dashboard-content-top-left-item-top-title">
  46. 目的站统计分析
  47. </div>
  48. <div class="dashboard-content-bottom-left-top-time" @click="showDatePicker(showTimeMsg.NodePeak)">
  49. <el-icon color="#ffffff" size="18">
  50. <Calendar />
  51. </el-icon>
  52. <el-icon color="#ffffff">
  53. <CaretBottom />
  54. </el-icon>
  55. </div>
  56. </div>
  57. <div v-loading="loading3" element-loading-text="数据加载中..." element-loading-svg-view-box="-10, -10, 50, 50" element-loading-background="rgba(0,0,0, 0.3)" class="dashboard-content-top-left-item-bottom">
  58. <Echarts id="ww4" :option="nodePeakObj" />
  59. </div>
  60. </div>
  61. </div>
  62. <!-- 地图 -->
  63. <div class="dashboard-content-top-center">
  64. <div v-loading="loading4" element-loading-text="数据加载中..." element-loading-svg-view-box="-10, -10, 50, 50" element-loading-background="rgba(0,0,0, 0.3)" class="dashboard-content-top-center-top">
  65. <div class="dashboard-content-top-center-top-list">
  66. <div class="dashboard-content-top-center-top-list-txt">
  67. 今日计划航班数
  68. </div>
  69. <div class="dashboard-content-top-center-top-list-num">
  70. {{ flightNums }}
  71. </div>
  72. </div>
  73. <div class="dashboard-content-top-center-top-list">
  74. <div class="dashboard-content-top-center-top-list-txt">
  75. 已完成航班数
  76. </div>
  77. <div class="dashboard-content-top-center-top-list-num">
  78. {{ stockNums }}
  79. </div>
  80. </div>
  81. <div class="dashboard-content-top-center-top-list">
  82. <div class="dashboard-content-top-center-top-list-txt">
  83. 已装载总量KG
  84. </div>
  85. <div class="dashboard-content-top-center-top-list-num">
  86. {{ weightNums }}
  87. </div>
  88. </div>
  89. </div>
  90. <div v-loading="loading5" element-loading-text="数据加载中..." element-loading-svg-view-box="-10, -10, 50, 50" element-loading-background="rgba(0,0,0, 0.3)" class="dashboard-content-top-center-bottom">
  91. <div class="dashboard-content-top-center-bottom-title">
  92. 航班动态跟踪
  93. </div>
  94. <div class="dashboard-content-top-center-bottom-content">
  95. <div class="dashboard-content-top-center-bottom-content-head">
  96. <div class="dashboard-content-top-center-bottom-content-head-list">
  97. 公司/航班号
  98. </div>
  99. <div class="dashboard-content-top-center-bottom-content-head-list">
  100. 航班状态
  101. </div>
  102. <div class="dashboard-content-top-center-bottom-content-head-list">
  103. 经停/到达站
  104. </div>
  105. <div class="dashboard-content-top-center-bottom-content-head-list">
  106. 计划起飞
  107. </div>
  108. <div class="dashboard-content-top-center-bottom-content-head-list">
  109. 实际起飞
  110. </div>
  111. <div class="dashboard-content-top-center-bottom-content-head-list">
  112. 机型
  113. </div>
  114. <div class="dashboard-content-top-center-bottom-content-head-list">
  115. 类型
  116. </div>
  117. </div>
  118. <div class="dashboard-content-top-center-bottom-content-bottom">
  119. <vue3-seamless-scroll :list="listData" :hover-stop="true" :hover="true" :step="0.3">
  120. <div v-for="(item, index) in listData" :key="index" class="dashboard-content-top-center-bottom-content-bottom-list">
  121. <div class="dashboard-content-top-center-bottom-content-bottom-list-txt">
  122. {{ item.flightNo }}
  123. </div>
  124. <div class="dashboard-content-top-center-bottom-content-bottom-list-txt">
  125. {{ item.flightState }}
  126. </div>
  127. <div class="dashboard-content-top-center-bottom-content-bottom-list-txt">
  128. {{ item.airport }}
  129. </div>
  130. <div class="dashboard-content-top-center-bottom-content-bottom-list-txt">
  131. {{ item.planTime }}
  132. </div>
  133. <div class="dashboard-content-top-center-bottom-content-bottom-list-txt">
  134. {{ item.acTime }}
  135. </div>
  136. <div class="dashboard-content-top-center-bottom-content-bottom-list-txt">
  137. {{ item.planeType }}
  138. </div>
  139. <div class="dashboard-content-top-center-bottom-content-bottom-list-txt">
  140. {{ item.KHT }}
  141. </div>
  142. </div>
  143. </vue3-seamless-scroll>
  144. </div>
  145. </div>
  146. </div>
  147. </div>
  148. <div class="dashboard-content-top-right">
  149. <div class="dashboard-content-top-right-item">
  150. <div class="dashboard-content-top-right-item-top">
  151. <div class="dashboard-content-top-right-item-top-title">
  152. 航司统计分析
  153. </div>
  154. <div class="dashboard-content-top-right-item-top-time" @click="showDatePicker(showTimeMsg.AirlineTraffic)">
  155. <el-icon color="#ffffff" size="18">
  156. <Calendar />
  157. </el-icon>
  158. <el-icon color="#ffffff">
  159. <CaretBottom />
  160. </el-icon>
  161. </div>
  162. </div>
  163. <div v-loading="loading6" element-loading-text="数据加载中..." element-loading-svg-view-box="-10, -10, 50, 50" element-loading-background="rgba(0,0,0, 0.3)" class="dashboard-content-top-right-item-bottom">
  164. <Echarts id="a1" :option="airlineTrafficObj" />
  165. </div>
  166. </div>
  167. <div class="dashboard-content-top-right-item">
  168. <div class="dashboard-content-top-right-item-top">
  169. <div class="dashboard-content-top-right-item-top-title">
  170. 航班动态统计
  171. </div>
  172. <div class="dashboard-content-top-right-item-top-time" @click="showDatePicker(showTimeMsg.AirlineAbnormal)">
  173. <el-icon color="#ffffff" size="18">
  174. <Calendar />
  175. </el-icon>
  176. <el-icon color="#ffffff">
  177. <CaretBottom />
  178. </el-icon>
  179. </div>
  180. </div>
  181. <div v-loading="loading7" element-loading-text="数据加载中..." element-loading-svg-view-box="-10, -10, 50, 50" element-loading-background="rgba(0,0,0, 0.3)" class="dashboard-content-top-left-item-bottom">
  182. <Echarts id="ww44" :option="airlineObj" />
  183. </div>
  184. </div>
  185. <div class="dashboard-content-top-right-item">
  186. <div class="dashboard-content-top-right-item-top">
  187. <div class="dashboard-content-top-right-item-top-title">
  188. 拉货统计分析
  189. </div>
  190. <div class="dashboard-content-top-right-item-top-time" @click="showDatePicker(showTimeMsg.PickingStatistics)">
  191. <el-icon color="#ffffff" size="18">
  192. <Calendar />
  193. </el-icon>
  194. <el-icon color="#ffffff">
  195. <CaretBottom />
  196. </el-icon>
  197. </div>
  198. </div>
  199. <div v-loading="loading8" element-loading-text="数据加载中..." element-loading-svg-view-box="-10, -10, 50, 50" element-loading-background="rgba(0,0,0, 0.3)" class="dashboard-content-top-left-item-bottom">
  200. <Echarts id="ww45" :option="pickingObj" />
  201. </div>
  202. </div>
  203. </div>
  204. </div>
  205. </div>
  206. <Dialog :flag="flag" msg-title="日期选择" @resetForm="resetForm" @submitForm="submitForm">
  207. <el-form :model="form" label-width="120px">
  208. <el-form-item label="开始日期">
  209. <el-date-picker :disabled-date="disabledStartDate" v-model="form.startDate" type="date" placeholder="请选择开始日期" size="default" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
  210. </el-form-item>
  211. <el-form-item label="结束日期">
  212. <el-date-picker :disabled-date="disabledEndDate" v-model="form.endDate" type="date" placeholder="请选择结束日期" size="default" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
  213. </el-form-item>
  214. </el-form>
  215. </Dialog>
  216. </div>
  217. </template>
  218. <script setup lang="ts">
  219. import { ref, onMounted } from "vue";
  220. import { Vue3SeamlessScroll } from "vue3-seamless-scroll";
  221. import Echarts from "@/components/Echarts/commonChartsBar.vue";
  222. import ComHead from "./components/comHead.vue";
  223. import { Calendar, CaretBottom } from "@element-plus/icons-vue";
  224. import Dialog from "@/components/dialog/index.vue";
  225. import { usePublic, showTimeMsg } from "./hooks/usePublic";
  226. import nodeCode from "./hooks/nodeCode";
  227. import { parseTime, isValue } from "@/utils/validate";
  228. import * as _ from "lodash";
  229. const {
  230. optionLeft,
  231. airCompaneBaggage,
  232. airlineAbnormalBaggage,
  233. getPublicData,
  234. findData,
  235. } = usePublic();
  236. const timePickerName = ref<number>(0);
  237. const flag = ref<boolean>(false);
  238. const loading1 = ref<boolean>(false);
  239. const loading2 = ref<boolean>(false);
  240. const loading3 = ref<boolean>(false);
  241. const loading4 = ref<boolean>(false);
  242. const loading5 = ref<boolean>(false);
  243. const loading6 = ref<boolean>(false);
  244. const loading7 = ref<boolean>(false);
  245. const loading8 = ref<boolean>(false);
  246. const hourlyPeakObj = ref<any>({});
  247. const waybillTrendObj = ref<any>({});
  248. const nodePeakObj = ref<any>({});
  249. const airlineTrafficObj = ref<any>({});
  250. const airlineObj = ref<any>({});
  251. const pickingObj = ref<any>({});
  252. const flightNums = ref<number>(0);
  253. const stockNums = ref<number>(0);
  254. const weightNums = ref<number | string>(0);
  255. const form = ref({
  256. startDate: parseTime(Date.now() - 24 * 60 * 60 * 1000 * 7, "{y}-{m}-{d}"),
  257. endDate: parseTime(Date.now(), "{y}-{m}-{d}"),
  258. });
  259. const dateNow = ref({
  260. time: parseTime(Date.now(), "{y}-{m}-{d}"),
  261. });
  262. const listData = ref<any>([]);
  263. const disabledStartDate = (time: Date) => {
  264. const timer: any = form.value.endDate;
  265. const data = new Date(timer);
  266. return time.getTime() > data.getTime();
  267. };
  268. const disabledEndDate = (time: Date) => {
  269. const timer: any = form.value.startDate;
  270. let data = new Date(timer);
  271. return data.getTime() > time.getTime();
  272. };
  273. const resetForm = () => {
  274. flag.value = false;
  275. };
  276. const submitForm = () => {
  277. flag.value = false;
  278. switch (timePickerName.value) {
  279. case showTimeMsg.HourlyPeak:
  280. dateNow.value.time = form.value.startDate;
  281. hourlyPeakFunc();
  282. break;
  283. case showTimeMsg.WaybillTrend:
  284. waybillTrendFunc();
  285. break;
  286. case showTimeMsg.NodePeak:
  287. nodePeakFunc();
  288. break;
  289. case showTimeMsg.AirlineTraffic:
  290. airlineTrafficFunc();
  291. break;
  292. case showTimeMsg.AirlineAbnormal:
  293. airlineFunc();
  294. break;
  295. case showTimeMsg.PickingStatistics:
  296. pickingFuncs();
  297. break;
  298. default:
  299. break;
  300. }
  301. };
  302. const showDatePicker = (id?) => {
  303. flag.value = true;
  304. timePickerName.value = id;
  305. };
  306. const sortClass = (sortData) => {
  307. const groupBy = (array, f) => {
  308. let groups = {};
  309. array.forEach((o) => {
  310. let group = JSON.stringify(f(o));
  311. groups[group] = groups[group] || [];
  312. groups[group].push(o);
  313. });
  314. return Object.keys(groups).map((group) => {
  315. return groups[group];
  316. });
  317. };
  318. const sorted = groupBy(sortData, (item) => {
  319. return item.jobName;
  320. });
  321. return sorted;
  322. };
  323. const pubFunc = (listValues, target, type?) => {
  324. const newObj = _.cloneDeep(target);
  325. const [jobTimes, stockNums, weights] = [<any>[], <any>[], <any>[]];
  326. listValues.forEach((item) => {
  327. jobTimes.push(item.jobTime);
  328. stockNums.push(item.stockNum);
  329. weights.push(item.weight);
  330. });
  331. newObj.xAxis.data = jobTimes;
  332. if (type) {
  333. newObj.series[1].data = stockNums;
  334. newObj.series[0].data = weights;
  335. } else {
  336. newObj.series[0].data = stockNums;
  337. newObj.series[1].data = weights;
  338. }
  339. return newObj;
  340. };
  341. //获取小时峰值分布
  342. const hourlyPeakFunc = async () => {
  343. loading1.value = true;
  344. const listValues = (await getPublicData(DATACONTENT_ID.jscGjHourlyPeakId, [
  345. { flightDate1: dateNow.value.time, flightDate2: form.value.endDate },
  346. ])) as any;
  347. if (listValues && isValue(listValues)) {
  348. hourlyPeakObj.value = pubFunc(listValues, optionLeft, true);
  349. }
  350. loading1.value = false;
  351. };
  352. //运单趋势分析
  353. const waybillTrendFunc = async () => {
  354. loading2.value = true;
  355. const listValues = (await getPublicData(DATACONTENT_ID.jscGjWaybillTrendId, [
  356. { flightDate1: form.value.startDate, flightDate2: form.value.endDate },
  357. ])) as any;
  358. if (listValues && isValue(listValues)) {
  359. listValues.forEach((item) => {
  360. item.jobTime = parseDate(item["jobTime"]);
  361. });
  362. waybillTrendObj.value = pubFunc(listValues, optionLeft, true);
  363. }
  364. loading2.value = false;
  365. };
  366. //始发站/目的站统计分析
  367. const nodePeakFunc = async () => {
  368. loading3.value = true;
  369. const listValues = (await getPublicData(DATACONTENT_ID.jscAirlineAbnormalId, [
  370. { fd1: form.value.startDate, fd2: form.value.endDate, fttp: "国际离港" },
  371. ])) as any;
  372. if (listValues && isValue(listValues)) {
  373. const newObj = _.cloneDeep(airCompaneBaggage.option.baseOption);
  374. listValues.forEach((item) => {
  375. item.jobTime = item["airport"];
  376. });
  377. nodePeakObj.value = pubFunc(listValues, newObj, true);
  378. }
  379. loading3.value = false;
  380. };
  381. //航班数&运单数
  382. const numbersFunc = async () => {
  383. loading4.value = true;
  384. const listValues = (await getPublicData(DATACONTENT_ID.jscGjNumbersId, [
  385. {
  386. fd1: parseTime(Date.now(), "{y}-{m}-{d}"),
  387. fd2: parseTime(Date.now(), "{y}-{m}-{d}"),
  388. },
  389. ])) as any;
  390. if (listValues && isValue(listValues)) {
  391. const { flightNum, finishFlightNum, weight } = listValues[0];
  392. flightNums.value = flightNum ?? 0;
  393. stockNums.value = finishFlightNum ?? 0;
  394. weightNums.value = weight ?? 0;
  395. }
  396. loading4.value = false;
  397. };
  398. //航司运量
  399. const airlineTrafficFunc = async () => {
  400. loading6.value = true;
  401. const listValues = (await getPublicData(
  402. DATACONTENT_ID.jscGjAirlineTrafficId,
  403. [{ flightDate1: form.value.startDate, flightDate2: form.value.endDate }]
  404. )) as any;
  405. if (listValues && isValue(listValues)) {
  406. const newObj: any = _.cloneDeep(airCompaneBaggage.option.baseOption);
  407. (newObj.dataZoom = [
  408. {
  409. id: "dataZoomX",
  410. type: "slider",
  411. xAxisIndex: [0],
  412. filterMode: "filter",
  413. start: 0,
  414. end: 20,
  415. },
  416. ]),
  417. listValues.forEach((item) => {
  418. item.jobTime = item["IACACode"];
  419. });
  420. airlineTrafficObj.value = pubFunc(listValues, newObj, true);
  421. }
  422. loading6.value = false;
  423. };
  424. //航班表格
  425. const airlineAbnormalFunc = async () => {
  426. loading5.value = true;
  427. const listValues = (await getPublicData(DATACONTENT_ID.jscFlightDynamicsId, [
  428. {
  429. fd1: parseTime(Date.now(), "{y}-{m}-{d}"),
  430. fd2: parseTime(Date.now(), "{y}-{m}-{d}"),
  431. fttp: "国际离港",
  432. },
  433. ])) as any;
  434. if (listValues && isValue(listValues)) {
  435. listData.value = listValues;
  436. }
  437. loading5.value = false;
  438. };
  439. //航班动态统计
  440. const airlineFunc = async () => {
  441. loading7.value = true;
  442. const listValues = (await getPublicData(DATACONTENT_ID.jscGjAirlineId, [
  443. {
  444. fd1: form.value.startDate,
  445. fd2: form.value.endDate,
  446. },
  447. ])) as any;
  448. if (listValues && isValue(listValues)) {
  449. const res = findData(
  450. nodeCode.internationalDeparture,
  451. listValues,
  452. "nodeCode",
  453. "flightNum"
  454. );
  455. const newObj: any = _.cloneDeep(airlineAbnormalBaggage.option.baseOption);
  456. (newObj.dataZoom = [
  457. {
  458. id: "dataZoomX",
  459. type: "slider",
  460. xAxisIndex: [0],
  461. filterMode: "filter",
  462. start: 0,
  463. end: 40,
  464. },
  465. ]),
  466. res.forEach((item) => {
  467. item.jobTime = item["name"] ?? item["nodeCode"];
  468. item.weight = item["flightNum"];
  469. });
  470. airlineObj.value = pubFunc(res, newObj);
  471. }
  472. loading7.value = false;
  473. };
  474. //拉货统计
  475. const pickingFuncs = async () => {
  476. loading8.value = true;
  477. const listValues = (await getPublicData(DATACONTENT_ID.jscGjPullId, [
  478. {
  479. fd1: form.value.startDate,
  480. fd2: form.value.endDate,
  481. },
  482. ])) as any;
  483. if (listValues && isValue(listValues)) {
  484. const newObj: any = _.cloneDeep(airlineAbnormalBaggage.option.baseOption);
  485. listValues.forEach((item) => {
  486. item.jobTime = parseDate(item["flightDate"]);
  487. item.weight = item["flightNum"];
  488. });
  489. pickingObj.value = pubFunc(listValues, newObj);
  490. }
  491. loading8.value = false;
  492. };
  493. const parseDate = (date: string) => {
  494. const dates = date.split("-");
  495. const newDate = dates.shift();
  496. return dates.join("-");
  497. };
  498. onMounted(() => {
  499. hourlyPeakFunc();
  500. waybillTrendFunc();
  501. nodePeakFunc();
  502. numbersFunc();
  503. airlineTrafficFunc();
  504. airlineAbnormalFunc();
  505. airlineFunc();
  506. pickingFuncs();
  507. });
  508. </script>
  509. <style lang="scss" scoped>
  510. @import "./css/index.scss";
  511. </style>