feige
2024-02-21 c1cff08cdbcee3278c1ac8d8a3a067e3bf015202
ruoyi-ui/src/views/clean/index.vue
@@ -254,6 +254,9 @@
            multiple
            :http-request="requestUpload"
            :file-list="fileList"
         :on-change="handleChange"
         :auto-upload="false"
         ref="upload"
          >
            <i slot="default" class="el-icon-plus"></i>
            <div slot="file" slot-scope="{ file }">
@@ -650,54 +653,80 @@
        });
      },
      requestUpload(params) {
        var file = params.file;
        var formData = new FormData();
        formData.append('uploadFile', file);
        let _this = this
        this.uploading1 = true;
    handleChange(file, fileList1) {
       //定义一个全局数组uploadFileList来做存储
     // this.uploadFileList.push(file.raw);
      console.log("=========5555=========")
      //console.log(file)
    //  console.log(this.uploadFileList)
    //  this.fileList = fileList
    },
    handleChange1(file, fileOtherList1) {
       //定义一个全局数组uploadFileList来做存储
     // this.uploadFileList.push(file.raw);
      console.log("=========5555=========")
      //console.log(file)
    //  console.log(this.uploadFileList)
    //  this.fileList = fileList
    },
    fileUpload(){
    //   var file = params.file;
       var formData = new FormData();
       this.$refs.upload1.submit();
       // formData.append('uploadFile', file);
       if(this.uploadFileList1.length==0){
            this.$modal.msgSuccess("文档上传列表不能为空!");
            return
       }
       this.uploadFileList1.forEach((elem)=>{
          formData.append("files", elem)
       })
       let _this = this
       this.uploading = true;
       uploadPic(formData).then(response => {
       _this.uploadFileList1 = []
       _this.formDat.url = _this.formDat.url+","+response.fileNames
       _this.$modal.msgSuccess("文件上传成功!");
         })
    },
    picUpload()
    {
       var formData = new FormData();
       this.$refs.upload.submit();
    if(this.uploadFileList.length==0){
         this.$modal.msgSuccess("图片上传列表不能为空!");
         return}
    //console.log(this.uploadFileList)
       this.uploadFileList.forEach((elem)=>{
          formData.append("files", elem)
       })
       //alert(90)
       let _this = this
       //alert(9)
        uploadPic(formData).then(response => {
          let pth = response.data.originalFilename.substr(response.data.originalFilename.length-4, response.data.originalFilename.length)
          this.uploading1 = false;
          this.$modal.msgSuccess("上传成功");
          if(_this.fot.includes(pth) === true)
          {
            _this.fileList.push({name:response.data.fileName, "url":response.data.url})
          }
          else{
            // _this.fileListOther.push({name:response.data.fileName, url:response.data.url})
          }
        })
      },
      requestUpload1(params)
      {
        var file = params.file;
        var formData = new FormData();
        formData.append('uploadFile', file);
        let _this = this
        this.uploading = true;
        uploadPic(formData).then(response => {
          let pth = response.data.originalFilename.substr(response.data.originalFilename.length-4, response.data.originalFilename.length)
          this.uploading = false;
          this.$modal.msgSuccess("上传成功");
          if(_this.fot.includes(pth) !== true)
          {
            // _this.fileList.push({name:response.data.fileName, "url":response.data.url})
            _this.fileListOther.push({name:response.data.fileName, url:response.data.url})
          }
          // else{
          //   _this.fileListOther.push({name:response.data.fileName, url:response.data.url})
          //
          // }
        })
      },
       //   alert("dds")
          _this.formDat.url = _this.formDat.url+","+response.fileNames
         _this.uploadFileList = []
         _this.$modal.msgSuccess("图片上传成功");
      });
    },
    requestUpload(params) {
     this.uploadFileList.push(params.file);
    },
    requestUpload1(params)
    {
            this.uploadFileList1.push(params.file);
    },
      /** 删除按钮操作 */
      handleDelete(row) {
        const Ids = row.id || this.ids;