Explorar el Código

编辑/添加

suochencheng hace 7 años
padre
commit
7b73dba0cf

+ 7 - 12
src/main/resources/templates/FormTemplate.vm

@@ -210,16 +210,6 @@ export default {
 
     created() {
 
-        if (this.${esc.d}route.query.column) {
-            this.subColumn = this.${esc.d}route.query.column.split(',')[1];
-            this.subValue = this.${esc.d}route.query.column.split(',')[0];
-        }
-
-    if (this.${esc.d}route.query.column) {
-        this.formData[this.subColumn] = this.subValue;
-    }
-
-
         #foreach($field in $model.fields)
             #if(${field.formType}=="select"||${field.formType}=="multiSelect")
                 #if(${field.apiFlag}=="2")
@@ -329,12 +319,17 @@ export default {
                 #end
             #end
         #end
-        subColumn: '',
-                subValue: '',
     }
     },
     computed: {
             ...mapState(['userInfo']),
+                subColumn(){
+                if(this.formData.subColumn){
+                   return  this.formData.subColumn;
+                }else{
+                    return '';
+                }
+        },
 },
 methods: {
     changeEditDialogVisible(value){

+ 10 - 1
src/main/resources/templates/ListTemplate.vm

@@ -15,7 +15,7 @@
             <el-button @click="showTableSortDialog = !showTableSortDialog" type="primary" size="small"
                        icon="el-icon-sort" class="filter-item">排序
             </el-button>
-            <el-button @click="${esc.d}router.push({path:'/${display.uncapitalize($model.className)}',query:{column:${esc.d}route.query.column}})" type="primary"
+            <el-button @click="editRow({id:0,column:${esc.d}route.query.column})" type="primary"
                        size="small" icon="el-icon-edit"
                        class="filter-item">添加
             </el-button>
@@ -394,6 +394,15 @@
                     #end
                 #end
 
+                if (this.${esc.d}route.query.column) {
+                    jsonp.subColumn = this.${esc.d}route.query.column.split(',')[1];
+                    jsonp.subValue = this.${esc.d}route.query.column.split(',')[0];
+                }
+
+                if (this.${esc.d}route.query.column) {
+                    jsonp[jsonp.subColumn] = jsonp.subValue;
+                }
+
                 this.editRowInfo = jsonp
                 this.editDialogVisible = true
             },

+ 8 - 13
src/main/vue/src/pages/TestBbb.vue

@@ -43,16 +43,6 @@ export default {
 
     created() {
 
-        if (this.$route.query.column) {
-            this.subColumn = this.$route.query.column.split(',')[1];
-            this.subValue = this.$route.query.column.split(',')[0];
-        }
-
-    if (this.$route.query.column) {
-        this.formData[this.subColumn] = this.subValue;
-    }
-
-
                                                                                                                                                                                                                                                                                                                                                             },
     data() {
         return {
@@ -71,12 +61,17 @@ export default {
                                             {required: true, message: '请输入 名称3', trigger: 'blur'},
                                                         ],
                                                                 },
-                                                                                                                                        subColumn: '',
-                subValue: '',
-    }
+                                                                                                                                    }
     },
     computed: {
             ...mapState(['userInfo']),
+                subColumn(){
+                if(this.formData.subColumn){
+                   return  this.formData.subColumn;
+                }else{
+                    return '';
+                }
+        },
 },
 methods: {
     changeEditDialogVisible(value){

+ 10 - 1
src/main/vue/src/pages/TestBbbs.vue

@@ -11,7 +11,7 @@
             <el-button @click="showTableSortDialog = !showTableSortDialog" type="primary" size="small"
                        icon="el-icon-sort" class="filter-item">排序
             </el-button>
-            <el-button @click="$router.push({path:'/testBbb',query:{column:$route.query.column}})" type="primary"
+            <el-button @click="editRow({id:0,column:$route.query.column})" type="primary"
                        size="small" icon="el-icon-edit"
                        class="filter-item">添加
             </el-button>
@@ -335,6 +335,15 @@
                 var jsonp = { ...row }
 
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
+                if (this.$route.query.column) {
+                    jsonp.subColumn = this.$route.query.column.split(',')[1];
+                    jsonp.subValue = this.$route.query.column.split(',')[0];
+                }
+
+                if (this.$route.query.column) {
+                    jsonp[jsonp.subColumn] = jsonp.subValue;
+                }
+
                 this.editRowInfo = jsonp
                 this.editDialogVisible = true
             },