Showing
4 changed files
with
69 additions
and
71 deletions
| ... | @@ -223,7 +223,7 @@ export function getTime(type) { | ... | @@ -223,7 +223,7 @@ export function getTime(type) { |
| 223 | * @return {*} | 223 | * @return {*} |
| 224 | */ | 224 | */ |
| 225 | export function debounce(func, wait, immediate) { | 225 | export function debounce(func, wait, immediate) { |
| 226 | - let timeout, args, context, timestamp, result; | 226 | + let timeout, args, context, timestamp, result, data; |
| 227 | 227 | ||
| 228 | const later = function () { | 228 | const later = function () { |
| 229 | // 据上一次触发时间间隔 | 229 | // 据上一次触发时间间隔 |
| ... | @@ -236,7 +236,7 @@ export function debounce(func, wait, immediate) { | ... | @@ -236,7 +236,7 @@ export function debounce(func, wait, immediate) { |
| 236 | timeout = null; | 236 | timeout = null; |
| 237 | // 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用 | 237 | // 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用 |
| 238 | if (!immediate) { | 238 | if (!immediate) { |
| 239 | - result = func.apply(context, args); | 239 | + result = func.apply(context, data); |
| 240 | if (!timeout) context = args = null; | 240 | if (!timeout) context = args = null; |
| 241 | } | 241 | } |
| 242 | } | 242 | } |
| ... | @@ -245,6 +245,7 @@ export function debounce(func, wait, immediate) { | ... | @@ -245,6 +245,7 @@ export function debounce(func, wait, immediate) { |
| 245 | return function (...args) { | 245 | return function (...args) { |
| 246 | context = this; | 246 | context = this; |
| 247 | timestamp = +new Date(); | 247 | timestamp = +new Date(); |
| 248 | + data = args; | ||
| 248 | const callNow = immediate && !timeout; | 249 | const callNow = immediate && !timeout; |
| 249 | // 如果延时不存在,重新设定延时 | 250 | // 如果延时不存在,重新设定延时 |
| 250 | if (!timeout) timeout = setTimeout(later, wait); | 251 | if (!timeout) timeout = setTimeout(later, wait); | ... | ... |
| ... | @@ -240,7 +240,7 @@ export const inputBlurValidate = { | ... | @@ -240,7 +240,7 @@ export const inputBlurValidate = { |
| 240 | let markCoin = false; | 240 | let markCoin = false; |
| 241 | if (value.length) { | 241 | if (value.length) { |
| 242 | this[customVal] = Number(value); | 242 | this[customVal] = Number(value); |
| 243 | - // 其中一个有值的情况下 | 243 | + // 其中一个有值的情况下人民币 |
| 244 | if (customVal == "minCNYCustomVal" || customVal == "maxCNYCustomVal") { | 244 | if (customVal == "minCNYCustomVal" || customVal == "maxCNYCustomVal") { |
| 245 | if (this.minCNYCustomVal && this.maxCNYCustomVal) { | 245 | if (this.minCNYCustomVal && this.maxCNYCustomVal) { |
| 246 | this.validateForm = false; | 246 | this.validateForm = false; |
| ... | @@ -251,7 +251,7 @@ export const inputBlurValidate = { | ... | @@ -251,7 +251,7 @@ export const inputBlurValidate = { |
| 251 | this.$refs[coin[customVal]].innerHTML = ""; | 251 | this.$refs[coin[customVal]].innerHTML = ""; |
| 252 | } | 252 | } |
| 253 | } | 253 | } |
| 254 | - // 都有值的情况下 | 254 | + // 都有值的情况下美元 |
| 255 | else { | 255 | else { |
| 256 | if (this.minSUDCustomVal && this.maxSUDCustomVal) { | 256 | if (this.minSUDCustomVal && this.maxSUDCustomVal) { |
| 257 | this.validateForm = false; | 257 | this.validateForm = false; |
| ... | @@ -278,20 +278,6 @@ export const inputBlurValidate = { | ... | @@ -278,20 +278,6 @@ export const inputBlurValidate = { |
| 278 | // this.validateForm = true; | 278 | // this.validateForm = true; |
| 279 | // this.$refs[coin[customVal]].innerHTML = ""; | 279 | // this.$refs[coin[customVal]].innerHTML = ""; |
| 280 | // } | 280 | // } |
| 281 | - } else { | ||
| 282 | - if (value.length) { | ||
| 283 | - // 判断申报价值不得大于上限 | ||
| 284 | - // if (Number(value) > currency[customVal]) { | ||
| 285 | - // this.validateForm = false; | ||
| 286 | - // this.$refs[coin[customVal]].innerHTML = ""; | ||
| 287 | - // this.$refs[ | ||
| 288 | - // coin[customVal] | ||
| 289 | - // ].innerHTML = `最大申报值不得大于${currency[customVal]}`; | ||
| 290 | - // } else { | ||
| 291 | - // this.validateForm = true; | ||
| 292 | - // this.$refs[coin[customVal]].innerHTML = ""; | ||
| 293 | - // } | ||
| 294 | - } | ||
| 295 | } | 281 | } |
| 296 | } else { | 282 | } else { |
| 297 | this.validateForm = false; | 283 | this.validateForm = false; | ... | ... |
| ... | @@ -56,23 +56,24 @@ | ... | @@ -56,23 +56,24 @@ |
| 56 | <el-table-column | 56 | <el-table-column |
| 57 | label="加减天数" | 57 | label="加减天数" |
| 58 | prop="calculateDay" | 58 | prop="calculateDay" |
| 59 | - width="100" | 59 | + width="140" |
| 60 | align="center" | 60 | align="center" |
| 61 | > | 61 | > |
| 62 | <template slot-scope="scope"> | 62 | <template slot-scope="scope"> |
| 63 | - <el-input | 63 | + <el-input-number |
| 64 | - type="text" | ||
| 65 | v-model="scope.row.calculateDay" | 64 | v-model="scope.row.calculateDay" |
| 66 | :disabled="scope.row.edit" | 65 | :disabled="scope.row.edit" |
| 67 | - min="-7" | 66 | + :min="-7" |
| 68 | - max="7" | 67 | + :max="7" |
| 68 | + :precision="0" | ||
| 69 | v-input-filter | 69 | v-input-filter |
| 70 | clearable | 70 | clearable |
| 71 | placeholder="" | 71 | placeholder="" |
| 72 | size="small" | 72 | size="small" |
| 73 | + style="width: 100%" | ||
| 73 | /> | 74 | /> |
| 74 | <!-- <el-input | 75 | <!-- <el-input |
| 75 | - type="number" | 76 | + type="text" |
| 76 | v-model="scope.row.calculateDay" | 77 | v-model="scope.row.calculateDay" |
| 77 | :disabled="scope.row.edit" | 78 | :disabled="scope.row.edit" |
| 78 | min="-7" | 79 | min="-7" |
| ... | @@ -497,40 +498,6 @@ export default { | ... | @@ -497,40 +498,6 @@ export default { |
| 497 | ]; | 498 | ]; |
| 498 | } | 499 | } |
| 499 | }, | 500 | }, |
| 500 | - mounted() {}, | ||
| 501 | - directives: { | ||
| 502 | - // 处理加减天数 | ||
| 503 | - "input-filter": { | ||
| 504 | - bind: function (el, binding, { context }) { | ||
| 505 | - el.handler = function (event) { | ||
| 506 | - if (event.data == "E" || event.data == "e") { | ||
| 507 | - // 无理数时 | ||
| 508 | - event.target.value = ""; | ||
| 509 | - } | ||
| 510 | - if (event.target.value) { | ||
| 511 | - if (Number(event.target.value) < -7) { | ||
| 512 | - event.target.value = ""; | ||
| 513 | - context.msgError("加减天数最小不能低于7天"); | ||
| 514 | - } else if (Number(event.target.value) > 7) { | ||
| 515 | - event.target.value = ""; | ||
| 516 | - context.msgError("加减天数最小不能大于7天"); | ||
| 517 | - } else if (/[\.]/.test(Number(event.target.value))) { | ||
| 518 | - // 浮点数时 | ||
| 519 | - event.target.value = ""; | ||
| 520 | - } else { | ||
| 521 | - | ||
| 522 | - } | ||
| 523 | - event.target.dispatchEvent(new Event("input")); | ||
| 524 | - } | ||
| 525 | - }; | ||
| 526 | - el.addEventListener("input", el.handler); | ||
| 527 | - }, | ||
| 528 | - unbind: function (el) { | ||
| 529 | - el.removeEventListener("input", el.handler); | ||
| 530 | - }, | ||
| 531 | - }, | ||
| 532 | - }, | ||
| 533 | - filters: {}, | ||
| 534 | methods: { | 501 | methods: { |
| 535 | // ET86新增 | 502 | // ET86新增 |
| 536 | postAdd(params) { | 503 | postAdd(params) { |
| ... | @@ -553,7 +520,7 @@ export default { | ... | @@ -553,7 +520,7 @@ export default { |
| 553 | const { code, data, msg } = res; | 520 | const { code, data, msg } = res; |
| 554 | if (code == 200) { | 521 | if (code == 200) { |
| 555 | data.list.flightRankDtoList.map((item) => { | 522 | data.list.flightRankDtoList.map((item) => { |
| 556 | - if (name == "view") { | 523 | + if (name == "view") { // 跳转页面传过来的字段值等于view展示查看 |
| 557 | item.edit = true; | 524 | item.edit = true; |
| 558 | } else { | 525 | } else { |
| 559 | item.edit = false; | 526 | item.edit = false; |
| ... | @@ -565,13 +532,10 @@ export default { | ... | @@ -565,13 +532,10 @@ export default { |
| 565 | item.permitOverweight = true; | 532 | item.permitOverweight = true; |
| 566 | } | 533 | } |
| 567 | }); | 534 | }); |
| 568 | - data.list.flightRankDtoList.map((item) => { | 535 | + // ET86配舱航班顺位列表 |
| 569 | - item.calculateDay = item.calculateDay; | ||
| 570 | - }); | ||
| 571 | - // ET86配舱航班顺位 | ||
| 572 | this.tableData = data.list.flightRankDtoList; | 536 | this.tableData = data.list.flightRankDtoList; |
| 573 | Object.keys(data.list.fltRuleDto).map((key) => { | 537 | Object.keys(data.list.fltRuleDto).map((key) => { |
| 574 | - if (key == "multiHs") { | 538 | + if (key == "multiHs") { // N为单品名,Y为多品名 |
| 575 | if (data.list.fltRuleDto[key] == "N") { | 539 | if (data.list.fltRuleDto[key] == "N") { |
| 576 | data.list.fltRuleDto[key] = true; | 540 | data.list.fltRuleDto[key] = true; |
| 577 | } else { | 541 | } else { |
| ... | @@ -583,6 +547,7 @@ export default { | ... | @@ -583,6 +547,7 @@ export default { |
| 583 | data.list.fltRuleDto[key] = ""; | 547 | data.list.fltRuleDto[key] = ""; |
| 584 | } | 548 | } |
| 585 | }); | 549 | }); |
| 550 | + // 申报类别详情转化成数组赋值给申报类别勾选框作为回显展示数据 | ||
| 586 | if (data.list.fltRuleDto.declarationCategory) { | 551 | if (data.list.fltRuleDto.declarationCategory) { |
| 587 | this.checkboxClassType = | 552 | this.checkboxClassType = |
| 588 | data.list.fltRuleDto.declarationCategory.split(";"); | 553 | data.list.fltRuleDto.declarationCategory.split(";"); |
| ... | @@ -660,24 +625,28 @@ export default { | ... | @@ -660,24 +625,28 @@ export default { |
| 660 | }, | 625 | }, |
| 661 | // 失焦查询 | 626 | // 失焦查询 |
| 662 | blurSearch() { | 627 | blurSearch() { |
| 628 | + // 转大写字母 | ||
| 663 | this.tableData[this.currentIndex].flightNo = this.upCase( | 629 | this.tableData[this.currentIndex].flightNo = this.upCase( |
| 664 | this.tableData[this.currentIndex].flightNo | 630 | this.tableData[this.currentIndex].flightNo |
| 665 | - ); // 转大写字母 | 631 | + ); |
| 666 | - let params = { | 632 | + // 筛选重复的航班:【重复规则】航班号 + 加减天数 + 航线有同样的就认为是重复 |
| 667 | - fltNo: this.tableData[this.currentIndex].flightNo, | ||
| 668 | - }; | ||
| 669 | let repeat = this.tableData.filter( | 633 | let repeat = this.tableData.filter( |
| 670 | (item) => | 634 | (item) => |
| 671 | item.flightNo == this.tableData[this.currentIndex].flightNo && | 635 | item.flightNo == this.tableData[this.currentIndex].flightNo && |
| 672 | item.calculateDay == this.tableData[this.currentIndex].calculateDay && | 636 | item.calculateDay == this.tableData[this.currentIndex].calculateDay && |
| 673 | item.flightRoute == this.tableData[this.currentIndex].flightRoute | 637 | item.flightRoute == this.tableData[this.currentIndex].flightRoute |
| 674 | - ); // 筛选重复的航班 | 638 | + ); |
| 639 | + // 出现重复的返回 | ||
| 675 | if (repeat.length > 1) { | 640 | if (repeat.length > 1) { |
| 676 | this.msgError("航班顺位已重复"); | 641 | this.msgError("航班顺位已重复"); |
| 677 | return; | 642 | return; |
| 678 | } | 643 | } |
| 644 | + let params = { | ||
| 645 | + fltNo: this.tableData[this.currentIndex].flightNo, | ||
| 646 | + }; | ||
| 647 | + // 航班号输入框失焦时判断有没有航班号,有航班号调用航线查询 | ||
| 679 | if (params.fltNo) { | 648 | if (params.fltNo) { |
| 680 | - this.getQueryRouteByFltNo(params); | 649 | + this.getQueryRouteByFltNo(params); // 航线查询 |
| 681 | } else { | 650 | } else { |
| 682 | this.tableData[this.currentIndex].flightRoute = ""; | 651 | this.tableData[this.currentIndex].flightRoute = ""; |
| 683 | this.tableData[this.currentIndex].routeList = []; | 652 | this.tableData[this.currentIndex].routeList = []; |
| ... | @@ -715,7 +684,7 @@ export default { | ... | @@ -715,7 +684,7 @@ export default { |
| 715 | let include = this.cargoType.filter((item) => | 684 | let include = this.cargoType.filter((item) => |
| 716 | arr.some((val) => val == item.chineseName) | 685 | arr.some((val) => val == item.chineseName) |
| 717 | ); // 查询已被勾选的类别 | 686 | ); // 查询已被勾选的类别 |
| 718 | - this.checkboxCargoType = include; //已勾选申报类别的数据 | 687 | + this.checkboxCargoType = include; // 已勾选申报类别的数据 |
| 719 | this.queryForm.declarationCategory = arr.join(";"); | 688 | this.queryForm.declarationCategory = arr.join(";"); |
| 720 | }, | 689 | }, |
| 721 | // 失焦事件 | 690 | // 失焦事件 | ... | ... |
| 1 | +import { debounce } from "@/utils"; | ||
| 1 | export default { | 2 | export default { |
| 3 | + directives: { | ||
| 4 | + // 处理加减天数 | ||
| 5 | + "input-filter": { | ||
| 6 | + bind: function (el, binding, { context }) { | ||
| 7 | + el.handler = function (event) { | ||
| 8 | + context.calculateDay(event); | ||
| 9 | + }; | ||
| 10 | + el.addEventListener("input", el.handler); | ||
| 11 | + }, | ||
| 12 | + unbind: function (el) { | ||
| 13 | + el.removeEventListener("input", el.handler); | ||
| 14 | + }, | ||
| 15 | + }, | ||
| 16 | + }, | ||
| 2 | methods: { | 17 | methods: { |
| 18 | + // 防抖函数处理加减天数校验 | ||
| 19 | + calculateDay: debounce(function (...args) { | ||
| 20 | + // 判断有没有值 | ||
| 21 | + if (args.length) { | ||
| 22 | + // 判断传过来的是不是一个对象 | ||
| 23 | + const { target } = args[0]; | ||
| 24 | + // 是不是一个数字 | ||
| 25 | + if (isNaN(Number(target.value))) { | ||
| 26 | + this.msgError("请输入有效数字"); | ||
| 27 | + target.value = ""; | ||
| 28 | + } else { | ||
| 29 | + // 非数字时 | ||
| 30 | + if (Number(target.value) < -7) { | ||
| 31 | + this.msgError("加减天数最小不能大于7天"); | ||
| 32 | + target.value = ""; | ||
| 33 | + } else if (Number(target.value) > 7) { | ||
| 34 | + this.msgError("加减天数最大不能大于7天"); | ||
| 35 | + target.value = ""; | ||
| 36 | + } else if (/[\.]/.test(Number(target.value))) { | ||
| 37 | + // 浮点数时 | ||
| 38 | + this.msgError("加减天数只能为整数"); | ||
| 39 | + target.value = ""; | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + target.dispatchEvent(new Event("input")); | ||
| 43 | + } | ||
| 44 | + }, 800), | ||
| 3 | // 获取字典 | 45 | // 获取字典 |
| 4 | getObj({ serviceCode }) { | 46 | getObj({ serviceCode }) { |
| 5 | let service_Code = []; | 47 | let service_Code = []; | ... | ... |
-
Please register or login to post a comment