indexHomeOut.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. <template>
  2. <div class="dashboard">
  3. <ComHead :tabs-index="0" />
  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">已装载总量(吨)</div>
  75. <div class="dashboard-content-top-center-top-list-num">{{ formatWeight(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 ref="scrollContent" class="dashboard-content-top-center-bottom-content-bottom">
  91. <vue3-seamless-scroll :list="listData" :limitScrollNum="limitScrollNum" :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">--</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">
  131. <el-dropdown trigger="click" @command="handleCommand">
  132. <span class="icons">
  133. <span class="icons-txt">{{ specialGoods }}</span>
  134. <el-icon color="#ffffff">
  135. <CaretBottom />
  136. </el-icon>
  137. </span>
  138. <template #dropdown>
  139. <el-dropdown-menu>
  140. <el-dropdown-item v-for="(item,index) in specialGoodsDatas" :key="index" :command="item.specialTypeName">{{ item.specialTypeName }}</el-dropdown-item>
  141. </el-dropdown-menu>
  142. </template>
  143. </el-dropdown>
  144. </div>
  145. </div>
  146. <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">
  147. <Echarts id="ww44" :option="airlineObj" />
  148. </div>
  149. </div>
  150. <div class="dashboard-content-top-right-item">
  151. <div class="dashboard-content-top-right-item-top">
  152. <div class="dashboard-content-top-right-item-top-title">
  153. 拉货统计分析
  154. </div>
  155. <div class="dashboard-content-top-right-item-top-time" @click="showDatePicker(showTimeMsg.PickingStatistics)">
  156. <el-icon color="#ffffff" size="18">
  157. <Calendar />
  158. </el-icon>
  159. <el-icon color="#ffffff">
  160. <CaretBottom />
  161. </el-icon>
  162. </div>
  163. </div>
  164. <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">
  165. <Echarts id="ww45" :option="pickingObj" />
  166. </div>
  167. </div>
  168. </div>
  169. </div>
  170. </div>
  171. <Dialog :flag="flag" msg-title="日期选择" @resetForm="resetForm" @submitForm="submitForm">
  172. <el-form :model="form" label-width="120px">
  173. <el-form-item label="开始日期">
  174. <el-date-picker :disabled-date="disabledStartDate" v-model="form.startDate" type="date" placeholder="请选择开始日期" size="default" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
  175. </el-form-item>
  176. <el-form-item label="结束日期">
  177. <el-date-picker :disabled-date="disabledEndDate" v-model="form.endDate" type="date" placeholder="请选择结束日期" size="default" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
  178. </el-form-item>
  179. </el-form>
  180. </Dialog>
  181. </div>
  182. </template>
  183. <script setup lang="ts">
  184. import { ref, onMounted } from "vue";
  185. import { Vue3SeamlessScroll } from "vue3-seamless-scroll";
  186. import Echarts from "@/components/Echarts/commonChartsBar.vue";
  187. import ComHead from "./components/comHead.vue";
  188. import { Calendar, CaretBottom } from "@element-plus/icons-vue";
  189. import Dialog from "@/components/dialog/index.vue";
  190. import { usePublic, showTimeMsg } from "./hooks/usePublic";
  191. import nodeCode from "./hooks/nodeCode";
  192. import { parseTime, isValue } from "@/utils/validate";
  193. import * as _ from "lodash";
  194. const {
  195. optionLeft,
  196. airCompaneBaggage,
  197. airlineAbnormalBaggage,
  198. getPublicData,
  199. formatGoods,
  200. formatWeight,
  201. } = usePublic();
  202. const timePickerName = ref<number>(0);
  203. const limitScrollNum = ref<number>(13);
  204. const scrollContent = ref<HTMLElement>();
  205. const flag = ref<boolean>(false);
  206. const loading1 = ref<boolean>(false);
  207. const loading2 = ref<boolean>(false);
  208. const loading3 = ref<boolean>(false);
  209. const loading4 = ref<boolean>(false);
  210. const loading5 = ref<boolean>(false);
  211. const loading6 = ref<boolean>(false);
  212. const loading7 = ref<boolean>(false);
  213. const loading8 = ref<boolean>(false);
  214. const hourlyPeakObj = ref<any>({});
  215. const waybillTrendObj = ref<any>({});
  216. const nodePeakObj = ref<any>({});
  217. const airlineTrafficObj = ref<any>({});
  218. const airlineObj = ref<any>({});
  219. const pickingObj = ref<any>({});
  220. const flightNums = ref<number>(0);
  221. const stockNums = ref<number>(0);
  222. const specialGoods = ref<string>("");
  223. const specialGoodsDatas = ref<any>([]);
  224. const specialGoodsAll = ref<any>([]);
  225. const weightNums = ref<number | string>(0);
  226. const form = ref({
  227. startDate: parseTime(Date.now() - 24 * 60 * 60 * 1000 * 7, "{y}-{m}-{d}"),
  228. endDate: parseTime(Date.now(), "{y}-{m}-{d}"),
  229. });
  230. const dateNow = ref({
  231. time: parseTime(Date.now(), "{y}-{m}-{d}"),
  232. });
  233. const listData = ref<any>([]);
  234. const disabledStartDate = (time: Date) => {
  235. const timer: any = form.value.endDate;
  236. const data = new Date(timer);
  237. return time.getTime() > data.getTime();
  238. };
  239. const disabledEndDate = (time: Date) => {
  240. const timer: any = form.value.startDate;
  241. let data = new Date(timer);
  242. return data.getTime() > time.getTime();
  243. };
  244. const resetForm = () => {
  245. flag.value = false;
  246. };
  247. const submitForm = () => {
  248. flag.value = false;
  249. switch (timePickerName.value) {
  250. case showTimeMsg.HourlyPeak:
  251. dateNow.value.time = form.value.startDate;
  252. hourlyPeakFunc();
  253. break;
  254. case showTimeMsg.WaybillTrend:
  255. waybillTrendFunc();
  256. break;
  257. case showTimeMsg.NodePeak:
  258. nodePeakFunc();
  259. break;
  260. case showTimeMsg.AirlineTraffic:
  261. airlineTrafficFunc();
  262. break;
  263. case showTimeMsg.AirlineAbnormal:
  264. airlineFunc();
  265. break;
  266. case showTimeMsg.PickingStatistics:
  267. pickingFuncs();
  268. break;
  269. default:
  270. break;
  271. }
  272. };
  273. const showDatePicker = (id?) => {
  274. flag.value = true;
  275. timePickerName.value = id;
  276. };
  277. const sortClass = (sortData) => {
  278. const groupBy = (array, f) => {
  279. let groups = {};
  280. array.forEach((o) => {
  281. let group = JSON.stringify(f(o));
  282. groups[group] = groups[group] || [];
  283. groups[group].push(o);
  284. });
  285. return Object.keys(groups).map((group) => {
  286. return groups[group];
  287. });
  288. };
  289. const sorted = groupBy(sortData, (item) => {
  290. return item.jobName;
  291. });
  292. return sorted;
  293. };
  294. const pubFunc = (listValues, target, type?) => {
  295. const newObj = _.cloneDeep(target);
  296. const [jobTimes, stockNums, weights] = [<any>[], <any>[], <any>[]];
  297. listValues.forEach((item) => {
  298. jobTimes.push(item.jobTime);
  299. stockNums.push(item.stockNum);
  300. weights.push(item.weight);
  301. });
  302. newObj.xAxis.data = jobTimes;
  303. if (type) {
  304. newObj.series[1].data = stockNums;
  305. newObj.series[0].data = weights;
  306. } else {
  307. newObj.series[0].data = stockNums;
  308. newObj.series[1].data = weights;
  309. }
  310. return newObj;
  311. };
  312. const parseDate = (date: string) => {
  313. const dates = date.split("-");
  314. const newDate = dates.shift();
  315. return dates.join("-");
  316. };
  317. // 特货分类统计-选取下拉数据
  318. const handleCommand = (command: string) => {
  319. specialGoods.value = command;
  320. const newObj: any = _.cloneDeep(airlineAbnormalBaggage.option.baseOption);
  321. const result = formatGoods(command, specialGoodsAll.value);
  322. airlineObj.value = pubFunc(result, newObj);
  323. };
  324. //获取小时峰值分布
  325. const hourlyPeakFunc = async () => {
  326. loading1.value = true;
  327. const listValues = (await getPublicData(DATACONTENT_ID.jscHourlyPeakId, [
  328. { flightDate1: dateNow.value.time, flightDate2: form.value.endDate },
  329. ])) as any;
  330. if (listValues && isValue(listValues)) {
  331. hourlyPeakObj.value = pubFunc(listValues, optionLeft, true);
  332. }
  333. loading1.value = false;
  334. };
  335. //运单趋势分析
  336. const waybillTrendFunc = async () => {
  337. loading2.value = true;
  338. const listValues = (await getPublicData(DATACONTENT_ID.jscWaybillTrendId, [
  339. { flightDate1: form.value.startDate, flightDate2: form.value.endDate },
  340. ])) as any;
  341. if (listValues && isValue(listValues)) {
  342. listValues.forEach((item) => {
  343. item.jobTime = parseDate(item["jobTime"]);
  344. });
  345. waybillTrendObj.value = pubFunc(listValues, optionLeft, true);
  346. }
  347. loading2.value = false;
  348. };
  349. //始发站/目的站统计分析
  350. const nodePeakFunc = async () => {
  351. loading3.value = true;
  352. const listValues = (await getPublicData(DATACONTENT_ID.jscAirlineAbnormalId, [
  353. { fd1: form.value.startDate, fd2: form.value.endDate, fttp: "国内离港" },
  354. ])) as any;
  355. if (listValues && isValue(listValues)) {
  356. const newObj = _.cloneDeep(airCompaneBaggage.option.baseOption);
  357. listValues.forEach((item) => {
  358. item.jobTime = item["airport"];
  359. });
  360. nodePeakObj.value = pubFunc(listValues, newObj, true);
  361. }
  362. loading3.value = false;
  363. };
  364. //航班数&运单数
  365. const numbersFunc = async () => {
  366. loading4.value = true;
  367. const listValues = (await getPublicData(DATACONTENT_ID.jscNumbersId, [
  368. {
  369. fd1: parseTime(Date.now(), "{y}-{m}-{d}"),
  370. fd2: parseTime(Date.now(), "{y}-{m}-{d}"),
  371. },
  372. ])) as any;
  373. if (listValues && isValue(listValues)) {
  374. const { flightNum, finishFlightNum, weight } = listValues[0];
  375. flightNums.value = flightNum ?? 0;
  376. stockNums.value = finishFlightNum ?? 0;
  377. weightNums.value = weight ?? 0;
  378. }
  379. loading4.value = false;
  380. };
  381. //航司运量
  382. const airlineTrafficFunc = async () => {
  383. loading6.value = true;
  384. const listValues = (await getPublicData(DATACONTENT_ID.jscAirlineTrafficId, [
  385. { flightDate1: form.value.startDate, flightDate2: form.value.endDate },
  386. ])) as any;
  387. if (listValues && isValue(listValues)) {
  388. const newObj: any = _.cloneDeep(airCompaneBaggage.option.baseOption);
  389. (newObj.dataZoom = [
  390. {
  391. id: "dataZoomX",
  392. type: "slider",
  393. xAxisIndex: [0],
  394. filterMode: "filter",
  395. start: 0,
  396. end: 20,
  397. },
  398. ]),
  399. listValues.forEach((item) => {
  400. item.jobTime = item["IACACode"];
  401. });
  402. airlineTrafficObj.value = pubFunc(listValues, newObj, true);
  403. }
  404. loading6.value = false;
  405. };
  406. //航班表格
  407. const airlineAbnormalFunc = async () => {
  408. loading5.value = true;
  409. const listValues = (await getPublicData(DATACONTENT_ID.jscFlightDynamicsId, [
  410. {
  411. fd1: parseTime(Date.now(), "{y}-{m}-{d}"),
  412. fd2: parseTime(Date.now(), "{y}-{m}-{d}"),
  413. fttp: "国内离港",
  414. },
  415. ])) as any;
  416. const domHeight = scrollContent.value?.clientHeight;
  417. if (domHeight && typeof domHeight == "number") {
  418. const cell = Math.ceil(domHeight / 40);
  419. limitScrollNum.value = cell;
  420. }
  421. if (listValues && isValue(listValues)) {
  422. listData.value = listValues;
  423. }
  424. loading5.value = false;
  425. };
  426. //航班动态统计
  427. // const airlineFunc = async () => {
  428. // loading7.value = true;
  429. // const listValues = (await getPublicData(DATACONTENT_ID.jscAirlineId, [
  430. // {
  431. // fd1: form.value.startDate,
  432. // fd2: form.value.endDate,
  433. // },
  434. // ])) as any;
  435. // if (listValues && isValue(listValues)) {
  436. // const res = findData(
  437. // nodeCode.departure,
  438. // listValues,
  439. // "nodeCode",
  440. // "flightNum"
  441. // );
  442. // const newObj: any = _.cloneDeep(airlineAbnormalBaggage.option.baseOption);
  443. // (newObj.dataZoom = [
  444. // {
  445. // id: "dataZoomX",
  446. // type: "slider",
  447. // xAxisIndex: [0],
  448. // filterMode: "filter",
  449. // start: 0,
  450. // end: 40,
  451. // },
  452. // ]),
  453. // res.forEach((item) => {
  454. // item.jobTime = item["name"] ?? item["nodeCode"];
  455. // item.weight = item["flightNum"];
  456. // });
  457. // airlineObj.value = pubFunc(res, newObj);
  458. // }
  459. // loading7.value = false;
  460. // };
  461. //特货分类统计
  462. const airlineFunc = async () => {
  463. loading7.value = true;
  464. const listValues = (await getPublicData(DATACONTENT_ID.jscGoodsId, [
  465. {
  466. fd1: form.value.startDate,
  467. fd2: form.value.endDate,
  468. fttp: "国内离港",
  469. },
  470. ])) as any;
  471. if (listValues && isValue(listValues)) {
  472. const newObj: any = _.cloneDeep(airlineAbnormalBaggage.option.baseOption);
  473. const newDatas = _.cloneDeep(listValues);
  474. const nameDatas = _.unionBy(newDatas, "specialTypeName");
  475. const names: any = [...nameDatas];
  476. specialGoods.value = names[0]["specialTypeName"];
  477. specialGoodsDatas.value = names;
  478. specialGoodsAll.value = listValues;
  479. const result = formatGoods(
  480. names[0]["specialTypeName"],
  481. specialGoodsAll.value
  482. );
  483. airlineObj.value = pubFunc(result, newObj);
  484. }
  485. loading7.value = false;
  486. };
  487. //拉货统计
  488. const pickingFuncs = async () => {
  489. loading8.value = true;
  490. const listValues = (await getPublicData(DATACONTENT_ID.jscGgPullId, [
  491. {
  492. fd1: form.value.startDate,
  493. fd2: form.value.endDate,
  494. },
  495. ])) as any;
  496. if (listValues && isValue(listValues)) {
  497. const newObj: any = _.cloneDeep(airlineAbnormalBaggage.option.baseOption);
  498. listValues.forEach((item) => {
  499. item.jobTime = parseDate(item["flightDate"]);
  500. item.weight = item["flightNum"];
  501. });
  502. pickingObj.value = pubFunc(listValues, newObj);
  503. }
  504. loading8.value = false;
  505. };
  506. onMounted(() => {
  507. hourlyPeakFunc();
  508. waybillTrendFunc();
  509. nodePeakFunc();
  510. numbersFunc();
  511. airlineTrafficFunc();
  512. airlineAbnormalFunc();
  513. airlineFunc();
  514. pickingFuncs();
  515. });
  516. </script>
  517. <style lang="scss" scoped>
  518. @import "./css/index.scss";
  519. </style>