Browse Source

:sparkles: Introducing new features. 客户端录入去重判断

冷冷 5 years ago
parent
commit
676a7d2bd3
2 changed files with 10 additions and 6 deletions
  1. 5 2
      src/const/crud/admin/client.js
  2. 5 4
      src/views/admin/client/index.vue

+ 5 - 2
src/const/crud/admin/client.js

@@ -28,9 +28,12 @@ const DIC = {
 
 
 var validateClient = (rule, value, callback) => {
 var validateClient = (rule, value, callback) => {
   getObj(value).then(response => {
   getObj(value).then(response => {
-    if (window.boxType === 'edit') callback()
+    if (window.boxType === 'edit') {
+      return callback()
+    }
     const result = response.data.data
     const result = response.data.data
-    if (result.length !==0) {
+    debugger
+    if (result.length !== 0) {
       callback(new Error('客户端已存在'))
       callback(new Error('客户端已存在'))
     } else {
     } else {
       callback()
       callback()

+ 5 - 4
src/views/admin/client/index.vue

@@ -27,6 +27,7 @@
         :permission="permissionList"
         :permission="permissionList"
         @on-load="getList"
         @on-load="getList"
         @refresh-change="refreshChange"
         @refresh-change="refreshChange"
+        :before-open="beforeOpen"
         @size-change="sizeChange"
         @size-change="sizeChange"
         @current-change="currentChange"
         @current-change="currentChange"
         @row-update="handleUpdate"
         @row-update="handleUpdate"
@@ -55,10 +56,6 @@
         tableOption: tableOption
         tableOption: tableOption
       }
       }
     },
     },
-    created() {
-    },
-    mounted: function () {
-    },
     computed: {
     computed: {
       ...mapGetters(['permissions']),
       ...mapGetters(['permissions']),
       permissionList() {
       permissionList() {
@@ -128,6 +125,10 @@
       },
       },
       refreshChange() {
       refreshChange() {
         this.getList(this.page)
         this.getList(this.page)
+      },
+      beforeOpen(show, type) {
+        window.boxType = type
+        show()
       }
       }
     }
     }
   }
   }