erp-el-element/commontable/tablepagination.vue

93 lines
1.9 KiB
Vue
Raw Permalink Normal View History

2024-05-07 11:30:13 +08:00
<template>
<div class="calculation">
2024-05-07 14:54:32 +08:00
<div v-if="costVisible">
2024-05-07 11:30:13 +08:00
<span style="font-weight: bold; padding: 0 10px">本页信息:</span>
<span style="padding: 0 10px">总定价:{{ total_cost }}</span>
</div>
2024-05-07 14:54:32 +08:00
<div v-else></div>
2024-05-07 11:30:13 +08:00
<div class="block">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="page.page"
:page-sizes="page.pagesizes"
layout="total, sizes, prev, pager, next, jumper"
:total="page.total"
:page-size.sync="page.list_row"
></el-pagination>
</div>
</div>
</template>
<script>
import { add } from "./../utils/Decimal";
export default {
name:"erpTablePagination",
props: {
2024-05-07 14:54:32 +08:00
costVisible:{
type: Boolean,
default: () => {
return false;
},
},
2024-05-07 11:30:13 +08:00
currentPage4: {
type: Number,
},
page: {
type: Object,
default: () => {
return {};
},
},
tableData: {
default: () => {
return [];
},
},
},
components: {},
data() {
return {};
},
computed: {
// 机器总成本
total_cost: function () {
let priceNumber = 0;
this.tableData.map((res, index) => {
2024-05-07 14:54:32 +08:00
if(res.total_cost){
priceNumber = add(priceNumber, res.total_cost);
}
2024-05-07 11:30:13 +08:00
});
return priceNumber.toFixed(2);
},
},
methods: {
//选择每页条数
2024-05-08 18:07:29 +08:00
handleSizeChange(value) {
this.$emit("handleSizeChange",value);
2024-05-07 11:30:13 +08:00
},
//点击页码
2024-05-08 18:07:29 +08:00
handleCurrentChange(value) {
this.$emit("handleCurrentChange",value);
2024-05-07 11:30:13 +08:00
},
},
};
</script>
<style scoped lang='scss'>
.calculation {
height: 50px;
border: 1px solid #ebeef5;
padding: 10px;
font-size: 14px;
display: flex;
justify-content: space-between;
align-items: center;
background: #fff;
::v-deep .el-pagination .el-input__suffix {
right: -18px;
}
}
</style>