yz3456
2024-04-09 4383ef853ef4027a81577fa8110938ddbce56410
ruoyi-ui/src/views/honor/honorInfo.vue
@@ -92,9 +92,9 @@
          accept="image/jpeg, image/png,image/jpg, image/WMF,image/gif"
          list-type="picture-card"
          multiple
        :show-file-list="true"
        :http-request="requestUpload"
        :http-request="requestUpload"
               :file-list="fileList"
             :on-change="handleChange"
             :auto-upload="false"
@@ -154,8 +154,8 @@
          :on-remove="handleRemoveFile"
          :http-request="requestUpload1"
          :show-file-list="true"
        ref="upload1"
              :on-change="handleChange1"
                    :auto-upload="false"
@@ -216,7 +216,7 @@
                @click="fileUpload"
              >上传到服务器</el-button>
            <h4 class="form-header"> </h4>
        <el-form-item size="large">
          <el-button v-if="isShow" type="primary" @click="submitForm" :disabled="dsb">修改</el-button>
        </el-form-item>
@@ -249,14 +249,13 @@
       '.svg','.psd','.cdr','.pcd','.dxf','.ufo','.eps','.ai','.aw','.WMF','.webp','.apng'],
      fileList:[],
     fileList1:[],
     uploadFileList:[],
     uploadFileList1:[],
     fileListOther:[
     ],
     fileListOther:[],
         fileListOther1:[],
      dsb:true,
      btn:false,
      isShow:true,
@@ -381,7 +380,7 @@
        for(let i = 0; i < paths.length; i++)
        {
          if(paths[i]!="") {
              let pth = paths[i].substr(paths[i].length - 4, paths[i].length)
          //   alert(pth)
              if (_this.fot.includes(pth) === true)
@@ -400,7 +399,7 @@
                _this.fileListOther.push({name:nm, url: process.env.VUE_APP_BASE_TRUE_API+paths[i].substr(1),res:false})
                else
                _this.fileListOther.push({name:nm, url: process.env.VUE_APP_BASE_TRUE_API+paths[i],res:false})
             }
            }
        }
@@ -423,6 +422,55 @@
  },
  mounted() {},
  methods: {
    getData(){
      const id = this.$route.params && this.$route.params.id;
      let _this = this
      if (id) {
        this.loading = true;
        getHonor({id}).then((response) => {
          this.formData = response.data;
        //    alert(this.formData.type)
          let paths = response.data.url.split(",");
          for(let i = 0; i < paths.length; i++)
          {
            if(paths[i]!="") {
                let pth = paths[i].substr(paths[i].length - 4, paths[i].length)
            //   alert(pth)
                if (_this.fot.includes(pth) === true)
               {
              console.log()
                 }
                else {
                  // alert(paths[i])
                // alert()
                  let nms = paths[i].split("\/")
                  let nm = nms[nms.length - 1]
                 if(paths[i][0]=="/")
                  _this.fileListOther1.push({name:nm, url: process.env.VUE_APP_BASE_TRUE_API+paths[i].substr(1),res:false})
                  else
                  _this.fileListOther1.push({name:nm, url: process.env.VUE_APP_BASE_TRUE_API+paths[i],res:false})
               }
              }
          }
          _this.fileListOther = _this.fileListOther1
          this.loading = false;
        });
        listType(this.queryParams).then(response => {
            this.typeList = response.data;
            this.total = response.data.total;
            // console.log( this.typeList )
            // 在回调函数中调用 getTypeOptions()
            this.getTypeOptions();
            this.loading = false;
          }
        );
        this.fetchData()
        // this.getCateInfor()
      }
    },
    // 获取数据方法
    fetchData(id) {
      const url = 'https://47.93.189.255:8080/zHonor/id=${id}'; // 接口 URL'/zHonor/id='+query
@@ -549,10 +597,10 @@
               this.$delete(this.uploadFileList1, Math.abs(i - this.uploadFileList1.length-1))
            }
            this.$delete(this.fileListOther,i);
         }
        }
        let ul = ""
        this.fileList.map(function (elem){
              if(elem.res==false)
@@ -569,7 +617,7 @@
           updateHonor(this.formData).then(response => {
            this.$modal.msgSuccess("删除成功");
            // this.open = false;
           });
        }
    },
@@ -593,7 +641,7 @@
                //     alert(this.uploadFileList.length)
             }
            this.$delete(this.fileList,i);
        }
        }
        let ul = ""
@@ -612,7 +660,7 @@
            this.$modal.msgSuccess("删除成功");
           });
        }
    },
    handleFileCardPreview(file){
      this.dialogFileUrl = file.url;
@@ -659,7 +707,7 @@
   //自定义上传方法
   handleChange1(file, fileListOther1) {
          //定义一个全局数组uploadFileList来做存储
        // this.uploadFileList.push(file.raw);
       this.uploadFileList1.push(file.raw);
        this.fileListOther.push({name:file.name,url:file.url,res:true})
@@ -678,10 +726,10 @@
      if(this.uploadFileList1.length==0){
           this.$modal.msgSuccess("文档上传列表不能为空!");
           return}
      this.uploadFileList1.forEach((elem)=>{
         formData.append("files", elem)
      })
      console.log(this.uploadFileList1)
      let _this = this
@@ -693,6 +741,8 @@
          updateHonor(_this.formData).then(response => {
            this.$modal.msgSuccess("文档上传成功");
            // this.open = false;
          this.getData()
          this.fileListOther1=[]
          });
        })
@@ -709,11 +759,11 @@
      this.uploadFileList.forEach((elem)=>{
         formData.append("files", elem)
      })
      let _this = this
        uploadPic(formData).then(response => {
         // console.log(response.originalFilenames)
         // console.log(response.urls)
@@ -755,8 +805,8 @@
//    this.uploadFileList.push(params.file);
     //alert(34)
    },
    requestUpload1(params)
    {