<template>
  <div class="main-box">
    <el-tabs v-model="activeName" @tab-change="handleClick">
      <el-tab-pane label="待审核" name="pending"> </el-tab-pane>
      <el-tab-pane label="已审核" name="resolve"> </el-tab-pane>
    </el-tabs>
    <ProTable
      ref="proTable"
      :columns="columns"
      :data="getTableList"
      :init-param="initParam"
      :search-col="{ xs: 1, sm: 1, md: 2, lg: 3, xl: 3 }"
    ></ProTable>
  </div>
</template>
<script lang="ts" setup>
import { ref, reactive } from "vue";
import ProTable from "@/components/ProTable/index.vue";
import { ProTableInstance, ColumnProps } from "@/components/ProTable/interface";
import type { TabsPaneContext } from "element-plus";

// ProTable 实例
const proTable = ref<ProTableInstance>();
const activeName = ref("pending");
// 如果表格需要初始化请求参数，直接定义传给 ProTable(之后每次请求都会自动带上该参数，此参数更改之后也会一直带上，改变此参数会自动刷新表格数据)
const initParam = reactive({ deptId: "" });

const handleClick = (tab: TabsPaneContext, event: Event) => {
  console.log(tab, event);
  if (tab === "resolve") {
    getTableList = [
      {
        semanticsId: "111222",
        semanticsName: "22222",
        updateTime: "2024-10-01 12:02:03",
        updatePerson: "更新人",
        dataSources: "数据来源",
        notes: "备注"
      }
    ];
  } else {
    getTableList = [
      {
        semanticsId: "111222",
        semanticsName: "111",
        updateTime: "2024-10-01 12:02:03",
        updatePerson: "更新人",
        dataSources: "数据来源",
        notes: "备注"
      }
    ];
  }
};
// 表格配置项
const columns = reactive<ColumnProps[]>([
  { prop: "semanticsName", label: "语义", search: { el: "input" } },
  { prop: "updateTime", label: "更新时间", search: { el: "date-range-picker", custom: true } },
  { prop: "updatePerson", label: "更新人", search: { el: "input" } },
  {
    prop: "dataSources",
    label: "数据来源",
    // enum: () => getDictOptions("sys_oper_type"),
    // enum: [{ label: "添加", value: "1" }],
    search: { el: "select" }
  },
  { prop: "notes", label: "备注" },
  { prop: "operation", label: "操作", width: 330, fixed: "right" }
]);
// 分页列表获取数据
let getTableList = [
  {
    semanticsId: "111222",
    semanticsName: "111",
    updateTime: "2024-10-01 12:02:03",
    updatePerson: "更新人",
    dataSources: "数据来源",
    notes: "备注"
  }
];
</script>
<style lang="scss" scoped>
.main-box {
  height: 100%;
  padding: 0;
  padding-bottom: 10px;
}
</style>
