indexHomeOut.vue 18 KB

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