import { FormType } from "@/components/form/interface";
import { UserDataType } from "@/model/userModel";
import { ColumnsType } from "antd/lib/table";
import { getBirthDateAndGender } from "@/util/util";
import { MenuConfig } from "@/service/user_config";

export const defaultConfig = [
  {
    type: FormType.input,
    label: "菜单名称",
    name: "name",
    value: "",
    rules: [{ required: true, message: "请输入名称!" }],
  },
  {
    type: FormType.input,
    label: "路由",
    name: "router_path",
    value: "",
    rules: [{ required: true, message: "请输入路由" }],
  },
  {
    type: FormType.input,
    label: "路由标题",
    name: "title",
    value: "",
    rules: [{ required: true, message: "请输入路由" }],
  },
  {
    type: FormType.input,
    label: "路由外部链接",
    name: "href",
    value: "",
  },
  {
    type: FormType.select,
    label: "上级菜单",
    name: "p_id",
    value: "",
    selectUrl:MenuConfig.LIST,
    key:"name",
    rules: [],
  },
  {
    type: FormType.input,
    label: "激活子菜单",
    name: "active_menu",
    value: "",
  },
  {
    type: FormType.input,
    label: "本地图标",
    name: "local_icon",
    value: "",
  },
];

export const columns: ColumnsType<UserDataType> = [
  {
    title: "菜单名称",
    dataIndex: "name",
    fixed: "left",
  },
  {
    title: "icon图标",
    render: (render) => (
      <span>{getBirthDateAndGender(render.id_card)?.gender}</span>
    ),
  },
  {
    title: "路由",
    dataIndex: "router_path",
  },
  {
    title: "路由标题",
    dataIndex: "title",
  },
  {
    title: "路由外部链接",
    dataIndex: "href",
  },
  {
    title: "指定激活子菜单",
    dataIndex: "active_menu",
  },
  {
    title: "本地图标",
    dataIndex: "local_icon",
  },
];
