Showing
5 changed files
with
54 additions
and
77 deletions
| ... | @@ -5,7 +5,7 @@ export const formConfig = [ | ... | @@ -5,7 +5,7 @@ export const formConfig = [ |
| 5 | name: "purposeOfFlightNo", | 5 | name: "purposeOfFlightNo", |
| 6 | prop: "purposeOfFlightNo", | 6 | prop: "purposeOfFlightNo", |
| 7 | placeholder: "请输入航班号", | 7 | placeholder: "请输入航班号", |
| 8 | - span: 5, | 8 | + span: 4, |
| 9 | trigger: "blur", | 9 | trigger: "blur", |
| 10 | labelWidth: "55px", | 10 | labelWidth: "55px", |
| 11 | disable: false, | 11 | disable: false, |
| ... | @@ -17,7 +17,7 @@ export const formConfig = [ | ... | @@ -17,7 +17,7 @@ export const formConfig = [ |
| 17 | prop: "flightDate", | 17 | prop: "flightDate", |
| 18 | placeholder: "请选择航班日期", | 18 | placeholder: "请选择航班日期", |
| 19 | format: "yyyy-MM-dd", | 19 | format: "yyyy-MM-dd", |
| 20 | - colWidth: "23%", | 20 | + colWidth: "18%", |
| 21 | inputWidth: "100%", | 21 | inputWidth: "100%", |
| 22 | disable: false, | 22 | disable: false, |
| 23 | hidden: false, | 23 | hidden: false, |
| ... | @@ -28,7 +28,7 @@ export const formConfig = [ | ... | @@ -28,7 +28,7 @@ export const formConfig = [ |
| 28 | name: "flightRouteListStr", | 28 | name: "flightRouteListStr", |
| 29 | prop: "flightRouteListStr", | 29 | prop: "flightRouteListStr", |
| 30 | placeholder: "", | 30 | placeholder: "", |
| 31 | - span: 5, | 31 | + span: 6, |
| 32 | labelWidth: "40px", | 32 | labelWidth: "40px", |
| 33 | trigger: "blur", // 事件名 | 33 | trigger: "blur", // 事件名 |
| 34 | disable: false, | 34 | disable: false, | ... | ... |
| ... | @@ -281,6 +281,7 @@ export default { | ... | @@ -281,6 +281,7 @@ export default { |
| 281 | // 保存 | 281 | // 保存 |
| 282 | saveSubmit(item, index) { | 282 | saveSubmit(item, index) { |
| 283 | item.flightRoute = item.route || item.flightRoute; | 283 | item.flightRoute = item.route || item.flightRoute; |
| 284 | + item.ruleDate = item.ruleDate || this.queryForm.flightDate | ||
| 284 | let parmas = JSON.parse(JSON.stringify(item)); | 285 | let parmas = JSON.parse(JSON.stringify(item)); |
| 285 | this.returnString(parmas, "cargoType"); | 286 | this.returnString(parmas, "cargoType"); |
| 286 | this.returnString(parmas, "typeOfGoods"); | 287 | this.returnString(parmas, "typeOfGoods"); |
| ... | @@ -332,7 +333,7 @@ export default { | ... | @@ -332,7 +333,7 @@ export default { |
| 332 | ]; | 333 | ]; |
| 333 | let validate = keys.some((key) => parmas[key]); | 334 | let validate = keys.some((key) => parmas[key]); |
| 334 | if (validate) { | 335 | if (validate) { |
| 335 | - // this.loading = true; | 336 | + this.loading = true; |
| 336 | if(parmas.flightRoute == null)return | 337 | if(parmas.flightRoute == null)return |
| 337 | updateOrAddFlight(parmas) | 338 | updateOrAddFlight(parmas) |
| 338 | .then((res) => { | 339 | .then((res) => { | ... | ... |
| ... | @@ -1269,19 +1269,6 @@ export default { | ... | @@ -1269,19 +1269,6 @@ export default { |
| 1269 | } | 1269 | } |
| 1270 | }); | 1270 | }); |
| 1271 | }, | 1271 | }, |
| 1272 | - compareArrays(arr1, arr2) { | ||
| 1273 | - for (let i = 0; i < arr1.length; i++) { | ||
| 1274 | - if (!arr2.includes(arr1[i])) { | ||
| 1275 | - return true; | ||
| 1276 | - } | ||
| 1277 | - } | ||
| 1278 | - for (let i = 0; i < arr2.length; i++) { | ||
| 1279 | - if (!arr1.includes(arr2[i])) { | ||
| 1280 | - return true; | ||
| 1281 | - } | ||
| 1282 | - } | ||
| 1283 | - return false; | ||
| 1284 | - }, | ||
| 1285 | /* | 1272 | /* |
| 1286 | 查看航班维度 | 1273 | 查看航班维度 |
| 1287 | 不仅分为航班种类又分当前航班航线是不是ET86, | 1274 | 不仅分为航班种类又分当前航班航线是不是ET86, |
| ... | @@ -1335,11 +1322,7 @@ export default { | ... | @@ -1335,11 +1322,7 @@ export default { |
| 1335 | routeInfo.isEtesRoute = whiteEt86.length; | 1322 | routeInfo.isEtesRoute = whiteEt86.length; |
| 1336 | } | 1323 | } |
| 1337 | }else{ | 1324 | }else{ |
| 1338 | - // console.log(row) | 1325 | + routeInfo.isEtesRoute = row.route.split(";").every((item) => et86RouteList.includes(item)); |
| 1339 | - // console.log(row.route.split(";")) | ||
| 1340 | - // console.log(et86RouteList) | ||
| 1341 | - // routeInfo.isEtesRoute = this.compareArrays(et86RouteList, row.route.split(";")); | ||
| 1342 | - // console.log(routeInfo.isEtesRoute) | ||
| 1343 | } | 1326 | } |
| 1344 | } else { | 1327 | } else { |
| 1345 | this.msgError("暂无当前航班航线"); | 1328 | this.msgError("暂无当前航班航线"); | ... | ... |
| ... | @@ -63,8 +63,6 @@ | ... | @@ -63,8 +63,6 @@ |
| 63 | <el-input-number | 63 | <el-input-number |
| 64 | v-model="scope.row.calculateDay" | 64 | v-model="scope.row.calculateDay" |
| 65 | :disabled="scope.row.edit" | 65 | :disabled="scope.row.edit" |
| 66 | - :min="-7" | ||
| 67 | - :max="7" | ||
| 68 | :precision="0" | 66 | :precision="0" |
| 69 | v-input-filter | 67 | v-input-filter |
| 70 | clearable | 68 | clearable | ... | ... |
| ... | @@ -33,14 +33,15 @@ export default { | ... | @@ -33,14 +33,15 @@ export default { |
| 33 | this.msgError("请输入有效数字"); | 33 | this.msgError("请输入有效数字"); |
| 34 | target.value = ""; | 34 | target.value = ""; |
| 35 | } else { | 35 | } else { |
| 36 | - // 非数字时 | 36 | + // // 非数字时 |
| 37 | - if (Number(target.value) < -7) { | 37 | + // if (Number(target.value) < -7) { |
| 38 | - this.msgError("加减天数最小不能大于7天"); | 38 | + // this.msgError("加减天数最小不能大于7天"); |
| 39 | - target.value = ""; | 39 | + // target.value = ""; |
| 40 | - } else if (Number(target.value) > 7) { | 40 | + // } else if (Number(target.value) > 7) { |
| 41 | - this.msgError("加减天数最大不能大于7天"); | 41 | + // this.msgError("加减天数最大不能大于7天"); |
| 42 | - target.value = ""; | 42 | + // target.value = ""; |
| 43 | - } else if (/[\.]/.test(Number(target.value))) { | 43 | + // } |
| 44 | + if (/[\.]/.test(Number(target.value))) { | ||
| 44 | // 浮点数时 | 45 | // 浮点数时 |
| 45 | this.msgError("加减天数只能为整数"); | 46 | this.msgError("加减天数只能为整数"); |
| 46 | target.value = ""; | 47 | target.value = ""; |
| ... | @@ -112,68 +113,62 @@ export default { | ... | @@ -112,68 +113,62 @@ export default { |
| 112 | }, | 113 | }, |
| 113 | // Ursa校验 | 114 | // Ursa校验 |
| 114 | validateUrsa(ursaMark, ursa) { | 115 | validateUrsa(ursaMark, ursa) { |
| 116 | + // 分隔字符串并且转数组&去除数组空字符串 | ||
| 115 | let ursaList = ursa.split(";").filter((str) => str !== ""); | 117 | let ursaList = ursa.split(";").filter((str) => str !== ""); |
| 118 | + // 是否有重复的 | ||
| 116 | let repeat = new Set(ursaList).size !== ursaList.length; | 119 | let repeat = new Set(ursaList).size !== ursaList.length; |
| 117 | - let inUrsa = ursaList.every((item) => /^[a-zA-Z][0-9]*_$/.test(item)); | 120 | + // 校验开头以字母开头下划线结尾的/^[a-zA-Z]*;$/ 和 校验开头以字母开头的/^[a-zA-Z]*;$/ |
| 121 | + let inUrsa = ursaList.every((item) => | ||
| 122 | + ursaMark | ||
| 123 | + ? /^[a-zA-Z][0-9]*_$/.test(item) | ||
| 124 | + : /^[a-zA-Z][0-9]*$/.test(item) | ||
| 125 | + ); | ||
| 118 | const ursaInfo = { | 126 | const ursaInfo = { |
| 119 | - ursaMark: ursaMark, // ursa包含/不包含 | 127 | + ursaMark: ursaMark, // Boolean ursa包含/不包含 |
| 120 | - ursa: ursaList, | 128 | + ursa: ursaList, // ursa |
| 121 | - repeat: repeat, | 129 | + repeat: repeat, // Boolean 是否有重复的 |
| 122 | - inUrsa: inUrsa, | 130 | + inUrsa: inUrsa, // Boolean ursa校验 |
| 123 | }; | 131 | }; |
| 124 | - }, | 132 | + // ursa包含 |
| 125 | - // 包含 | 133 | + if (ursaMark && ursaInfo.repeat) { |
| 126 | - includeUrsa() { | ||
| 127 | - // 分隔字符串并且转数组&去除数组空字符串 | ||
| 128 | - let inUrsa = this.queryForm.includeUrsa | ||
| 129 | - .split(";") | ||
| 130 | - .filter((str) => str !== ""); | ||
| 131 | - let repeat = new Set(inUrsa).size !== inUrsa.length; | ||
| 132 | - if (repeat) { | ||
| 133 | this.ursaError = "填写的Ursa已重复"; | 134 | this.ursaError = "填写的Ursa已重复"; |
| 134 | - this.validateForm = false; | ||
| 135 | - } else { | ||
| 136 | - this.ursaError = ""; | ||
| 137 | - this.validateForm = true; | ||
| 138 | } | 135 | } |
| 139 | - // 校验开头以字母开头下划线结尾的/^[a-zA-Z]*;$/ | 136 | + if (ursaMark && !ursaInfo.inUrsa) { |
| 140 | - let _inUrsa = inUrsa.every((item) => /^[a-zA-Z][0-9]*_$/.test(item)); | ||
| 141 | - if (!_inUrsa) { | ||
| 142 | this.ursaError = "Ursa包含之间用分号分隔,例:P2_;P3_;P_"; | 137 | this.ursaError = "Ursa包含之间用分号分隔,例:P2_;P3_;P_"; |
| 143 | - this.validateForm = false; | ||
| 144 | } | 138 | } |
| 145 | - if (!repeat && _inUrsa) { | 139 | + if (ursaMark && !ursaInfo.repeat && ursaInfo.inUrsa) { |
| 146 | this.ursaError = ""; | 140 | this.ursaError = ""; |
| 147 | - this.validateForm = true; | ||
| 148 | } | 141 | } |
| 149 | - console.log("包含:", this.validateForm); | 142 | + // ursa不包含; |
| 150 | - }, | 143 | + if (!ursaMark && ursaInfo.repeat) { |
| 151 | - | ||
| 152 | - // 不包含 | ||
| 153 | - notIncludeUrsa() { | ||
| 154 | - // 分隔字符串并且转数组&去除数组空字符串 | ||
| 155 | - let inUrsa = this.queryForm.notIncludeUrsa | ||
| 156 | - .split(";") | ||
| 157 | - .filter((str) => str !== ""); | ||
| 158 | - let repeat = new Set(inUrsa).size !== inUrsa.length; | ||
| 159 | - if (repeat) { | ||
| 160 | this.notUrsaError = "填写的Ursa已重复"; | 144 | this.notUrsaError = "填写的Ursa已重复"; |
| 161 | - this.validateForm = false; | ||
| 162 | - } else { | ||
| 163 | - this.notUrsaError = ""; | ||
| 164 | - this.validateForm = true; | ||
| 165 | } | 145 | } |
| 166 | - // 校验开头以字母开头的/^[a-zA-Z]*;$/ | 146 | + if (!ursaMark && !ursaInfo.inUrsa) { |
| 167 | - let _inUrsa = inUrsa.every((item) => /^[a-zA-Z][0-9]*$/.test(item)); | ||
| 168 | - if (!_inUrsa) { | ||
| 169 | this.notUrsaError = "Ursa不包含之间用分号分隔,例:P2;P3;P"; | 147 | this.notUrsaError = "Ursa不包含之间用分号分隔,例:P2;P3;P"; |
| 170 | - this.validateForm = false; | ||
| 171 | } | 148 | } |
| 172 | - if (!repeat && _inUrsa) { | 149 | + if (!ursaMark && !ursaInfo.repeat && ursaInfo.inUrsa) { |
| 173 | this.notUrsaError = ""; | 150 | this.notUrsaError = ""; |
| 151 | + } | ||
| 152 | + // 两则都为空时则校验通过 | ||
| 153 | + if ( | ||
| 154 | + (this.ursaError && this.notUrsaError) || | ||
| 155 | + this.ursaError || | ||
| 156 | + this.notUrsaError | ||
| 157 | + ) { | ||
| 158 | + this.validateForm = false; | ||
| 159 | + } else { | ||
| 174 | this.validateForm = true; | 160 | this.validateForm = true; |
| 175 | } | 161 | } |
| 176 | - console.log("不包含:", this.validateForm); | 162 | + }, |
| 163 | + // 包含 | ||
| 164 | + includeUrsa() { | ||
| 165 | + let { includeUrsa } = this.queryForm; | ||
| 166 | + this.validateUrsa(true, includeUrsa); | ||
| 167 | + }, | ||
| 168 | + // 不包含 | ||
| 169 | + notIncludeUrsa() { | ||
| 170 | + let { notIncludeUrsa } = this.queryForm; | ||
| 171 | + this.validateUrsa(false, notIncludeUrsa); | ||
| 177 | }, | 172 | }, |
| 178 | }, | 173 | }, |
| 179 | }; | 174 | }; | ... | ... |
-
Please register or login to post a comment