123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- <template>
- <div class="cont-table">
- <!-- :image="nonedataImg" -->
- <el-empty description=" " v-if="table.data.length == 0" />
- <el-table
- :data="table.data"
- v-else
- style="width: 100%"
- :show-overflow-tooltip="true"
- header-row-class-name="datatable"
- row-class-name="datarow"
- fit
- >
- <el-table-column v-if="indexed" label="序号" width="70px">
- <template slot-scope="scope">{{ scope.$index + 1 }}</template>
- </el-table-column>
- <el-table-column
- v-for="(item, index) in cloumn"
- :prop="item.prop"
- :label="item.label"
- :key="index"
- show-overflow-tooltip
- :width="item.width || null"
- :fixed="item.fixed"
- >
- <template #default="scope">
- <slot
- v-if="item.slot"
- :name="item.slot ? item.slot : ''"
- v-bind="scope"
- ></slot>
- <span v-else>{{ scope.row[item.prop] || "-" }}</span>
- </template>
- </el-table-column>
- </el-table>
- <div class="tabs-pagation" v-if="table.data.length">
- <div class="font" v-if="showTotal">共{{ table.total }}条记录</div>
- <!-- <el-pagination class="tabone-pagination" background layout="prev, pager, next" :current-page="pageNum"
- :pager-count="5" :page-size="5" :total="table.total" @current-change="changePage" /> -->
- <el-pagination
- :current-page="pageNum"
- :page-size="pageSize"
- :small="false"
- :disabled="false"
- :background="true"
- :layout="layout"
- :page-sizes="[10, 15, 20, 30, 50]"
- :total="table.total"
- @size-change="handleSizeChange"
- @current-change="changePage"
- />
- </div>
- </div>
- </template>
- <script >
- export default {
- components: {},
- props: {
- indexed: {
- type: Boolean,
- default: true,
- },
- cloumn: {
- type: Array,
- default: [],
- },
- table: {
- type: Object,
- },
- showTotal: {
- type: Boolean,
- default: true,
- },
- layout: {
- type: String,
- default: "total, sizes, prev, pager, next, jumper",
- },
- },
- data() {
- return {
- pageNum: 1,
- pageSize: 10,
- };
- },
- mounted() {},
- methods: {
- // 搜索
- searchFun() {
- this.$emit("search", {
- pageIndex: this.pageNum,
- size: this.pageSize,
- });
- },
- // 修改当前页数
- changePage(v) {
- this.pageNum = v;
- this.searchFun();
- },
- handleSizeChange(v) {
- this.pageSize = v;
- this.searchFun();
- },
- },
- beforeDestroy() {},
- watch: {},
- };
- // searchFun()
- </script>
- <style lang="scss" scoped>
- .el-table {
- height: calc(100% - 50px);
- }
- .tabs-pagation {
- position: absolute;
- right: 30px;
- }
- </style>
- <style lang="scss" >
- .cont-table {
- .el-pager li {
- background-color: transparent !important;
- // border: 1px solid #3ea6fe;
- border-radius: 5px;
- }
- .el-pager li.active {
- color: #3ea6fe !important;
- }
- .el-pagination button {
- color: #dbdbdb;
- }
- .el-pagination .btn-prev,
- .el-pagination .btn-next {
- background-color: transparent;
- // border: 1px solid #ebebeb;
- border-radius: 5px;
- line-height: 28px;
- }
- .el-pagination .btn-prev {
- padding-right: 5px;
- }
- .el-pagination .btn-prev:hover {
- color: #1890ff;
- }
- }
- // @import url(./tabs.scss);
- </style>
|