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 | 97 ++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 88 insertions(+), 9 deletions(-) diff --git a/src/pages/show/shehuiBaozhang/shehuiBaozhangChildren/shebaoShouzhiZongbiao.vue b/src/pages/show/shehuiBaozhang/shehuiBaozhangChildren/shebaoShouzhiZongbiao.vue index ad90328..2fe331a 100644 --- a/src/pages/show/shehuiBaozhang/shehuiBaozhangChildren/shebaoShouzhiZongbiao.vue +++ b/src/pages/show/shehuiBaozhang/shehuiBaozhangChildren/shebaoShouzhiZongbiao.vue @@ -3,6 +3,7 @@ <div class="shebaoShouzhiZongbiao-table"> <h1>绀句細淇濋殰鍩洪噾缁熻琛�</h1> <el-table + :max-height="tableHeight" :data="tableData" :cell-style="handleCellStyle" style="width: 100%"> @@ -71,101 +72,155 @@ prop="item" label="椤圭洰"> </el-table-column> - <el-table-column :label="month1" align="center"> + <el-table-column v-if="tableData[0]" :label="tableData[0].month1" align="center"> <el-table-column align="center" - prop="totalIncome1" label="鎬绘敹鍏�"> + <template slot-scope="scope"> + <span :class="Number(scope.row.totalIncome1) < 0 ? 'fontColorRed' : ''">{{scope.row.totalIncome1}}</span> + </template> </el-table-column> <el-table-column 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 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 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="month2" align="center"> + <el-table-column v-if="tableData[0]" :label="tableData[0].month2" align="center"> <el-table-column 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 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 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 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="month3" align="center"> + <el-table-column v-if="tableData[0]" :label="tableData[0].month3" align="center"> <el-table-column 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 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 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 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="month4" align="center"> + <el-table-column v-if="tableData[0]" :label="tableData[0].month4" align="center"> <el-table-column 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 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 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 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 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 class="shebaoShouzhiZongbiaoEcharts" id="shebaoShouzhiZongbiaoEcharts"></div> + <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> @@ -180,8 +235,10 @@ return { tableHead:[], tableData:[], - headerArry:[], - echartsSeries:{} + headerArry:{}, + echartsSeries:{}, + tableHeight: window.innerHeight - nowSize(960), + echartsShow: true } }, mounted() { @@ -189,10 +246,24 @@ 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====') + } + }) } }) }, @@ -301,7 +372,7 @@ myEchart.resize() }) }, - handleCellStyle({rowIndex, columnIndex}) { + handleCellStyle({row, column, rowIndex, columnIndex}) { if(columnIndex == 0) { return { background:'#51D2FF' } } @@ -399,4 +470,12 @@ 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