导出PDF报告

//导出PDF报告
 plantInfoExport() {
    
    
      let data={
    
    
          plantId: this.currentPlantInfo.id,
          versionFrom: 1,
          controllerType: this.currentPlantInfo.controllerType,
          equipmentListVos: this.currentPlantInfo.equipmentListVo
        };
      console.log(data);
      let axiosInstance = this.$axios.create({
    
    
        baseURL: "/api/", //生产环境
        withCredentials: false, //是否开启跨域,开启后可以设置自定义的header头,但是后端要开启*以及允许哪些header头
        headers: {
    
    
          Authorization: localStorage.getItem("Authorization"),
          'Content-Type': 'application/json'
        },
        responseType: "blob",
      });
      axiosInstance
        .post("plant-consumer/plant/getPlantInfoPdf", data)
        .then((res) => {
    
    
          download(res.data,`${
      
      this.currentPlantInfo.plantName + this.$t("wsofar25")}`,"application/pdf")
        })
        .catch((error) => {
    
    
          this.$dialog({
    
    
            title: this.$t("phrase623"), // 请注意
            content: this.$t("plant_detail269"), // 当前没有数据诶
          });
          console.log(error);
        });
    },

猜你喜欢

转载自blog.csdn.net/weixin_45288172/article/details/129411716