index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <!--
  2. * @Author: zk
  3. * @Date: 2022-01-17 10:39:22
  4. * @LastEditTime: 2022-06-22 17:39:49
  5. * @LastEditors: your name
  6. * @Description: 离港01
  7. -->
  8. <template>
  9. <div class="departure-one">
  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-select v-model="formData.currentAirport" class="input-shadow" size="small" style="width: 150px" filterable default-first-option placeholder="请选择机场" @change="airPortChange">
  16. <el-option v-for="(item, index) in AirportList" :key="index" :label="item.IATACode" :value="item.IATACode" />
  17. </el-select>
  18. </el-form-item>
  19. <el-form-item prop="flightDate" label="航班日期">
  20. <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="dateChange" />
  21. </el-form-item>
  22. <el-form-item>
  23. <div class="box-item">
  24. <p>预计装载总数:</p>
  25. <li v-for="(item, index) in orderNum" :key="index" :class="{ 'number-item': !isNaN(item), 'mark-item': isNaN(item) }">
  26. <span v-if="!isNaN(item)">
  27. <i ref="numberItem">0123456789</i>
  28. </span>
  29. <span v-else class="comma">{{ item }}</span>
  30. </li>
  31. </div>
  32. </el-form-item>
  33. </div>
  34. <div class="form-right" @keyup.enter="onSubmit(0)">
  35. <el-form-item prop="search">
  36. <el-popover :value="popoverVisible" placement="bottom" trigger="manual">
  37. <span>请输入航班号(示例:CA1234)或行李牌号(示例:1234567890)</span>
  38. <el-input slot="reference" v-model="formData.search" class="input-shadow" style="width: 240px; margin-left: 105px" size="small" placeholder="请输入内容" prefix-icon="el-icon-search" clearable @focus="popoverVisible = true" @blur="popoverVisible = false" />
  39. </el-popover>
  40. </el-form-item>
  41. <el-form-item>
  42. <el-button class="btn-shadow" size="mini" type="primary" @click="onSubmit(0)">搜索</el-button>
  43. </el-form-item>
  44. <el-form-item>
  45. <TimeZoneSelector />
  46. </el-form-item>
  47. <el-form-item>
  48. <img class="btn-img btn-shadow" src="@/assets/baggage/ic_export.png" title="导出" @click="exportHandler('table', '航站离港列表')" />
  49. </el-form-item>
  50. </div>
  51. </el-form>
  52. </div>
  53. <!--表格-->
  54. <div class="terminal-table">
  55. <Table :istableChild="true" :pageSize="9999" @tableLoad="tableLoad" style="height:100%" :btnStyle="{ 'top':'-43px','right':'8px' }" :istableCol="true" :tableTag="tableTag" ref="table" :should-reset.sync="loading" />
  56. </div>
  57. </div>
  58. </template>
  59. <script>
  60. import Dialog from "@/layout/components/Dialog";
  61. import TimeZoneSelector from "@/components/TimeZoneSelector";
  62. import { exportToExcel } from "@/utils/table";
  63. import pf from '@/layout/mixin/publicFunc'
  64. import { mapGetters } from "vuex";
  65. import formMixin from "./mixins/form";
  66. import Table from '@/views/newQuery/components/table.vue'
  67. export default {
  68. name: "DepartureTerminalView",
  69. components: { Dialog, TimeZoneSelector, Table },
  70. mixins: [formMixin, pf],
  71. data () {
  72. return {
  73. orderNum: ["0", "0", "0", "0", "0", "0"], // 默认总数
  74. popoverVisible: false,
  75. // 初始表头
  76. tableCols: [],
  77. tableDataSortRules: {
  78. flightCanceled: "ascending",
  79. },
  80. loading: true,
  81. AirportList: [],
  82. tableTag: {},
  83. timer: null
  84. };
  85. },
  86. computed: {
  87. singleDay () {
  88. return this.startDate === this.endDate;
  89. },
  90. ...mapGetters(["timeZone"]),
  91. },
  92. created () {
  93. this.getAirPortData()
  94. },
  95. mounted () {
  96. this.timer = setInterval(() => {
  97. this.getAirPortData()
  98. }, LOOP_INTERVAL.arrivalTable)
  99. },
  100. destroyed () {
  101. clearInterval(this.timer)
  102. this.timer = null
  103. },
  104. methods: {
  105. airPortChange (val) {
  106. this.formData.currentAirport = val
  107. this.getAirPortData(0)
  108. },
  109. dateChange () {
  110. this.getAirPortData(0)
  111. },
  112. formatParams () {
  113. const datas = []
  114. const queryData = {
  115. startDate: this.startDate,
  116. endDate: this.endDate
  117. }
  118. queryData['landAirport'] = this.formData.currentAirport
  119. for (const key in queryData) {
  120. if (Object.hasOwnProperty.call(queryData, key)) {
  121. const val = queryData[key]
  122. const comparator = key == 'startDate' ? '>=' : key == 'endDate' ? '<=' : '='
  123. const column = key == 'startDate' ? 'carrierFlightsDate' : key == 'endDate' ? 'carrierFlightsDate' : key
  124. const r = {
  125. left: '(',
  126. column: column,
  127. comparator,
  128. value: val,
  129. right: ')',
  130. connector: 'and'
  131. }
  132. datas.push(r)
  133. }
  134. }
  135. return datas
  136. },
  137. async getAirPortData (type = 1) {
  138. try {
  139. let res = null
  140. res = this.TauthId ? await this.getQueryListAuth(this.TqueryId || SERVICE_ID.getAirpotId, {}, 1, 999, this.TauthId) : await this.getQueryList(SERVICE_ID.getAirpotId)
  141. if (Number(res.code) === 0) {
  142. this.AirportList = res.returnData;
  143. if (type) {
  144. const flag = res.returnData.filter(item => item.IATACode == 'PEK');
  145. this.formData.currentAirport = this.TauthId && flag.length ? 'PEK' : res.returnData[0].IATACode;
  146. }
  147. this.tableTag = {
  148. filter: this.formatParams(),
  149. shouldReset: type !== 1
  150. }
  151. } else {
  152. this.$message.error(res.message);
  153. }
  154. } catch (error) {
  155. this.$message.error("失败");
  156. }
  157. },
  158. toOrderNum (num) {
  159. num = num.toString();
  160. if (num.length < 6) {
  161. num = "0" + num; // 如未满八位数,添加"0"补位
  162. this.toOrderNum(num); // 递归添加"0"补位
  163. } else if (num.length >= 6) {
  164. this.orderNum = num.split(""); // 将其便变成数据,渲染至滚动数组
  165. } else {
  166. // 订单总量数字超过八位显示异常
  167. this.$message.warning("总量数字过大");
  168. }
  169. this.setNumberTransform();
  170. },
  171. setNumberTransform () {
  172. const numberItems = this.$refs.numberItem; // 拿到数字的ref,计算元素数量
  173. const numberArr = this.orderNum.filter((item) => !isNaN(item));
  174. // 结合CSS 对数字字符进行滚动,显示订单数量
  175. for (let index = 0; index < numberItems.length; index++) {
  176. const elem = numberItems[index];
  177. elem.style.transform = `translate(-50%, -${numberArr[index] * 10}%)`;
  178. }
  179. },
  180. exportHandler (refName, tableName) {
  181. if (this.loading) {
  182. return;
  183. }
  184. const table = this.$refs[refName].$el.cloneNode(true);
  185. const fileName = `${tableName}-${this.currentAirport}-${this.startDate}-${this.endDate}.xlsx`;
  186. exportToExcel(table, tableName, fileName);
  187. },
  188. tableLoad (arr) {
  189. let num = 0
  190. arr.forEach(item => {
  191. num += Number(item.estimated_load_number)
  192. })
  193. this.toOrderNum(num)
  194. }
  195. },
  196. };
  197. </script>
  198. <style lang="scss" scoped>
  199. .departure-one {
  200. height: calc(100vh - 80px);
  201. }
  202. .terminal-form-wrap {
  203. padding-top: 11px;
  204. padding-left: 5px;
  205. ::v-deep .form {
  206. display: flex;
  207. justify-content: space-between;
  208. .form-left {
  209. flex: 1;
  210. }
  211. .form-right {
  212. flex: 0 1 auto;
  213. }
  214. .el-form-item {
  215. margin-bottom: 0px;
  216. margin-right: 8px;
  217. button,
  218. input,
  219. optgroup,
  220. select,
  221. textarea {
  222. font-family: Helvetica, "Microsoft YaHei";
  223. font-size: 14px;
  224. }
  225. .el-switch__label {
  226. color: #303133;
  227. }
  228. .el-form-item__error {
  229. z-index: 10;
  230. }
  231. &:last-child {
  232. margin-right: 45px;
  233. }
  234. }
  235. .btn-img {
  236. position: relative;
  237. top: 6px;
  238. }
  239. }
  240. .box-item {
  241. position: relative;
  242. height: 50px;
  243. font-size: 18px;
  244. line-height: 32px;
  245. text-align: center;
  246. list-style: none;
  247. color: #2d7cff;
  248. writing-mode: vertical-lr;
  249. text-orientation: upright;
  250. /*文字禁止编辑*/
  251. -moz-user-select: none; /*火狐*/
  252. -webkit-user-select: none; /*webkit浏览器*/
  253. -ms-user-select: none; /*IE10*/
  254. -khtml-user-select: none; /*早期浏览器*/
  255. user-select: none;
  256. /* overflow: hidden; */
  257. p {
  258. line-height: 32px;
  259. writing-mode: horizontal-tb !important;
  260. text-orientation: none !important;
  261. /*文字禁止编辑*/
  262. -moz-user-select: none; /*火狐*/
  263. -webkit-user-select: none; /*webkit浏览器*/
  264. -ms-user-select: none; /*IE10*/
  265. -khtml-user-select: none; /*早期浏览器*/
  266. user-select: none;
  267. margin-top: 5px;
  268. }
  269. }
  270. /* 默认逗号设置 */
  271. .mark-item {
  272. width: 10px;
  273. height: 32px;
  274. margin-right: 5px;
  275. line-height: 10px;
  276. font-size: 18px;
  277. position: relative;
  278. & > span {
  279. position: absolute;
  280. width: 100%;
  281. bottom: 0;
  282. writing-mode: vertical-rl;
  283. text-orientation: upright;
  284. }
  285. }
  286. /*滚动数字设置*/
  287. .number-item {
  288. width: 41px;
  289. height: 42px;
  290. /* 背景图片 */
  291. // background: url(/images/text-bg-blue.png) no-repeat center center;
  292. // background-size: 100% 100%;
  293. // background: #ccc;
  294. list-style: none;
  295. margin-right: 5px;
  296. // background:rgba(250,250,250,1);
  297. border-radius: 4px;
  298. border: 3px solid rgb(221, 221, 221);
  299. & > span {
  300. position: relative;
  301. display: inline-block;
  302. margin-right: 10px;
  303. width: 100%;
  304. height: 100%;
  305. writing-mode: vertical-rl;
  306. text-orientation: upright;
  307. overflow: hidden;
  308. & > i {
  309. font-style: normal;
  310. position: absolute;
  311. top: 11px;
  312. left: 50%;
  313. transform: translate(-50%, -1%);
  314. transition: transform 1s ease-in-out;
  315. letter-spacing: 10px;
  316. }
  317. }
  318. }
  319. .number-item:last-child {
  320. margin-right: 0;
  321. }
  322. }
  323. .terminal-table {
  324. width: 100%;
  325. height: calc(100% - 61px);
  326. }
  327. </style>