From 3accb1e683ca63b3c1903a9bad72f0cf804dd270 Mon Sep 17 00:00:00 2001 From: "277151821@qq.com" <277151821@qq.com> Date: Wed, 6 Mar 2024 12:02:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A7=E8=BF=90=E6=8C=82=E8=BD=A6=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../freight_trailer/add.vue | 69 ++++++++++++++----- .../freight_trailer/edit.vue | 69 ++++++++++++++----- .../freight_trailer/view.vue | 6 +- 3 files changed, 105 insertions(+), 39 deletions(-) diff --git a/src/views/enterprise_management/basics_info_management/freight_trailer/add.vue b/src/views/enterprise_management/basics_info_management/freight_trailer/add.vue index 89f48bb..7116c6d 100644 --- a/src/views/enterprise_management/basics_info_management/freight_trailer/add.vue +++ b/src/views/enterprise_management/basics_info_management/freight_trailer/add.vue @@ -7,32 +7,32 @@ - + - + - + - + - + - + @@ -42,22 +42,22 @@ - + - + - + - + @@ -95,27 +95,27 @@ - + - + - + - + - + @@ -124,6 +124,7 @@ v-model="form.NOTES" type="textarea" :autosize="{ minRows: 3 }" + maxlength="250" show-word-limit /> @@ -223,14 +224,46 @@ OPER_CERTIFICATE_IMG:[], TRAILER_INFO:[], }); + const isVehicleNumber = (rule, vehicleNumber, callback)=>{ + if(vehicleNumber){ + var xreg=/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/; + var creg=/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/; + if(vehicleNumber.length === 7){ + if(creg.test(vehicleNumber)===false){callback(new Error("格式错误"))}else callback(); + } else if(vehicleNumber.length === 8){ + if(xreg.test(vehicleNumber)===false){callback(new Error("格式错误"))}else callback(); + } else{ + callback(new Error("格式错误")) + } + }else callback(); + + } const rules = { - PLATE_NUMBER: [{ required: true, message: "请输入", trigger: "blur" }], + PLATE_NUMBER: [ + { required: true, message: "请输入", trigger: "blur" }, + { validator: isVehicleNumber, trigger: "blur" }, + ], VIN: [{ required: true, message: "请输入", trigger: "blur" }], TRAILER_TYPE: [{ required: true, message: "请输入", trigger: "blur" }], CAR_OWNERS: [{ required: true, message: "请输入", trigger: "blur" }], - CAR_OWNERS_TEL: [{ required: true, message: "请输入", trigger: "blur" }], + CAR_OWNERS_TEL: [ + { required: true, message: "请输入", trigger: "blur" }, + { min: 11, max: 11, message: "请输入11位手机号码", trigger: "blur" }, + { + pattern: + /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/, + message: "请输入正确的手机号码", + }, + ], CONTACTS: [{ required: true, message: "请输入", trigger: "blur" }], - CONTACT_PHONE: [{ required: true, message: "请输入", trigger: "blur" }], + CONTACT_PHONE: [ + { required: true, message: "请输入", trigger: "blur" }, + { min: 11, max: 11, message: "请输入11位手机号码", trigger: "blur" }, + { + pattern: + /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/, + message: "请输入正确的手机号码", + },], INITIAL_REGISTRATION_DATE: [{ required: true, message: "请输入", trigger: "blur" }], } const fnGetData = async () => { diff --git a/src/views/enterprise_management/basics_info_management/freight_trailer/edit.vue b/src/views/enterprise_management/basics_info_management/freight_trailer/edit.vue index 89f48bb..384a3e2 100644 --- a/src/views/enterprise_management/basics_info_management/freight_trailer/edit.vue +++ b/src/views/enterprise_management/basics_info_management/freight_trailer/edit.vue @@ -7,32 +7,32 @@ - + - + - + - + - + - + @@ -42,22 +42,22 @@ - + - + - + - + @@ -95,27 +95,27 @@ - + - + - + - + - + @@ -124,6 +124,7 @@ v-model="form.NOTES" type="textarea" :autosize="{ minRows: 3 }" + maxlength="250" show-word-limit /> @@ -223,14 +224,46 @@ OPER_CERTIFICATE_IMG:[], TRAILER_INFO:[], }); + const isVehicleNumber = (rule, vehicleNumber, callback)=>{ + if(vehicleNumber){ + var xreg=/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/; + var creg=/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/; + if(vehicleNumber.length === 7){ + if(creg.test(vehicleNumber)===false){callback(new Error("格式错误"))}else callback(); + } else if(vehicleNumber.length === 8){ + if(xreg.test(vehicleNumber)===false){callback(new Error("格式错误"))}else callback(); + } else{ + callback(new Error("格式错误")) + } + }else callback(); + + } const rules = { - PLATE_NUMBER: [{ required: true, message: "请输入", trigger: "blur" }], + PLATE_NUMBER: [ + { required: true, message: "请输入", trigger: "blur" }, + { validator: isVehicleNumber, trigger: "blur" }, + ], VIN: [{ required: true, message: "请输入", trigger: "blur" }], TRAILER_TYPE: [{ required: true, message: "请输入", trigger: "blur" }], CAR_OWNERS: [{ required: true, message: "请输入", trigger: "blur" }], - CAR_OWNERS_TEL: [{ required: true, message: "请输入", trigger: "blur" }], + CAR_OWNERS_TEL: [ + { required: true, message: "请输入", trigger: "blur" }, + { min: 11, max: 11, message: "请输入11位手机号码", trigger: "blur" }, + { + pattern: + /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/, + message: "请输入正确的手机号码", + }, + ], CONTACTS: [{ required: true, message: "请输入", trigger: "blur" }], - CONTACT_PHONE: [{ required: true, message: "请输入", trigger: "blur" }], + CONTACT_PHONE: [ + { required: true, message: "请输入", trigger: "blur" }, + { min: 11, max: 11, message: "请输入11位手机号码", trigger: "blur" }, + { + pattern: + /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/, + message: "请输入正确的手机号码", + },], INITIAL_REGISTRATION_DATE: [{ required: true, message: "请输入", trigger: "blur" }], } const fnGetData = async () => { diff --git a/src/views/enterprise_management/basics_info_management/freight_trailer/view.vue b/src/views/enterprise_management/basics_info_management/freight_trailer/view.vue index e4c689b..d87b8e8 100644 --- a/src/views/enterprise_management/basics_info_management/freight_trailer/view.vue +++ b/src/views/enterprise_management/basics_info_management/freight_trailer/view.vue @@ -21,9 +21,9 @@ {{ info.OPER_CERTIFICATE_NUM }} - - {{ info.TRANSPORT_ENTERPRISESNAME }} - + + + {{ info.DEPARTMENT_NAME }}