gaoluyang
2025-02-11 29b413387460cd532f6d9f045c82faad9a2c1e85
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<template>
  <div>
    <el-dialog title="报告查看下载" :visible.sync="isShow" width="500px" @closed="$emit('closeDownFileDialog')">
      <div style="margin-bottom: 18px">
        <span style="font-size: 16px;">进厂检验报告下载</span>
        <i class="el-icon-paperclip" style="color:#409EFF;margin-left: 6px"></i>
        <el-link :underline="false" style="vertical-align: bottom;font-size: 16px;"
                 :disabled="!downLoadInfo.enterUrls && !downLoadInfo.enterUrl"
                 type="primary" @click="downLoad0">查看</el-link>
      </div>
      <div>
        <span  style="font-size: 16px;">季度检验报告下载</span>
        <i class="el-icon-paperclip" style="color:#409EFF;margin-left: 6px"></i>
        <el-link :underline="false" style="vertical-align: bottom;font-size: 16px;"
                 :disabled="!downLoadInfo.quarterUrls && !downLoadInfo.quarterUrl"
                 type="primary" @click="downLoad1">查看</el-link>
      </div>
    </el-dialog>
  </div>
</template>
 
<script>
import ValueTable from "@/components/Table/value-table.vue";
 
export default {
  name: "downFileDialog",
  // import 引入的组件需要注入到对象中才能使用
  components: {ValueTable},
  props: {
    downFileDialogVisible: {
      type: Boolean,
      default: () => false
    },
    downLoadInfo: {
      type: Object,
      default: () => {}
    },
  },
  data() {
    // 这里存放数据
    return {
      isShow: this.downFileDialogVisible,
    }
  },
  // 方法集合
  methods: {
    // 进厂检验报告下载
    downLoad0 () {
      let url = this.downLoadInfo.enterUrlS ? this.downLoadInfo.enterUrlS : this.downLoadInfo.enterUrl
      if(url){
        url = url.split('.')[0]+'.pdf'
        const link = document.createElement('a');
        link.href = this.javaApi + url;
        link.target = '_blank';
        document.body.appendChild(link);
        link.click();
      }
    },
    // 季度检验报告下载
    downLoad1 () {
      let url = this.downLoadInfo.quarterUrlS ? this.downLoadInfo.quarterUrlS : this.downLoadInfo.quarterUrl
      if(url){
        url = url.split('.')[0]+'.pdf'
        const link = document.createElement('a');
        link.href = this.javaApi + url;
        link.target = '_blank';
        document.body.appendChild(link);
        link.click();
      }
    }
  },
}
</script>
 
<style scoped>
>>> .el-dialog {
  height: 160px;
}
</style>