Browse Source

Merge branch 'master' of http://192.168.101.10:13000/boman/boman-framwork

yrik 4 years ago
parent
commit
9cfe6a9d10

+ 35 - 4
ruoyi-ui/src/components/DynamicForm/index.vue

@@ -26,7 +26,7 @@
       </el-date-picker>
       <!-- 上传图片 -->
       <el-upload v-if="formConfig.htmlType == 'imageUpload'" :headers="{Authorization: 'Bearer ' + getToken()}" :action="process + '/boman-file/upload'" :file-list="config" list-type="picture-card"
-        :on-preview="handlePictureCardPreview" :on-remove="handleRemove">
+        :on-preview="handlePictureCardPreview" :on-success="upImageFn" :on-remove="reseImage" >
         <i class="el-icon-plus"></i>
       </el-upload>
       <el-dialog :visible.sync="dialogVisible" v-if="formConfig.htmlType == 'imageUpload'">
@@ -39,6 +39,8 @@
         v-if="formConfig.htmlType == 'fileUpload'"
         :action="process + '/boman-file/upload'"
         :on-change="handleChange"
+        :on-success="upImageFn"
+         :on-remove="reseImage"
         :file-list="config">
         <el-button size="small" type="primary">点击上传</el-button>
         <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
@@ -82,6 +84,12 @@
     mounted() {
     },
     methods: {
+      upImageFn(res, file){
+        this.config.push({
+          name: res.data.name,
+          url: res.data.url,
+        });
+      },
       init() {
         if(this.formConfig.htmlType == 'checkbox' || this.formConfig.htmlType == 'imageUpload' || this.formConfig.htmlType == 'fileUpload'){
           this.config = []
@@ -93,9 +101,32 @@
       },
       getToken() {
         return getToken()
-      },
-      handleRemove(file, fileList) {
-        console.log(file, fileList);
+      },
+      reseImage(file, fileList) {
+        let urls = ""
+        if(file.response){
+          urls = file.response.url
+        }else{
+          urls = file.url
+        }
+        for (let i = this.config.length - 1; i >= 0; i--) {
+          if (this.config[i].url == urls) {
+            this.config.splice(i, 1);
+          }
+        }
+      },
+      reseImage1(file, fileList) {
+        let urls = ""
+        if(file.response){
+          urls = file.response.url
+        }else{
+          urls = file.url
+        }
+        for (let i = this.config.length - 1; i >= 0; i--) {
+          if (this.config[i].url == urls) {
+            this.config.splice(i, 1);
+          }
+        }
       },
       handlePictureCardPreview(file) {
         this.dialogImageUrl = file.url;

+ 1 - 3
ruoyi-ui/src/views/system/surface/index.vue

@@ -95,10 +95,8 @@
       /** 搜索按钮操作 */
       handleQuery() {
         for(let item of this.queryData.queryList){
-          if(item.htmlType == 'checkbox'){
+          if(item.htmlType == 'checkbox' || item.htmlType == 'imageUpload' || item.htmlType == 'fileUpload'){
             this.queryParams[item.columnName] = this.$refs[item.columnName][0].config
-          }else if(item.htmlType == 'imageUpload'){
-            console.log(this.$refs[item.columnName][0].config,7777)
           } else{
             this.queryParams[item.columnName] = this.$refs[item.columnName][0].config[item.columnName]
           }