From ea982ec3f7877f648248e16ab8560b47f549c8f6 Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期二, 23 一月 2024 15:05:21 +0800
Subject: [PATCH] 添加新删除

---
 src/views/login/register.vue |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/src/views/login/register.vue b/src/views/login/register.vue
index 424a92e..13e8778 100644
--- a/src/views/login/register.vue
+++ b/src/views/login/register.vue
@@ -481,10 +481,22 @@
 import {isNameExist, isNumberExist, register} from "../../api/login";
 import {getCityListData, getProvinceListData} from "../../api/area";
 import {parseError} from "../../utils/messageDialog";
+import {validEnterName} from "../../utils/validate";
 
 export default {
     name: "register",
     data(){
+        let checkEnterName = (rule, value, callback)=>{
+            if(value === ''){
+                callback(new Error('请填写企业名称'))
+            }else{
+                if(!validEnterName(value)){
+                    callback(new Error('名称不能包含中文括号'))
+                }else{
+                    callback()
+                }
+            }
+        }
         return{
             showNumber:false,
             showName:false,
@@ -524,7 +536,7 @@
             safetyProduction:[],
             rules:{
                 enterprisename:[
-                    { required: true, message: '请填写企业名称', trigger: 'blur' },
+                    { required: true, validator: checkEnterName,  trigger: 'blur' },
                 ],
                 enterprisenumber:[
                     { required: true, message: '请填写终端机用户名', trigger: 'blur' },
@@ -656,7 +668,8 @@
         async submit(){
             this.$refs["ruleForm"].validate((valid) =>{
                 if(valid){
-                    if(this.registerForm.type === '烟花爆竹生产' && this.businessLicense.length !== 0 && this.idCard.length !== 0 && this.legalPerson.length !== 0 && this.operationQualification.length !== 0 && this.escortCompany.length !== 0 && this.insurance.length !==0){
+                    // console.log(this.registerForm.type,'type',this.businessLicense, this.idCard,this.legalPerson,this.operationQualification,this.escortCompany,this.insurance)
+                    if(this.registerForm.type === '烟花爆竹生产'){
                         this.businessLicense = this.businessLicense.map((item,index,arr) =>{
                             return item.raw
                         },this.businessLicense)
@@ -733,7 +746,7 @@
                         }).catch(error => {
                             parseError({error: error, vm: this})
                         })
-                    }else if(this.registerForm.type === '烟花爆竹批发经营'&&  this.businessLicense.length !== 0 && this.idCard.length !== 0 && this.legalPerson.length !== 0 && this.operationQualification.length !== 0 && this.escortCompany.length !== 0 && this.insurance.length !== 0 && this.safetyProduction.length !== 0){
+                    }else if(this.registerForm.type === '烟花爆竹批发经营'){
                         this.businessLicense = this.businessLicense.map((item,index,arr) =>{
                             return item.raw
                         },this.businessLicense)
@@ -810,7 +823,7 @@
                         }).catch(error => {
                             parseError({error: error, vm: this})
                         })
-                    }else if(this.registerForm.type === '烟花爆竹零售经营(长期)' && this.businessLicense.length !== 0 && this.idCard.length !== 0 && this.legalPerson.length !== 0 && this.insurance.length !== 0){
+                    }else if(this.registerForm.type === '烟花爆竹零售经营(长期)'){
                         this.businessLicense = this.businessLicense.map((item,index,arr) =>{
                             return item.raw
                         },this.businessLicense)
@@ -887,7 +900,7 @@
                         }).catch(error => {
                             parseError({error: error, vm: this})
                         })
-                    }else if(this.registerForm.type==='烟花爆竹零售经营(短期)' && this.idCard.length !== 0 && this.legalPerson.length !== 0 && this.insurance.length !== 0){
+                    }else if(this.registerForm.type==='烟花爆竹零售经营(短期)'){
                         this.businessLicense = this.businessLicense.map((item,index,arr) =>{
                             return item.raw
                         },this.businessLicense)

--
Gitblit v1.9.2