hcong
2024-11-21 2f8efde07d3ecba6065635874126360b3ea82fd1
src/components/table/FYTable.vue
@@ -28,12 +28,17 @@
    <slot name="options-expand2"></slot>
  </div>
  <el-table
    ref="tableRef"
    :data="tableData"
    v-loading="loading"
    table-layout="fixed"
    :row-class-name="tableRowClassName"
    :height="tableHeight"
    :size="fontSize"
    @cell-click="cellClick"
    :cell-class-name="cellClassName"
    @paste="handlePaste"
    @sort-change="handleSortChange"
    border
  >
    <slot name="table-column" :size="fontSize"></slot>
@@ -64,6 +69,7 @@
export default {
  props: {
    rowClassName: undefined,
    cellClassName: Function || String,
    pagination: {
      type: Boolean,
      default: true
@@ -85,7 +91,7 @@
      fontSize: 'default'
    };
  },
  emits: ['search'],
  emits: ['search', 'cellClick', 'tablePaste', 'sortChange'],
  watch: {
    currentPage(nValue, oValue) {
      if (nValue != oValue) {
@@ -140,6 +146,7 @@
          this.tableData = res.data;
          this.total = res.total ? res.total : 0;
          this.loading = false;
          this.doLayout();
        }
      );
    },
@@ -163,6 +170,21 @@
      } else {
        return row.extension1 != '0' ? 'online-row' : 'offline-row';
      }
    },
    cellClick(row, column, cell, event) {
      this.$emit('cellClick', row, column, cell, event);
    },
    handlePaste(event) {
      this.$emit('tablePaste', event);
    },
    doLayout() {
      this.$refs.tableRef.doLayout();
    },
    handleSortChange({ column, prop, order }) {
      this.$emit('sortChange', { column, prop, order });
    },
    clearSort(){
      this.$refs.tableRef.clearSort();
    }
  },
  mounted() {