فهرست منبع

修改正则校验

sqg 3 سال پیش
والد
کامیت
f5d33bb758
1فایلهای تغییر یافته به همراه23 افزوده شده و 23 حذف شده
  1. 23 23
      front-vue/src/views/service/rel/companyRel.vue

+ 23 - 23
front-vue/src/views/service/rel/companyRel.vue

@@ -344,9 +344,9 @@
               allow-create
               clearable
               @clear="clearRemote"
+              @change="choice"
               remote
               reserve-keyword
-              @change="choice"
               placeholder="请输入关键词"
               :remote-method="remoteMethod"
               >
@@ -354,7 +354,7 @@
                 v-for="item in companyList"
                 :key="item.value"
                 :label="item.label"
-                :value="item.value">
+                :value="item.label">
               </el-option>
             </el-select>
         </el-form-item>
@@ -592,7 +592,7 @@ export default {
         scyName: [
           { required: true, message: "企业名称不能为空", trigger: ["blur", "change"] },
           {
-            pattern: /^[\u4E00-\u9FFF0-9A-Z《》()()]+$/,
+            pattern: /^[0-9A-Z\u4E00-\u9FFF《》()()]+$/,
             message: "企业名称不能带有特殊字符",
             trigger: ["blur","change"]
           }
@@ -617,7 +617,7 @@ export default {
         scySocialCode: [
           { required: true, message: "企业统一代码不能为空", trigger: "blur"},
           {
-            pattern: /^([0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}|[1-9]\d{14})||([1-9]\d{15})$/,
+            pattern: /^([0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}|[1-9]\d{14})$/,
             message: "企业统一代码格式不正确",
             trigger: ["blur","change"]
           }
@@ -823,24 +823,23 @@ export default {
 
     //选择企业后反显
     choice(item){
-      debugger
-        let scyId = item;
+      if (item) {
+        let scyId;
+        for (var company of this.companyList) {
+          if (company.label == item) {
+            scyId = company.value;
+            break;
+          }
+        }
         if(scyId){
             listCompanyQuery(scyId).then(response => {
-                if(response.data.length > 0){
+              if(response.data.length > 0){
+                this.$set(this.form, "scyName", response.data[0].scyName);
                 this.$set(this.form, "scySocialCode", response.data[0].scySocialCode);
-                }else{
-                this.$set(this.form, "scySocialCode", '');
-                }
-                if(response.data.length > 0){
-                this.$set(this.form, "scyId", response.data[0].scyId);
-                this.idShow = true;
-                }else{
-                this.$set(this.form, "scyId", '');
-                this.idShow = false;
-                }
+              }
             })
         }
+      }
     },
 
     // 取消按钮
@@ -931,13 +930,14 @@ submitForm() {
             spinner: "el-icon-loading",
             background: "rgba(0, 0, 0, 0.7)",
           })
-          for (var company of this.companyList) {
-            if (company.value == self.form.scyId) {
-              self.form.scyName = company.label;
-              break;
-            }
-          }
+          // for (var company of this.companyList) {
+          //   if (company.value == self.form.scyId) {
+          //     self.form.scyName = company.label;
+          //     break;
+          //   }
+          // }
           console.log(self.form,"提交表单")
+          debugger
           addRel(self.form).then(response => {
             this.msgSuccess("新增成功");
             loading.close();