| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <template>
- <div style="float: right">
- <!-- <div v-show="stripe" class="stripe-panel">-->
- <!-- <el-checkbox v-model="stripe">斑马纹</el-checkbox>-->
- <!-- </div>-->
- <!-- <div class="border-panel">-->
- <!-- <el-checkbox v-model="border">边框(可拉伸列)</el-checkbox>-->
- <!-- </div>-->
- <!-- <el-button-->
- <!-- style="margin: 0 10px 10px 0 !important"-->
- <!-- type="primary"-->
- <!-- @click="clickFullScreen">-->
- <!-- <vab-icon-->
- <!-- :icon="isFullscreen ? 'fullscreen-exit-fill' : 'fullscreen-fill'" />-->
- <!-- 表格全屏-->
- <!-- </el-button>-->
- <!-- <el-popover-->
- <!-- ref="popover"-->
- <!-- popper-class="custom-table-checkbox"-->
- <!-- trigger="hover">-->
- <!-- <el-radio-group v-model="lineHeight">-->
- <!-- <el-radio label="medium">大</el-radio>-->
- <!-- <el-radio label="small">中</el-radio>-->
- <!-- <el-radio label="mini">小</el-radio>-->
- <!-- </el-radio-group>-->
- <!-- <template #reference>-->
- <!-- <el-button style="margin: 0 10px 10px 0 !important" type="primary">-->
- <!-- <vab-icon icon="line-height" />-->
- <!-- 表格尺寸-->
- <!-- </el-button>-->
- <!-- </template>-->
- <!-- </el-popover>-->
- <el-popover popper-class="custom-table-checkbox" trigger="hover">
- <el-checkbox-group v-model="checkColumns">
- <vab-draggable v-bind="dragOptions" :list="columns">
- <div v-for="(item, index) in columns" :key="item + index">
- <vab-icon icon="drag-drop-line" />
- <el-checkbox :disabled="item.disableCheck === true" :label="item.label">
- {{ item.label }}
- </el-checkbox>
- </div>
- </vab-draggable>
- </el-checkbox-group>
- <template #reference>
- <el-button icon="el-icon-setting" style="margin: 0 10px 10px 0 !important" />
- </template>
- </el-popover>
- </div>
- </template>
- <script>
- import VabDraggable from 'vuedraggable'
- export default {
- name: 'TableTool',
- components: {
- VabDraggable,
- },
- props: {
- columns: {
- type: Array,
- default() {
- return []
- },
- },
- checkList: {
- type: Array,
- default() {
- return []
- },
- },
- },
- data() {
- return {
- isFullscreen: false,
- border: true,
- height: this.$baseTableHeight(1),
- stripe: false,
- lineHeight: 'medium',
- // checkList: ['标题', '作者', '评级', '点击量', '时间'],
- // columns: [
- // {
- // label: '标题',
- // width: 'auto',
- // prop: 'title',
- // sortable: true,
- // disableCheck: true,
- // },
- // ],
- flag: true,
- }
- },
- computed: {
- dragOptions() {
- return {
- animation: 600,
- group: 'description',
- }
- },
- checkColumns: {
- get() {
- return this.checkList
- },
- set(val) {
- this.$emit('update:checkList', val)
- },
- },
- },
- created() {
- let list = []
- for (let item of this.columns) {
- list.push(item['label'])
- }
- this.$emit('update:checkList', list)
- },
- methods: {},
- }
- </script>
- <style lang="scss" scoped>
- .custom-table-container {
- :deep() {
- i {
- cursor: pointer;
- }
- }
- .stripe-panel,
- .border-panel {
- margin: 0 10px #{$base-margin/2} 10px !important;
- }
- }
- </style>
- <style lang="scss">
- .custom-table-checkbox {
- [class*='ri'] {
- vertical-align: -2.5px;
- cursor: pointer;
- }
- .el-checkbox {
- margin: 5px 0 5px 8px;
- }
- }
- </style>
|