烟花爆竹批发企业仓库安全风险监测前端
zhouwx
2025-04-03 15c3a0082b51422801f1985e5d9e68eef76c3039
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
<template>
  <div class="notice">
    <el-dialog
        v-model="dialogVisible"
        width="50%"
        title="文件预览"
        :before-close="handleClose"
        :close-on-press-escape="false"
        :close-on-click-modal="false"
    >
      <div style="width: 100%;height: auto;">
        <iframe
            :src="state.iframeSrc"
            width="100%"
            height="750px"
            class="custom-iframe"
        ></iframe>
      </div>
    </el-dialog>
  </div>
</template>
<script setup>
import {reactive, ref, toRefs} from 'vue'
const dialogVisible = ref(false);
const title = ref("");
 
const emit = defineEmits(["getList"]);
 
const state = reactive({
  iframeSrc: ''
})
 
 
const openDialog = async (value) => {
  if(value.itemStatus == 2){
    state.iframeSrc =  import.meta.env.VITE_APP_BASE_API  + value.itemFile
  }else{
    state.iframeSrc =  import.meta.env.VITE_APP_BASE_API  + value.tempFile
  }
  dialogVisible.value = true;
}
 
const handleClose = () => {
  reset();
  dialogVisible.value = false;
  emit("getList")
}
const reset = () => {
state.iframeSrc = ''
}
 
defineExpose({
  openDialog
});
 
</script>
 
<style scoped lang="scss">
.notice{
  .custom-iframe {
    border: 1px solid #9b9999;
    /* 隐藏原生滚动条 */
    overflow: hidden;
  }
}
</style>