PlmPicModal.vue
3.15 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
switchFullscreen
@ok="handleOk"
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
@cancel="handleCancel"
cancelText="关闭">
<iframe v-for="(item, index) in picUrl" style="width: 400px;height: 600px;display: none" :src="item"></iframe>
<!-- <vue-qr v-for="(url, index) in qrCodeList" :text="url" :size="120" :margin="0" style="position: relative;-->
<!-- top: -52vh;"></vue-qr>-->
<!-- -->
<!-- -->
<!-- <iframe v-for="(url, index) in picUrl2" :src="url" :key="url" :ref="'myIframe'+index"-->
<!-- style="width: 450px;height: 600px;margin-left: 10px"></iframe>-->
<div class="ant-modal-body">
<div v-for="(item, index) in picAll" style="display: flex">
<div>
<p style="text-align: center;font-weight: 600;color: black;font-size: 20px">{{ item.name }}</p>
<vue-qr :text="item.qrCode" :size="120" style="margin-top: -15px;
margin-right: -22px;
/* left: -3px; */
width: 177px;
height: 196px;
display: inline-block;"></vue-qr>
</div>
<iframe :src="item.url" :key="item.url" :ref="'myIframe'+index"
style="width: 450px;height: 600px;margin-left: 10px"></iframe>
</div>
</div>
</j-modal>
</template>
<script>
import QRCode from 'qrcodejs2' // 引入qrcode
// import QrcodeVue from 'qrcode.vue'
import VueQr from 'vue-qr'
export default {
name: 'PlmPicModal',
components: {
QRCode,
VueQr
},
data() {
return {
title: '',
width: 1800,
picUrl: [],
picUrl2: [],
picAll: [],
visible: false,
disableSubmit: false
}
},
mounted() {
// 获取指定的iframe元素
// 判断iframe是否成功加载页面了
this.picUrl = [];
this.picUrl2 = [];
this.picAll = [];
},
methods: {
edit(picUrl, picUrl2, picAll) {
this.$message.loading("图纸加载中....")
this.picUrl = [];
this.picUrl = picUrl;
this.picUrl2 = [];
this.picUrl2 = picUrl2;
this.picAll = [];
this.picAll = picAll;
this.visible = true;
let timeSearch = setTimeout(() => {
for (let i = 0; i <= this.picUrl2.length; i++) {
console.log('aaaaaaaaaaaa:')
const iframeRefName = 'myIframe' + i;
const myIframe = this.$refs[iframeRefName][0];
console.log(myIframe)
if (myIframe != undefined) {
myIframe.contentWindow.location.reload(true);
}
// if (i = this.picUrl2.length - 1) {
// clearInterval(timeSearch);
// }
}
//clearInterval(timeSearch);
}, 1000)
},
close() {
this.$emit('close');
this.visible = false;
},
handleOk() {
this.$refs.realForm.submitForm();
},
submitCallback() {
this.$emit('ok');
this.visible = false;
},
handleCancel() {
this.close()
}
}
}
</script>
<style lang="less" scoped>
.ant-modal-body {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
align-content: space-around;
}
</style>