indexOut.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <template>
  2. <div class="dashboard">
  3. <ComHead :tabs-index="3" />
  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 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 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 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 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">{{ weight }}</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">{{ flightNums }}</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">{{ stockNums }}</div>
  76. </div>
  77. </div>
  78. <div 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.AirlineAbnormal)">
  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 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.AirlineTraffic)">
  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 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, airStutas, getPublicData } = usePublic();
  169. const timePickerName = ref<number>(0);
  170. const flag = ref<boolean>(false);
  171. const hourlyPeakObj = ref<any>({});
  172. const waybillTrendObj = ref<any>({});
  173. const nodePeakObj = ref<any>({});
  174. const airlineTrafficObj = ref<any>({});
  175. const airlineObj = ref<any>({});
  176. const flightNums = ref<number>(0);
  177. const stockNums = ref<number>(0);
  178. const weight = ref<number>(0);
  179. const form = ref({
  180. startDate: parseTime(Date.now() - 24 * 60 * 60 * 1000 * 7, "{y}-{m}-{d}"),
  181. endDate: parseTime(Date.now(), "{y}-{m}-{d}"),
  182. });
  183. const listData = ref<any>([]);
  184. const disabledStartDate = (time: Date) => {
  185. const timer: any = form.value.endDate;
  186. const data = new Date(timer);
  187. return time.getTime() > data.getTime();
  188. };
  189. const disabledEndDate = (time: Date) => {
  190. const timer: any = form.value.startDate;
  191. let data = new Date(timer);
  192. return data.getTime() > time.getTime();
  193. };
  194. const resetForm = () => {
  195. flag.value = false;
  196. };
  197. const submitForm = () => {
  198. flag.value = false;
  199. switch (timePickerName.value) {
  200. case showTimeMsg.HourlyPeak:
  201. hourlyPeakFunc();
  202. break;
  203. case showTimeMsg.WaybillTrend:
  204. waybillTrendFunc();
  205. break;
  206. case showTimeMsg.NodePeak:
  207. nodePeakFunc();
  208. break;
  209. case showTimeMsg.AirlineTraffic:
  210. airlineTrafficFunc();
  211. break;
  212. case showTimeMsg.AirlineAbnormal:
  213. airlineAbnormalFunc();
  214. break;
  215. default:
  216. break;
  217. }
  218. };
  219. const showDatePicker = (id?) => {
  220. flag.value = true;
  221. timePickerName.value = id;
  222. };
  223. const sortClass = (sortData) => {
  224. const groupBy = (array, f) => {
  225. let groups = {};
  226. array.forEach((o) => {
  227. let group = JSON.stringify(f(o));
  228. groups[group] = groups[group] || [];
  229. groups[group].push(o);
  230. });
  231. return Object.keys(groups).map((group) => {
  232. return groups[group];
  233. });
  234. };
  235. const sorted = groupBy(sortData, (item) => {
  236. return item.jobName;
  237. });
  238. return sorted;
  239. };
  240. const pubFunc = (listValues, target) => {
  241. const newObj = _.cloneDeep(target);
  242. const [jobTimes, stockNums, weights] = [<any>[], <any>[], <any>[]];
  243. listValues.forEach((item) => {
  244. jobTimes.push(item.jobTime);
  245. stockNums.push(item.stockNum);
  246. weights.push(item.weight);
  247. });
  248. newObj.xAxis.data = jobTimes;
  249. newObj.series[0].data = stockNums;
  250. newObj.series[1].data = weights;
  251. return newObj;
  252. };
  253. //获取小时峰值分布
  254. const hourlyPeakFunc = async () => {
  255. const listValues = (await getPublicData(DATACONTENT_ID.jscCgHourlyPeakId, [
  256. { fd1: form.value.startDate, fd2: form.value.endDate },
  257. ])) as any;
  258. if (listValues && isValue(listValues)) {
  259. hourlyPeakObj.value = pubFunc(listValues, optionLeft);
  260. }
  261. };
  262. //运单趋势分析
  263. const waybillTrendFunc = async () => {
  264. const listValues = (await getPublicData(DATACONTENT_ID.jscCgWaybillTrendId, [
  265. { fd1: form.value.startDate, fd2: form.value.endDate },
  266. ])) as any;
  267. if (listValues && isValue(listValues)) {
  268. waybillTrendObj.value = pubFunc(listValues, optionLeft);
  269. }
  270. };
  271. //始发站/目的站统计分析
  272. const nodePeakFunc = async () => {
  273. const listValues = (await getPublicData(DATACONTENT_ID.jscAirlineAbnormalId, [
  274. { fd1: form.value.startDate, fd2: form.value.endDate, fttp: "国内进港" },
  275. ])) as any;
  276. if (listValues && isValue(listValues)) {
  277. const newObj = _.cloneDeep(airCompaneBaggage.option.baseOption);
  278. listValues.forEach((item) => {
  279. item.jobTime = item["airport"];
  280. });
  281. nodePeakObj.value = pubFunc(listValues, newObj);
  282. }
  283. };
  284. //航班数&运单数
  285. const numbersFunc = async () => {
  286. const listValues = (await getPublicData(DATACONTENT_ID.jscCgNumbersId, [
  287. { fd1: form.value.startDate, fd2: form.value.endDate },
  288. ])) as any;
  289. if (listValues && isValue(listValues)) {
  290. const { flightNum, stockNum, weight } = listValues[0];
  291. flightNums.value = flightNum;
  292. stockNums.value = stockNum;
  293. weight.value = weight;
  294. }
  295. };
  296. //航司运量
  297. const airlineTrafficFunc = async () => {
  298. const listValues = (await getPublicData(
  299. DATACONTENT_ID.jscCgAirlineTrafficId,
  300. [{ fd1: form.value.startDate, fd2: form.value.endDate }]
  301. )) as any;
  302. if (listValues && isValue(listValues)) {
  303. listValues.forEach((item) => {
  304. item.jobTime = item["IACACode"];
  305. });
  306. airlineTrafficObj.value = pubFunc(
  307. listValues,
  308. airCompaneBaggage.option.baseOption
  309. );
  310. }
  311. };
  312. //航班表格
  313. const airlineAbnormalFunc = async () => {
  314. const listValues = (await getPublicData(DATACONTENT_ID.jscFlightDynamicsId, [
  315. {
  316. fd1: form.value.startDate,
  317. fd2: form.value.endDate,
  318. fttp: "国内进港",
  319. },
  320. ])) as any;
  321. if (listValues && isValue(listValues)) {
  322. listData.value = listValues;
  323. }
  324. };
  325. //航班动态统计
  326. const airlineFunc = async () => {
  327. const listValues = (await getPublicData(DATACONTENT_ID.jscCgAirlineId, [
  328. {
  329. fd1: form.value.startDate,
  330. fd2: form.value.endDate,
  331. },
  332. ])) as any;
  333. if (listValues && isValue(listValues)) {
  334. const newObj = _.cloneDeep(airCompaneBaggage.option.baseOption);
  335. listValues.forEach((item) => {
  336. item.jobTime = item["nodeCode"];
  337. item.stockNum = item["flightNum"];
  338. item.weight = item["stockNum"];
  339. });
  340. airlineObj.value = pubFunc(listValues, newObj);
  341. }
  342. };
  343. onMounted(() => {
  344. hourlyPeakFunc();
  345. waybillTrendFunc();
  346. nodePeakFunc();
  347. numbersFunc();
  348. airlineTrafficFunc();
  349. airlineAbnormalFunc();
  350. airlineFunc();
  351. });
  352. </script>
  353. <style lang="scss" scoped>
  354. @import "./css/index.scss";
  355. </style>