import { inject, observer } from "mobx-react";
import BTable from "@/components/b_table";
import { useEffect } from "react";
import { Store } from "antd/lib/form/interface";
import { columns, defaultConfig } from "./user_config";
import "./user.less";

const User = (props: Store) => {
  const { usrStore } = props;
  // 获取列表数据
  useEffect(() => {
    usrStore.getlist();
  }, [usrStore]);

  return (
    <div className="contentBox">
      <BTable
        store={usrStore}
        scroll={{ x: "max-content" }}
        columns={columns}
        btnText="添加人员"
        dataSource={usrStore.list}
        deleteCallback={(record) => {
          usrStore.deleteItem(record);
        }}
        config={defaultConfig}
      />
    </div>
  );
};

export default inject("usrStore")(observer(User));
