Merge pull request #137 from lanrenwo/home_charts_width

首页图表宽度自适应
This commit is contained in:
bjdgyc 2022-09-16 21:20:13 +08:00 committed by GitHub
commit 5586b27319
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 40 deletions

View File

@ -29,8 +29,10 @@
}, },
mounted() { mounted() {
this.initChart() this.initChart()
window.addEventListener('resize', this.listenerResize)
}, },
beforeDestroy() { beforeDestroy() {
window.removeEventListener('resize', this.listenerResize)
}, },
watch: { watch: {
chartData:{ chartData:{
@ -41,6 +43,9 @@
} }
}, },
methods: { methods: {
listenerResize() {
this.chart.resize()
},
initChart() { initChart() {
this.chart = echarts.init(this.$el) this.chart = echarts.init(this.$el)

View File

@ -306,12 +306,15 @@ export default {
</script> </script>
<style scoped> <style scoped>
.panel-group {
margin-bottom: 20px;
}
.card-panel { .card-panel {
display: flex; display: flex;
border-radius: 12px; border-radius: 12px;
justify-content: space-around; justify-content: space-around;
border: 1px solid red; border: 1px solid red;
padding: 30px 0; padding: 20px 0;
color: #666; color: #666;
background: #fff; background: #fff;
@ -363,6 +366,6 @@ export default {
.time-range { .time-range {
position: absolute; position: absolute;
right: 5px; right: 5px;
top: 10px; top: 5px;
} }
</style> </style>

View File

@ -66,16 +66,15 @@
border> border>
<el-table-column <el-table-column
sortable="true"
prop="id" prop="id"
label="ID" label="ID"
width="60"> width="100">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="username" prop="username"
label="用户名" label="用户名"
width="120"> width="140">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -99,7 +98,7 @@
<el-table-column <el-table-column
prop="access_proto" prop="access_proto"
label="访问协议" label="访问协议"
width="85" width="80"
:formatter="protoFormat"> :formatter="protoFormat">
</el-table-column> </el-table-column>
@ -114,24 +113,6 @@
width="150" width="150"
:formatter="tableDateFormat"> :formatter="tableDateFormat">
</el-table-column> </el-table-column>
<el-table-column
label="操作"
width="100">
<template slot-scope="scope">
<el-popconfirm
class="m-left-10"
@confirm="handleDel(scope.row)"
title="确定要删除审计日志吗?">
<el-button
slot="reference"
size="mini"
type="danger">删除
</el-button>
</el-popconfirm>
</template>
</el-table-column>
</el-table> </el-table>
<div class="sh-20"></div> <div class="sh-20"></div>
@ -237,22 +218,6 @@ export default {
pageChange(p) { pageChange(p) {
this.getData(p) this.getData(p)
}, },
handleDel(row) {
axios.post('/set/audit/del?id=' + row.id).then(resp => {
var rdata = resp.data
if (rdata.code === 0) {
this.$message.success(rdata.msg);
this.getData(1);
} else {
this.$message.error(rdata.msg);
}
console.log(rdata);
}).catch(error => {
this.$message.error('哦,请求出错');
console.log(error);
});
},
handleExport() { handleExport() {
if (this.count > this.maxExportNum) { if (this.count > this.maxExportNum) {
var formatNum = (this.maxExportNum + "").replace(/\d{1,3}(?=(\d{3})+$)/g,function(s){ var formatNum = (this.maxExportNum + "").replace(/\d{1,3}(?=(\d{3})+$)/g,function(s){