Browse Source

娄浩给的bug文件

East 4 years ago
parent
commit
699aa75b26
2 changed files with 21 additions and 23 deletions
  1. 19 22
      src/views/modules/basicdata/branch.vue
  2. 2 1
      src/views/modules/pigfarm/pfperson.vue

+ 19 - 22
src/views/modules/basicdata/branch.vue

@@ -478,14 +478,21 @@ export default {
       // 只允许中文、英文、数字、-、_的输入,取反
       const reg = /[^\w\u4E00-\u9FA5\_\-]/g
       if (reg.test(this.form.name)) {
-        return 1
+        return 0
       }
       if (reg.test(this.form.manager)) {
-        return 2
+        return 1
       }
       // 只允许中文、英文、下划线、!、!的输入
       const a = /[^\w\u4E00-\u9FA5\!\!]/g
       if (a.test(this.form.location2)) {
+        return 2
+      }
+      // 不允许纯数字、字母的出现
+      const b = /^[\w]*([a-zA-Z][0-9]|[0-9][a-zA-Z])[\w]*$/
+      // 不允许纯符号的出现
+      const c = /^[\_\-\!\!]*[\_\-\!\!]*$/
+      if (b.test(this.form.name) || b.test(this.form.manager) || b.test(this.form.location2) || c.test(this.form.name) || c.test(this.form.manager) || c.test(this.form.location2)) {
         return 3
       }
       // 建立日期不得大于今日
@@ -495,31 +502,21 @@ export default {
         console.log('建立日期有误');
         return 4
       }
-      return 0
+      return 5
     },
     // 如不合法,则提示
     confirmInput () {
-      if (this.validInput() === 0) {
+      if (this.validInput() === 5) {
         return true
       }
-      let msg = ''
-      switch (this.validInput()) {
-        case 1:
-          msg = '牧场名称只允许中英文、数字、-、_的输入'
-          break;
-        case 2:
-          msg = '管理员只允许中英文、数字、-、_的输入'
-          break;
-        case 3:
-          msg = '具体地址只允许中英文、数字、_、!与!的输入'
-          break;
-        case 4:
-          msg = '建立日期选择有误'
-          break;
-        default:
-          break;
-      }
-      this.$confirm(msg, '提示', {
+      let msg = [
+        '牧场名称只允许中英文、数字、-、_的输入',
+        '管理员只允许中英文、数字、-、_的输入',
+        '具体地址只允许中英文、数字、_、!与!的输入',
+        '不允许输入纯数字、纯字母或纯符号',
+        '建立日期选择有误'
+      ]
+      this.$confirm(msg[this.validInput()], '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'

+ 2 - 1
src/views/modules/pigfarm/pfperson.vue

@@ -7,7 +7,7 @@
       <el-form-item>
         <el-input
           v-model="dataForm.key"
-          placeholder="用户名/用户操作"
+          placeholder="关键字"
           clearable
         ></el-input>
       </el-form-item>
@@ -296,6 +296,7 @@ export default {
           method: 'post',
           data: this.$http.adornData({
             id: this.form.id,
+            name: this.form.name,
             position: this.form.position,
             approachTime: this.form.approachTime,
             departureTime: this.form.departureTime,