yxh
2023-12-01 02aa4d157d800650f1dc2fa2b7fbee52837df074
src/components/SFtable/index.vue
@@ -2,7 +2,7 @@
<template>
    <el-table
      :data="currentList"
      style="width: 1158px"
    @selection-change="handleSelectionChange"
      :header-cell-style="{
        background: '#f3f6fb',
        color: '#666',
@@ -12,8 +12,8 @@
      :highlight-current-row="true"
      empty-text="暂无数据"
    >
      <el-table-column type="index" :index="indexMethod" label="序号" width="80">
      </el-table-column>
    <el-table-column v-if="multiplechoice" type="selection" width="50" align="center" />
    <el-table-column label="序号" align="center" key="id" prop="id" />
      <el-table-column
        v-for="(item, index) in tableLabel"
        :key="index"
@@ -23,10 +23,30 @@
        :formatter="formatData"
      >
      </el-table-column>
      <el-table-column label="操作" width="100">
    <el-table-column
      label="操作"
      align="center"
      width="120"
      class-name="small-padding fixed-width"
    >
        <template slot-scope="scope">
          <el-button type="text" @click.native="$emit('details', scope.row)"
            >查看详情</el-button
        <el-button
          v-if="controlxz"
          size="medium"
          type="text"
          @click.native="$emit('handleUpdate', scope.row)"
          ><span class="button-zx"
            ><i class="el-icon-s-promotion"></i>选择</span
          ></el-button
        >
        <el-button
          v-if="controlsc"
          size="medium"
          type="text"
          @click.native="$emit('details', scope.row)"
          ><span style="color: red"
            ><i class="el-icon-delete"></i>删除</span
          ></el-button
          >
        </template>
      </el-table-column>
@@ -37,7 +57,9 @@
  import dayjs from "dayjs";
  export default {
    data() {
      return {};
    return {
      ids: [],
    };
    },
    props: {
      currentList: {
@@ -48,17 +70,23 @@
        type: Array,
        default: () => [],
      },
      currentIndex: {
        type: Number,
        required: true,
    controlsc: {
      type: Boolean,
      default: true,
      },
    controlxz: {
      type: Boolean,
      default: true,
    },
    multiplechoice:{
      type: Boolean,
      default: true,
    }
    },
    created() {},
  
    methods: {
      indexMethod(index) {
        return parseInt(this.currentIndex) - 9 + index;
      },
    //   数据过滤
      formatData(row, column, cellValue) {
        if (column.property === "createType") {
@@ -71,6 +99,10 @@
          return dayjs(cellValue).format("YYYY.MM.DD HH:mm:ss");
        }
        return cellValue;
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      $emit("handleSelectionChange", selection);
      },
    },
  };
@@ -97,4 +129,3 @@
    box-sizing: border-box;
  }
  </style>