Elements-SY

modify

...@@ -72,28 +72,34 @@ ...@@ -72,28 +72,34 @@
72 </el-radio-group> 72 </el-radio-group>
73 </el-col> 73 </el-col>
74 <el-col :span="10"> 74 <el-col :span="10">
75 - <el-input 75 + <span style="width: 500px; display: block">
76 - v-if="item.isLocation == '1'" 76 + <el-input
77 - :disabled="pageName || status" 77 + v-show="item.isLocation == '1'"
78 - type="textarea" 78 + :disabled="pageName || status"
79 - v-model="item.location" 79 + type="textarea"
80 - :rows="4" 80 + v-model="item.location"
81 - placeholder="始发站之间用回车符分隔" 81 + :rows="4"
82 - style="width: 500px" 82 + placeholder="始发站之间用回车符分隔"
83 - @blur="location({ index, item, $event })" 83 + @blur="location({ index, item, $event })"
84 - > 84 + >
85 - </el-input> 85 + </el-input>
86 - <el-input 86 + <el-input
87 - v-else 87 + v-show="item.isLocation == '2'"
88 - :disabled="pageName || status" 88 + :disabled="pageName || status"
89 - type="textarea" 89 + type="textarea"
90 - v-model="item.notLocation" 90 + v-model="item.notLocation"
91 - :rows="4" 91 + :rows="4"
92 - placeholder="始发站之间用回车符分隔" 92 + placeholder="始发站之间用回车符分隔"
93 - style="width: 500px" 93 + @blur="notLocation({ index, item, $event })"
94 - @blur="notLocation({ index, item, $event })" 94 + >
95 - > 95 + </el-input>
96 - </el-input> 96 + </span>
97 + <div class="form-item-error-block">
98 + <span
99 + class="el-form-item__error"
100 + v-text="item.locationError"
101 + ></span>
102 + </div>
97 </el-col> 103 </el-col>
98 </el-form-item> 104 </el-form-item>
99 </el-col> 105 </el-col>
...@@ -110,30 +116,36 @@ ...@@ -110,30 +116,36 @@
110 </el-radio-group> 116 </el-radio-group>
111 </el-col> 117 </el-col>
112 <el-col :span="10"> 118 <el-col :span="10">
113 - <el-input 119 + <span style="width: 500px; display: block">
114 - v-if="item.isDestinationSite == '1'" 120 + <el-input
115 - :disabled="pageName || status" 121 + v-show="item.isDestinationSite == '1'"
116 - type="textarea" 122 + :disabled="pageName || status"
117 - v-model="item.destinationSite" 123 + type="textarea"
118 - :rows="4" 124 + v-model="item.destinationSite"
119 - placeholder="目的站之间用回车符分隔" 125 + :rows="4"
120 - style="width: 500px" 126 + placeholder="目的站之间用回车符分隔"
121 - @blur="destinationSite({ index, item, $event })" 127 + @blur="destinationSite({ index, item, $event })"
122 - > 128 + >
123 - </el-input> 129 + </el-input>
124 - <el-input 130 + <el-input
125 - v-else 131 + v-show="item.isDestinationSite == '2'"
126 - :disabled="pageName || status" 132 + :disabled="pageName || status"
127 - type="textarea" 133 + type="textarea"
128 - v-model="item.notDestinationSite" 134 + v-model="item.notDestinationSite"
129 - :rows="4" 135 + :rows="4"
130 - placeholder="目的站之间用回车符分隔" 136 + placeholder="目的站之间用回车符分隔"
131 - style="width: 500px" 137 + @blur="
132 - @blur=" 138 + notDestinationSite({ index, item, $event })
133 - notDestinationSite({ index, item, $event }) 139 + "
134 - " 140 + >
135 - > 141 + </el-input>
136 - </el-input> 142 + </span>
143 + <div class="form-item-error-block">
144 + <span
145 + class="el-form-item__error"
146 + v-text="destinationSiteError"
147 + ></span>
148 + </div>
137 </el-col> 149 </el-col>
138 </el-form-item> 150 </el-form-item>
139 </el-col> 151 </el-col>
...@@ -149,6 +161,10 @@ ...@@ -149,6 +161,10 @@
149 @blur="includeUrsa({ index, item, $event })" 161 @blur="includeUrsa({ index, item, $event })"
150 > 162 >
151 </el-input> 163 </el-input>
164 + <span
165 + class="el-form-item__error"
166 + v-text="ursaError"
167 + ></span>
152 </el-form-item> 168 </el-form-item>
153 </el-col> 169 </el-col>
154 <el-col :span="10"> 170 <el-col :span="10">
...@@ -162,6 +178,12 @@ ...@@ -162,6 +178,12 @@
162 @blur="notIncludeUrsa({ index, item, $event })" 178 @blur="notIncludeUrsa({ index, item, $event })"
163 > 179 >
164 </el-input> 180 </el-input>
181 + <div class="form-item-error-block">
182 + <span
183 + class="el-form-item__error"
184 + v-text="notUrsaError"
185 + ></span>
186 + </div>
165 </el-form-item> 187 </el-form-item>
166 </el-col> 188 </el-col>
167 </el-col> 189 </el-col>
......
...@@ -12,6 +12,10 @@ export default { ...@@ -12,6 +12,10 @@ export default {
12 queryForm: { 12 queryForm: {
13 // 表单参数 13 // 表单参数
14 }, 14 },
15 + locationError: "URSA包含", // 始发站
16 + destinationSiteError: "", // 目的站
17 + ursaError: "", // URSA包含
18 + notUrsaError: "", // URSA不包含
15 }; 19 };
16 }, 20 },
17 computed: { 21 computed: {
...@@ -766,47 +770,58 @@ export default { ...@@ -766,47 +770,58 @@ export default {
766 blurEvent({ originOfFlightNo }) { 770 blurEvent({ originOfFlightNo }) {
767 this.queryForm.originOfFlightNo = this.upCase(originOfFlightNo); 771 this.queryForm.originOfFlightNo = this.upCase(originOfFlightNo);
768 }, 772 },
769 - 773 + // 校验目的地
770 - validateLocation({ isLocation, location, notLocation }) { 774 + validateLocation(
771 - let locationVal, 775 + index,
772 - notLocationVal, 776 + {
773 - repeat, 777 + isLocation,
774 - validateLocation, 778 + location,
775 - validateNotlocation; 779 + notLocation,
780 + isDestinationSite,
781 + destinationSite,
782 + notDestinationSite,
783 + }
784 + ) {
785 + let locationVal, notLocationVal, repeat, validate;
776 if (isLocation == "1") { 786 if (isLocation == "1") {
777 // 分隔字符串并且转数组&去除数组空字符串 787 // 分隔字符串并且转数组&去除数组空字符串
778 locationVal = location.split(";").filter((str) => str !== ""); 788 locationVal = location.split(";").filter((str) => str !== "");
779 // 是否有重复的 789 // 是否有重复的
780 repeat = new Set(locationVal).size !== locationVal.length; 790 repeat = new Set(locationVal).size !== locationVal.length;
781 // 校验校验开头以字母或者数字开头的/^[a-zA-Z0-9]*$/ 791 // 校验校验开头以字母或者数字开头的/^[a-zA-Z0-9]*$/
782 - validateLocation = locationVal.every((item) => 792 + validate = locationVal.every((item) => /^[a-zA-Z0-9]*$/.test(item));
783 - /^[a-zA-Z0-9]*$/.test(item)
784 - );
785 } else { 793 } else {
786 notLocationVal = notLocation.split(";").filter((str) => str !== ""); 794 notLocationVal = notLocation.split(";").filter((str) => str !== "");
787 repeat = new Set(notLocationVal).size !== notLocationVal.length; 795 repeat = new Set(notLocationVal).size !== notLocationVal.length;
788 - validateNotlocation = locationVal.every((item) => 796 + validate = locationVal.every((item) => /^[a-zA-Z0-9]*$/.test(item));
789 - /^[a-zA-Z0-9]*$/.test(item) 797 + }
790 - ); 798 + if (repeat) {
799 + this.routesInfo[index].locationError = "填写的目的地已重复";
800 + this.$set(this.routesInfo, index, this.routesInfo[index]);
801 + }
802 + if (!validate) {
803 + this.routesInfo[index].locationError =
804 + "目的地之间用分号分隔,例:P1;P2;P3";
805 + this.$set(this.routesInfo, index, this.routesInfo[index]);
806 + }
807 + if (!repeat && validate) {
808 + this.routesInfo[index].locationError = "";
809 + this.$set(this.routesInfo, index, this.routesInfo[index]);
791 } 810 }
792 }, 811 },
793 -
794 // 包含始发站失焦事件 812 // 包含始发站失焦事件
795 locationBur({ index, item }) { 813 locationBur({ index, item }) {
796 - /*
797 - 对于单选框这种,不论是勾选哪一个两则都使用一个布尔值;
798 - // 校验:只能字母和数组组合,不能有重复的,包含中不能有包含的
799 - */
800 - // console.log(this.routesInfo);
801 - // console.log("locationBur", index, item);
802 // 不为空的时候做校验 814 // 不为空的时候做校验
803 - // if (item.location || item.notLocation) { 815 + if (item.location) {
804 - // this.validateLocation(item); 816 + this.validateLocation(index, item);
805 - // } 817 + }
806 }, 818 },
807 // 不包含始发站失焦事件 819 // 不包含始发站失焦事件
808 notLocationBur({ index, item }) { 820 notLocationBur({ index, item }) {
809 // console.log("notLocationBur", index, item); 821 // console.log("notLocationBur", index, item);
822 + if (item.notLocation) {
823 + this.validateLocation(index, item);
824 + }
810 }, 825 },
811 // 包含目的站失焦事件 826 // 包含目的站失焦事件
812 destinationSiteBur({ index, item }) { 827 destinationSiteBur({ index, item }) {
......