| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- <template>
- <div>
- <!--表格栏-->
- <el-table :data="data.content" :highlight-current-row="highlightCurrentRow" @selection-change="selectionChange" @row-click="rowClick"
- @current-change="handleCurrentChange" v-loading="loading" :element-loading-text="$t('action.loading')" :border="border" :stripe="stripe"
- :show-overflow-tooltip="showOverflowTooltip" :max-height="maxHeight" :height="height" :size="size" :align="align" style="width:100%;" >
- <!-- <el-table-column type="selection" width="40" v-if="showBatchDelete & showOperation"></el-table-column> -->
- <el-table-column type="index" label="序号" align="center" ></el-table-column>
- <el-table-column v-for="column in columns" header-align="center" align="left"
- :prop="column.prop" :label="column.label" :width="column.width" :min-width="column.minWidth"
- :fixed="column.fixed" :key="column.prop" :type="column.type" :formatter="column.formatter"
- :sortable="column.sortable==null?true:column.sortable">
- </el-table-column>
- <el-table-column :label="$t('action.operation')" width="185" fixed="right" v-if="showOperation" header-align="center" align="center">
- <template slot-scope="scope">
- <kt-button icon="fa fa-edit" :label="operationText" type="primary" :perms="permsOperation" :size="size" @click="handleOperation(scope.$index, scope.row)" />
- </template>
- </el-table-column>
- </el-table>
- <!--分页栏-->
- <div class="toolbar" style="padding:10px;" v-show="isshowpagination">
- <kt-button :label="$t('action.batchDelete')" :perms="permsOperation" :size="size" type="danger" @click="handleBatchDelete()"
- :disabled="this.selections.length===0" style="float:left;" v-if="showBatchDelete & showOperation"/>
- <el-pagination layout="total, prev, pager, next, jumper" @current-change="refreshPageRequest"
- :current-page="pageRequest.pageNum" :page-size="pageRequest.pageSize" :total="data.totalSize" style="float:right;">
- </el-pagination>
- </div>
- </div>
- </template>
- <script>
- import KtButton from "@/views/Core/KtButton"
- export default {
- name: 'KtTableSh',
- components:{
- KtButton
- },
- props: {
- isshowpagination: { //是否显示分页栏
- type: Boolean,
- default: true
- },
- keyName: String, //主键字段名
- columns: Array, // 表格列配置
- data: Object, // 表格分页数据
- permsOperation: String, // 审核权限标识
- operationText: { //操作button的文字
- type: String,
- default: '操作'
- },
- size: { // 尺寸样式
- type: String,
- default: 'mini'
- },
- align: { // 文本对齐方式
- type: String,
- default: 'left'
- },
- maxHeight: { // 表格最大高度
- type: Number,
- default: 420
- },
- height: { // 表格最大高度
- type: Number,
- default: 250
- },
- showOperation: { // 是否显示操作组件
- type: Boolean,
- default: true
- },
- border: { // 是否显示边框
- type: Boolean,
- default: true
- },
- stripe: { // 是否显示斑马线
- type: Boolean,
- default: true
- },
- highlightCurrentRow: { // // 是否高亮当前行
- type: Boolean,
- default: true
- },
- showOverflowTooltip: { // 是否单行显示
- type: Boolean,
- default: true
- },
- showBatchDelete: { // 是否显示操作组件
- type: Boolean,
- default: true
- }
- },
- data() {
- return {
- // 分页信息
- pageRequest: {
- pageNum: 1,
- pageSize: 10
- },
- loading: false, // 加载标识
- selections: [] // 列表选中列
- }
- },
- methods: {
- // 分页查询
- findPage: function () {
- this.loading = true
- let callback = res => {
- this.loading = false
- }
- this.$emit('findPage', {pageRequest:this.pageRequest, callback:callback})
- },
- // 选择切换
- selectionChange: function (selections) {
- this.selections = selections
- this.$emit('selectionChange', {selections:selections})
- },
- // 选择切换
- handleCurrentChange: function (val) {
- this.$emit('handleCurrentChange', {val:val})
- },
- rowClick: function(row){
- this.$emit('rowClick', {row:row})
- },
- // 换页刷新
- refreshPageRequest: function (pageNum) {
- this.pageRequest.pageNum = pageNum
- this.findPage()
- },
- // 审核
- handleOperation: function (index, row) {
- this.$emit('handleOperation', {index:index, row:row})
- }
- },
- mounted() {
- this.refreshPageRequest(1)
- }
- }
- </script>
- <style scoped>
- </style>
|