mirror of
https://gitee.com/anji-plus/report.git
synced 2026-02-02 09:27:47 +08:00
@@ -30,17 +30,20 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
bigScreenStyle: {},
|
bigScreenStyle: {},
|
||||||
|
dashboard:{},
|
||||||
widgets: []
|
widgets: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getData();
|
this.getData();
|
||||||
|
window.onresize=this.Debounce(this.setScale,500);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async getData() {
|
async getData() {
|
||||||
const reportCode = this.$route.query.reportCode;
|
const reportCode = this.$route.query.reportCode;
|
||||||
const { code, data } = await detailDashboard(reportCode);
|
const { code, data } = await detailDashboard(reportCode);
|
||||||
if (code != 200) return;
|
if (code != 200) return;
|
||||||
|
this.dashboard=data.dashboard||{};
|
||||||
const equipment = document.body.clientWidth;
|
const equipment = document.body.clientWidth;
|
||||||
const ratioEquipment = equipment / data.dashboard.width;
|
const ratioEquipment = equipment / data.dashboard.width;
|
||||||
this.bigScreenStyle = {
|
this.bigScreenStyle = {
|
||||||
@@ -74,7 +77,32 @@ export default {
|
|||||||
if(data.dashboard.refreshSeconds>0) {
|
if(data.dashboard.refreshSeconds>0) {
|
||||||
setTimeout(function(){ window.location.reload(); }, data.dashboard.refreshSeconds*1000);
|
setTimeout(function(){ window.location.reload(); }, data.dashboard.refreshSeconds*1000);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
Debounce:(fn,t)=>{
|
||||||
|
const delay=t||500;
|
||||||
|
let timer=null;
|
||||||
|
return(...args)=>{
|
||||||
|
if(timer){
|
||||||
|
clearTimeout(timer);
|
||||||
|
}
|
||||||
|
const context=this
|
||||||
|
timer=setTimeout(()=>{
|
||||||
|
fn.apply(context,args);
|
||||||
|
},delay);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setScale(){
|
||||||
|
const scale=this.getScale();
|
||||||
|
this.bigScreenStyle.transform='scale('+scale.scalex+','+scale.scaley+')'
|
||||||
|
},
|
||||||
|
getScale(){
|
||||||
|
let width=this.dashboard.width;
|
||||||
|
let height=this.dashboard.height;
|
||||||
|
return{
|
||||||
|
scalex:(window.innerWidth)/width,
|
||||||
|
scaley:(window.innerHeight)/height,
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user