Commit f3af0d32 by qiyeqing

首页自适应调整

1 parent cd3121ee
<script src="node_modules/element-resize-detector/dist/element-resize-detector.min.js"></script>
var elemt = elementResizeDetectorMaker();
var erdUltraFast = elementResizeDetectorMaker({
strategy: "scroll"
});
elemt.listenTo(document.getElementById("fatherbox"), function(element) {
var width = element.offsetWidth;
var height = element.offsetHeight;
console.log("Size: " + width + "x" + height);
});
\ No newline at end of file \ No newline at end of file
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
<div class="index_l whitebg"> <div class="index_l whitebg">
<div class="box titlebox"> <div class="box titlebox">
<p class="adminname">{{getTimeState()}},Admin</p> <p class="adminname">{{getTimeState()}},Admin</p>
<p>20230-2-2 123:3123:1232</p> <p>{{parseTime(nowTime)}}</p>
</div> </div>
<div class="tables"> <div class="tables">
<div style="text-align:left"> <div style="text-align:left">
<el-row type="flex" class="row-bg" justify="space-between"> <el-row type="flex" class="row-bg" justify="space-between">
<el-col :span="24">实时数据</el-col> <el-col :span="24" style="font-weight:bold">实时数据</el-col>
</el-row> </el-row>
<el-row type="flex" class="row-bg" justify="space-between" style="margin-top:20px"> <el-row type="flex" class="row-bg" justify="space-between" style="margin-top:20px">
<el-col :span="6">企业成员总数</el-col> <el-col :span="6">企业成员总数</el-col>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<div class="dataall" style="margin-top:20px"> <div class="dataall" style="margin-top:20px">
<div style="text-align:left"> <div style="text-align:left">
<el-row type="flex" class="row-bg" justify="space-between"> <el-row type="flex" class="row-bg" justify="space-between">
<el-col :span="24">实时数据 <span class="fr fontgay">更新于{{uptime}}</span></el-col> <el-col :span="24" style="font-weight:bold">实时数据 <span class="fr fontgay">更新于{{uptime}}</span></el-col>
</el-row> </el-row>
<el-row type="flex" class="row-bg" justify="space-between"> <el-row type="flex" class="row-bg" justify="space-between">
<el-col :span="24"> <el-col :span="24">
...@@ -76,7 +76,9 @@ ...@@ -76,7 +76,9 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row type="flex" class="row-bg" justify="space-between" style="margin-top:20px"> <el-row type="flex" class="row-bg" justify="space-between" style="margin-top:20px">
<div id="main" style="width: 100%;height: 500px;"></div> <div id="fatherbox" >
<div id="main" ref="views"></div>
</div>
</el-row> </el-row>
</div> </div>
</div> </div>
...@@ -151,6 +153,10 @@ ...@@ -151,6 +153,10 @@
</div> </div>
</template> </template>
<script> <script>
var elementResizeDetectorMaker = require("element-resize-detector")
import {
parseTime
} from '@/utils/common.js'
import { import {
content content
} from '@/api/content.js' } from '@/api/content.js'
...@@ -160,6 +166,7 @@ ...@@ -160,6 +166,7 @@
components: {}, components: {},
data() { data() {
return { return {
nowTime:new Date(),
car: [{ car: [{
name: '发起申请数', name: '发起申请数',
url: '/' url: '/'
...@@ -186,7 +193,8 @@ ...@@ -186,7 +193,8 @@
uptime: '21321-21321:22', uptime: '21321-21321:22',
timeType: 'day', timeType: 'day',
charts: '', charts: '',
opinionData: ["3", "2", "4", "4", "5"] opinionData: ["3", "2", "4", "4", "5"],
charts:null
} }
}, },
methods: { methods: {
...@@ -289,8 +297,12 @@ ...@@ -289,8 +297,12 @@
this.uptime = data.updateTime; this.uptime = data.updateTime;
}) })
}, },
drawLine(id) { drawLine(id,width) {
this.charts = echarts.init(document.getElementById(id)) let obj=document.getElementById(id)
obj.style.width=width?`${width}px`:'100%';
obj.style.height='500px';
this.charts = echarts.init(obj)
this.charts.setOption({ this.charts.setOption({
tooltip: { tooltip: {
trigger: 'axis' trigger: 'axis'
...@@ -329,10 +341,20 @@ ...@@ -329,10 +341,20 @@
//调用 //调用
mounted() { mounted() {
this.$nextTick(function () { this.$nextTick(function () {
this.drawLine('main') this.drawLine('main','')
}) })
this.erchatInfo() this.erchatInfo()
this.tableInfo() this.tableInfo()
var erd = elementResizeDetectorMaker()
let that=this
erd.listenTo(document.getElementById("fatherbox"), function (element) {
var width = element.offsetWidth
var height = element.offsetHeight
that.$nextTick(function () {
console.log(this.$refs['views'])
this.drawLine('main',width)
})
})
} }
} }
...@@ -348,6 +370,9 @@ ...@@ -348,6 +370,9 @@
color: #999; color: #999;
font-size: 14px; font-size: 14px;
} }
#fatherbox{ width: 100%;height: 500px; overflow-y: scroll;}
#main{ width: 100%;height: 500px;
}
.fr { .fr {
float: right; float: right;
} }
...@@ -418,21 +443,21 @@ ...@@ -418,21 +443,21 @@
.inedx_r_top { .inedx_r_top {
width: 100%; width: 100%;
background: #fff; background: #fff;
height: 240px; height: 220px;
border-radius: 5px; border-radius: 5px;
.inedx_r_top_header { .inedx_r_top_header {
height: 180px; height: 160px;
width: 100%; width: 100%;
color: #999; color: #999;
} }
.inedx_r_top_t { .inedx_r_top_t {
height: 120px; height: 100px;
width: 100%; width: 100%;
line-height: 120px; line-height: 100px;
padding: 0 15px; padding: 0 15px;
font-size: 26px; font-size: 21px;
color: #199ed8; color: #199ed8;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!