WXL
2024-08-03 d96a7562b2515584fac4dcb57fdbdcadc8f36fef
src/components/SFtable/index.vue
@@ -1,7 +1,13 @@
<!-- 表格组件封装 -->
<template>
  <el-table
    :data="currentList"
    ref="multipleTableson"
    :data="
      currentList.filter(
        (data) =>
          !search || data.name.toLowerCase().includes(search.toLowerCase())
      )
    "
    @selection-change="handleSelectionChange"
    :header-cell-style="{
      background: '#f3f6fb',
@@ -46,13 +52,45 @@
      </template>
    </el-table-column> -->
    <el-table-column
      v-if="center"
      v-if="center && !searchTrue"
      label="操作"
      fixed="right"
      align="center"
      width="120"
      class-name="small-padding fixed-width"
    >
      <template slot-scope="scope">
        <el-button
          v-if="controlxz"
          size="medium"
          type="text"
          @click.native="$emit('selectfn', scope.row, typeinfo)"
          ><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, typeinfo)"
          ><span style="color: red"
            ><i class="el-icon-delete"></i>删除</span
          ></el-button
        >
      </template>
    </el-table-column>
    <el-table-column
      v-if="center && searchTrue"
      label="操作"
      fixed="right"
      align="right"
      width="200"
      class-name="small-padding fixed-width"
    >
      <template slot="header" slot-scope="scope">
        <el-input v-model="search" size="mini" placeholder="输入患者名称搜索" />
      </template>
      <template slot-scope="scope">
        <el-button
          v-if="controlxz"
@@ -89,6 +127,7 @@
      editabshape: [],
      qyoptions: [],
      precedencetype: [],
      search: "",
    };
  },
  props: {
@@ -125,6 +164,10 @@
      type: Number,
      default: 1,
    },
    searchTrue: {
      type: Boolean,
      default: false,
    },
  },
  created() {
    this.mode = store.getters.mode;
@@ -158,6 +201,13 @@
    handleSelectionChange(selection) {
      this.$emit("handleSelectionChange", selection);
    },
    toggleRowSelection(row, selected) {
      this.$refs.multipleTableson.toggleRowSelection(row, selected);
    },
    clearSelection() {
      // 在这里编写清除选择的逻辑
      this.$refs.multipleTableson.clearSelection();
    },
  },
};
</script>