MrShi
2025-04-11 3a45da15c947c2d478a44a51bd0f926647b1b841
company/src/components/common/UploadFile.vue
@@ -12,7 +12,7 @@
      :on-error="uploadError"
      :before-upload="beforeFileUpload"
      :file-list="fileList">
    <el-button size="small" type="primary"  >点击上传</el-button>
    <el-button  size="small" type="primary"  >点击上传</el-button>
    <div style="display: inline-block;position: absolute"  slot="tip" class="el-upload__tip" v-if="showTips">{{'(只能上传'+uploadData.fileType +'文件,且不超过5mb)'}}</div>
  </el-upload>
  </div>
@@ -46,6 +46,7 @@
  },
  data() {
    return {
      uploaded:false,
      // fileList:[],
      uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/upload?folder='+this.uploadData.folder
    }
@@ -54,6 +55,11 @@
    fileList (nv,ov) {
      if(this.fileList ==null){
        this.fileList = new Array();
      }
      if(this.fileList.length == 0){
        this.uploaded = false
      }else{
        this.uploaded=true
      }
     // alert(this.fileList)
    },
@@ -65,6 +71,7 @@
  },
  methods: {
    removes() {
      this.uploaded=false
      this.$emit('remove')
    },
    // 上传图片
@@ -74,6 +81,7 @@
    handleFileSuccess(res, file) {
      if (res.code == 200) {
        let { data } = res
        this.uploaded = true
        // this.fileList = [{name: data.originname, url: data.url }]
        this.$message.success('上传成功')
        this.$emit('uploadSuccess', { fileurl: data.imgaddr,  fileurlFull: data.url, name: data.originname ,index:this.fileIndex})