Elements-SY

modify

...@@ -782,29 +782,37 @@ export default { ...@@ -782,29 +782,37 @@ export default {
782 notDestinationSite, 782 notDestinationSite,
783 } 783 }
784 ) { 784 ) {
785 - let locationVal, notLocationVal, repeat, validate; 785 + let locationVal,
786 + notLocationVal,
787 + locationRepeat,
788 + validateLocation,
789 + destinationSiteRepeat;
786 if (isLocation == "1") { 790 if (isLocation == "1") {
787 // 分隔字符串并且转数组&去除数组空字符串 791 // 分隔字符串并且转数组&去除数组空字符串
788 locationVal = location.split(";").filter((str) => str !== ""); 792 locationVal = location.split(";").filter((str) => str !== "");
789 // 是否有重复的 793 // 是否有重复的
790 - repeat = new Set(locationVal).size !== locationVal.length; 794 + locationRepeat = new Set(locationVal).size !== locationVal.length;
791 // 校验校验开头以字母或者数字开头的/^[a-zA-Z0-9]*$/ 795 // 校验校验开头以字母或者数字开头的/^[a-zA-Z0-9]*$/
792 - validate = locationVal.every((item) => /^[a-zA-Z0-9]*$/.test(item)); 796 + validateLocation = locationVal.every((item) =>
797 + /^[a-zA-Z0-9]*$/.test(item)
798 + );
793 } else { 799 } else {
794 notLocationVal = notLocation.split(";").filter((str) => str !== ""); 800 notLocationVal = notLocation.split(";").filter((str) => str !== "");
795 - repeat = new Set(notLocationVal).size !== notLocationVal.length; 801 + locationRepeat = new Set(notLocationVal).size !== notLocationVal.length;
796 - validate = locationVal.every((item) => /^[a-zA-Z0-9]*$/.test(item)); 802 + validateLocation = locationVal.every((item) =>
803 + /^[a-zA-Z0-9]*$/.test(item)
804 + );
797 } 805 }
798 - if (repeat) { 806 + if (locationRepeat) {
799 this.routesInfo[index].locationError = "填写的目的地已重复"; 807 this.routesInfo[index].locationError = "填写的目的地已重复";
800 this.$set(this.routesInfo, index, this.routesInfo[index]); 808 this.$set(this.routesInfo, index, this.routesInfo[index]);
801 } 809 }
802 - if (!validate) { 810 + if (!validateLocation) {
803 this.routesInfo[index].locationError = 811 this.routesInfo[index].locationError =
804 "目的地之间用分号分隔,例:P1;P2;P3"; 812 "目的地之间用分号分隔,例:P1;P2;P3";
805 this.$set(this.routesInfo, index, this.routesInfo[index]); 813 this.$set(this.routesInfo, index, this.routesInfo[index]);
806 } 814 }
807 - if (!repeat && validate) { 815 + if (!locationRepeat && validateLocation) {
808 this.routesInfo[index].locationError = ""; 816 this.routesInfo[index].locationError = "";
809 this.$set(this.routesInfo, index, this.routesInfo[index]); 817 this.$set(this.routesInfo, index, this.routesInfo[index]);
810 } 818 }
......