index.vue
1.73 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
<!--
* @Descripttion: 大屏设计器 -- 预览
!-->
<template>
<div class="layout">
<div :style="bigScreenStyle">
<widget
v-for="(widget, index) in widgets"
:key="index"
v-model="widget.value"
:type="widget.type"
/>
</div>
</div>
</template>
<script>
import widget from "../designer/widget/temp";
import { detailDashboard } from "@/api/bigscreen";
export default {
name: "Login",
components: {
widget
},
data() {
return {
bigScreenStyle: {},
widgets: []
};
},
mounted() {
this.getData();
},
methods: {
async getData() {
const reportCode = this.$route.query.reportCode;
const { code, data } = await detailDashboard(reportCode);
if (code != 200) return;
const equipment = document.body.clientWidth;
const ratioEquipment = equipment / data.dashboard.width;
this.bigScreenStyle = {
width: data.dashboard.width + "px",
height: data.dashboard.height + "px",
"background-color": data.dashboard.backgroundColor,
"background-image": "url(" + data.dashboard.backgroundImage + ")",
"background-position": "0% 0%",
"background-size": "100% 100%",
"background-repeat": "initial",
"background-attachment": "initial",
"background-origin": "initial",
"background-clip": "initial",
transform: `scale(${ratioEquipment}, ${ratioEquipment})`,
"transform-origin": "0 0"
};
this.widgets = data.dashboard.widgets;
}
}
};
</script>
<style scoped lang="scss">
.layout {
width: 100%;
height: 100%;
text-align: center;
}
.bottom-text {
width: 100%;
color: #a0a0a0;
position: fixed;
bottom: 16px;
z-index: 9999;
}
</style>