indexHomeOut.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  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 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>
  44. <!-- 地图 -->
  45. <div class="dashboard-content-top-center">
  46. <div class="dashboard-content-top-center-top"></div>
  47. <div class="dashboard-content-top-center-bottom">
  48. <div class="dashboard-content-top-center-bottom-box1">
  49. <div class="dashboard-content-top-center-bottom-box1-title">
  50. 航班数:{{ flightNums }}
  51. </div>
  52. </div>
  53. <div class="dashboard-content-top-center-bottom-box2">
  54. <div class="dashboard-content-top-center-bottom-box2-title">
  55. 运单数:{{ stockNums }}
  56. </div>
  57. </div>
  58. <EchartsMap :option="mapOptions" id="ww2" />
  59. </div>
  60. </div>
  61. <div class="dashboard-content-top-right">
  62. <div class="dashboard-content-top-right-item">
  63. <div class="dashboard-content-top-right-item-top">
  64. <div class="dashboard-content-top-right-item-top-title">
  65. 航班预警报警分析
  66. </div>
  67. <div class="dashboard-content-top-right-item-top-time" @click="showDatePicker(showTimeMsg.AirlineAbnormal)">
  68. <el-icon color="#ffffff" size="18">
  69. <Calendar />
  70. </el-icon>
  71. <el-icon color="#ffffff">
  72. <CaretBottom />
  73. </el-icon>
  74. </div>
  75. </div>
  76. <div class="dashboard-content-top-right-item-bottom">
  77. <Echarts id="ww3" :option="airlineAbnormalBaggage.option" />
  78. </div>
  79. </div>
  80. <div class="dashboard-content-top-right-item">
  81. <div class="dashboard-content-top-right-item-top">
  82. <div class="dashboard-content-top-right-item-top-title">
  83. 航司运量统计
  84. </div>
  85. <div class="dashboard-content-top-right-item-top-time" @click="showDatePicker(showTimeMsg.AirlineTraffic)">
  86. <el-icon color="#ffffff" size="18">
  87. <Calendar />
  88. </el-icon>
  89. <el-icon color="#ffffff">
  90. <CaretBottom />
  91. </el-icon>
  92. </div>
  93. </div>
  94. <div class="dashboard-content-top-left-item-bottom">
  95. <Echarts id="ww33" :option="airlineTrafficObj" />
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. <div class="dashboard-content-bottom flex">
  101. <div class="dashboard-content-bottom-left">
  102. <div class="dashboard-content-bottom-left-top">
  103. <div class="dashboard-content-bottom-left-top-title">
  104. 节点峰值分布
  105. </div>
  106. <div class="dashboard-content-bottom-left-top-time" @click="showDatePicker(showTimeMsg.NodePeak)">
  107. <el-icon color="#ffffff" size="18">
  108. <Calendar />
  109. </el-icon>
  110. <el-icon color="#ffffff">
  111. <CaretBottom />
  112. </el-icon>
  113. </div>
  114. </div>
  115. <div class="dashboard-content-bottom-left-bottom">
  116. <Echarts id="ww4" :option="nodePeakObj" />
  117. </div>
  118. </div>
  119. <div class="dashboard-content-bottom-center">
  120. <div class="dashboard-content-bottom-center-top">
  121. <div class="dashboard-content-bottom-center-top-title">
  122. 节点效率分析
  123. </div>
  124. <div class="dashboard-content-bottom-center-top-time" @click="showDatePicker()">
  125. <el-icon color="#ffffff" size="18">
  126. <Calendar />
  127. </el-icon>
  128. <el-icon color="#ffffff">
  129. <CaretBottom />
  130. </el-icon>
  131. </div>
  132. </div>
  133. <div class="dashboard-content-bottom-center-bottom">
  134. <Echarts id="ww5" :option="nodeEfficiency.option" />
  135. </div>
  136. </div>
  137. <div class="dashboard-content-bottom-right">
  138. <div class="dashboard-content-bottom-right-top">
  139. <div class="dashboard-content-bottom-center-top-title">
  140. 航班动态统计
  141. </div>
  142. </div>
  143. <div class="dashboard-content-bottom-right-bottom">
  144. <Echarts id="ww6" :option="airStutas.option" />
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. <Dialog :flag="flag" msg-title="日期选择" @resetForm="resetForm" @submitForm="submitForm">
  150. <el-form :model="form" label-width="120px">
  151. <el-form-item label="开始日期">
  152. <el-date-picker :disabled-date="disabledStartDate" v-model="form.startDate" type="date" placeholder="请选择开始日期" size="default" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
  153. </el-form-item>
  154. <el-form-item label="结束日期">
  155. <el-date-picker :disabled-date="disabledEndDate" v-model="form.endDate" type="date" placeholder="请选择结束日期" size="default" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
  156. </el-form-item>
  157. </el-form>
  158. </Dialog>
  159. </div>
  160. </template>
  161. <script setup lang="ts">
  162. import { ref, onMounted } from "vue";
  163. import Echarts from "@/components/Echarts/commonChartsBar.vue";
  164. import EchartsMap from "@/components/Echarts/commonChartsChinaMap.vue";
  165. import ComHead from "./components/comHead.vue";
  166. import { Calendar, CaretBottom } from "@element-plus/icons-vue";
  167. import Dialog from "@/components/dialog/index.vue";
  168. import { usePublic, showTimeMsg } from "./hooks/usePublic";
  169. import { parseTime } from "@/utils/validate";
  170. import * as _ from "lodash";
  171. const {
  172. optionLeft,
  173. airlineAbnormalBaggage,
  174. airCompaneBaggage,
  175. airStutas,
  176. nodeEfficiency,
  177. hourPeak,
  178. getPublicData,
  179. getMapData,
  180. } = usePublic();
  181. const timePickerName = ref<number>(0);
  182. const flag = ref<boolean>(false);
  183. const hourlyPeakObj = ref<any>({});
  184. const waybillTrendObj = ref<any>({});
  185. const nodePeakObj = ref<any>({});
  186. const airlineTrafficObj = ref<any>({});
  187. const flightNums = ref<number>(0);
  188. const stockNums = ref<number>(0);
  189. const mapOptions = ref<any>({
  190. tooltip: {
  191. trigger: "item",
  192. formatter: function (params, ticket, callback) {
  193. if (params.seriesType == "effectScatter") {
  194. return "线路:" + params.data.name + "" + params.data.value[2];
  195. } else if (params.seriesType == "lines") {
  196. return (
  197. params.data.fromName +
  198. ">" +
  199. params.data.toName +
  200. "<br />" +
  201. params.data.value
  202. );
  203. } else {
  204. return params.name;
  205. }
  206. },
  207. },
  208. geo: {
  209. map: "china",
  210. label: {
  211. emphasis: {
  212. show: true,
  213. color: "#fff",
  214. },
  215. },
  216. roam: true,
  217. itemStyle: {
  218. normal: {
  219. areaColor: "#154186",
  220. borderColor: "#255caf",
  221. },
  222. emphasis: {
  223. areaColor: "#255caf",
  224. },
  225. },
  226. },
  227. series: [],
  228. });
  229. const form = ref({
  230. startDate: parseTime(Date.now(), "{y}-{m}-{d}"),
  231. endDate: parseTime(Date.now(), "{y}-{m}-{d}"),
  232. });
  233. const disabledStartDate = (time: Date) => {
  234. const timer: any = form.value.endDate;
  235. const data = new Date(timer);
  236. return time.getTime() > data.getTime();
  237. };
  238. const disabledEndDate = (time: Date) => {
  239. const timer: any = form.value.startDate;
  240. let data = new Date(timer);
  241. return data.getTime() > time.getTime();
  242. };
  243. const resetForm = () => {
  244. flag.value = false;
  245. };
  246. const submitForm = () => {
  247. flag.value = false;
  248. switch (timePickerName.value) {
  249. case showTimeMsg.HourlyPeak:
  250. hourlyPeakFunc();
  251. break;
  252. case showTimeMsg.WaybillTrend:
  253. waybillTrendFunc();
  254. break;
  255. case showTimeMsg.NodePeak:
  256. nodePeakFunc();
  257. break;
  258. case showTimeMsg.AirlineTraffic:
  259. airlineTrafficFunc();
  260. break;
  261. case showTimeMsg.AirlineAbnormal:
  262. airlineAbnormalFunc();
  263. break;
  264. default:
  265. break;
  266. }
  267. };
  268. const showDatePicker = (id?) => {
  269. flag.value = true;
  270. timePickerName.value = id;
  271. };
  272. const sortClass = (sortData) => {
  273. const groupBy = (array, f) => {
  274. let groups = {};
  275. array.forEach((o) => {
  276. let group = JSON.stringify(f(o));
  277. groups[group] = groups[group] || [];
  278. groups[group].push(o);
  279. });
  280. return Object.keys(groups).map((group) => {
  281. return groups[group];
  282. });
  283. };
  284. const sorted = groupBy(sortData, (item) => {
  285. return item.jobName;
  286. });
  287. return sorted;
  288. };
  289. const pubFunc = (listValues, target) => {
  290. const newObj = _.cloneDeep(target);
  291. const [jobTimes, stockNums, weights] = [<any>[], <any>[], <any>[]];
  292. listValues.forEach((item) => {
  293. jobTimes.push(item.jobTime);
  294. stockNums.push(item.stockNum);
  295. weights.push(item.weight);
  296. });
  297. newObj.xAxis.data = jobTimes;
  298. newObj.series[0].data = stockNums;
  299. newObj.series[1].data = weights;
  300. return newObj;
  301. };
  302. //获取小时峰值分布
  303. const hourlyPeakFunc = async () => {
  304. const listValues = (await getPublicData(DATACONTENT_ID.jscHourlyPeakId, [
  305. form.value.startDate,
  306. form.value.endDate,
  307. ])) as any;
  308. hourlyPeakObj.value = pubFunc(listValues, optionLeft);
  309. };
  310. //运单趋势分析
  311. const waybillTrendFunc = async () => {
  312. const listValues = (await getPublicData(DATACONTENT_ID.jscWaybillTrendId, [
  313. form.value.startDate,
  314. form.value.endDate,
  315. ])) as any;
  316. waybillTrendObj.value = pubFunc(listValues, optionLeft);
  317. };
  318. //节点峰值
  319. const nodePeakFunc = async () => {
  320. const listValues = (await getPublicData(DATACONTENT_ID.jscNodePeakId, [
  321. form.value.startDate,
  322. form.value.endDate,
  323. ])) as any;
  324. const newObj = _.cloneDeep(hourPeak.option);
  325. const arr = sortClass(listValues);
  326. const [title, series, singleAxis] = [<any>[], <any>[], <any>[]];
  327. arr.forEach((item, index) => {
  328. const msg: any = [];
  329. const datas: any = [];
  330. item.map((p, i) => {
  331. msg.push(p.stockNum);
  332. datas.push(i + 1);
  333. });
  334. title.push({
  335. top: ((index + 0.5) * 100) / 4 - 3 + "%",
  336. text: item[0].jobName,
  337. textStyle: {
  338. fontSize: 12,
  339. fontWeight: "normal",
  340. color: "#698dc3",
  341. },
  342. });
  343. series.push({
  344. singleAxisIndex: index,
  345. coordinateSystem: "singleAxis",
  346. type: "scatter",
  347. data: msg,
  348. });
  349. singleAxis.push({
  350. type: "category",
  351. data: datas,
  352. top: ((index + 0.5) * 100) / 4 - 3 + "%",
  353. height: 100 / 4 - 5 + "%",
  354. left: "12%",
  355. right: "1%",
  356. axisTick: {
  357. show: false,
  358. },
  359. splitLine: {
  360. show: false,
  361. },
  362. });
  363. });
  364. newObj.series = series;
  365. newObj.singleAxis = singleAxis;
  366. newObj.title = title;
  367. nodePeakObj.value = newObj;
  368. };
  369. //航班数&运单数
  370. const numbersFunc = async () => {
  371. const listValues = (await getPublicData(
  372. DATACONTENT_ID.jscNumbersId,
  373. []
  374. )) as any;
  375. const { flightNum, stockNum } = listValues[0];
  376. flightNums.value = flightNum;
  377. stockNums.value = stockNum;
  378. };
  379. //航司运量
  380. const airlineTrafficFunc = async () => {
  381. const listValues = (await getPublicData(DATACONTENT_ID.jscAirlineTrafficId, [
  382. form.value.startDate,
  383. form.value.endDate,
  384. ])) as any;
  385. listValues.forEach((item) => {
  386. item.jobTime = item["IACACode"];
  387. });
  388. airlineTrafficObj.value = pubFunc(
  389. listValues,
  390. airCompaneBaggage.option.baseOption
  391. );
  392. };
  393. //航班预警报警分析
  394. const airlineAbnormalFunc = async () => {
  395. const listValues = (await getPublicData(DATACONTENT_ID.jscAirlineAbnormalId, [
  396. { flightDate1: form.value.startDate },
  397. { flightDate2: form.value.endDate },
  398. ])) as any;
  399. // console.log(listValues);
  400. };
  401. onMounted(() => {
  402. hourlyPeakFunc();
  403. waybillTrendFunc();
  404. nodePeakFunc();
  405. numbersFunc();
  406. airlineTrafficFunc();
  407. airlineAbnormalFunc();
  408. setTimeout(() => {
  409. var BJData = [
  410. [{ name: "北京" }, { name: "深圳", value: 95 }],
  411. [{ name: "成都" }, { name: "深圳", value: 95 }],
  412. [{ name: "重庆" }, { name: "深圳", value: 95 }],
  413. [{ name: "西安" }, { name: "深圳", value: 95 }],
  414. [{ name: "太原" }, { name: "深圳", value: 95 }],
  415. ];
  416. var GZData = [
  417. [{ name: "深圳" }, { name: "福州", value: 95 }],
  418. [{ name: "深圳" }, { name: "太原", value: 90 }],
  419. [{ name: "深圳" }, { name: "长春", value: 80 }],
  420. [{ name: "深圳" }, { name: "重庆", value: 70 }],
  421. [{ name: "深圳" }, { name: "西安", value: 60 }],
  422. [{ name: "深圳" }, { name: "成都", value: 50 }],
  423. [{ name: "深圳" }, { name: "常州", value: 40 }],
  424. [{ name: "深圳" }, { name: "北京", value: 30 }],
  425. [{ name: "深圳" }, { name: "北海", value: 20 }],
  426. [{ name: "深圳" }, { name: "海口", value: 10 }],
  427. ];
  428. mapOptions.value.series = getMapData([
  429. ["北京", BJData],
  430. ["深圳", GZData],
  431. ]);
  432. }, 0);
  433. });
  434. </script>
  435. <style lang="scss" scoped>
  436. @import "./css/index.scss";
  437. </style>