| | |
| | | <slot name="options-expand2"></slot> |
| | | </div> |
| | | <el-table |
| | | v-bind="$attrs" |
| | | ref="tableRef" |
| | | :data="tableData" |
| | | v-loading="loading" |
| | |
| | | :cell-class-name="cellClassName" |
| | | @paste="handlePaste" |
| | | @sort-change="handleSortChange" |
| | | :show-overflow-tooltip="true" |
| | | border |
| | | > |
| | | <slot name="table-column" :size="fontSize"></slot> |
| | |
| | | size: { |
| | | type: String, |
| | | default: 'default' |
| | | }, |
| | | data: { |
| | | type: Array, |
| | | default: () => [] |
| | | }, |
| | | totalCount: { |
| | | type: Number, |
| | | default: 0 |
| | | } |
| | | }, |
| | | data() { |
| | |
| | | } |
| | | }, |
| | | immediate: true |
| | | }, |
| | | data(nValue, oValue) { |
| | | if (nValue != oValue) { |
| | | this.tableData = nValue; |
| | | } |
| | | }, |
| | | totalCount(nValue, oValue) { |
| | | if (nValue != oValue) { |
| | | this.total = nValue; |
| | | } |
| | | } |
| | | }, |
| | | computed: { |
| | | cTableHeight() { |
| | | if (this.$refs.searchRef) { |
| | | const h1 = this.$refs.searchRef.$el.offsetHeight; |
| | | const h2 = this.$refs.paginationRef ? this.$refs.paginationRef.$el.offsetHeight : 0; |
| | | const h2 = this.$refs.paginationRef |
| | | ? this.$refs.paginationRef.$el.offsetHeight |
| | | : 0; |
| | | const h3 = this.$refs.expandRef.$el.offsetHeight; |
| | | const h4 = this.$refs.expand2Ref.offsetHeight; |
| | | |
| | |
| | | pageSize: this.pageSize |
| | | }, |
| | | (res) => { |
| | | this.tableData = res.data; |
| | | this.total = res.total ? res.total : 0; |
| | | if (res) { |
| | | if (res.data) { |
| | | this.tableData = res.data; |
| | | } |
| | | if (res.total) { |
| | | this.total = res.total; |
| | | } |
| | | } |
| | | this.loading = false; |
| | | this.doLayout(); |
| | | } |
| | |
| | | }, |
| | | calcTableHeight() { |
| | | const h1 = this.$refs.searchRef.$el.offsetHeight; |
| | | const h2 = this.$refs.paginationRef ? this.$refs.paginationRef.$el.offsetHeight : 0; |
| | | const h2 = this.$refs.paginationRef |
| | | ? this.$refs.paginationRef.$el.offsetHeight |
| | | : 0; |
| | | const h3 = this.$refs.expandRef.$el.offsetHeight; |
| | | const h4 = this.$refs.expand2Ref.offsetHeight; |
| | | |
| | |
| | | handleSortChange({ column, prop, order }) { |
| | | this.$emit('sortChange', { column, prop, order }); |
| | | }, |
| | | clearSort(){ |
| | | clearSort() { |
| | | this.$refs.tableRef.clearSort(); |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.tableHeight = this.calcTableHeight(); |
| | | this.onSearch(); |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | | |