Showing
3 changed files
with
66 additions
and
32 deletions
| ... | @@ -7,7 +7,7 @@ export const inputBlurValidate = { | ... | @@ -7,7 +7,7 @@ export const inputBlurValidate = { |
| 7 | minNumOfPieces: "", | 7 | minNumOfPieces: "", |
| 8 | maxNumOfPieces: "", | 8 | maxNumOfPieces: "", |
| 9 | }, | 9 | }, |
| 10 | - validateForm: true, | 10 | + validateForm: true, // form表单节流阀 |
| 11 | }; | 11 | }; |
| 12 | }, | 12 | }, |
| 13 | methods: { | 13 | methods: { | ... | ... |
| ... | @@ -237,6 +237,7 @@ | ... | @@ -237,6 +237,7 @@ |
| 237 | :disabled="!getRouter" | 237 | :disabled="!getRouter" |
| 238 | @blur="includeUrsa" | 238 | @blur="includeUrsa" |
| 239 | ></el-input> | 239 | ></el-input> |
| 240 | + <span v-text="ursaError" class="el-form-item__error"></span> | ||
| 240 | </el-form-item> | 241 | </el-form-item> |
| 241 | </el-col> | 242 | </el-col> |
| 242 | <el-col :span="14"> | 243 | <el-col :span="14"> |
| ... | @@ -265,6 +266,7 @@ | ... | @@ -265,6 +266,7 @@ |
| 265 | :disabled="!getRouter" | 266 | :disabled="!getRouter" |
| 266 | @blur="notIncludeUrsa" | 267 | @blur="notIncludeUrsa" |
| 267 | ></el-input> | 268 | ></el-input> |
| 269 | + <span class="el-form-item__error" v-text="notUrsaError" style="width: 50%; margin-left: 28%"></span> | ||
| 268 | </el-col> | 270 | </el-col> |
| 269 | </el-form-item> | 271 | </el-form-item> |
| 270 | </el-col> | 272 | </el-col> |
| ... | @@ -467,7 +469,7 @@ export default { | ... | @@ -467,7 +469,7 @@ export default { |
| 467 | minCustomVal: "", // 人民币最小申报值 | 469 | minCustomVal: "", // 人民币最小申报值 |
| 468 | maxCustomVal: "", // 人民币最大申报值 | 470 | maxCustomVal: "", // 人民币最大申报值 |
| 469 | minUsdCustomVal: "", // 美元最小申报值 | 471 | minUsdCustomVal: "", // 美元最小申报值 |
| 470 | - maxUsdCustomVal: "" // 美元最大申报值 | 472 | + maxUsdCustomVal: "", // 美元最大申报值 |
| 471 | }, | 473 | }, |
| 472 | tableAttr: tableAttr, // table配置项 | 474 | tableAttr: tableAttr, // table配置项 |
| 473 | tableData: [], // ET86配舱航班顺位 | 475 | tableData: [], // ET86配舱航班顺位 |
| ... | @@ -499,9 +501,9 @@ export default { | ... | @@ -499,9 +501,9 @@ export default { |
| 499 | }, | 501 | }, |
| 500 | created() { | 502 | created() { |
| 501 | this.getAllDictData(); // 获取全部字典 | 503 | this.getAllDictData(); // 获取全部字典 |
| 502 | - if (this.$route.query.name == "view"){ | 504 | + if (this.$route.query.name == "view") { |
| 503 | tableAttr.isDragSort = false; | 505 | tableAttr.isDragSort = false; |
| 504 | - }else{ | 506 | + } else { |
| 505 | tableAttr.isDragSort = true; | 507 | tableAttr.isDragSort = true; |
| 506 | } | 508 | } |
| 507 | if (this.$route.query.name == "view" || this.$route.query.name == "edit") { | 509 | if (this.$route.query.name == "view" || this.$route.query.name == "edit") { |
| ... | @@ -581,11 +583,11 @@ export default { | ... | @@ -581,11 +583,11 @@ export default { |
| 581 | this.checkboxClassType = []; | 583 | this.checkboxClassType = []; |
| 582 | } | 584 | } |
| 583 | // 服务种类 | 585 | // 服务种类 |
| 584 | - if(data.list.fltRuleDto.includeServiceType){ | 586 | + if (data.list.fltRuleDto.includeServiceType) { |
| 585 | this.isServiceCode = "1"; | 587 | this.isServiceCode = "1"; |
| 586 | - }else if(data.list.fltRuleDto.notIncludeServiceType){ | 588 | + } else if (data.list.fltRuleDto.notIncludeServiceType) { |
| 587 | this.isServiceCode = "2"; | 589 | this.isServiceCode = "2"; |
| 588 | - }else{ | 590 | + } else { |
| 589 | this.isServiceCode = "1"; | 591 | this.isServiceCode = "1"; |
| 590 | } | 592 | } |
| 591 | this.queryForm = data.list.fltRuleDto; // ET86配舱航班顺位维度 | 593 | this.queryForm = data.list.fltRuleDto; // ET86配舱航班顺位维度 |
| ... | @@ -731,9 +733,9 @@ export default { | ... | @@ -731,9 +733,9 @@ export default { |
| 731 | submitForm(formName) { | 733 | submitForm(formName) { |
| 732 | this.$refs[formName].validate((valid) => { | 734 | this.$refs[formName].validate((valid) => { |
| 733 | if (valid) { | 735 | if (valid) { |
| 734 | - this.tableData.map((item,i)=>{ | 736 | + this.tableData.map((item, i) => { |
| 735 | - item.priority = ++i | 737 | + item.priority = ++i; |
| 736 | - }) | 738 | + }); |
| 737 | // 爆仓是否继续配舱 | 739 | // 爆仓是否继续配舱 |
| 738 | const newtTableData = JSON.parse(JSON.stringify(this.tableData)); | 740 | const newtTableData = JSON.parse(JSON.stringify(this.tableData)); |
| 739 | const tableData = newtTableData; | 741 | const tableData = newtTableData; |
| ... | @@ -762,9 +764,9 @@ export default { | ... | @@ -762,9 +764,9 @@ export default { |
| 762 | return; | 764 | return; |
| 763 | } | 765 | } |
| 764 | // 服务种类包含不包含二选一 | 766 | // 服务种类包含不包含二选一 |
| 765 | - if(this.isServiceCode == "1"){ | 767 | + if (this.isServiceCode == "1") { |
| 766 | this.queryForm.notIncludeServiceType = ""; | 768 | this.queryForm.notIncludeServiceType = ""; |
| 767 | - }else{ | 769 | + } else { |
| 768 | this.queryForm.includeServiceType = ""; | 770 | this.queryForm.includeServiceType = ""; |
| 769 | } | 771 | } |
| 770 | let parmas = { | 772 | let parmas = { | ... | ... |
| 1 | import { debounce } from "@/utils"; | 1 | import { debounce } from "@/utils"; |
| 2 | export default { | 2 | export default { |
| 3 | + data() { | ||
| 4 | + return { | ||
| 5 | + ursaError: "", // URSA包含校验提示语 | ||
| 6 | + notUrsaError: "", // URSA包含校验提示语 | ||
| 7 | + validateForm: true, // form表单节流阀 | ||
| 8 | + }; | ||
| 9 | + }, | ||
| 3 | directives: { | 10 | directives: { |
| 4 | // 处理加减天数 | 11 | // 处理加减天数 |
| 5 | "input-filter": { | 12 | "input-filter": { |
| ... | @@ -105,29 +112,54 @@ export default { | ... | @@ -105,29 +112,54 @@ export default { |
| 105 | }, | 112 | }, |
| 106 | // 不包含 | 113 | // 不包含 |
| 107 | includeUrsa() { | 114 | includeUrsa() { |
| 108 | - let inUrsa = this.queryForm.includeUrsa.split(";"); | 115 | + // 分隔字符串并且转数组&去除数组空字符串 |
| 109 | - // 校验开头以字母开头下划线结尾的 | 116 | + let inUrsa = this.queryForm.includeUrsa |
| 110 | - // let _inUrsa = inUrsa.every((item) => { | 117 | + .split(";") |
| 111 | - // if (item) { | 118 | + .filter((str) => str !== ""); |
| 112 | - // return /^[a-zA-Z]*_$/.test(item); | 119 | + let repeat = new Set(inUrsa).size !== inUrsa.length; |
| 113 | - // } | 120 | + if (repeat) { |
| 114 | - // }); | 121 | + this.ursaError = "填写的Ursa已重复"; |
| 115 | - // console.log(_inUrsa); | 122 | + this.validateForm = false; |
| 116 | - | 123 | + this.msgError("填写的Ursa已重复"); |
| 117 | - // function hasDuplicate(arr) { | 124 | + } else { |
| 118 | - // return new Set(arr).size !== arr.length; | 125 | + this.ursaError = ""; |
| 119 | - // } | 126 | + this.validateForm = true; |
| 120 | - | 127 | + } |
| 121 | - /* | 128 | + // 校验开头以字母开头下划线结尾的/^[a-zA-Z]*;$/ |
| 122 | - 使用JavaScript写一个只能开头以字母开头下划线和分号结尾的正则表达式; | 129 | + let _inUrsa = inUrsa.every((item) => /^[a-zA-Z][0-9]*_$/.test(item)); |
| 123 | - 使用JavaScript写一个判断数组中有重复的字符返回true, | 130 | + if (!_inUrsa) { |
| 124 | - */ | 131 | + this.ursaError = "Ursa包含之间用分号分隔,例:P2_;P3_;P_"; |
| 125 | - // 要有下划线且不能出现重复的 | 132 | + this.validateForm = false; |
| 126 | - // console.log(this.queryForm.includeUrsa.split(";")); | 133 | + } |
| 134 | + if (!repeat && _inUrsa) { | ||
| 135 | + this.ursaError = ""; | ||
| 136 | + this.validateForm = true; | ||
| 137 | + } | ||
| 127 | }, | 138 | }, |
| 128 | // 不包含 | 139 | // 不包含 |
| 129 | notIncludeUrsa() { | 140 | notIncludeUrsa() { |
| 130 | - // 不要有下划线且不能出现重复的 | 141 | + // 分隔字符串并且转数组&去除数组空字符串 |
| 142 | + let inUrsa = this.queryForm.notIncludeUrsa | ||
| 143 | + .split(";") | ||
| 144 | + .filter((str) => str !== ""); | ||
| 145 | + let repeat = new Set(inUrsa).size !== inUrsa.length; | ||
| 146 | + if (repeat) { | ||
| 147 | + this.notUrsaError = "填写的Ursa已重复"; | ||
| 148 | + this.validateForm = false; | ||
| 149 | + } else { | ||
| 150 | + this.notUrsaError = ""; | ||
| 151 | + this.validateForm = true; | ||
| 152 | + } | ||
| 153 | + // 校验开头以字母开头的/^[a-zA-Z]*;$/ | ||
| 154 | + let _inUrsa = inUrsa.every((item) => /^[a-zA-Z][0-9]*$/.test(item)); | ||
| 155 | + if (!_inUrsa) { | ||
| 156 | + this.notUrsaError = "Ursa不包含之间用分号分隔,例:P2;P3;P"; | ||
| 157 | + this.validateForm = false; | ||
| 158 | + } | ||
| 159 | + if (!repeat && _inUrsa) { | ||
| 160 | + this.notUrsaError = ""; | ||
| 161 | + this.validateForm = true; | ||
| 162 | + } | ||
| 131 | }, | 163 | }, |
| 132 | }, | 164 | }, |
| 133 | }; | 165 | }; | ... | ... |
-
Please register or login to post a comment