licp
2024-12-31 5c8aaba66c16b1a143fdec27e29ad36eaefd1e3a
src/components/do/a8-file-handling/DistributionCollectionRecord.vue
@@ -429,21 +429,43 @@
          'Content-Type': 'application/json'
        },responseType: "blob"},).then(res => {
        this.outLoading = false
        this.$message.success('导出成功')
        const blob = new Blob([res],{ type: 'application/octet-stream' });
        const url = URL.createObjectURL(blob);
        const link = document.createElement('a');
        link.href = url;
        link.download = '发放回收记录.xlsx';
        link.click();
        //将Blob 对象转换成字符串
        let reader = new FileReader();
        reader.readAsText(blob, 'utf-8');
        reader.onload = () => {
          try {
            let result = JSON.parse(reader.result);
            if (result.message) {
              this.$message.error(result.message);
            } else {
              const url = URL.createObjectURL(blob);
              const link = document.createElement('a');
              link.href = url;
              link.download = '发放回收记录.xlsx';
              link.click();
              this.$message.success('导出成功')
            }
          } catch (err) {
            console.log(err);
            const url = URL.createObjectURL(blob);
            const link = document.createElement('a');
            link.href = url;
            link.download = '发放回收记录.xlsx';
            link.click();
            this.$message.success('导出成功')
          }
        }
      })
    },
    changeFileList(e){
      if(e){
        let obj = this.fileList.find(a=>a.documentCode == e)
        this.addInfo.name = obj.name
        this.addInfo.version = obj.version
        this.addInfo.state = obj.state
        if(obj){
          this.addInfo.name = obj.name
          this.addInfo.version = obj.version
          this.addInfo.state = obj.state
        }
      }
    },
    // 提交
@@ -494,11 +516,32 @@
      }else{
        let {documentCode,id,issueUser,recycleUser,receiveUser,name,version,documentState,issueCode,recycleCode,issueDate,recycleDate,issueNote,recycleNote} = this.addInfo
        // 添加回收记录
        this.$axios.post(this.$api.manageDocumentList.doManageDocumentIssueRecycle,{
          documentCode,id,issueUser,recycleUser,receiveUser,name,version,documentState,issueCode,recycleCode,issueDate,recycleDate,issueNote,recycleNote
        },{headers: {
            'Content-Type': 'application/json'
          },noQS:true}).then(res=>{
        let obj = {
          documentCode,
          id,
          issueUser,
          recycleUser,
          receiveUser,
          name,
          version,
          documentState,
          issueCode,
          recycleCode,
          issueDate,
          recycleDate,
          issueNote,
          recycleNote
        }
        let fd = new FormData();
        for(let key in obj){
          fd.append(key,obj[key])
        }
        this.$axios.post(this.$api.manageDocumentList.doManageDocumentIssueRecycle,fd,{
            headers: {
              'Content-Type': 'multipart/form-data'
            },
            noQs:true
          }).then(res=>{
            this.addLoading = false;
          if(res.code==200){
            this.$message.success('提交成功')