spring
2025-03-19 1f69274b3f62e60378d7c5dbce05357366aaf2a6
src/components/Table/lims-table.vue
@@ -13,8 +13,10 @@
        :filter-method="item.filterHandler" :filter-multiple="item.filterMultiple" :filtered-value="item.filteredValue"
        :filters="item.filters" :fixed="item.fixed" :label="item.label" :prop="item.prop"
                       :show-overflow-tooltip="item.dataType === 'action' || item.dataType === 'slot' ? false : true"
                       :min-width="item.dataType == 'action' ? btnWidth : getTitleWidth(item)"
        :sortable="item.sortable ? true : false" :type="item.type" :width="item.dataType == 'action' ? btnWidth : getTitleWidth(item)" align="center">
        :min-width="item.dataType == 'action' ? btnWidth : getTitleWidth(item)" :sortable="item.sortable ? true : false"
        :type="item.type"
        :width="item.dataType == 'action' ? btnWidth : (column.length < 6 ? 'auto' : getTitleWidth(item))"
        align="center">
        <!-- <div class="123" v-if="item.type == ''"> -->
        <template v-if="item.hasOwnProperty('colunmTemplate')" :slot="item.colunmTemplate" slot-scope="scope">
          <slot v-if="item.theadSlot" :index="index" :name="item.theadSlot" :row="scope.row" />
@@ -63,20 +65,17 @@
          </div>
          <!-- 按钮 -->
          <div v-else-if="item.dataType == 'action'"
               :style="`width:${getWidth(item.operation, scope.row)}`">
          <div v-else-if="item.dataType == 'action'" :style="`width:${getWidth(item.operation, scope.row)}`">
            <template v-for="(o, key) in item.operation">
              <el-button v-show="o.type != 'upload'" size="mini" v-if="o.showHide ? o.showHide(scope.row) : true"
                :disabled="o.disabled ? o.disabled(scope.row) : false" :icon="iconFn(o)" :plain="o.plain"
                :disabled="o.disabled ? o.disabled(scope.row) : false" :plain="o.plain"
                :style="{ color: o.name === '删除' ? '#f56c6c' : o.color }" :type="o.type | typeFn(scope.row)"
                @click="o.clickFun(scope.row)" :key="key">
                {{ o.name }}
              </el-button>
              <el-upload :action="javaApi + o.url + '?id=' + (o.uploadIdFun ? o.uploadIdFun(scope.row) : scope.row.id)"
                         :key="uploadKeys[scope.$index]"
                         ref="uploadRef"
                size="mini" :multiple="o.multiple ? o.multiple : false" :limit="1"
                :disabled="o.disabled ? o.disabled(scope.row) : false" :accept="o.accept
                :key="uploadKeys[scope.$index]" ref="uploadRef" size="mini" :multiple="o.multiple ? o.multiple : false"
                :limit="1" :disabled="o.disabled ? o.disabled(scope.row) : false" :accept="o.accept
                  ? o.accept
                  : '.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar'
                  " v-if="o.type == 'upload'" style="display: inline-block; width: 50px"
@@ -302,19 +301,21 @@
          count += a.name.length;
        }
      });
      this.btnWidth = count * 15 + 50 + "px";
      this.btnWidth = count * 15 + 60 + "px";
      return count * 15 + 50 + "px";
    },
    getTitleWidth(row) {
      if (row.label.includes('时间') || row.label.includes('编号') || row.label.includes('样品名称') || row.label.includes('零件')) {
        return 160
      } else if (row.label.includes('产品')) {
        return 210
      } else if (row.label.includes('操作')) {
        return row.width
      } else {
        const span = document.createElement('span');
        span.innerText = row.label;
        document.body.appendChild(span);
        const width = `${span.offsetWidth + 50}px`;
        const width = `${span.offsetWidth + 60}px`;
        document.body.removeChild(span);
        return width;
@@ -481,9 +482,11 @@
  color: rgb(64, 158, 255);
  cursor: pointer;
}
>>>.cell {
  padding: 0 !important;
}
.cell {
  white-space: nowrap;
  overflow: hidden;
@@ -496,6 +499,7 @@
  height: 10px;
  /* 设置滚动条宽度 */
}
.lims-table .highlight-warning-row-border td:first-child {
  border-left: 4px solid #ffcd29;
}