From f2733edebdd17be85ade33122beb0ba07ea24125 Mon Sep 17 00:00:00 2001 From: zzq <a13193816592@163.com> Date: 星期三, 27 九月 2023 20:54:29 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/zzq' --- src/components/makepager/TableCommonView.vue | 80 +++++++++++++++++++++------------------- 1 files changed, 42 insertions(+), 38 deletions(-) diff --git a/src/components/makepager/TableCommonView.vue b/src/components/makepager/TableCommonView.vue index 2c9631a..8fcc0fe 100644 --- a/src/components/makepager/TableCommonView.vue +++ b/src/components/makepager/TableCommonView.vue @@ -1,6 +1,9 @@ <!-- eslint-disable vue/no-use-v-if-with-v-for --> <template> - <div :class="{'table-view':true,'table_height':!showSummary}" v-loading="loading"> + <div + :class="{ 'table-view': true, table_height: !showSummary }" + v-loading="loading" + > <el-table ref="table" border @@ -178,10 +181,10 @@ type: Boolean, default: true, }, - showSummary:{ - type:Boolean, - default:false - } + showSummary: { + type: Boolean, + default: false, + }, }, data() { return { @@ -252,52 +255,54 @@ }, //姹傚拰 getSummaries(param) { - if(this.tableList.countcol&&this.tableList.countcol.length>0){ - const { columns, data } = param; - const sums = []; - columns.forEach((column, index) => { - if (index === 0) { - sums[index] = " "; - return; - } - this.tableList.countcol.forEach((countcols,idx) => { - if (column.label === countcols) { - const values = data.map((item) => Number(item[column.property])); - if (!values.every((value) => isNaN(value))) { - sums[index] = values.reduce((prev, curr) => { - const value = Number(curr); - if (!isNaN(value)) { - return prev + curr; - } else { - return prev; - } - }, 0); - sums[index] = sums[index].toLocaleString(); - // console.log(sums,"sums") - } else { - sums[index] = ""; - } - } else { + if (this.tableList.countcol && this.tableList.countcol.length > 0) { + const { columns, data } = param; + const sums = []; + columns.forEach((column, index) => { + if (index === 0) { + sums[index] = " "; return; } + this.tableList.countcol.forEach((countcols) => { + if (column.label === countcols) { + const values = data.map((item) => Number(item[column.property])); + if (!values.every((value) => isNaN(value))) { + sums[index] = values.reduce((prev, curr) => { + const value = Number(curr); + if (!isNaN(value)) { + return prev + curr; + } else { + return prev; + } + }, 0); + sums[index] = + this.tableList.tableColumn[index - 1].unit + "" + sums[index]; + } else { + sums[index] = ""; + } + } else { + return; + } + }); }); - }); - return sums; - }else{ + return sums; } }, - }, }; </script> <!-- Add "scoped" attribute to limit CSS to this component only --> <style lang="scss" scoped> -.table_height{ +.table_height { + height: 100%; +} +.el-table__body-wrapper{ height: 100%; } .table-view { position: relative; + height: 100%; .blue { width: 70px; text-align: center; @@ -375,9 +380,8 @@ border-top-right-radius: 12px; overflow: auto; } - .el-table__body-wrapper{ + .el-table__body-wrapper { // height: ; } } - </style> -- Gitblit v1.8.0