linwenling
2023-09-26 0edf2cc107cd03e8e007f97f38387d66f480cd3d
修改家大事记 的图片文件上传 直调接口
3个文件已修改
241 ■■■■ 已修改文件
ruoyi-ui/src/views/bignote/familyeventInfo.vue 109 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-ui/src/views/bignote/index.vue 129 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-ui/src/views/marry/index.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-ui/src/views/bignote/familyeventInfo.vue
@@ -35,23 +35,25 @@
        <el-input v-model="formData.remark" placeholder="请输入备注" clearable :style="{width: '100%'}" :disabled="dsb"></el-input>
      </el-form-item>
      <el-form-item label="是否是本家庭记录" prop="ownData">
        <el-input  v-model="formData.ownData=== 1 ? '是':'否'" placeholder=" " clearable :style="{width: '100%'}" :disabled=true></el-input>
      </el-form-item>
<!--      <el-form-item label="是否是本家庭记录" prop="ownData">-->
<!--        <el-input  v-model="formData.ownData=== 1 ? '是':'否'" placeholder=" " clearable :style="{width: '100%'}" :disabled=true></el-input>-->
<!--      </el-form-item>-->
      <h4 class="form-header">相关图片 </h4>
      <el-upload
        action="#"
        list-type="picture-card"
        multiple
        accept="image/jpeg, image/png,image/jpg, image/WMF,image/gif"
        :http-request="requestUpload"
        :file-list="fileList"
        :disabled="!btn"
        :class="{ hide: !btn }"
      >
        <div v-if="uploading" class="upload-status">正在上传...</div>
        <i v-if="!uploading" slot="default" class="el-icon-plus"></i>
        <div v-if="uploading1" class="upload-status">正在上传...</div>
        <i v-if="!uploading1" slot="default" class="el-icon-plus"></i>
        <div slot="file" slot-scope="{file}">
          <img
            class="el-upload-list__item-thumbnail"
@@ -67,7 +69,8 @@
          class="el-upload-list__item-preview"
          @click="handlePictureCardPreview(file)"
        >
          <i class="el-icon-zoom-in"></i>
<!--          <i class="el-icon-zoom-in"></i>-->
          <i v-if="isImage(file)" class="el-icon-zoom-in"></i>
        </span>
        <span
@@ -98,7 +101,7 @@
        list-type="picture-card"
        :on-preview="handleFileCardPreview"
        :on-remove="handleRemoveFile"
        :http-request="requestUpload"
        :http-request="requestUpload1"
        :show-file-list="true"
        :disabled="!btn"
        :class="{ hide: !btn }"
@@ -178,7 +181,7 @@
      btn:false,
      isShow:true,
      uploading: false,
      uploading1:false,
      formData: {
        id: undefined,
        title: undefined,
@@ -196,11 +199,7 @@
          message: '请输入大事标题',
          trigger: 'blur'
        }],
        familyId: [{
          required: true,
          message: '请输入家庭号',
          trigger: 'blur'
        }],
        people: [{
          required: true,
          message: '请输入人物',
@@ -320,6 +319,18 @@
      {
        if(this.fileListOther[i].url==file.url)
          this.$delete(this.fileListOther,i);
        let ul = this.fileList.map(function (elem){
          return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
        }).join(",")
        let uls = this.fileListOther.map(function (elem){
          return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
        }).join(",")
        this.formData.url = ul+","+uls;
        updateFamilyevent(this.formData).then(response => {
          this.$modal.msgSuccess("删除成功");
          // this.open = false;
          // this.btn=false
        });
      }
    },
    handleRemove(file) {
@@ -327,6 +338,19 @@
      {
        if(this.fileList[i].url==file.url)
          this.$delete(this.fileList,i);
        let ul = this.fileList.map(function (elem){
          return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
        }).join(",")
        let uls = this.fileListOther.map(function (elem){
          return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
        }).join(",")
        this.formData.url = ul+","+uls;
        updateFamilyevent(this.formData).then(response => {
          this.$modal.msgSuccess("删除成功");
          // this.open = false;
          // this.btn=false
        });
      }
    },
    handleFileCardPreview(file){
@@ -358,7 +382,50 @@
      this.btn = true
      this.isShow=false
    },
    isImage(file) {
      let pth = file.name.substr(file.name.length - 4, file.name.length);
      return this.fot.includes(pth) ;
    },
    requestUpload(params)
    {
      var file = params.file;
      var formData = new FormData();
      formData.append('uploadFile', file);
      let _this = this
      this.uploading1 = true;
      uploadPic(formData).then(response => {
        let pth = response.data.originalFilename.substr(response.data.originalFilename.length-4, response.data.originalFilename.length)
        this.uploading1= false;
        console.log(_this.fot.includes(pth))
        // debugger
        if(_this.fot.includes(pth) === true)
        {
          _this.fileList.push({name:response.data.fileName, "url":response.data.url})
          let ul = this.fileList.map(function (elem){
            return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
          }).join(",")
          let uls = this.fileListOther.map(function (elem){
            return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
          }).join(",")
          this.formData.url = ul+","+uls
          console.log(this.formData.url)
          updateFamilyevent(this.formData).then(response => {
            this.$modal.msgSuccess("图片上传成功");
            // this.open = false;
            // this.btn=false
          });
        }
        else{
          _this.fileListOther.push({name:response.data.fileName, url:response.data.url})
        }
      })
    },
    requestUpload1(params)
    {
      var file = params.file;
      var formData = new FormData();
@@ -368,7 +435,7 @@
      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("上传成功");
        // this.$modal.msgSuccess("上传成功");
        if(_this.fot.includes(pth) === true)
        {
          _this.fileList.push({name:response.data.fileName, "url":response.data.url})
@@ -377,7 +444,19 @@
        else{
          _this.fileListOther.push({name:response.data.fileName, url:response.data.url})
          let ul = this.fileList.map(function (elem){
            return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
          }).join(",")
          let uls = this.fileListOther.map(function (elem){
            return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
          }).join(",")
          this.formData.url = ul+","+uls
          console.log(this.formData.url)
          updateFamilyevent(this.formData).then(response => {
            this.$modal.msgSuccess("文档上传成功");
            // this.open = false;
            // this.btn=false
          });
        }
      })
ruoyi-ui/src/views/bignote/index.vue
@@ -250,40 +250,39 @@
        <h4 class="form-header">相关图片 </h4>
        <el-upload
          action="#"
          accept="image/jpeg, image/png,image/jpg, image/WMF,image/gif"
          list-type="picture-card"
          multiple
          :http-request="requestUpload"
          :file-list="fileList"
        >
          <i  slot="default" class="el-icon-plus"></i>
          <div slot="file" slot-scope="{file}">
            <img
              class="el-upload-list__item-thumbnail"
              :src="file.url"
              alt=""
              style="width: 126px; height: 126px"
              fit="cover"
              :preview-src-list="[file.url]"
            >
          <i slot="default" class="el-icon-plus"></i>
          <div slot="file" slot-scope="{ file }">
            <template v-if="fileList">
              <img
                class="el-upload-list__item-thumbnail"
                :src="file.url"
                alt=""
                style="width: 100%; height: 100%; object-fit: cover;"
                fit="cover"
                :preview-src-list="[file.url]"
              >
            </template>
            <span class="el-upload-list__item-actions">
          <span
            class="el-upload-list__item-preview"
            @click="handlePictureCardPreview(file)"
          >
            <i class="el-icon-zoom-in"></i>
          </span>
          <span
            v-if="!disabled"
            class="el-upload-list__item-delete"
            @click="handleRemove(file)"
          >
            <i class="el-icon-delete"></i>
          </span>
        </span>
      <span
        class="el-upload-list__item-preview"
        @click="handlePictureCardPreview(file)"
      >
        <i class="el-icon-zoom-in"></i>
      </span>
      <span
        v-if="!disabled"
        class="el-upload-list__item-delete"
        @click="handleRemove(file)"
      >
        <i class="el-icon-delete"></i>
      </span>
    </span>
          </div>
        </el-upload>
        <h4 class="form-header">其他附件 </h4>
@@ -294,7 +293,7 @@
          multiple
          :on-remove="handleRemoveFile"
          :http-request="requestUpload"
          :http-request="requestUpload1"
          :show-file-list="true"
        >
@@ -369,7 +368,8 @@
      // 日期范围
      dateRange: [],
      // 数据范围选项
      fot:[".jpg",".jif"],
      fot:['.bmp','.jpg','.jpeg','.png','.tif','.gif','.pcx','.tga','.exif','.fpx',
        '.svg','.psd','.cdr','.pcd','.dxf','.ufo','.eps','.ai','.aw','.WMF','.webp','.apng'],
      fileList:[],
      fileListOther:[],
      dsb:true,
@@ -444,6 +444,13 @@
  },
  methods: {
    isImage(fileType) {
      return fileType.startsWith('image/');
    },
    isInFot(fileName) {
      return this.fot.includes(fileName);
    },
    // 取消按钮
    cancelData() {
      this.open = false;
@@ -568,6 +575,7 @@
      {
        if(this.fileList[i].url==file.url)
          this.$delete(this.fileList,i);
      }
    },
    handleRemoveFile(file) {
@@ -597,23 +605,47 @@
          addFamilyevent(this.formDat).then(response => {
            this.$modal.msgSuccess("新增成功");
            this.open = false;
            // 清空formDat对象的数据
            Object.keys(this.formDat).forEach(key => {
              this.formDat[key] = '';
            });
            for(let i = 0; i <= this.fileList.length; i++)
            {
              this.handleRemove(this.fileList[0]);
            }
            for(let i = 0; i < this.fileListOther.length; i++){
              this.handleRemoveFile(this.fileListOther[0]);
            }
            this.getList();
          });
        }
      });
      // 清空formDat对象的数据
      Object.keys(this.formDat).forEach(key => {
        this.formDat[key] = '';
      });
      for(let i = 0; i <= this.fileList.length; i++)
      {
        this.handleRemove(this.fileList[0]);
      }
      for(let i = 0; i < this.fileListOther.length; i++){
        this.handleRemoveFile(this.fileListOther[0]);
      }
    },
    requestUpload(params)
    requestUpload(params) {
      var file = params.file;
      var formData = new FormData();
      formData.append('uploadFile', file);
      let _this = this
      this.uploading1 = true;
      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();
@@ -624,16 +656,17 @@
        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)
        if(_this.fot.includes(pth) !== true)
        {
          _this.fileList.push({name:response.data.fileName, "url":response.data.url})
        }
        else{
          // _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})
        //
        // }
      })
    },
ruoyi-ui/src/views/marry/index.vue
@@ -768,10 +768,11 @@
      //个人信息
      listMarry(this.queryParams).then(response => {
          if(response.data.length == 0){
          if(response.data.length === 0){
            this.loading = false;
            this.marryList={};
            this.oldSpouseList = {};
            console.log(this.marryList)
          }
          else{
            this.marryList = response.data;