indexIn.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  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">今日计划航班数</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>
  144. </div>
  145. </div>
  146. <Dialog :flag="flag" msg-title="日期选择" @resetForm="resetForm" @submitForm="submitForm">
  147. <el-form :model="form" label-width="120px">
  148. <el-form-item label="开始日期">
  149. <el-date-picker :disabled-date="disabledStartDate" v-model="form.startDate" type="date" placeholder="请选择开始日期" size="default" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
  150. </el-form-item>
  151. <el-form-item label="结束日期">
  152. <el-date-picker :disabled-date="disabledEndDate" v-model="form.endDate" type="date" placeholder="请选择结束日期" size="default" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
  153. </el-form-item>
  154. </el-form>
  155. </Dialog>
  156. </div>
  157. </template>
  158. <script setup lang="ts">
  159. import { ref, onMounted } from "vue";
  160. import { Vue3SeamlessScroll } from "vue3-seamless-scroll";
  161. import Echarts from "@/components/Echarts/commonChartsBar.vue";
  162. import ComHead from "./components/comHead.vue";
  163. import { Calendar, CaretBottom } from "@element-plus/icons-vue";
  164. import Dialog from "@/components/dialog/index.vue";
  165. import { usePublic, showTimeMsg } from "./hooks/usePublic";
  166. import { parseTime, isValue } from "@/utils/validate";
  167. import * as _ from "lodash";
  168. const { optionLeft, airCompaneBaggage, airlineAbnormalBaggage, getPublicData } =
  169. usePublic();
  170. const timePickerName = ref<number>(0);
  171. const flag = ref<boolean>(false);
  172. const loading1 = ref<boolean>(false);
  173. const loading2 = ref<boolean>(false);
  174. const loading3 = ref<boolean>(false);
  175. const loading4 = ref<boolean>(false);
  176. const loading5 = ref<boolean>(false);
  177. const loading6 = ref<boolean>(false);
  178. const loading7 = ref<boolean>(false);
  179. const hourlyPeakObj = ref<any>({});
  180. const waybillTrendObj = ref<any>({});
  181. const nodePeakObj = ref<any>({});
  182. const airlineTrafficObj = ref<any>({});
  183. const airlineObj = ref<any>({});
  184. const flightNums = ref<number>(0);
  185. const stockNums = ref<number>(0);
  186. const weightNums = ref<number | string>(0);
  187. const form = ref({
  188. startDate: parseTime(Date.now() - 24 * 60 * 60 * 1000 * 7, "{y}-{m}-{d}"),
  189. endDate: parseTime(Date.now(), "{y}-{m}-{d}"),
  190. });
  191. const dateNow = ref({
  192. time: parseTime(Date.now(), "{y}-{m}-{d}"),
  193. });
  194. const listData = ref<any>([]);
  195. const disabledStartDate = (time: Date) => {
  196. const timer: any = form.value.endDate;
  197. const data = new Date(timer);
  198. return time.getTime() > data.getTime();
  199. };
  200. const disabledEndDate = (time: Date) => {
  201. const timer: any = form.value.startDate;
  202. let data = new Date(timer);
  203. return data.getTime() > time.getTime();
  204. };
  205. const resetForm = () => {
  206. flag.value = false;
  207. };
  208. const submitForm = () => {
  209. flag.value = false;
  210. switch (timePickerName.value) {
  211. case showTimeMsg.HourlyPeak:
  212. dateNow.value.time = form.value.startDate;
  213. hourlyPeakFunc();
  214. break;
  215. case showTimeMsg.WaybillTrend:
  216. waybillTrendFunc();
  217. break;
  218. case showTimeMsg.NodePeak:
  219. nodePeakFunc();
  220. break;
  221. case showTimeMsg.AirlineTraffic:
  222. airlineTrafficFunc();
  223. break;
  224. case showTimeMsg.AirlineAbnormal:
  225. airlineFunc();
  226. break;
  227. default:
  228. break;
  229. }
  230. };
  231. const showDatePicker = (id?) => {
  232. flag.value = true;
  233. timePickerName.value = id;
  234. };
  235. const sortClass = (sortData) => {
  236. const groupBy = (array, f) => {
  237. let groups = {};
  238. array.forEach((o) => {
  239. let group = JSON.stringify(f(o));
  240. groups[group] = groups[group] || [];
  241. groups[group].push(o);
  242. });
  243. return Object.keys(groups).map((group) => {
  244. return groups[group];
  245. });
  246. };
  247. const sorted = groupBy(sortData, (item) => {
  248. return item.jobName;
  249. });
  250. return sorted;
  251. };
  252. const pubFunc = (listValues, target, type?) => {
  253. const newObj = _.cloneDeep(target);
  254. const [jobTimes, stockNums, weights] = [<any>[], <any>[], <any>[]];
  255. listValues.forEach((item) => {
  256. jobTimes.push(item.jobTime);
  257. stockNums.push(item.stockNum);
  258. weights.push(item.weight);
  259. });
  260. newObj.xAxis.data = jobTimes;
  261. if (type) {
  262. newObj.series[1].data = stockNums;
  263. newObj.series[0].data = weights;
  264. } else {
  265. newObj.series[0].data = stockNums;
  266. newObj.series[1].data = weights;
  267. }
  268. return newObj;
  269. };
  270. const parseDate = (date: string) => {
  271. const dates = date.split("-");
  272. const newDate = dates.shift();
  273. return dates.join("-");
  274. };
  275. //获取小时峰值分布
  276. const hourlyPeakFunc = async () => {
  277. loading1.value = true;
  278. const listValues = (await getPublicData(DATACONTENT_ID.jscJgHourlyPeakId, [
  279. { flightDate1: dateNow.value.time, flightDate2: form.value.endDate },
  280. ])) as any;
  281. if (listValues && isValue(listValues)) {
  282. hourlyPeakObj.value = pubFunc(listValues, optionLeft, true);
  283. }
  284. loading1.value = false;
  285. };
  286. //运单趋势分析
  287. const waybillTrendFunc = async () => {
  288. loading2.value = true;
  289. const listValues = (await getPublicData(DATACONTENT_ID.jscJgWaybillTrendId, [
  290. { flightDate1: form.value.startDate, flightDate2: form.value.endDate },
  291. ])) as any;
  292. if (listValues && isValue(listValues)) {
  293. listValues.forEach((item) => {
  294. item.jobTime = parseDate(item["jobTime"]);
  295. });
  296. waybillTrendObj.value = pubFunc(listValues, optionLeft, true);
  297. }
  298. loading2.value = false;
  299. };
  300. //始发站/目的站统计分析
  301. const nodePeakFunc = async () => {
  302. loading3.value = true;
  303. const listValues = (await getPublicData(DATACONTENT_ID.jscAirlineAbnormalId, [
  304. { fd1: form.value.startDate, fd2: form.value.endDate, fttp: "国际进港" },
  305. ])) as any;
  306. if (listValues && isValue(listValues)) {
  307. const newObj = _.cloneDeep(airCompaneBaggage.option.baseOption);
  308. listValues.forEach((item) => {
  309. item.jobTime = item["airport"];
  310. });
  311. nodePeakObj.value = pubFunc(listValues, newObj, true);
  312. }
  313. loading3.value = false;
  314. };
  315. //航班数&运单数
  316. const numbersFunc = async () => {
  317. loading4.value = true;
  318. const listValues = (await getPublicData(DATACONTENT_ID.jscJgNumbersId, [
  319. {
  320. fd1: parseTime(Date.now(), "{y}-{m}-{d}"),
  321. fd2: parseTime(Date.now(), "{y}-{m}-{d}"),
  322. },
  323. ])) as any;
  324. if (listValues && isValue(listValues)) {
  325. const { flightNum, finishFlightNum, weight } = listValues[0];
  326. flightNums.value = flightNum ?? 0;
  327. stockNums.value = finishFlightNum ?? 0;
  328. weightNums.value = weight ?? 0;
  329. }
  330. loading4.value = false;
  331. };
  332. //航司运量
  333. const airlineTrafficFunc = async () => {
  334. loading6.value = true;
  335. const listValues = (await getPublicData(
  336. DATACONTENT_ID.jscJgAirlineTrafficId,
  337. [{ flightDate1: form.value.startDate, flightDate2: form.value.endDate }]
  338. )) as any;
  339. if (listValues && isValue(listValues)) {
  340. const newObj: any = _.cloneDeep(airCompaneBaggage.option.baseOption);
  341. (newObj.dataZoom = [
  342. {
  343. id: "dataZoomX",
  344. type: "slider",
  345. xAxisIndex: [0],
  346. filterMode: "filter",
  347. start: 0,
  348. end: 20,
  349. },
  350. ]),
  351. listValues.forEach((item) => {
  352. item.jobTime = item["IACACode"];
  353. });
  354. airlineTrafficObj.value = pubFunc(listValues, newObj, true);
  355. }
  356. loading6.value = false;
  357. };
  358. //航班表格
  359. const airlineAbnormalFunc = async () => {
  360. loading5.value = true;
  361. const listValues = (await getPublicData(DATACONTENT_ID.jscFlightDynamicsId, [
  362. {
  363. fd1: parseTime(Date.now(), "{y}-{m}-{d}"),
  364. fd2: parseTime(Date.now(), "{y}-{m}-{d}"),
  365. fttp: "国际进港",
  366. },
  367. ])) as any;
  368. if (listValues && isValue(listValues)) {
  369. listData.value = listValues;
  370. }
  371. loading5.value = false;
  372. };
  373. //航班动态统计
  374. const airlineFunc = async () => {
  375. loading7.value = true;
  376. const listValues = (await getPublicData(DATACONTENT_ID.jscJgAirlineId, [
  377. {
  378. fd1: form.value.startDate,
  379. fd2: form.value.endDate,
  380. },
  381. ])) as any;
  382. if (listValues && isValue(listValues)) {
  383. const newObj: any = _.cloneDeep(airlineAbnormalBaggage.option.baseOption);
  384. (newObj.dataZoom = [
  385. {
  386. id: "dataZoomX",
  387. type: "slider",
  388. xAxisIndex: [0],
  389. filterMode: "filter",
  390. start: 0,
  391. end: 20,
  392. },
  393. ]),
  394. listValues.forEach((item) => {
  395. item.jobTime = NODE_CODE[item["nodeCode"]] ?? item["nodeCode"];
  396. item.weight = item["flightNum"];
  397. });
  398. airlineObj.value = pubFunc(listValues, newObj);
  399. }
  400. loading7.value = false;
  401. };
  402. onMounted(() => {
  403. hourlyPeakFunc();
  404. waybillTrendFunc();
  405. nodePeakFunc();
  406. numbersFunc();
  407. airlineTrafficFunc();
  408. airlineAbnormalFunc();
  409. airlineFunc();
  410. });
  411. </script>
  412. <style lang="scss" scoped>
  413. @import "./css/index.scss";
  414. </style>