Browse Source

顶部搜索功能添加及生成代码功能去重校验

klausY 4 years ago
parent
commit
90125a0ee2

+ 2 - 1
server/model/sys_user.go

@@ -2,7 +2,7 @@ package model
 
 import (
 	"github.com/jinzhu/gorm"
-	uuid "github.com/satori/go.uuid"
+	"github.com/satori/go.uuid"
 )
 
 type SysUser struct {
@@ -15,3 +15,4 @@ type SysUser struct {
 	Authority   SysAuthority `json:"authority" gorm:"ForeignKey:AuthorityId;AssociationForeignKey:AuthorityId"`
 	AuthorityId string       `json:"authorityId" gorm:"default:888"`
 }
+

+ 18 - 34
web/package-lock.json

@@ -2878,8 +2878,7 @@
             "version": "4.6.0",
             "resolved": "https://registry.npm.taobao.org/co/download/co-4.6.0.tgz",
             "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=",
-            "dev": true,
-            "optional": true
+            "dev": true
         },
         "coa": {
             "version": "2.0.2",
@@ -5246,8 +5245,7 @@
                 "ansi-regex": {
                     "version": "2.1.1",
                     "bundled": true,
-                    "dev": true,
-                    "optional": true
+                    "dev": true
                 },
                 "aproba": {
                     "version": "1.2.0",
@@ -5268,14 +5266,12 @@
                 "balanced-match": {
                     "version": "1.0.0",
                     "bundled": true,
-                    "dev": true,
-                    "optional": true
+                    "dev": true
                 },
                 "brace-expansion": {
                     "version": "1.1.11",
                     "bundled": true,
                     "dev": true,
-                    "optional": true,
                     "requires": {
                         "balanced-match": "^1.0.0",
                         "concat-map": "0.0.1"
@@ -5290,20 +5286,17 @@
                 "code-point-at": {
                     "version": "1.1.0",
                     "bundled": true,
-                    "dev": true,
-                    "optional": true
+                    "dev": true
                 },
                 "concat-map": {
                     "version": "0.0.1",
                     "bundled": true,
-                    "dev": true,
-                    "optional": true
+                    "dev": true
                 },
                 "console-control-strings": {
                     "version": "1.1.0",
                     "bundled": true,
-                    "dev": true,
-                    "optional": true
+                    "dev": true
                 },
                 "core-util-is": {
                     "version": "1.0.2",
@@ -5420,8 +5413,7 @@
                 "inherits": {
                     "version": "2.0.3",
                     "bundled": true,
-                    "dev": true,
-                    "optional": true
+                    "dev": true
                 },
                 "ini": {
                     "version": "1.3.5",
@@ -5433,7 +5425,6 @@
                     "version": "1.0.0",
                     "bundled": true,
                     "dev": true,
-                    "optional": true,
                     "requires": {
                         "number-is-nan": "^1.0.0"
                     }
@@ -5448,7 +5439,6 @@
                     "version": "3.0.4",
                     "bundled": true,
                     "dev": true,
-                    "optional": true,
                     "requires": {
                         "brace-expansion": "^1.1.7"
                     }
@@ -5456,14 +5446,12 @@
                 "minimist": {
                     "version": "0.0.8",
                     "bundled": true,
-                    "dev": true,
-                    "optional": true
+                    "dev": true
                 },
                 "minipass": {
                     "version": "2.3.5",
                     "bundled": true,
                     "dev": true,
-                    "optional": true,
                     "requires": {
                         "safe-buffer": "^5.1.2",
                         "yallist": "^3.0.0"
@@ -5482,7 +5470,6 @@
                     "version": "0.5.1",
                     "bundled": true,
                     "dev": true,
-                    "optional": true,
                     "requires": {
                         "minimist": "0.0.8"
                     }
@@ -5563,8 +5550,7 @@
                 "number-is-nan": {
                     "version": "1.0.1",
                     "bundled": true,
-                    "dev": true,
-                    "optional": true
+                    "dev": true
                 },
                 "object-assign": {
                     "version": "4.1.1",
@@ -5576,7 +5562,6 @@
                     "version": "1.4.0",
                     "bundled": true,
                     "dev": true,
-                    "optional": true,
                     "requires": {
                         "wrappy": "1"
                     }
@@ -5662,8 +5647,7 @@
                 "safe-buffer": {
                     "version": "5.1.2",
                     "bundled": true,
-                    "dev": true,
-                    "optional": true
+                    "dev": true
                 },
                 "safer-buffer": {
                     "version": "2.1.2",
@@ -5699,7 +5683,6 @@
                     "version": "1.0.2",
                     "bundled": true,
                     "dev": true,
-                    "optional": true,
                     "requires": {
                         "code-point-at": "^1.0.0",
                         "is-fullwidth-code-point": "^1.0.0",
@@ -5719,7 +5702,6 @@
                     "version": "3.0.1",
                     "bundled": true,
                     "dev": true,
-                    "optional": true,
                     "requires": {
                         "ansi-regex": "^2.0.0"
                     }
@@ -5763,14 +5745,12 @@
                 "wrappy": {
                     "version": "1.0.2",
                     "bundled": true,
-                    "dev": true,
-                    "optional": true
+                    "dev": true
                 },
                 "yallist": {
                     "version": "3.0.3",
                     "bundled": true,
-                    "dev": true,
-                    "optional": true
+                    "dev": true
                 }
             }
         },
@@ -9892,8 +9872,7 @@
             "version": "4.0.8",
             "resolved": "https://registry.npm.taobao.org/rx-lite/download/rx-lite-4.0.8.tgz",
             "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=",
-            "dev": true,
-            "optional": true
+            "dev": true
         },
         "rx-lite-aggregates": {
             "version": "4.0.8",
@@ -10115,6 +10094,11 @@
                 "ajv-keywords": "^3.1.0"
             }
         },
+        "screenfull": {
+            "version": "5.0.2",
+            "resolved": "https://registry.npmjs.org/screenfull/-/screenfull-5.0.2.tgz",
+            "integrity": "sha512-cCF2b+L/mnEiORLN5xSAz6H3t18i2oHh9BA8+CQlAh5DRw2+NFAGQJOSYbcGw8B2k04g/lVvFcfZ83b3ysH5UQ=="
+        },
         "script-ext-html-webpack-plugin": {
             "version": "2.1.4",
             "resolved": "https://registry.npmjs.org/script-ext-html-webpack-plugin/-/script-ext-html-webpack-plugin-2.1.4.tgz",

+ 41 - 3
web/src/view/layout/index.vue

@@ -28,6 +28,19 @@
                 >{{item.meta.title}}</el-breadcrumb-item>
               </el-breadcrumb>
               <div class="fl-right right-box">
+                <transition name="el-fade-in-linear">
+                  <div v-show="show" class="transition-box" style="display: inline-block; ">
+                     <el-select v-model="value" filterable placeholder="请选择" @blur="test()">
+                      <el-option
+                              v-for="item in options"
+                              :key="item.value"
+                              :label="item.label"
+                              :value="item.value">
+                      </el-option>
+                    </el-select>
+                  </div>
+                </transition>
+                <i class="el-icon-search" style="font-size: 20px; display: inline-block; " @click="show = !show"></i>
                 <Screenfull class="screenfull"></Screenfull>
                 <el-dropdown>
                   <span class="el-dropdown-link">
@@ -95,6 +108,7 @@ export default {
   name: "Layout",
   data() {
     return {
+      show:false,
       isCollapse: false,
       isSider: true,
       isMobile: false,
@@ -124,7 +138,24 @@ export default {
             trigger: "blur"
           }
         ]
-      }
+      },
+      options: [{
+        value: '选项1',
+        label: '黄金糕'
+      }, {
+        value: '选项2',
+        label: '双皮奶'
+      }, {
+        value: '选项3',
+        label: '蚵仔煎'
+      }, {
+        value: '选项4',
+        label: '龙须面'
+      }, {
+        value: '选项5',
+        label: '北京烤鸭'
+      }],
+      value:''
     };
   },
   components: {
@@ -133,6 +164,9 @@ export default {
     Screenfull
   },
   methods: {
+    test(){
+      this.show = false
+    },
     ...mapActions("user", ["LoginOut"]),
     totalCollapse() {
       this.isCollapse = !this.isCollapse;
@@ -321,7 +355,7 @@ $mainHight: 100vh;
       &:not(.el-menu--collapse) {
         width: 220px;
       }
-      
+
     }
 .el-menu--collapse{
         li{
@@ -374,8 +408,12 @@ $mainHight: 100vh;
     vertical-align: middle;
   }
 }
+.el-input__inner{
+  border: none;
+  border-bottom: 1px solid #606266;
+}
 .screenfull{
   display: inline-block;
- 
+
 }
 </style>

+ 4 - 4
web/src/view/systemTools/autoCode/component/fieldDialog.vue

@@ -78,11 +78,11 @@ export default {
                 fieldJson:[ { required: true, message: '请输入field格式化json', trigger: 'blur' }],
                 fieldType:[ { required: true, message: '请选择field数据类型', trigger: 'blur' }]
             }
-            
+
         }
-    }
+    },
 }
 </script>
 <style lang="scss">
-    
-</style>
+
+</style>

+ 12 - 10
web/src/view/systemTools/autoCode/index.vue

@@ -28,7 +28,6 @@
                 width="280">
             </el-table-column>
             <el-table-column
-                v-test
                 prop="fieldName"
                 label="Field名"
                 width="280">
@@ -117,12 +116,6 @@ export default {
     components:{
         FieldDialog
     },
-    directives:{
-        'test':function(el,binding,vnode){
-            /** el可以获取当前dom节点,并且进行编译,也可以操作事件 **/
-            /** binding指的是一个对象,一般不用 **/    /** vnode 是 Vue 编译生成的虚拟节点 **/
-            console.log(el.click());  //获取v-model的值
-        }},
         methods:{
         editAndAddField(item){
             this.dialogFlag = true
@@ -135,9 +128,14 @@ export default {
                 this.dialogMiddle = JSON.parse(JSON.stringify(fieldTemplate))
             }
         },
+        regExp(ele){
+            return ele.replace(/\s*/g,"")
+        },
         enterDialog(){
-            console.log(this.dialogMiddle.fieldName.replace(/\s*/g,""))
-
+            this.dialogMiddle.fieldName = this.regExp(this.dialogMiddle.fieldName)
+            this.dialogMiddle.fieldDesc = this.regExp(this.dialogMiddle.fieldDesc)
+            this.dialogMiddle.fieldJson = this.regExp(this.dialogMiddle.fieldJson)
+            this.dialogMiddle.columnName = this.regExp(this.dialogMiddle.columnName)
             this.$refs.fieldDialog.$refs.fieldDialogFrom.validate((valid) => {
           if (valid) {
             this.dialogMiddle.fieldName = toUpperCase(this.dialogMiddle.fieldName)
@@ -170,7 +168,11 @@ export default {
             }
             this.$refs.autoCodeForm.validate(async (valid) => {
           if (valid) {
-            this.form.structName = toUpperCase(this.form.structName)
+              this.form.structName = this.regExp(this.form.structName)
+              this.form.structName = toUpperCase(this.form.structName)
+              this.form.abbreviation = this.regExp(this.form.abbreviation)
+              this.form.packageName = this.regExp(this.form.packageName)
+
             if(this.form.structName == this.form.abbreviation){
                 this.$message({
                     type:"error",