Showing
1 changed file
with
41 additions
and
12 deletions
| ... | @@ -766,50 +766,79 @@ export default { | ... | @@ -766,50 +766,79 @@ export default { |
| 766 | blurEvent({ originOfFlightNo }) { | 766 | blurEvent({ originOfFlightNo }) { |
| 767 | this.queryForm.originOfFlightNo = this.upCase(originOfFlightNo); | 767 | this.queryForm.originOfFlightNo = this.upCase(originOfFlightNo); |
| 768 | }, | 768 | }, |
| 769 | + | ||
| 770 | + validateLocation({ isLocation, location, notLocation }) { | ||
| 771 | + let locationVal, | ||
| 772 | + notLocationVal, | ||
| 773 | + repeat, | ||
| 774 | + validateLocation, | ||
| 775 | + validateNotlocation; | ||
| 776 | + if (isLocation == "1") { | ||
| 777 | + // 分隔字符串并且转数组&去除数组空字符串 | ||
| 778 | + locationVal = location.split(";").filter((str) => str !== ""); | ||
| 779 | + // 是否有重复的 | ||
| 780 | + repeat = new Set(locationVal).size !== locationVal.length; | ||
| 781 | + // 校验校验开头以字母或者数字开头的/^[a-zA-Z0-9]*$/ | ||
| 782 | + validateLocation = locationVal.every((item) => | ||
| 783 | + /^[a-zA-Z0-9]*$/.test(item) | ||
| 784 | + ); | ||
| 785 | + } else { | ||
| 786 | + notLocationVal = notLocation.split(";").filter((str) => str !== ""); | ||
| 787 | + repeat = new Set(notLocationVal).size !== notLocationVal.length; | ||
| 788 | + validateNotlocation = locationVal.every((item) => | ||
| 789 | + /^[a-zA-Z0-9]*$/.test(item) | ||
| 790 | + ); | ||
| 791 | + } | ||
| 792 | + }, | ||
| 793 | + | ||
| 769 | // 包含始发站失焦事件 | 794 | // 包含始发站失焦事件 |
| 770 | locationBur({ index, item }) { | 795 | locationBur({ index, item }) { |
| 771 | /* | 796 | /* |
| 772 | 对于单选框这种,不论是勾选哪一个两则都使用一个布尔值; | 797 | 对于单选框这种,不论是勾选哪一个两则都使用一个布尔值; |
| 773 | - | 798 | + // 校验:只能字母和数组组合,不能有重复的,包含中不能有包含的 |
| 774 | */ | 799 | */ |
| 775 | - console.log(this.routesInfo); | 800 | + // console.log(this.routesInfo); |
| 776 | - console.log("locationBur", index, item); | 801 | + // console.log("locationBur", index, item); |
| 802 | + // 不为空的时候做校验 | ||
| 803 | + // if (item.location || item.notLocation) { | ||
| 804 | + // this.validateLocation(item); | ||
| 805 | + // } | ||
| 777 | }, | 806 | }, |
| 778 | // 不包含始发站失焦事件 | 807 | // 不包含始发站失焦事件 |
| 779 | notLocationBur({ index, item }) { | 808 | notLocationBur({ index, item }) { |
| 780 | - console.log("notLocationBur", index, item); | 809 | + // console.log("notLocationBur", index, item); |
| 781 | }, | 810 | }, |
| 782 | // 包含目的站失焦事件 | 811 | // 包含目的站失焦事件 |
| 783 | destinationSiteBur({ index, item }) { | 812 | destinationSiteBur({ index, item }) { |
| 784 | - console.log("destinationSiteBur", index, item); | 813 | + // console.log("destinationSiteBur", index, item); |
| 785 | }, | 814 | }, |
| 786 | // 不包含目的站失焦事件 | 815 | // 不包含目的站失焦事件 |
| 787 | notDestinationSiteBur({ index, item }) { | 816 | notDestinationSiteBur({ index, item }) { |
| 788 | - console.log("notDestinationSiteBur", index, item); | 817 | + // console.log("notDestinationSiteBur", index, item); |
| 789 | }, | 818 | }, |
| 790 | // URSA包含失焦事件 | 819 | // URSA包含失焦事件 |
| 791 | includeUrsaBur({ index, item }) { | 820 | includeUrsaBur({ index, item }) { |
| 792 | - console.log("includeUrsaBur", index, item); | 821 | + // console.log("includeUrsaBur", index, item); |
| 793 | }, | 822 | }, |
| 794 | // URSA不包含失焦事件 | 823 | // URSA不包含失焦事件 |
| 795 | notIncludeUrsaBur({ index, item }) { | 824 | notIncludeUrsaBur({ index, item }) { |
| 796 | - console.log("notIncludeUrsaBur", index, item); | 825 | + // console.log("notIncludeUrsaBur", index, item); |
| 797 | }, | 826 | }, |
| 798 | // 最少件数失焦事件 | 827 | // 最少件数失焦事件 |
| 799 | minNumOfPiecesBur({ index, item }) { | 828 | minNumOfPiecesBur({ index, item }) { |
| 800 | - console.log("minNumOfPiecesBur", index, item); | 829 | + // console.log("minNumOfPiecesBur", index, item); |
| 801 | }, | 830 | }, |
| 802 | // 最多件数失焦事件 | 831 | // 最多件数失焦事件 |
| 803 | maxNumOfPiecesBur({ index, item }) { | 832 | maxNumOfPiecesBur({ index, item }) { |
| 804 | - console.log("maxNumOfPiecesBur", index, item); | 833 | + // console.log("maxNumOfPiecesBur", index, item); |
| 805 | }, | 834 | }, |
| 806 | // 最小重量失焦事件 | 835 | // 最小重量失焦事件 |
| 807 | minWeightBur({ index, item }) { | 836 | minWeightBur({ index, item }) { |
| 808 | - console.log("minWeightBur", index, item); | 837 | + // console.log("minWeightBur", index, item); |
| 809 | }, | 838 | }, |
| 810 | // 最大重量失焦事件 | 839 | // 最大重量失焦事件 |
| 811 | maxWeightBur({ index, item }) { | 840 | maxWeightBur({ index, item }) { |
| 812 | - console.log("maxWeightBur", index, item); | 841 | + // console.log("maxWeightBur", index, item); |
| 813 | }, | 842 | }, |
| 814 | }, | 843 | }, |
| 815 | }; | 844 | }; | ... | ... |
-
Please register or login to post a comment