页面结构部分:
:visible="true" :beforeClose="handleCancel" width="70%" center>
ref="table1" row-key="ID" style="width: 100%" height="600" :data="GetTerSumList" show-summary :summary-method="getSummaries" >
逻辑部分:
import Api from "@/api/impotApi/index.js";
// import Api from "@/api/outportApi/index.js";
export default {
name: "summary",
props: {
visiable: {
require: true,
type: Boolean,
default: false
},
},
data() {
return {
GetTerSumList:[],
GetSumData:[]
}
},
computed: {
},
created () {
this.GetTerSum()
},
methods: {
handleCancel() {
this.$emit('update:visiable', false)
this.$emit('close')
},
GetTerSum(){
Api.GetTerSum().then((res)=>{
this.GetTerSumList=res.data.data.TerModel
this.GetSumData=res.data.data.TerBoxSum
})
},
getSummaries(param) {
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '汇总';
return;
}
if (index === 2){
sums[index]= this.GetSumData.HEAVYSUM;
return;
}
if (index === 3){
sums[index]= this.GetSumData.EMPTYSUM;
return;
}
if (index === 6){
sums[index]= this.GetSumData.DANGERSUM;
return;
}
if (index === 7){
sums[index]= this.GetSumData.COLDSUM;
return;
}
const values = data.map(item => Number(item[column.property]));
const valuesNoNum = data.map(item => item[column.property]);
if (!values.some(value => isNaN(value))) {
if (valuesNoNum.every(value => value === null || value === '')) {
sums[index] = '';
} else {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
}
} else {
sums[index] = '';
}
});
return sums;
}
}
};
样式部分:
.mainPop /deep/ .el-dialog,
.el-pager li {
background: #00132e !important;
border: 2px solid #20bffb !important;
}
.mainPop {
/deep/ .el-dialog__header {
padding: 10px;
}
/deep/ .el-dialog__body {
padding: 25px;
}
}
.mainPop /deep/ .el-dialog__headerbtn .el-dialog__close {
width: 36px;
height: 36px;
color: #20bffb;
transform: scale(1.6);
font-weight: bolder;
}
.mainPop {
/deep/ .el-select-dropdown {
background: #002e3c;
border: 1px solid #20bffb;
.popper__arrow {
display: none;
}
.el-select-dropdown__wrap {
max-height: 500px;
.el-select-dropdown__item {
background: #002e3c;
height: 50px;
line-height: 50px;
padding: 13px;
box-sizing: content-box;
color: #EEEEEE;
&.hover {
background: rgb(1, 60, 87);
}
}
}
}
.select /deep/ .el-input {
width: 400px;
margin-right: 30px;
}
.select /deep/ .el-input__inner {
background: #002e3c;
border: 2px solid #20bffb;
border-radius: 5px;
height: 70px;
font-size: 32px;
font-weight: 400;
line-height: 70pxpx;
color: #ffffff;
display: inline;
}
.select /deep/ .el-input__icon {
line-height: 70px;
margin-right: 10px;
}
.btn {
width: 72px;
height: 50px;
font-size: 36px;
font-weight: bold;
line-height: 54px;
color: #ffffff;
width: 199px;
height: 68px;
background: #1489b4;
border: 1px solid #20bffb;
margin-left: 50px;
}
.cancel {
margin: 30px 0;
.can_btn {
background: #fedb6f;
border-radius: 100px;
width: 199px;
height: 68px;
font-size: 36px;
font-weight: bold;
line-height: 54px;
color: #000000;
cursor: pointer;
}
}
.mainSumary{
padding-left: 20px;
font-size: 1.7407vw;
color: #ffffff;
}
.WithPool {
padding: 0 12px;
margin: 0 auto;
margin-top: 40px;
height: 80%;
overflow-y: hidden;
background-color: #013c57;
}
// 上下与左右的滚动条的距离
.clearstyle /deep/ .el-table__body-wrapper::-webkit-scrollbar-corner {
height: 0;
width: 0;
}
.clearstyle /deep/ .el-table__body-wrapper::-webkit-scrollbar {
width: 40px;
height: 40px;
position: absolute;
}
/*滚动条滑块*/
.clearstyle /deep/ .el-table__body-wrapper::-webkit-scrollbar-thumb {
background: rgba(71, 145, 242, 0.5);
border-radius: 5px;
}
.clearstyle /deep/ .el-checkbox__inner {
height: 40px;
width: 40px;
line-height: 40px;
background: #FFFFFF;
border-color: #FFFFFF;
}
.clearstyle /deep/ .el-table__row td {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.clearstyle /deep/ .el-checkbox__inner::after {
height: 27px;
width: 12px;
left: 9px;
top: 0px;
border-color: black;
}
.clearstyle
/deep/
.el-checkbox__input.is-indeterminate
.el-checkbox__inner::before {
border: none;
height: 0;
width: 0;
}
.clearstyle /deep/ .el-table {
height: 100%;
}
.clearstyle /deep/ .el-table__body-wrapper {
height: calc(100% - 12%) !important;
overflow: auto;
&::-webkit-scrollbar {
// 滚动条整体
background: none;
}
&::-webkit-scrollbar-thumb {
//滑块
background: rgba(71, 145, 242, 0.5);
border-radius: 5px;
}
&::-moz-scrollbar-thumb {
/* Mozilla Firefox 4 to 18 */
color: rgba(71, 145, 242, 0.5);
}
&::-ms-scrollbar-thumb {
/* Internet Explorer 10+ */
color: rgba(71, 145, 242, 0.5);
}
}
.clearstyle /deep/ .el-table__footer-wrapper {
margin-top: -138px;
}
.clearstyle /deep/ .el-table__footer-wrapper tbody td{
background-color: #20bffb;
color:#fff;
border:#20bffb;
}
.clearstyle /deep/ .el-table__row > td {
/* 去除表格线 */
border: none;
}
.clearstyle /deep/ .el-table th.is-leaf {
/* 去除上边框 */
border: none;
}
.clearstyle /deep/ .el-table .cell {
overflow: visible;
}
.clearstyle /deep/ .el-table th,
.el-table tr {
background-color: #20bffb;
width: 90px;
height: 70px;
font-size: 30px;
font-weight: 400;
line-height: 28px;
color: #ffffff;
}
.clearstyle /deep/ .el-table__row {
height: 100px;
font-size: 30px;
line-height: 28px;
color: #ffffff;
font-weight: 400;
}
.clearstyle /deep/ .el-table,
.el-table__expanded-cell {
background-color: transparent;
}
.clearstyle /deep/ .el-table tr {
background-color: transparent !important;
}
.clearstyle /deep/ .el-table--enable-row-transition .el-table__body td,
.el-table .cell {
background-color: transparent;
}
.clearstyle /deep/ .el-table::before {
/* 去除下边框 */
height: 0;
}
.clearstyle /deep/ .el-loading-mask {
.el-loading-spinner {
.circular {
width: 70px;
height: 70px;
}
}
background: rgba(0, 46, 60, .5)
}
}
.swal2-container {
z-index: 9999999 !important;
}
效果展示部分: