import BTable from "@/components/b_table";
import { UserDataType } from "@/model/userModel";
import { Button } from "antd";
import { Store } from "antd/es/form/interface";
import { ColumnsType } from "antd/lib/table";
import { inject, observer } from "mobx-react";
import { useEffect } from "react";

const ExceCompet = (props: Store) => {
  const { exceCompetStore } = props;
  useEffect(() => {
    exceCompetStore.getlist();
  }, [exceCompetStore]);
  const columns: ColumnsType<UserDataType> = [
    { title: "评优标题", dataIndex: "title" },
    { title: "内容", dataIndex: "content" },
    {
      title: "评优申请人",
      dataIndex: "users",
      render: (users) => <span>{users?.user_name}</span>
    },
    { title: "申请积分", dataIndex: "reviewer_score" },
    { title: "申请时间", dataIndex: "created_at" },
    { title: "描述", dataIndex: "desc" },
    { title: "审核状态", dataIndex: "status" },
    { title: "审核人", dataIndex: "reviewer_identity" },
    {
      title: "操作",
      dataIndex: "id",
      render: (any, record) => (
        <Button
          type="dashed"
          size="small"
          onClick={() => {
            // edit(record);
          }}
        >
          审核
        </Button>
      ),
    },
  ];
  return (
    <div>
      <BTable
        store={exceCompetStore}
        columns={columns}
        dataSource={exceCompetStore.list}
      />
    </div>
  );
};
export default inject("exceCompetStore")(observer(ExceCompet));
