gaoluyang
2025-02-15 b1187d1141a17fea3a7c184db73f232ca9877a85
src/components/Table/lims-table.vue
@@ -6,7 +6,7 @@
          v-loading="tableLoading"
          :border="border"
          :data="tableData"
          :header-cell-style="{ background: '#0e3372', color: '#cccccc' }"
          :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }"
          :height="height"
          :highlight-current-row="highlightCurrentRow"
          :row-class-name="rowClassName"
@@ -25,13 +25,13 @@
        <template>
          <el-table-column align="center" label="序号" type="index" width="60" />
        </template>
        <template v-for="(item, index) in column">
          <el-table-column :column-key="item.columnKey" :filter-method="item.filterHandler"
            :filter-multiple="item.filterMultiple" :filtered-value="item.filteredValue"
            :filters="item.filters" :fixed="item.fixed" :label="item.label"
            :min-width="item.minWidth" :prop="item.prop"
            :show-overflow-tooltip="item.showOverflowTooltip"
            show-overflow-tooltip
            :sortable="item.sortable ? true : false" :type="item.type" :width="item.width"
            align="center">
            <!-- <div class="123" v-if="item.type == ''"> -->
@@ -39,7 +39,7 @@
                      slot-scope="scope">
              <slot v-if="item.theadSlot" :index="index" :name="item.theadSlot" :row="scope.row" />
            </template>
            <template slot-scope="scope">
              <!-- 插槽 -->
              <div v-if="item.dataType == 'slot'">
@@ -49,7 +49,7 @@
              <div v-else-if="item.dataType == 'progress'">
                <el-progress :percentage="Number(scope.row[item.prop])" />
              </div>
              <!-- tag -->
              <div v-else-if="item.dataType == 'tag'">
                <el-tag v-if="typeof dataTypeFn(scope.row[item.prop], item.formatData) == 'string'"
@@ -62,23 +62,25 @@
                <el-tag v-else :title="scope.row[item.prop] | formatters(item.formatData)"
                        :type="formatType(scope.row[item.prop], item.formatType)">{{ scope.row[item.prop] | formatters(item.formatData) }}</el-tag>
              </div>
              <!-- 按钮 -->
              <div v-else-if="item.dataType == 'action'">
                <template v-for="(o, key) in item.operation">
                  <el-button
                      v-if="o.type!='upload'"
                      size="mini"
                      v-show="o.showHide ? o.showHide(scope.row) : true"
                      :disabled="o.disabled ? o.disabled(scope.row) : false"
                      :icon="o.icon | iconFn(scope.row)"
                      :plain="o.plain" :size="o.size"
                      :style="{ 'color': o.color }"
                      :icon="o.icon | iconFn(scope.row, o)"
                      :plain="o.plain"
                      :style="{ 'color': o.name === '删除' ? '#f56c6c' : o.color }"
                      :type="o.type | typeFn(scope.row)"
                      @click="o.clickFun(scope.row)">
                    {{ o.name }}
                  </el-button>
                  <el-upload
                    action="#"
                    size="mini"
                    :on-change="(file, fileList)=>o.clickFun(scope.row,file, fileList)"
                    :multiple="o.multiple?o.multiple:false"
                    :limit="o.limit?o.limit:1"
@@ -105,13 +107,13 @@
      <pagination
      v-show="page.total>0"
      :total="page.total"
      :page.sync="page.pageNum"
      :limit.sync="page.pageSize"
      :page.sync="page.current"
      :limit.sync="page.size"
      @pagination="pagination"
    />
    </div>
  </template>
  <script>
  // 注:以下是所有配置项,其中最常使用的就是label、width、prop、dataType、slot
  // label :列名,就是表头上的标签叫什么些什么,类型 string
@@ -223,7 +225,7 @@
      },
      border: {
        type: Boolean,
        default: true
        default: false
      },
      highlightCurrentRow: {
        type: Boolean,
@@ -244,7 +246,7 @@
      rowClassName: {
        type: Function,
        default: () => {
        }
      },
      rowStyle: {
@@ -263,17 +265,17 @@
        default: undefined
      },
      page:{
        type:object,
        type:Object,
        default() {
          return {
            total:0,
            pageNum:0,
            pageSize:10
            current:0,
            size:10
          };
        }
      }
    },
    methods: {
      formatType(val, format) {
        if (typeof (format) === 'function') {
@@ -297,10 +299,9 @@
    }
  };
  </script>
  <style scoped>
  .el-table >>> .el-table__empty-text {
    text-align: center
  }
  </style>