Ver Fonte

20181221通用IFRAME

suochencheng há 7 anos atrás
pai
commit
13dba8fdd3

+ 22 - 0
src/main/java/com/izouma/awesomeadmin/web/QueryConfigController.java

@@ -166,5 +166,27 @@ public class QueryConfigController {
 
 
     }
+
+
+    @RequestMapping(value = "/check", method = RequestMethod.GET)
+    @ResponseBody
+    public Result check(QueryConfig record) {
+
+        QueryConfig queryConfig = new QueryConfig();
+        queryConfig.setCode(record.getCode());
+
+        QueryConfig data = queryConfigService.getQueryConfig(queryConfig);
+        if (data != null) {
+            if (record.getId() != null) {
+                if (!record.getId().equals(data.getId())) {
+                    return new Result(false, "CODE冲突");
+                }
+            } else {
+                return new Result(false, "CODE冲突");
+            }
+        }
+
+        return new Result(true, "1");
+    }
 }
 

+ 23 - 1
src/main/vue/src/pages/QueryConfig.vue

@@ -558,12 +558,34 @@ export default {
         onSave() {
             this.$refs.form.validate((valid) => {
                 if (valid) {
-                    this.submit();
+                    this.checkCodeName();
                 } else {
                     return false;
                 }
             });
         },
+
+        checkCodeName() {
+
+            this.$http.get({
+                url: '/queryConfig/check',
+                data: {
+                    id: this.formData.id,
+                    code: this.formData.code,
+                }
+            }).then(res => {
+                if (res.success) {
+
+                    this.submit();
+
+                } else {
+                    this.$msgbox({ title: '提示', type: 'error', message: 'CODE以存在' });
+                }
+            })
+
+
+        },
+
         submit() {
 
             this.tablecolumnsStr = '';