index.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939
  1. <!--
  2. * @Author: zk
  3. * @Date: 2022-01-17 10:39:22
  4. * @LastEditTime: 2022-06-28 10:04:17
  5. * @LastEditors: your name
  6. * @Description: 中转进港
  7. -->
  8. <template>
  9. <div class="transfer-in">
  10. <!--功能区-表单-->
  11. <div ref="formWrap" class="terminal-form-wrap">
  12. <el-form ref="form" :inline="true" :model="formData" :rules="rules" class="form">
  13. <div class="form-left">
  14. <el-form-item prop="currentAirport">
  15. <!-- <el-cascader
  16. v-model="formData.currentAirport"
  17. style="width:144px;margin-left:10px"
  18. placeholder="全部机场"
  19. size="small"
  20. :options="currentAirportList"
  21. :props="currentAirportProps"
  22. collapse-tags
  23. clearable
  24. filterable
  25. @change="setCurrentAirport"
  26. /> -->
  27. <el-select v-model="formData.currentAirport" class="input-shadow" size="small" style="width: 100px" filterable default-first-option placeholder="请选择机场" @change="airPortChange">
  28. <el-option v-for="(item, index) in AirportList" :key="index" :label="item.planDepartureApt" :value="item.planDepartureApt" />
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item prop="inboundCarrier">
  32. <el-cascader v-model="formData.inboundCarrier" class="input-shadow" style="width: 150px" size="small" :options="carrierProps" :props="optionProps" placeholder="进港承运航司" collapse-tags clearable filterable default-first-option @change="resetLoopEvent" />
  33. </el-form-item>
  34. <el-form-item prop="outgoingAirline">
  35. <el-cascader v-model="formData.outgoingAirline" class="input-shadow" style="width: 150px" size="small" :options="carrierPropsop" :props="optionPropser" placeholder="离港承运航司" collapse-tags clearable filterable default-first-option @change="resetLoopEvent" />
  36. </el-form-item>
  37. <!-- <el-form-item prop="startDate">
  38. <el-date-picker
  39. v-model="formData.startDate"
  40. class="input-shadow"
  41. style="width: 216px"
  42. size="small"
  43. type="date"
  44. value-format="yyyy-MM-dd"
  45. placeholder="开始时间"
  46. @change="startDateChangeHandler"
  47. />
  48. </el-form-item>
  49. <el-form-item prop="endDate">
  50. <el-date-picker
  51. v-model="formData.endDate"
  52. class="input-shadow"
  53. style="width: 216px"
  54. size="small"
  55. type="date"
  56. value-format="yyyy-MM-dd"
  57. placeholder="结束时间"
  58. @change="endDateChangeHandler"
  59. />
  60. </el-form-item> -->
  61. <el-form-item prop="flightDate" label="航班日期">
  62. <el-date-picker v-model="formData.flightDate" :clearable="false" size="small" style="width: 300px" type="daterange" value-format="yyyy-MM-dd" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="dateRangePickerOptions" @change="dateChangeHandler" />
  63. </el-form-item>
  64. <el-form-item>
  65. <div class="box-item">
  66. <p>预计中转数:</p>
  67. <li v-for="(item, index) in orderNum" :key="index" :class="{ 'number-item': !isNaN(item), 'mark-item': isNaN(item) }">
  68. <span v-if="!isNaN(item)">
  69. <i ref="numberItem">0123456789</i>
  70. </span>
  71. <span v-else class="comma">{{ item }}</span>
  72. </li>
  73. </div>
  74. </el-form-item>
  75. </div>
  76. <div class="form-right" @keyup.enter="onSubmit(1)">
  77. <el-form-item prop="search">
  78. <el-popover :value="popoverVisible" placement="bottom" trigger="manual">
  79. <span>请输入航班号(示例:CA1234)或行李牌号(示例:1234567890)</span>
  80. <el-input slot="reference" v-model="formData.search" class="input-shadow" style="width: 240px" size="small" placeholder="请输入内容" prefix-icon="el-icon-search" clearable @focus="popoverVisible = true" @blur="popoverVisible = false" />
  81. </el-popover>
  82. </el-form-item>
  83. <el-form-item>
  84. <el-button class="btn-shadow" size="mini" type="primary" @click="onSubmit(1)">搜索</el-button>
  85. </el-form-item>
  86. <el-form-item>
  87. <el-button class="btn-shadow" size="mini" type="primary" @click="changeView">切换视角</el-button>
  88. </el-form-item>
  89. <!-- <el-form-item v-is="['ti_timeIcon']">
  90. <TimeZoneSelector />
  91. </el-form-item> -->
  92. <el-form-item>
  93. <TimeZoneSelector />
  94. </el-form-item>
  95. <!-- <el-form-item v-is="['ti_columnSettings']">
  96. <img class="btn-img btn-shadow" src="@/assets/baggage/ic_setting.png" title="列设置" @click="show" />
  97. </el-form-item> -->
  98. <el-form-item>
  99. <img class="btn-img btn-shadow" src="@/assets/baggage/ic_setting.png" title="列设置" @click="show" />
  100. </el-form-item>
  101. <!-- <el-form-item v-is="['dm_dt_columnSettings']">
  102. <img class="btn-img btn-shadow" src="@/assets/baggage/ic_export.png" title="导出" @click="exportHandler('table', '航站中转进港列表')" />
  103. </el-form-item> -->
  104. <el-form-item>
  105. <img class="btn-img btn-shadow" src="@/assets/baggage/ic_export.png" title="导出" @click="exportHandler('table', '航站中转进港列表')" />
  106. </el-form-item>
  107. </div>
  108. </el-form>
  109. </div>
  110. <!--表格-->
  111. <div v-loading="loading" class="terminal-table" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)">
  112. <el-table ref="table" class="table" :data="dealedTableData" :height="computedTableHeight" show-summary :summary-method="summaryMethod" :span-method="arraySpanMethod" :header-cell-class-name="headerCellClass" :row-class-name="tableRowClassName" :cell-class-name="cellClass" border stripe fit @cell-click="cellClickHandler">
  113. <el-table-column v-for="col in tableColsCopy" :key="col.prop" :prop="col.prop" :label="col.label" :width="col.width" :fixed="col.fixed">
  114. <el-table-column v-for="childCol in col.children" :key="childCol.prop" :prop="childCol.prop" :label="childCol.label" :width="childCol.width" :formatter="tableFormat">
  115. <template #header>
  116. <el-tooltip :content="childCol.desc || childCol.label" placement="top">
  117. <TableHeaderCell :label="childCol.label" :filter-options="tableDataFilters[childCol.prop]" :filter-values.sync="filterValues[childCol.prop]" :sortable="childCol.sortable" :sort-rule.sync="tableDataSortRules[childCol.prop]" />
  118. </el-tooltip>
  119. </template>
  120. </el-table-column>
  121. </el-table-column>
  122. </el-table>
  123. </div>
  124. <!--列设置-->
  125. <Dialog :flag="dialogFlag" class="dialog-check-group">
  126. <div class="dialog-wrapper">
  127. <div class="title">列设置</div>
  128. <div class="content">
  129. <el-tree ref="columnSetTree" :data="tableCols" :class="colsCheckClass" show-checkbox node-key="index" :default-expand-all="true" :props="{
  130. label: 'label',
  131. children: 'children',
  132. }" :default-checked-keys="checkedKeysTemp" @check="handleCheck" />
  133. </div>
  134. <div class="foot right t30">
  135. <el-button size="medium" class="r24" type="primary" @click="onCheck">确定</el-button>
  136. <el-button size="medium" @click="hide">取消</el-button>
  137. </div>
  138. </div>
  139. </Dialog>
  140. </div>
  141. </template>
  142. <script>
  143. import Dialog from "@/layout/components/Dialog";
  144. import TimeZoneSelector from "@/components/TimeZoneSelector";
  145. import terminalMixin from "../../mixins/terminal";
  146. import formMixin from "../../mixins/form";
  147. import tableColsMixin from "../../mixins/tableCols";
  148. import timeZoneMixin from "../../mixins/timeZone";
  149. import { getQuery } from "@/api/flight";
  150. import TableHeaderCell from "@/components/TableHeaderCell";
  151. import { setTableFilters, exportToExcel, timeInZone } from "@/utils/table";
  152. import { GeneralDataReception } from "@/api/dataIntegration";
  153. import { parseTime } from "@/utils/index";
  154. import { mapGetters } from "vuex";
  155. import { getToken } from '@/utils/auth';
  156. export default {
  157. name: "DepartureTerminalView",
  158. components: { Dialog, TimeZoneSelector, TableHeaderCell },
  159. mixins: [terminalMixin, formMixin, tableColsMixin, timeZoneMixin],
  160. data () {
  161. return {
  162. optionProps: {
  163. value: "inAicompanyCode2",
  164. label: "inAicompanyCode2",
  165. },
  166. optionPropser: {
  167. value: "outAicompanyCode2",
  168. label: "outAicompanyCode2",
  169. },
  170. popoverVisible: false,
  171. orderNum: ["0", "0", "0", "0", "0", "0"], // 默认总数
  172. // 初始表头
  173. tableCols: [
  174. {
  175. prop: "arrivalInfo",
  176. label: "进港航班",
  177. width: 180,
  178. fixed: "left",
  179. children: [
  180. {
  181. prop: "preFlightNO",
  182. label: "航班号",
  183. desc: "进港航班编号",
  184. width: 80,
  185. filterable: true,
  186. sortable: true,
  187. },
  188. {
  189. prop: "preFlightDate",
  190. label: "航班日期",
  191. desc: "指航班计划起飞日期(不变的,机票上),不是预计起飞日期(预计起飞时间可能多个),也不是实际起飞日期(实际起飞等于最后预计)",
  192. width: 100,
  193. },
  194. {
  195. prop: "preAirport",
  196. label: "起飞航站",
  197. desc: "指进港航班的起飞机场三字码",
  198. width: 100,
  199. filterable: true,
  200. sortable: true,
  201. },
  202. {
  203. prop: "actualLandingTime",
  204. label: "降落时间",
  205. desc: "根据优先级别显示时间。优先级别:1.实际降落时间,2.预计降落时间,3.计划降落时间",
  206. width: 100,
  207. },
  208. {
  209. prop: "landingBuild",
  210. label: "降落航站楼",
  211. desc: "指航班降落后位于机场的哪个航站楼",
  212. width: 98,
  213. filterable: true,
  214. sortable: true,
  215. },
  216. {
  217. prop: "carousel",
  218. label: "行李转盘",
  219. desc: "指航班到达后行李提取的地方,仅显示最新信息",
  220. width: 100,
  221. filterable: true,
  222. sortable: true,
  223. },
  224. {
  225. prop: "standForLanding",
  226. label: "降落停机位",
  227. desc: "指航班的停机位代码,数据是变化的,仅显示最新信息",
  228. width: 98,
  229. filterable: true,
  230. sortable: true,
  231. },
  232. {
  233. prop: "inTransferBaggageCount",
  234. label: "中转行李数",
  235. desc: "指航班在本航站预计需要中转至对应航班的行李数量",
  236. },
  237. ],
  238. },
  239. {
  240. prop: "departureInfo",
  241. label: "离港航班",
  242. children: [
  243. {
  244. prop: "inTransferredBaggageCount",
  245. label: "已中转行李数",
  246. desc: "指航班在本航站实际已经中转至对应航班的行李数量",
  247. width: 100,
  248. },
  249. {
  250. prop: "flightNO",
  251. label: "航班号",
  252. desc: "指航班编号",
  253. width: 80,
  254. filterable: true,
  255. sortable: true,
  256. },
  257. {
  258. prop: "flightDate",
  259. label: "航班日期",
  260. desc: "指航班计划起飞日期(不变的,机票上),不是预计起飞日期(预计起飞时间可能多个),也不是实际起飞日期(实际起飞等于最后预计)",
  261. width: 100,
  262. },
  263. {
  264. prop: "actualDepartureTime",
  265. label: "起飞时间",
  266. desc: "指航班预计起飞时间,数据是变化的,仅显示最新结果",
  267. width: 100,
  268. },
  269. {
  270. prop: "targetAirport",
  271. label: "目的站",
  272. desc: "指航班执飞航段的目的航站,以航站三字码+航站简称显示",
  273. filterable: true,
  274. sortable: true,
  275. },
  276. {
  277. prop: "departureBuild",
  278. label: "起飞航站楼",
  279. desc: "指航班执飞航段的起飞航站的航站楼",
  280. width: 98,
  281. filterable: true,
  282. sortable: true,
  283. },
  284. {
  285. prop: "bordingGate",
  286. label: "起飞登机口",
  287. desc: "指航班的登机口代码,数据是变化的,仅显示最新信息",
  288. width: 98,
  289. filterable: true,
  290. sortable: true,
  291. },
  292. {
  293. prop: "standForDepartrue",
  294. label: "起飞停机位",
  295. desc: "指航班的停机位代码,数据是变化的,仅显示最新信息",
  296. width: 98,
  297. filterable: true,
  298. sortable: true,
  299. },
  300. // {
  301. // prop: 'outTransferBaggageCount',
  302. // label: '中转进行李数',
  303. // desc: '指其它航班预计中转至本航班的行李数量',
  304. // width: 100
  305. // },
  306. // {
  307. // prop: 'outTransferredBaggageCount',
  308. // label: '已中转进行李数',
  309. // desc: '指其它航班实际已中转至本航班的行李数量',
  310. // width: 120
  311. // },
  312. {
  313. prop: "timeDifference",
  314. label: "转运时间",
  315. desc: "指中转动作完成时间",
  316. },
  317. ],
  318. },
  319. ],
  320. loading: false,
  321. AirportList: [],
  322. carrierProps: [],
  323. carrierPropsop: [],
  324. loopEvent: null,
  325. arrivalCount: 0,
  326. baggageCount: 0,
  327. hasSetTableScroll: false,
  328. spanArr: [],
  329. contactDot: 0,
  330. flag: 0,
  331. table: null,
  332. WarningData: [],
  333. };
  334. },
  335. computed: {
  336. singleDay () {
  337. return this.startDate === this.endDate;
  338. },
  339. ...mapGetters(["timeZone"]),
  340. },
  341. watch: {
  342. dealedTableData: {
  343. handler (val) {
  344. this.spanArr = [];
  345. let contactDot = this.contactDot;
  346. val.forEach((item, index, arr) => {
  347. if (index === 0) {
  348. this.spanArr.push(1);
  349. } else {
  350. if (item["preFlightNO"] === arr[index - 1]["preFlightNO"] && item["preFlightDate"] === arr[index - 1]["preFlightDate"]) {
  351. this.spanArr[contactDot] += 1;
  352. this.spanArr.push(0);
  353. } else {
  354. this.spanArr.push(1);
  355. contactDot = index;
  356. }
  357. }
  358. });
  359. },
  360. deep: true,
  361. },
  362. },
  363. created () {
  364. // this.getAirPortData()
  365. },
  366. mounted () {
  367. this.$refs["form"].validateField("flightDate");
  368. this.getAirPortData();
  369. this.table = this.$refs.table.bodyWrapper;
  370. const that = this;
  371. this.table.addEventListener("scroll", () => {
  372. that.scrollTop = this.table.scrollTop;
  373. });
  374. },
  375. activated () {
  376. this.table.scrollTop = this.scrollTop;
  377. this.getTableData();
  378. this.getWarningData();
  379. this.loopEvent = setInterval(this.getTableData, LOOP_INTERVAL.transferArrivalTable);
  380. // const { startDate, endDate } = this.$route.query
  381. // Object.entries(this.$route.query).forEach(([key, value]) => {
  382. // if ((value ?? '') !== '' && JSON.stringify(value) !== '[]') {
  383. // this.formData[key] = value
  384. // }
  385. // })
  386. // if (startDate !== null && startDate !== undefined) {
  387. // this.formData.flightDate[0] = startDate
  388. // }
  389. // if (endDate !== null && endDate !== undefined) {
  390. // this.formData.flightDate[1] = endDate
  391. // }
  392. },
  393. deactivated () {
  394. if (this.loopEvent) {
  395. clearInterval(this.loopEvent);
  396. this.loopEvent = null;
  397. }
  398. },
  399. beforeDestroy () {
  400. if (this.loopEvent) {
  401. clearInterval(this.loopEvent);
  402. this.loopEvent = null;
  403. }
  404. },
  405. methods: {
  406. async getWarningData () {
  407. try {
  408. const res = await getQuery({
  409. serviceId: DATACONTENT_ID.departureWarningId,
  410. dataContent: {},
  411. event: '0',
  412. token: getToken()
  413. });
  414. if (Number(res.code) === 0) {
  415. const { returnData } = res;
  416. this.WarningData = returnData;
  417. } else {
  418. this.$message.error(res.message);
  419. }
  420. } catch (error) {
  421. this.$message.error("失败");
  422. }
  423. },
  424. resetLoopEvent () {
  425. this.loading = true;
  426. this.hasSetTableScroll = false;
  427. this.loopEvent && clearInterval(this.loopEvent);
  428. this.getTableData();
  429. this.loopEvent = setInterval(this.getTableData, LOOP_INTERVAL.transferArrivalTable);
  430. },
  431. headerCellClass ({ row, column }) {
  432. const classes = [];
  433. const rule = this.tableDataSortRules[column.property];
  434. if (rule) {
  435. classes.push(rule);
  436. }
  437. return classes.join(" ");
  438. },
  439. tableRowClassName ({ row, rowIndex }) {
  440. const classes = [];
  441. if (row.hasArrived) {
  442. classes.push("bgl-hui");
  443. if (rowIndex === this.arrivalCount - 1) {
  444. classes.push("redBorder");
  445. }
  446. }
  447. return classes.join(" ");
  448. },
  449. changeView () {
  450. // const query = {
  451. // ...this.formData,
  452. // startDate: this.startDate,
  453. // endDate: this.endDate
  454. // }
  455. // delete query.flightDate
  456. // this.$router.replace({
  457. // path: '/transfer/departure',
  458. // query
  459. // })
  460. this.$router.push("/transfer/departure");
  461. },
  462. airPortChange () {
  463. this.getAviationData();
  464. this.upAviationData();
  465. this.resetLoopEvent();
  466. },
  467. dateChangeHandler () {
  468. this.getAviationData();
  469. this.upAviationData();
  470. this.resetLoopEvent();
  471. },
  472. // 选择机场
  473. async getAirPortData () {
  474. try {
  475. const res = await getQuery({
  476. serviceId: DATACONTENT_ID.departureAirId,
  477. dataContent: {},
  478. event: '0',
  479. token: getToken()
  480. });
  481. if (Number(res.code) === 0) {
  482. this.AirportList = res.returnData;
  483. this.formData.currentAirport = "PEK";
  484. this.getAviationData();
  485. this.upAviationData();
  486. this.resetLoopEvent();
  487. } else {
  488. this.$message.error(res.message);
  489. }
  490. } catch (error) {
  491. this.$message.error("失败");
  492. }
  493. },
  494. // 选择航司
  495. async getAviationData () {
  496. try {
  497. const res = await getQuery({
  498. serviceId: DATACONTENT_ID.departureAviJoinId,
  499. dataContent: { departureAirport: this.formData.currentAirport },
  500. event: '0',
  501. token: getToken()
  502. });
  503. if (Number(res.code) === 0) {
  504. this.carrierProps = res.returnData;
  505. } else {
  506. this.$message.error(res.message);
  507. }
  508. } catch (error) {
  509. this.$message.error("失败");
  510. }
  511. },
  512. // 选择航司
  513. async upAviationData () {
  514. try {
  515. const res = await getQuery({
  516. serviceId: DATACONTENT_ID.departureAviLeaveId,
  517. dataContent: { departureAirport: this.formData.currentAirport },
  518. event: '0',
  519. token: getToken()
  520. });
  521. if (Number(res.code) === 0) {
  522. this.carrierPropsop = res.returnData;
  523. } else {
  524. this.$message.error(res.message);
  525. }
  526. } catch (error) {
  527. this.$message.error("失败");
  528. }
  529. },
  530. // 获取表单下拉框数据
  531. // getFormData(params) {
  532. // this.relatedAirportQuery({
  533. // ...params,
  534. // type: 'OUT'
  535. // })
  536. // this.outgoingAirlineQuery(params)
  537. // this.craftTypeQuery(params)
  538. // this.flightAttrQuery(params)
  539. // },
  540. // 获取表格数据
  541. async getTableData () {
  542. if (!this.formData.currentAirport || !this.startDate || !this.endDate) {
  543. return;
  544. }
  545. try {
  546. const res = await getQuery({
  547. serviceId: DATACONTENT_ID.departureTableId,
  548. dataContent: {
  549. departureAirport: this.formData.currentAirport,
  550. startTime: this.startDate,
  551. endTime: this.endDate
  552. },
  553. event: '0',
  554. token: getToken()
  555. });
  556. if (Number(res.code) === 0) {
  557. this.initTableData(res.returnData);
  558. } else {
  559. }
  560. this.loading = false;
  561. } catch (error) {
  562. if (this.loopEvent) {
  563. clearInterval(this.loopEvent);
  564. this.loopEvent = null;
  565. }
  566. this.loading = false;
  567. }
  568. },
  569. initTableData (tableData) {
  570. const currentTime = new Date();
  571. const curTime = this.formatTime(currentTime);
  572. this.arrivalCount = 0;
  573. this.baggageCount = 0;
  574. tableData.forEach((item) => {
  575. const o1 = item["inTransferBaggageCount"];
  576. const o2 = item["inTransferredBaggageCount"];
  577. const out1 = o1 != undefined || o1 != null ? o1 : 0;
  578. const out2 = o2 != undefined || o2 != null ? o2 : 0;
  579. if (this.hasArrived(item)) {
  580. this.arrivalCount++;
  581. }
  582. if (item["hasArrived"] && out1 - out2 > 0) {
  583. this.WarningData.forEach((p) => {
  584. const startTime = this.formatTime(timeInZone((p.startDate ?? "").replace("T", " "), this.timeZone), 2);
  585. const endTime = this.formatTime(timeInZone((p.endDate ?? "").replace("T", " "), this.timeZone), 2);
  586. const planTime = this.formatTime(timeInZone((item.actualDepartureTime ?? "").replace("T", " "), this.timeZone), 2);
  587. const capTime = Math.ceil((planTime - curTime) / (1000 * 60));
  588. if (Number(startTime) - Number(curTime) < 0 && Number(endTime) - Number(curTime) > 0) {
  589. const newItem = _.cloneDeep(item);
  590. if (p.flightNO != "" && p.flightNO == item.flightNO) {
  591. if (p.warningDuration && capTime - p.warningDuration < 0 && capTime - p.alarmDuration > 0) {
  592. item["warningState"] = 1;
  593. const returnedTarget = Object.assign(newItem, p);
  594. this.sendLog(returnedTarget);
  595. }
  596. if (p.alarmDuration && capTime - p.alarmDuration < 0) {
  597. item["warningState"] = 2;
  598. const returnedTarget = Object.assign(newItem, p);
  599. this.sendLog(returnedTarget);
  600. }
  601. } else if (p.flightNO == "" && p.IATACode != "") {
  602. if (item.flightNO.substring(0, 2) == p.IATACode) {
  603. if (p.warningDuration && capTime - p.warningDuration < 0 && capTime - p.alarmDuration > 0) {
  604. item["warningState"] = 1;
  605. const returnedTarget = Object.assign(newItem, p);
  606. this.sendLog(returnedTarget);
  607. }
  608. if (p.alarmDuration && capTime - p.alarmDuration < 0) {
  609. item["warningState"] = 2;
  610. const returnedTarget = Object.assign(newItem, p);
  611. this.sendLog(returnedTarget);
  612. }
  613. }
  614. }
  615. }
  616. });
  617. }
  618. this.baggageCount = this.baggageCount + item.inTransferBaggageCount;
  619. });
  620. this.tableData = this._.sortBy(tableData, ["actualLandingTime", "preFlightNO", "actualDepartureTime", "flightNO"]);
  621. setTableFilters(this.tableData, this.tableDataFilters);
  622. this.toOrderNum(this.baggageCount);
  623. this.$nextTick(() => {
  624. this.setTableScroll();
  625. });
  626. },
  627. formatTime (date, type = 1) {
  628. let time = null;
  629. if (type == 1) {
  630. time = parseTime(date, "{y}-{m}-{d} {h}:{i}:{s}");
  631. } else {
  632. time = date;
  633. }
  634. const newTimt = new Date(time);
  635. return newTimt.getTime();
  636. },
  637. async sendLog (obj) {
  638. try {
  639. const newObj = {
  640. logTime: parseTime(new Date(), "{y}-{m}-{d} {h}:{i}:{s}"),
  641. logInfo: JSON.stringify(obj),
  642. flightNO: obj.flightNO,
  643. flightDate: obj.flightDate,
  644. luggageSN: "",
  645. strategyUseID: obj.alarmStrategyID,
  646. event: 1,
  647. };
  648. await GeneralDataReception({
  649. serviceId: SERVICE_ID.departureScId,
  650. dataContent: JSON.stringify(newObj),
  651. });
  652. } catch (error) {
  653. this.$message.error("失败");
  654. }
  655. },
  656. hasArrived (flight) {
  657. if (flight.actualLandingTime) {
  658. const now = new Date();
  659. const actualLandingTime = new Date(flight.actualLandingTime.replace("T", " "));
  660. flight["hasArrived"] = now > actualLandingTime && !flight["flightCanceled"];
  661. } else {
  662. flight["hasArrived"] = false;
  663. }
  664. return flight["hasArrived"];
  665. },
  666. setTableScroll () {
  667. if (!this.singleDay || this.hasSetTableScroll || this.arrivalCount === 0) {
  668. return;
  669. }
  670. const table = this.$refs["table"].$el;
  671. const scrollParent = table.querySelector(".el-table__body-wrapper");
  672. if (scrollParent.scrollHeight <= scrollParent.offsetHeight) {
  673. return;
  674. }
  675. const lastRow = table.querySelectorAll(".el-table__body tr")[this.arrivalCount - 1];
  676. setTimeout(() => {
  677. const scrollMid = lastRow.offsetTop + lastRow.offsetHeight - scrollParent.offsetHeight / 2;
  678. const scrollMax = scrollParent.scrollHeight - scrollParent.offsetHeight;
  679. if (scrollMid > 0) {
  680. const scrollHeight = Math.min(scrollMid, scrollMax);
  681. scrollParent.scrollTo(0, scrollHeight);
  682. }
  683. }, 0);
  684. this.hasSetTableScroll = true;
  685. },
  686. setNumberTransform () {
  687. const numberItems = this.$refs.numberItem; // 拿到数字的ref,计算元素数量
  688. const numberArr = this.orderNum.filter((item) => !isNaN(item));
  689. // 结合CSS 对数字字符进行滚动,显示订单数量
  690. for (let index = 0; index < numberItems.length; index++) {
  691. const elem = numberItems[index];
  692. elem.style.transform = `translate(-50%, -${numberArr[index] * 10}%)`;
  693. }
  694. },
  695. toOrderNum (num) {
  696. num = num.toString();
  697. if (num.length < 6) {
  698. num = "0" + num; // 如未满八位数,添加"0"补位
  699. this.toOrderNum(num); // 递归添加"0"补位
  700. } else if (num.length >= 6) {
  701. this.orderNum = num.split(""); // 将其便变成数据,渲染至滚动数组
  702. } else {
  703. // 订单总量数字超过八位显示异常
  704. this.$message.warning("总量数字过大");
  705. }
  706. this.setNumberTransform();
  707. },
  708. arraySpanMethod ({ row, column, rowIndex, columnIndex }) {
  709. for (let i = 0; i < 7; i++) {
  710. if (columnIndex === i) {
  711. const _row = this.spanArr[rowIndex];
  712. const _col = _row > 0 ? 1 : 0;
  713. return {
  714. rowspan: _row,
  715. colspan: _col,
  716. };
  717. }
  718. }
  719. },
  720. exportHandler (refName, tableName) {
  721. if (this.loading) {
  722. return;
  723. }
  724. const table = this.$refs[refName].$el.cloneNode(true);
  725. const fileName = `${tableName}-${this.currentAirport}-${this.startDate}-${this.endDate}.xlsx`;
  726. exportToExcel(table, tableName, fileName, 2);
  727. },
  728. },
  729. };
  730. </script>
  731. <style lang="scss" scoped>
  732. .terminal-form-wrap {
  733. padding-top: 11px;
  734. padding-left: 5px;
  735. ::v-deep .form {
  736. display: flex;
  737. justify-content: space-between;
  738. .form-left {
  739. flex: 1;
  740. }
  741. .form-right {
  742. flex: 0 1 auto;
  743. }
  744. .el-form-item {
  745. margin-bottom: 0px;
  746. margin-right: 8px;
  747. button,
  748. input,
  749. optgroup,
  750. select,
  751. textarea {
  752. font-family: Helvetica, "Microsoft YaHei";
  753. font-size: 14px;
  754. }
  755. .el-switch__label {
  756. color: #303133;
  757. }
  758. .el-form-item__error {
  759. z-index: 10;
  760. }
  761. }
  762. .btn-img {
  763. position: relative;
  764. top: 6px;
  765. }
  766. }
  767. .box-item {
  768. position: relative;
  769. height: 50px;
  770. font-size: 18px;
  771. line-height: 32px;
  772. text-align: center;
  773. list-style: none;
  774. color: #2f3480;
  775. writing-mode: vertical-lr;
  776. text-orientation: upright;
  777. /*文字禁止编辑*/
  778. -moz-user-select: none; /*火狐*/
  779. -webkit-user-select: none; /*webkit浏览器*/
  780. -ms-user-select: none; /*IE10*/
  781. -khtml-user-select: none; /*早期浏览器*/
  782. user-select: none;
  783. /* overflow: hidden; */
  784. p {
  785. line-height: 32px;
  786. writing-mode: horizontal-tb !important;
  787. text-orientation: none !important;
  788. /*文字禁止编辑*/
  789. -moz-user-select: none; /*火狐*/
  790. -webkit-user-select: none; /*webkit浏览器*/
  791. -ms-user-select: none; /*IE10*/
  792. -khtml-user-select: none; /*早期浏览器*/
  793. user-select: none;
  794. margin-top: 5px;
  795. }
  796. }
  797. /* 默认逗号设置 */
  798. .mark-item {
  799. width: 10px;
  800. height: 32px;
  801. margin-right: 5px;
  802. line-height: 10px;
  803. font-size: 18px;
  804. position: relative;
  805. & > span {
  806. position: absolute;
  807. width: 100%;
  808. bottom: 0;
  809. writing-mode: vertical-rl;
  810. text-orientation: upright;
  811. }
  812. }
  813. /*滚动数字设置*/
  814. .number-item {
  815. width: 41px;
  816. height: 42px;
  817. /* 背景图片 */
  818. // background: url(/images/text-bg-blue.png) no-repeat center center;
  819. // background-size: 100% 100%;
  820. // background: #ccc;
  821. list-style: none;
  822. margin-right: 5px;
  823. // background:rgba(250,250,250,1);
  824. border-radius: 4px;
  825. border: 3px solid rgb(221, 221, 221);
  826. & > span {
  827. position: relative;
  828. display: inline-block;
  829. margin-right: 10px;
  830. width: 100%;
  831. height: 100%;
  832. writing-mode: vertical-rl;
  833. text-orientation: upright;
  834. overflow: hidden;
  835. & > i {
  836. font-style: normal;
  837. position: absolute;
  838. top: 11px;
  839. left: 50%;
  840. transform: translate(-50%, -1%);
  841. transition: transform 1s ease-in-out;
  842. letter-spacing: 10px;
  843. }
  844. }
  845. }
  846. .number-item:last-child {
  847. margin-right: 0;
  848. }
  849. }
  850. .terminal-table {
  851. width: 100%;
  852. ::v-deep .table {
  853. width: 100%;
  854. .cell {
  855. padding: 0;
  856. text-align: center;
  857. font-size: 14px;
  858. font-family: Helvetica, "Microsoft YaHei";
  859. letter-spacing: 0;
  860. }
  861. .cell-click {
  862. cursor: pointer;
  863. color: #2f3480;
  864. &.cell-clicked {
  865. color: purple;
  866. }
  867. }
  868. .el-table__header-wrapper,
  869. .el-table__fixed-header-wrapper {
  870. .cell {
  871. font-weight: bold;
  872. color: #101116;
  873. }
  874. .has-gutter {
  875. tr {
  876. .bgl-huang {
  877. background: #fcf0b1;
  878. }
  879. }
  880. }
  881. }
  882. .el-table__body-wrapper,
  883. .el-table__fixed-body-wrapper {
  884. tr.bgl-hui {
  885. background: #d2d6df;
  886. td {
  887. background: #d2d6df;
  888. }
  889. &.redBorder {
  890. position: relative;
  891. &::after {
  892. content: "";
  893. position: absolute;
  894. left: 0;
  895. bottom: 0;
  896. width: 100%;
  897. height: 2px;
  898. background: #e83f82;
  899. }
  900. }
  901. }
  902. }
  903. td.cell-toUnload {
  904. background: lightcoral !important;
  905. position: relative;
  906. &::after {
  907. content: "";
  908. display: block;
  909. width: 100%;
  910. height: 100%;
  911. position: absolute;
  912. top: 0;
  913. left: 0;
  914. border: 2px dashed red;
  915. }
  916. }
  917. td.cell-toUnloadNew {
  918. background: #fcf0b1 !important;
  919. position: relative;
  920. &::after {
  921. content: "";
  922. display: block;
  923. width: 100%;
  924. height: 100%;
  925. position: absolute;
  926. top: 0;
  927. left: 0;
  928. border: 2px dashed #e28913;
  929. }
  930. }
  931. .el-table__cell.is-hidden > * {
  932. visibility: visible;
  933. }
  934. }
  935. }
  936. </style>