snow 2 سال پیش
والد
کامیت
0dd5463ba4
3فایلهای تغییر یافته به همراه254 افزوده شده و 24 حذف شده
  1. 0 0
      dist/static/js/0.js
  2. 119 8
      src/views/serviceParam/supplier/components/addEdit.vue
  3. 135 16
      src/views/serviceParam/workCompany/addEdit.vue

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
dist/static/js/0.js


+ 119 - 8
src/views/serviceParam/supplier/components/addEdit.vue

@@ -168,7 +168,11 @@
                         placeholder="联系电话"
                         maxlength="100"
                         :disabled="isDetail == '007'"
-                      />
+                      >
+                        <el-select slot="prepend" v-model="currentMobileMode" style="width:120px">
+                          <el-option v-for="opt in options" :key="opt.value" :label="opt.label" :value="opt.value" />
+                        </el-select>
+                      </el-input>
                     </el-form-item>
                   </el-col>
 
@@ -196,7 +200,8 @@
 <script>
 import asyncRequest from '@/apis/service/serviceParam/supplier'
 import resToken from '@/mixins/resToken'
-import { isMobile, isPhone, invTime } from '@/utils/validate'
+import { isMobile, isPhone, invTime, isqz, isqzf, iszf, isz } from '@/utils/validate'
+
 export default {
   name: 'WorkCompany',
   mixins: [resToken],
@@ -214,6 +219,8 @@ export default {
       }
     }
 
+    const basicRule = { required: true, trigger: 'blur' }
+
     return {
       pickerOptions: {
         disabledDate(time) {
@@ -225,6 +232,7 @@ export default {
       loading: false,
       title: '供应商升级业务企业',
       showModelThis: this.showModel,
+      currentMobileMode: '0',
       ruleForm: {
         id: '',
         code: '',
@@ -244,6 +252,98 @@ export default {
         invoice_title: ''
       },
       rulesThis: this.rules,
+      options: [
+        {
+          value: '0',
+          label: '区-固-分',
+          rule: {
+            ...basicRule,
+            validator(rule, value, callback) {
+              if (!value) {
+                return callback(new Error('联系电话不能为空!'))
+              }
+
+              if (!isqzf(value)) {
+                callback(new Error('联系电话格式不正确!'))
+              } else {
+                callback()
+              }
+            }
+          }
+        },
+        {
+          value: '1',
+          label: '区-固',
+          rule: {
+            ...basicRule,
+            validator(rule, value, callback) {
+              if (!value) {
+                return callback(new Error('联系电话不能为空!'))
+              }
+
+              if (!isqz(value)) {
+                callback(new Error('联系电话格式不正确!'))
+              } else {
+                callback()
+              }
+            }
+          }
+        },
+        {
+          value: '2',
+          label: '固-分',
+          rule: {
+            ...basicRule,
+            validator(rule, value, callback) {
+              if (!value) {
+                return callback(new Error('联系电话不能为空!'))
+              }
+
+              if (!iszf(value)) {
+                callback(new Error('联系电话格式不正确!'))
+              } else {
+                callback()
+              }
+            }
+          }
+        },
+        {
+          value: '3',
+          label: '固',
+          rule: {
+            ...basicRule,
+            validator(rule, value, callback) {
+              if (!value) {
+                return callback(new Error('联系电话不能为空!'))
+              }
+
+              if (!isz(value)) {
+                callback(new Error('联系电话格式不正确!'))
+              } else {
+                callback()
+              }
+            }
+          }
+        },
+        {
+          value: '4',
+          label: '手机号',
+          rule: {
+            ...basicRule,
+            validator(rule, value, callback) {
+              if (!value) {
+                return callback(new Error('联系电话不能为空!'))
+              }
+
+              if (!isMobile(value)) {
+                callback(new Error('联系电话格式不正确!'))
+              } else {
+                callback()
+              }
+            }
+          }
+        }
+      ],
       rules: {
         inv_bank: [
           {
@@ -260,13 +360,21 @@ export default {
           }
         ],
 
-        mobile: [
-          {
-            required: true,
-            validator: validatemobile,
-            trigger: 'blur'
+        mobile: [{
+          ...basicRule,
+          validator(rule, value, callback) {
+            if (!value) {
+              return callback(new Error('联系电话不能为空!'))
+            }
+
+            if (!isqzf(value)) {
+              callback(new Error('联系电话格式不正确!'))
+            } else {
+              callback()
+            }
           }
-        ],
+        }],
+
         inv_addr: [{ required: true, message: '联系地址不能为空!', trigger: 'blur' }],
         invoice_title: [{ required: true, message: '公司抬头不能为空', trigger: 'blur' }]
       }
@@ -283,6 +391,9 @@ export default {
       if (!val) {
         this.$emit('cancel')
       }
+    },
+    currentMobileMode() {
+      this.$set(this.rulesThis.mobile, '0', this.options[this.currentMobileMode].rule)
     }
   },
   methods: {

+ 135 - 16
src/views/serviceParam/workCompany/addEdit.vue

@@ -177,7 +177,11 @@
                         placeholder="联系电话"
                         maxlength="100"
                         :disabled="isDetail == '007'"
-                      />
+                      >
+                        <el-select slot="prepend" v-model="currentMobileMode" style="width:120px">
+                          <el-option v-for="opt in options" :key="opt.value" :label="opt.label" :value="opt.value" />
+                        </el-select>
+                      </el-input>
                     </el-form-item>
                   </el-col>
 
@@ -205,23 +209,25 @@
 <script>
 import asyncRequest from '@/apis/service/serviceParam/workCompany'
 import resToken from '@/mixins/resToken'
-import { isMobile, isPhone, invTime } from '@/utils/validate'
+import { isMobile, isPhone, invTime, isqzf, isqz, iszf, isz } from '@/utils/validate'
 export default {
   name: 'WorkCompany',
   mixins: [resToken],
   props: ['showModel', 'id', 'isDetail'],
   data() {
-    const validatemobile = (rule, value, callback) => {
-      if (value !== '') {
-        if (isPhone(value) || isMobile(value)) {
-          callback()
-        } else {
-          callback(new Error('联系电话格式不正确!'))
-        }
-      } else {
-        callback(new Error('联系电话不能为空!'))
-      }
-    }
+    // const validatemobile = (rule, value, callback) => {
+    //   if (value !== '') {
+    //     if (isPhone(value) || isMobile(value)) {
+    //       callback()
+    //     } else {
+    //       callback(new Error('联系电话格式不正确!'))
+    //     }
+    //   } else {
+    //     callback(new Error('联系电话不能为空!'))
+    //   }
+    // }
+
+    const basicRule = { required: true, trigger: 'blur' }
 
     return {
       pickerOptions: {
@@ -229,6 +235,7 @@ export default {
           return time.getTime() >= Date.now()
         }
       },
+      currentMobileMode: '0',
       supplier_name: '',
       accountNames: '',
       loading: false,
@@ -252,6 +259,102 @@ export default {
         invoice_title: ''
       },
       rulesThis: this.rules,
+      options: [
+        {
+          value: '0',
+          label: '区-固-分',
+          rule: {
+            ...basicRule,
+            validator(rule, value, callback) {
+              if (!value) {
+                return callback(new Error('联系电话不能为空!'))
+              }
+
+              if (!isqzf(value)) {
+                callback(new Error('联系电话格式不正确!'))
+              } else {
+                callback()
+                return true
+              }
+            }
+          }
+        },
+        {
+          value: '1',
+          label: '区-固',
+          rule: {
+            ...basicRule,
+            validator(rule, value, callback) {
+              if (!value) {
+                return callback(new Error('联系电话不能为空!'))
+              }
+
+              if (!isqz(value)) {
+                callback(new Error('联系电话格式不正确!'))
+              } else {
+                callback()
+                return true
+              }
+            }
+          }
+        },
+        {
+          value: '2',
+          label: '固-分',
+          rule: {
+            ...basicRule,
+            validator(rule, value, callback) {
+              if (!value) {
+                return callback(new Error('联系电话不能为空!'))
+              }
+
+              if (!iszf(value)) {
+                callback(new Error('联系电话格式不正确!'))
+              } else {
+                callback()
+              }
+            }
+          }
+        },
+        {
+          value: '3',
+          label: '固',
+          rule: {
+            ...basicRule,
+            validator(rule, value, callback) {
+              if (!value) {
+                return callback(new Error('联系电话不能为空!'))
+              }
+
+              if (!isz(value)) {
+                callback(new Error('联系电话格式不正确!'))
+              } else {
+                callback()
+                return true
+              }
+            }
+          }
+        },
+        {
+          value: '4',
+          label: '手机号',
+          rule: {
+            ...basicRule,
+            validator(rule, value, callback) {
+              if (!value) {
+                callback(new Error('联系电话不能为空!'))
+              }
+
+              if (!isMobile(value)) {
+                callback(new Error('联系电话格式不正确!'))
+              } else {
+                callback()
+                return true
+              }
+            }
+          }
+        }
+      ],
       rules: {
         inv_bank: [
           {
@@ -270,9 +373,19 @@ export default {
 
         mobile: [
           {
-            required: true,
-            validator: validatemobile,
-            trigger: 'blur'
+            ...basicRule,
+            validator(rule, value, callback) {
+              if (!value) {
+                return callback(new Error('联系电话不能为空!'))
+              }
+
+              if (!isqzf(value)) {
+                callback(new Error('联系电话格式不正确!'))
+              } else {
+                callback()
+                return true
+              }
+            }
           }
         ],
         invoice_title: [{ required: true, message: '公司抬头不能为空!', trigger: 'blur' }],
@@ -291,6 +404,9 @@ export default {
       if (!val) {
         this.$emit('cancel')
       }
+    },
+    currentMobileMode() {
+      this.$set(this.rulesThis.mobile, '0', this.options[this.currentMobileMode].rule)
     }
   },
   methods: {
@@ -342,6 +458,9 @@ export default {
           invoice_title
         } = res.data
 
+        const index = this.options.findIndex(({ rule }) => rule.validator('', mobile, () => {}))
+        this.currentMobileMode = String(index)
+
         this.ruleForm = {
           id: id || '',
           company: company || '', // 公司名称

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است