From 77536cfa95b1e3c5e60f94dce3a53aa2e93f121a Mon Sep 17 00:00:00 2001
From: zhangxiaoxu123 <819527061@qq.com>
Date: 星期三, 14 九月 2022 17:35:54 +0800
Subject: [PATCH] echarts添加显示隐藏按钮
---
src/pages/show/shehuiBaozhang/shehuiBaozhangChildren/shebaoShouzhiZongbiao.vue | 653 ++++++++++++++++++++++++++++++++++++----------------------
1 files changed, 401 insertions(+), 252 deletions(-)
diff --git a/src/pages/show/shehuiBaozhang/shehuiBaozhangChildren/shebaoShouzhiZongbiao.vue b/src/pages/show/shehuiBaozhang/shehuiBaozhangChildren/shebaoShouzhiZongbiao.vue
index 87aa6e3..2fe331a 100644
--- a/src/pages/show/shehuiBaozhang/shehuiBaozhangChildren/shebaoShouzhiZongbiao.vue
+++ b/src/pages/show/shehuiBaozhang/shehuiBaozhangChildren/shebaoShouzhiZongbiao.vue
@@ -3,330 +3,479 @@
<div class="shebaoShouzhiZongbiao-table">
<h1>绀句細淇濋殰鍩洪噾缁熻琛�</h1>
<el-table
- v-fit-columns
+ :max-height="tableHeight"
+ :data="tableData"
+ :cell-style="handleCellStyle"
style="width: 100%">
+ <!--<template v-for="(item,index) in headerArry">
+ <template v-if="index == 0">
+ <el-table-column
+ align="center"
+ :prop="item.item"
+ label="椤圭洰"
+ fixed>
+ <template slot-scope="scope">
+ <span style="margin-left: 10px">{{scope.row.item}}</span>
+ </template>
+ </el-table-column>
+ <template v-for="(e,i) in item.dataList">
+ <el-table-column :label="e.month" align="center">
+ <el-table-column
+ align="center"
+ label="鎬绘敹鍏�">
+ <template slot-scope="scope">
+ <template>
+ <template>
+ <span :class="[Number(e.taxesIncome) < 0 ? 'fontColorRed' : '']" style="margin-left: 10px">{{scope.row.dataList[0].totalIncome}}</span>
+ </template>
+ </template>
+ </template>
+ </el-table-column>
+ <el-table-column
+ align="center"
+ label="寰侀泦鏀跺叆">
+ <template slot-scope="scope">
+ <span :class="[Number(e.taxesIncome) < 0 ? 'fontColorRed' : '']" style="margin-left: 10px">{{scope.row.dataList[0].taxesIncome}}</span>
+ </template>
+ </el-table-column>
+ <el-table-column
+ align="center"
+ label="鏈湀鏀嚭">
+ <template slot-scope="scope">
+ <span :class="[Number(e.pay) < 0 ? 'fontColorRed' : '']" style="margin-left: 10px">{{scope.row.dataList[0].pay}}</span>
+ </template>
+ </el-table-column>
+ <el-table-column
+ align="center"
+ label="鏈湀缁撲綑">
+ <template slot-scope="scope">
+ <span :class="[Number(e.balance) < 0 ? 'fontColorRed' : '']" style="margin-left: 10px">{{scope.row.dataList[0].balance}}</span>
+ </template>
+ </el-table-column>
+ </el-table-column>
+ </template>
+ <template>
+ <el-table-column
+ align="center"
+ :prop="item.surplus"
+ label="绱缁撲綑">
+ <template slot-scope="scope">
+ <span :class="[Number(item.surplus) < 0 ? 'fontColorRed' : '']" style="margin-left: 10px">{{item.surplus}}</span>
+ </template>
+ </el-table-column>
+ </template>
+ </template>
+ </template>-->
<el-table-column
- prop="name"
- label="椤圭洰"
- :data="tableData"
- fixed>
+ width="260"
+ align="center"
+ prop="item"
+ label="椤圭洰">
</el-table-column>
- <el-table-column
- label="1鏈�">
+ <el-table-column v-if="tableData[0]" :label="tableData[0].month1" align="center">
<el-table-column
- prop="totalMoney"
+ align="center"
label="鎬绘敹鍏�">
+ <template slot-scope="scope">
+ <span :class="Number(scope.row.totalIncome1) < 0 ? 'fontColorRed' : ''">{{scope.row.totalIncome1}}</span>
+ </template>
</el-table-column>
<el-table-column
- prop="zhengjishouru"
+ align="center"
+ prop="taxesIncome1"
label="寰侀泦鏀跺叆">
+ <template slot-scope="scope">
+ <span :class="Number(scope.row.taxesIncome1) < 0 ? 'fontColorRed' : ''">{{scope.row.taxesIncome1}}</span>
+ </template>
</el-table-column>
<el-table-column
- prop="benyuezhichu"
+ align="center"
+ prop="pay1"
label="鏈湀鏀嚭">
+ <template slot-scope="scope">
+ <span :class="Number(scope.row.pay1) < 0 ? 'fontColorRed' : ''">{{scope.row.pay1}}</span>
+ </template>
</el-table-column>
<el-table-column
- prop="benyuejieyu"
+ align="center"
+ prop="balance1"
label="鏈湀缁撲綑">
+ <template slot-scope="scope">
+ <span :class="Number(scope.row.balance1) < 0 ? 'fontColorRed' : ''">{{scope.row.balance1}}</span>
+ </template>
</el-table-column>
</el-table-column>
- <el-table-column
- label="2鏈�">
+ <el-table-column v-if="tableData[0]" :label="tableData[0].month2" align="center">
<el-table-column
- prop="totalMoney"
+ align="center"
+ prop="totalIncome2"
label="鎬绘敹鍏�">
+ <template slot-scope="scope">
+ <span :class="Number(scope.row.totalIncome2) < 0 ? 'fontColorRed' : ''">{{scope.row.totalIncome2}}</span>
+ </template>
</el-table-column>
<el-table-column
- prop="totalMoney"
+ align="center"
+ prop="taxesIncome2"
label="寰侀泦鏀跺叆">
+ <template slot-scope="scope">
+ <span :class="Number(scope.row.taxesIncome2) < 0 ? 'fontColorRed' : ''">{{scope.row.taxesIncome2}}</span>
+ </template>
</el-table-column>
<el-table-column
- prop="totalMoney"
+ align="center"
+ prop="pay2"
label="鏈湀鏀嚭">
+ <template slot-scope="scope">
+ <span :class="Number(scope.row.pay2) < 0 ? 'fontColorRed' : ''">{{scope.row.pay2}}</span>
+ </template>
</el-table-column>
<el-table-column
- prop="totalMoney"
+ align="center"
+ prop="balance2"
label="鏈湀缁撲綑">
+ <template slot-scope="scope">
+ <span :class="Number(scope.row.balance2) < 0 ? 'fontColorRed' : ''">{{scope.row.balance2}}</span>
+ </template>
</el-table-column>
</el-table-column>
- <el-table-column
- label="3鏈�">
+ <el-table-column v-if="tableData[0]" :label="tableData[0].month3" align="center">
<el-table-column
- prop="totalMoney"
+ align="center"
+ prop="totalIncome3"
label="鎬绘敹鍏�">
+ <template slot-scope="scope">
+ <span :class="Number(scope.row.totalIncome3) < 0 ? 'fontColorRed' : ''">{{scope.row.totalIncome3}}</span>
+ </template>
</el-table-column>
<el-table-column
- prop="totalMoney"
+ align="center"
+ prop="taxesIncome3"
label="寰侀泦鏀跺叆">
+ <template slot-scope="scope">
+ <span :class="Number(scope.row.taxesIncome3) < 0 ? 'fontColorRed' : ''">{{scope.row.taxesIncome3}}</span>
+ </template>
</el-table-column>
<el-table-column
- prop="totalMoney"
+ align="center"
+ prop="pay3"
label="鏈湀鏀嚭">
+ <template slot-scope="scope">
+ <span :class="Number(scope.row.pay3) < 0 ? 'fontColorRed' : ''">{{scope.row.pay3}}</span>
+ </template>
</el-table-column>
<el-table-column
- prop="totalMoney"
+ align="center"
+ prop="balance3"
label="鏈湀缁撲綑">
+ <template slot-scope="scope">
+ <span :class="Number(scope.row.balance3) < 0 ? 'fontColorRed' : ''">{{scope.row.balance3}}</span>
+ </template>
</el-table-column>
</el-table-column>
- <el-table-column
- label="4鏈�">
+ <el-table-column v-if="tableData[0]" :label="tableData[0].month4" align="center">
<el-table-column
- prop="totalMoney"
+ align="center"
+ prop="totalIncome4"
label="鎬绘敹鍏�">
+ <template slot-scope="scope">
+ <span :class="Number(scope.row.totalIncome4) < 0 ? 'fontColorRed' : ''">{{scope.row.totalIncome4}}</span>
+ </template>
</el-table-column>
<el-table-column
- prop="totalMoney"
+ align="center"
+ prop="taxesIncome4"
label="寰侀泦鏀跺叆">
+ <template slot-scope="scope">
+ <span :class="Number(scope.row.taxesIncome4) < 0 ? 'fontColorRed' : ''">{{scope.row.taxesIncome4}}</span>
+ </template>
</el-table-column>
<el-table-column
- prop="totalMoney"
+ align="center"
+ prop="pay4"
label="鏈湀鏀嚭">
+ <template slot-scope="scope">
+ <span :class="Number(scope.row.pay4) < 0 ? 'fontColorRed' : ''">{{scope.row.pay4}}</span>
+ </template>
</el-table-column>
<el-table-column
- prop="totalMoney"
+ align="center"
+ prop="balance4"
label="鏈湀缁撲綑">
+ <template slot-scope="scope">
+ <span :class="Number(scope.row.balance4) < 0 ? 'fontColorRed' : ''">{{scope.row.balance4}}</span>
+ </template>
</el-table-column>
</el-table-column>
<el-table-column
- label="5鏈�">
- <el-table-column
- prop="totalMoney"
- label="鎬绘敹鍏�">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="寰侀泦鏀跺叆">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="鏈湀鏀嚭">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="鏈湀缁撲綑">
- </el-table-column>
- </el-table-column>
- <el-table-column
- label="6鏈�">
- <el-table-column
- prop="totalMoney"
- label="鎬绘敹鍏�">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="寰侀泦鏀跺叆">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="鏈湀鏀嚭">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="鏈湀缁撲綑">
- </el-table-column>
- </el-table-column>
- <el-table-column
- label="7鏈�">
- <el-table-column
- prop="totalMoney"
- label="鎬绘敹鍏�">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="寰侀泦鏀跺叆">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="鏈湀鏀嚭">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="鏈湀缁撲綑">
- </el-table-column>
- </el-table-column>
- <el-table-column
- label="9鏈�">
- <el-table-column
- prop="totalMoney"
- label="鎬绘敹鍏�">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="寰侀泦鏀跺叆">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="鏈湀鏀嚭">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="鏈湀缁撲綑">
- </el-table-column>
- </el-table-column>
- <el-table-column
- label="10鏈�">
- <el-table-column
- prop="totalMoney"
- label="鎬绘敹鍏�">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="寰侀泦鏀跺叆">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="鏈湀鏀嚭">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="鏈湀缁撲綑">
- </el-table-column>
- </el-table-column>
- <el-table-column
- label="11鏈�">
- <el-table-column
- prop="totalMoney"
- label="鎬绘敹鍏�">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="寰侀泦鏀跺叆">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="鏈湀鏀嚭">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="鏈湀缁撲綑">
- </el-table-column>
- </el-table-column>
- <el-table-column
- label="12鏈�">
- <el-table-column
- prop="totalMoney"
- label="鎬绘敹鍏�">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="寰侀泦鏀跺叆">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="鏈湀鏀嚭">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="鏈湀缁撲綑">
- </el-table-column>
- </el-table-column>
- <el-table-column
- label="鏈勾绱">
- <el-table-column
- prop="totalMoney"
- label="鎬绘敹鍏�">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="寰侀泦鏀跺叆">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="鏈湀鏀嚭">
- </el-table-column>
- <el-table-column
- prop="totalMoney"
- label="鏈湀缁撲綑">
- </el-table-column>
- </el-table-column>
- <el-table-column
- prop="name"
+ align="center"
+ prop="surplus"
label="绱缁撲綑">
+ <template slot-scope="scope">
+ <span :class="Number(scope.row.surplus) < 0 ? 'fontColorRed' : ''">{{scope.row.surplus}}</span>
+ </template>
</el-table-column>
</el-table>
+ <div v-show="echartsShow" class="shebaoShouzhiZongbiaoEcharts" id="shebaoShouzhiZongbiaoEcharts"></div>
+ <div class="yincang-box">
+ <el-button @click="showEchartsBtn" v-show="echartsShow" type="primary">闅愯棌</el-button>
+ <el-button @click="showEchartsBtn" v-show="!echartsShow" type="primary">鏄剧ず</el-button>
+ </div>
</div>
</div>
</template>
<script>
- export default {
- name: "shebaoShouzhiZongbiao",
- data() {
- return {
- tableData:[{
- totalMoney: '323332',
- zhengjishouru: '223333',
- benyuezhichu: '3t638',
- benyuejieyu: '76373637'
- }]
- }
- }
+ import nowSize from "../../../../libs/nowSize";
+ import {getStatisticsTable,getStatisticsChart } from '@/api/shehuiBaozhang'
+ import index from "../../index/index";
+export default {
+ name: "shebaoShouzhiZongbiao",
+ data() {
+ return {
+ tableHead:[],
+ tableData:[],
+ headerArry:{},
+ echartsSeries:{},
+ tableHeight: window.innerHeight - nowSize(960),
+ echartsShow: true
}
+ },
+ mounted() {
+ this.getStatisticsTable()
+ this.getStatisticsChart()
+ },
+ methods: {
+ showEchartsBtn() {
+ this.echartsShow = !this.echartsShow
+ if(this.echartsShow) {
+ this.tableHeight = window.innerHeight - nowSize(960)
+ }else {
+ this.tableHeight = window.innerHeight - nowSize(320)
+ }
+ },
+ getStatisticsTable() {
+ getStatisticsTable().then(res => {
+ if(res.code == 1000) {
+ this.tableData = res.list
+ res.list.forEach((item,index) => {
+ if(index == 0) {
+ this.headerArry = item
+ console.log(this.headerArry,'this.headerArry====')
+ }
+ })
+ }
+ })
+ },
+ shebaoShouzhiZongbiaoEcharts() {
+ let myEchart = this.$echarts.init(document.getElementById('shebaoShouzhiZongbiaoEcharts'))
+ let option = {
+ color : ['#FF5151','#51FF5D','#FFD151','#FFD151'],
+ title: {
+ text: '鍘嗗勾绀句繚鍩洪噾绱鏁版嵁鍒嗘瀽鍥�',
+ left: 'center',
+ top: '8%',
+ textStyle: {
+ color: '#FFFFFF',
+ fontSize: nowSize(30)
+ },
+ },
+ tooltip: {
+ trigger: 'axis'
+ },
+ legend: {
+ itemWidth: nowSize(30),
+ itemHeight: nowSize(4),
+ itemGap: nowSize(50),
+ right:'2%',
+ top: 'center',
+ orient: 'vertical',
+ textStyle: {
+ color: '#FFFFFF',
+ fontSize: nowSize(24),
+ }
+ },
+ grid: {
+ top: '15%',
+ left: '4%',
+ right: '18%',
+ bottom: '9%',
+ containLabel: true
+ },
+ xAxis: {
+ type: 'category',
+ boundaryGap: false,
+ data: this.echartsSeries.years,
+ axisLabel: {
+ show: true,
+ textStyle: {
+ color: "#fff",
+ fontSize:nowSize(24)
+ }
+ },
+ axisLine: {
+ lineStyle: {
+ color: "#999999",
+ width: 1,
+ type: "solid"
+ }
+ },
+ splitLine: {
+ show: false
+ }
+ },
+ yAxis: {
+ type: 'value',
+ axisLabel: {
+ show: true,
+ textStyle: {
+ color: "#fff",
+ fontSize:nowSize(24)
+ }
+ },
+ axisLine: {
+ lineStyle: {
+ color: "#999999",
+ width: 1,
+ type: "solid"
+ }
+ },
+ splitLine: {
+ show: false
+ }
+ },
+ series: [
+ {
+ name: '骞寸疮璁℃�绘敹鍏�',
+ type: 'line',
+ data: this.echartsSeries.income
+ },
+ {
+ name: '骞寸疮璁℃敮鍑�',
+ type: 'line',
+ data: this.echartsSeries.pay
+ },
+ {
+ name: '骞寸疮璁″緛缂存敹鍏�',
+ type: 'line',
+ data: this.echartsSeries.taxes
+ },
+ {
+ name: '骞寸疮璁$粨浣�',
+ type: 'line',
+ data:this.echartsSeries.balance
+ }
+ ]
+ };
+ myEchart.setOption(option)
+ window.addEventListener('resize',function () {
+ myEchart.resize()
+ })
+ },
+ handleCellStyle({row, column, rowIndex, columnIndex}) {
+ if(columnIndex == 0) {
+ return { background:'#51D2FF' }
+ }
+ },
+ //35. 鏌ヨ鍘嗗勾绀句繚鍩洪噾鏁版嵁鍒嗘瀽鍥炬暟鎹帴鍙�
+ getStatisticsChart() {
+ getStatisticsChart().then(res => {
+ if(res.code ===1000){
+ this.echartsSeries = res.obj
+ this.shebaoShouzhiZongbiaoEcharts()
+ }
+ })
+ }
+ }
+}
</script>
<style lang="scss">
- @import "../../../../assets/css/base";
- .shebaoShouzhiZongbiao-table{
- width: 100%;
- height: calc(100% - 0.078125rem /* 20/256 */);
- margin-top: 0.078125rem /* 20/256 */;
- .el-table th.el-table__cell{
- background-color:$color-blue;
- height: 0.3125rem /* 80/256 */;
- }
- .el-table tr{
- height: 0.3125rem /* 80/256 */;
- }
- .el-table tr:nth-child(odd){
- background-color: #CEF2FF;
- }
- .el-table tr:nth-child(even){
- background-color: #A8E9FF;
- }
- .el-table, .el-table__expanded-cell{
- background-color: transparent;
- }
- .el-table thead{
- color: $color-darkGrey;
- }
- .el-table{
- color: $color-darkGrey;
- }
- .el-table .cell{
- font-size: $fontSize-28;
- color: $color-darkGrey;
- font-weight: 300;
- line-height: 1;
- white-space:pre-line;
- }
- .el-table--border th.el-table__cell, .el-table__fixed-right-patch{
- border-bottom:1Px solid $color-grey; /*no*/
- }
- .el-table thead.is-group th.el-table__cell{
- background-color: $color-blue;
- }
- .el-table td.el-table__cell, .el-table th.el-table__cell.is-leaf{
- border-bottom:1Px solid $color-grey; /*no*/
- }
- .el-table--border .el-table__cell, .el-table__body-wrapper .el-table--border.is-scrolling-left~.el-table__fixed{
- border-right:1Px solid $color-grey; /*no*/
- }
+@import "../../../../assets/css/base";
+.shebaoShouzhiZongbiao-table{
+ width: 100%;
+ height: calc(100% - 0.078125rem /* 20/256 */);
+ margin-top: 0.078125rem /* 20/256 */;
+ /*.el-table .cell, el-table th > .cell{*/
+ /* display: inline-block;*/
+ /* white-space: nowrap;*/
+ /* width: auto;*/
+ /* overflow: auto;*/
+ /*}*/
+ .el-table th.el-table__cell{
+ background-color:$color-blue;
+ height: 0.3125rem /* 80/256 */;
}
+ .el-table tr{
+ height: 0.3125rem /* 80/256 */;
+ }
+ .el-table tr:nth-child(odd){
+ background-color: #CEF2FF;
+ }
+ .el-table tr:nth-child(even){
+ background-color: #A8E9FF;
+ }
+ .el-table, .el-table__expanded-cell{
+ background-color: transparent;
+ }
+ .el-table thead{
+ color: $color-darkGrey;
+ }
+ .el-table{
+ color: $color-darkGrey;
+ }
+ .el-table .cell{
+ font-size: $fontSize-28;
+ color: $color-darkGrey;
+ font-weight: 300;
+ line-height: 1;
+ white-space:pre-line;
+ }
+ .el-table--border th.el-table__cell, .el-table__fixed-right-patch{
+ border-bottom:1Px solid $color-grey; /*no*/
+ }
+ .el-table thead.is-group th.el-table__cell{
+ background-color: $color-blue;
+ }
+ .el-table td.el-table__cell, .el-table th.el-table__cell.is-leaf{
+ border-bottom:1Px solid $color-grey; /*no*/
+ }
+ .el-table--border .el-table__cell, .el-table__body-wrapper .el-table--border.is-scrolling-left~.el-table__fixed{
+ border-right:1Px solid $color-grey; /*no*/
+ }
+}
</style>
<style lang="scss" scoped>
- @import "../../../../assets/css/base";
- .shebaoShouzhiZongbiao-wrap{
- width: 100%;
- height: calc(100% - 0.078125rem /* 20/256 */);
- .shebaoShouzhiZongbiao-table{
- margin-top: 0.078125rem /* 20/256 */;
- h1{
- font-size: $fontSize-30;
- color: $color-white;
- text-align: center;
- line-height: 2;
- }
+@import "../../../../assets/css/base";
+.shebaoShouzhiZongbiao-wrap{
+ width: 100%;
+ height: calc(100% - 0.078125rem /* 20/256 */);
+ .shebaoShouzhiZongbiao-table{
+ margin-top: 0.078125rem /* 20/256 */;
+ h1{
+ font-size: $fontSize-30;
+ color: $color-white;
+ text-align: center;
+ line-height: 2;
+ }
+ .fontColorBlue {
+ color: $color-blue;
+ }
+ .fontColorRed {
+ color: #FF3939;
}
}
+ .shebaoShouzhiZongbiaoEcharts{
+ height: calc(100% - 640px - 0.33203125rem /* 85/256 */);
+ }
+}
+.shebaoShouzhiZongbiao-table{
+ position: relative;
+ .yincang-box{
+ position: absolute;
+ right: 0.078125rem /* 20/256 */;
+ bottom: 0.078125rem /* 20/256 */;
+ }
+}
</style>
--
Gitblit v1.9.1