Răsfoiți Sursa

fix form template

x1ongzhu 7 ani în urmă
părinte
comite
fe715c7812

+ 6 - 0
pom.xml

@@ -950,6 +950,12 @@
             <version>2.0</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.google.googlejavaformat</groupId>
+            <artifactId>google-java-format</artifactId>
+            <version>1.6</version>
+        </dependency>
+
         <dependency>
             <groupId>com.fasterxml.uuid</groupId>
             <artifactId>java-uuid-generator</artifactId>

+ 1 - 4
src/main/resources/templates/FormTemplate.vm

@@ -215,9 +215,6 @@
             #foreach($field in $model.fields)
                 #if(${field.formType}=="select"||${field.formType}=="multiSelect")
                     #if(${field.apiFlag}=="2")
-
-
-
                         this.${esc.d}http.get({
                             url:'${field.optionsMethod}'
                         }).then(res => {
@@ -225,7 +222,7 @@
 
                                 if (res.data.length > 0) {
                                     res.data.forEach(item => {
-                                        this.${field.modelName}Options.push({label: item.${field.optionsLabel}, value:item.${field.optionsValue}});
+                                        this.${field.modelName}Options.push({label: item.${field.optionsLabel}, value:item.${field.optionsValue}#if(${field.formType}=="multiSelect") +'' #end});
                                     })
                                 }
                             }

+ 41 - 0
src/main/vue/src/components/FileUpload.vue

@@ -0,0 +1,41 @@
+<template>
+    <el-upload
+        class="upload-demo"
+        :action="$baseUrl + '/assets/uploadFile'"
+        :on-success="onSuccess"
+        :on-remove="onRemove">
+        <el-button size="small" type="primary" v-if="!single || fileList.length===0">点击上传</el-button>
+    </el-upload>
+</template>
+
+<script>
+    export default {
+        name: "FileUpload",
+        props: {
+            single: {
+                type: Boolean,
+                default() {
+                    return false
+                }
+            }
+        },
+        data() {
+            return {
+                fileList: []
+            }
+        },
+        methods: {
+            onSuccess(res, file, fileList) {
+                this.fileList = fileList;
+                this.$emit('input', res.data[0])
+            },
+            onRemove(file, fileList) {
+                this.fileList = fileList;
+            }
+        }
+    }
+</script>
+
+<style scoped>
+
+</style>

+ 11 - 8
src/main/vue/src/entries/admin.js

@@ -5,9 +5,8 @@ import ElementUI from 'element-ui'
 import axios from 'axios'
 import MultiUpload from '../components/MultiUpload'
 import SingleUpload from '../components/SingleUpload'
+import FileUpload from '../components/FileUpload'
 import RichText from '../components/RichText'
-import VueI18n from 'vue-i18n'
-import VueAMap from 'vue-amap'
 
 import 'normalize.css/normalize.css'
 import 'element-ui/lib/theme-chalk/index.css'
@@ -15,17 +14,21 @@ import '../main.less'
 import {format} from 'date-fns'
 import zh from 'date-fns/locale/zh_cn'
 
-VueAMap.initAMapApiLoader({
-    key: 'bf91055058a47a7dc387e40ab6256a5f',
-    plugin: ['Autocomplete', 'PlaceSearch', 'Scale', 'OverView', 'ToolBar', 'MapType', 'PolyEditor', 'AMap.CircleEditor', 'AMap.Geolocation'],
-    v: '1.4.7'
-});
+// import VueI18n from 'vue-i18n'
+// import VueAMap from 'vue-amap'
+// Vue.use(VueI18n);
+// VueAMap.initAMapApiLoader({
+//     key: 'bf91055058a47a7dc387e40ab6256a5f',
+//     plugin: ['Autocomplete', 'PlaceSearch', 'Scale', 'OverView', 'ToolBar', 'MapType', 'PolyEditor', 'AMap.CircleEditor', 'AMap.Geolocation'],
+//     v: '1.4.7'
+// });
 
 Vue.config.productionTip = false;
 Vue.use(ElementUI);
-Vue.use(VueI18n);
+
 Vue.component('multi-upload', MultiUpload);
 Vue.component('single-upload', SingleUpload);
+Vue.component('file-upload', FileUpload);
 Vue.component('rich-text', RichText);
 const baseUrl = process.env.NODE_ENV === 'production' ? '../' : `http://${location.hostname}:8080`;
 Vue.prototype.$baseUrl = baseUrl;