统计展开更多

dev_2022-04-07
Jo 3 years ago
parent 22a6b89a53
commit 0dbd9729b9
  1. 79
      src/pages/stat/list/index.vue

@ -93,7 +93,7 @@
<div class="m-b-20 text-right"> <div class="m-b-20 text-right">
<el-button type="primary" size="small" @click="exportDatabaseByMonth" v-auth="'/stat/list:月份统计导出'">导出数据</el-button> <el-button type="primary" size="small" @click="exportDatabaseByMonth" v-auth="'/stat/list:月份统计导出'">导出数据</el-button>
</div> </div>
<div :class="['chart', 'chart' + i]" :id="'chart' + i" v-for="i in yearLen" :key="i"></div>
<el-table :data="monthData" class="table" stripe header-align="center" row-key="id" :span-method="objectSpanMethod" @selection-change="handleSelectionChange1"> <el-table :data="monthData" class="table" stripe header-align="center" row-key="id" :span-method="objectSpanMethod" @selection-change="handleSelectionChange1">
<el-table-column type="selection" width="80" align="center"></el-table-column> <el-table-column type="selection" width="80" align="center"></el-table-column>
<el-table-column prop="year" width="80" label="年份" align="center"></el-table-column> <el-table-column prop="year" width="80" label="年份" align="center"></el-table-column>
@ -115,7 +115,12 @@
<el-table-column prop="11" label="11月" align="center"></el-table-column> <el-table-column prop="11" label="11月" align="center"></el-table-column>
<el-table-column prop="12" label="12月" align="center"></el-table-column> <el-table-column prop="12" label="12月" align="center"></el-table-column>
</el-table> </el-table>
<div class="chart" :id="'chart' + i" v-for="i in yearLen" :key="i"></div> <div class="fold" v-if="monthDataOri.length > 9">
<span :class="{active: showCharts}" @click="toggleCharts">
展开更多
<i class="el-icon-arrow-down"></i>
</span>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -149,7 +154,11 @@ export default {
initShowLen: 5, // 使 initShowLen: 5, // 使
multipleSelection: [], multipleSelection: [],
yearLen: 0, yearLen: 0,
showCharts: false,
monthDataOri: [], //
monthData: [], monthData: [],
chartList: {},
chartListOri: {},
multipleSelection1: [], multipleSelection1: [],
active: false active: false
} }
@ -227,10 +236,13 @@ export default {
result.push(item) result.push(item)
} }
} }
this.yearLen = len this.yearLen = len > 3 ? 3 : len // 3
this.monthData = result this.monthData = result.slice(0, 9)
this.monthDataOri = result
this.chartList = list
this.chartListOri = list
this.$nextTick(() => { this.$nextTick(() => {
this.initChart(list) this.initChart()
}) })
}).catch(res => {}) }).catch(res => {})
// //
@ -244,7 +256,8 @@ export default {
this.getDatabase() this.getDatabase()
}, },
// 使 // 使
initChart(list){ initChart(){
const list = this.chartList
const seriesList = [] const seriesList = []
// series // series
for (let i in list) { for (let i in list) {
@ -332,8 +345,8 @@ export default {
show: false show: false
}, },
grid: { grid: {
left: '3%', left: '2%',
right: '4%', right: '-4%',
bottom: '3%', bottom: '3%',
containLabel: true containLabel: true
}, },
@ -429,6 +442,21 @@ export default {
}).then((res) => { }).then((res) => {
util.downloadFileDirect(`按月份统计数据库使用概况.xls`,new Blob([res.data])) util.downloadFileDirect(`按月份统计数据库使用概况.xls`,new Blob([res.data]))
}).catch(res => {}) }).catch(res => {})
},
// 使
toggleCharts() {
if (this.showCharts) {
this.monthData = this.monthDataOri.slice(0, 9)
this.yearLen = 3
} else {
this.monthData = JSON.parse(JSON.stringify(this.monthDataOri))
this.yearLen = this.monthDataOri.length / 3
this.chartList = JSON.parse(JSON.stringify(this.chartListOri))
this.$nextTick(() => {
this.initChart()
})
}
this.showCharts = !this.showCharts
} }
} }
}; };
@ -506,6 +534,7 @@ export default {
max-width: calc(100% - 250px); max-width: calc(100% - 250px);
} }
.page{ .page{
position: relative;
margin-bottom: 20px; margin-bottom: 20px;
.arrow{ .arrow{
cursor: pointer; cursor: pointer;
@ -570,9 +599,39 @@ export default {
} }
} }
.chart{ .chart{
width: calc(100% - 180px); z-index: 2;
position: absolute !important;
top: 154px;
width: calc(100% - 272px);
height: 132px; height: 132px;
margin: -132px 0 0 240px; margin-left: 240px;
}
.chart2{
top: 286px;
}
.chart3{
top: 416px;
}
.chart4{
top: 546px;
}
.chart5{
top: 676px;
}
.fold{
margin-top: 20px;
text-align: center;
font-size: 12px;
color: #006EFF;
span{
cursor: pointer;
i{
transition: .5s;
}
&.active i{
transform: rotate(180deg);
}
}
} }
} }
.fold{ .fold{

Loading…
Cancel
Save