indexOut.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  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>
  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 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()">
  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. } = usePublic();
  180. const timePickerName = ref<number>(0);
  181. const flag = ref<boolean>(false);
  182. const hourlyPeakObj = ref<any>({});
  183. const waybillTrendObj = ref<any>({});
  184. const nodePeakObj = ref<any>({});
  185. const airlineTrafficObj = ref<any>({});
  186. const flightNums = ref<number>(0);
  187. const stockNums = ref<number>(0);
  188. const form = ref({
  189. startDate: parseTime(Date.now(), "{y}-{m}-{d}"),
  190. endDate: parseTime(Date.now(), "{y}-{m}-{d}"),
  191. });
  192. const disabledStartDate = (time: Date) => {
  193. const timer: any = form.value.endDate;
  194. const data = new Date(timer);
  195. return time.getTime() > data.getTime();
  196. };
  197. const disabledEndDate = (time: Date) => {
  198. const timer: any = form.value.startDate;
  199. let data = new Date(timer);
  200. return data.getTime() > time.getTime();
  201. };
  202. const resetForm = () => {
  203. flag.value = false;
  204. };
  205. const submitForm = () => {
  206. flag.value = false;
  207. switch (timePickerName.value) {
  208. case showTimeMsg.HourlyPeak:
  209. hourlyPeakFunc();
  210. break;
  211. case showTimeMsg.WaybillTrend:
  212. waybillTrendFunc();
  213. break;
  214. case showTimeMsg.NodePeak:
  215. nodePeakFunc();
  216. break;
  217. case showTimeMsg.AirlineTraffic:
  218. airlineTrafficFunc();
  219. break;
  220. default:
  221. break;
  222. }
  223. };
  224. const showDatePicker = (id?) => {
  225. flag.value = true;
  226. timePickerName.value = id;
  227. };
  228. const sortClass = (sortData) => {
  229. const groupBy = (array, f) => {
  230. let groups = {};
  231. array.forEach((o) => {
  232. let group = JSON.stringify(f(o));
  233. groups[group] = groups[group] || [];
  234. groups[group].push(o);
  235. });
  236. return Object.keys(groups).map((group) => {
  237. return groups[group];
  238. });
  239. };
  240. const sorted = groupBy(sortData, (item) => {
  241. return item.jobName;
  242. });
  243. return sorted;
  244. };
  245. const pubFunc = (listValues, target) => {
  246. const newObj = _.cloneDeep(target);
  247. const [jobTimes, stockNums, weights] = [<any>[], <any>[], <any>[]];
  248. listValues.forEach((item) => {
  249. jobTimes.push(item.jobTime);
  250. stockNums.push(item.stockNum);
  251. weights.push(item.weight);
  252. });
  253. newObj.xAxis.data = jobTimes;
  254. newObj.series[0].data = stockNums;
  255. newObj.series[1].data = weights;
  256. return newObj;
  257. };
  258. //获取小时峰值分布
  259. const hourlyPeakFunc = async () => {
  260. const listValues = (await getPublicData(DATACONTENT_ID.jscGjHourlyPeakId, [
  261. form.value.startDate,
  262. form.value.endDate,
  263. ])) as any;
  264. hourlyPeakObj.value = pubFunc(listValues, optionLeft);
  265. };
  266. //运单趋势分析
  267. const waybillTrendFunc = async () => {
  268. const listValues = (await getPublicData(DATACONTENT_ID.jscGjWaybillTrendId, [
  269. form.value.startDate,
  270. form.value.endDate,
  271. ])) as any;
  272. waybillTrendObj.value = pubFunc(listValues, optionLeft);
  273. };
  274. //节点峰值
  275. const nodePeakFunc = async () => {
  276. const listValues = (await getPublicData(DATACONTENT_ID.jscGjNodePeakId, [
  277. form.value.startDate,
  278. form.value.endDate,
  279. ])) as any;
  280. const newObj = _.cloneDeep(hourPeak.option);
  281. const arr = sortClass(listValues);
  282. const [title, series, singleAxis] = [<any>[], <any>[], <any>[]];
  283. arr.forEach((item, index) => {
  284. const msg: any = [];
  285. const datas: any = [];
  286. item.map((p, i) => {
  287. msg.push(p.stockNum);
  288. datas.push(i + 1);
  289. });
  290. title.push({
  291. top: ((index + 0.5) * 100) / 4 - 3 + "%",
  292. text: item[0].jobName,
  293. textStyle: {
  294. fontSize: 12,
  295. fontWeight: "normal",
  296. color: "#698dc3",
  297. },
  298. });
  299. series.push({
  300. singleAxisIndex: index,
  301. coordinateSystem: "singleAxis",
  302. type: "scatter",
  303. data: msg,
  304. });
  305. singleAxis.push({
  306. type: "category",
  307. data: datas,
  308. top: ((index + 0.5) * 100) / 4 - 3 + "%",
  309. height: 100 / 4 - 5 + "%",
  310. left: "12%",
  311. right: "1%",
  312. axisTick: {
  313. show: false,
  314. },
  315. splitLine: {
  316. show: false,
  317. },
  318. });
  319. });
  320. newObj.series = series;
  321. newObj.singleAxis = singleAxis;
  322. newObj.title = title;
  323. nodePeakObj.value = newObj;
  324. };
  325. //航班数&运单数
  326. const numbersFunc = async () => {
  327. const listValues = (await getPublicData(
  328. DATACONTENT_ID.jscGjNumbersId,
  329. []
  330. )) as any;
  331. const { flightNum, stockNum } = listValues[0];
  332. flightNums.value = flightNum;
  333. stockNums.value = stockNum;
  334. };
  335. //航司运量
  336. const airlineTrafficFunc = async () => {
  337. const listValues = (await getPublicData(
  338. DATACONTENT_ID.jscGjAirlineTrafficId,
  339. [form.value.startDate, form.value.endDate]
  340. )) as any;
  341. listValues.forEach((item) => {
  342. item.jobTime = item["IACACode"];
  343. });
  344. airlineTrafficObj.value = pubFunc(
  345. listValues,
  346. airCompaneBaggage.option.baseOption
  347. );
  348. };
  349. onMounted(() => {
  350. hourlyPeakFunc();
  351. waybillTrendFunc();
  352. nodePeakFunc();
  353. numbersFunc();
  354. airlineTrafficFunc();
  355. });
  356. </script>
  357. <style lang="scss" scoped>
  358. @import "./css/index.scss";
  359. </style>