import { FormType } from "@/components/form/interface";
import { UserDataType } from "@/model/userModel";
import { ColumnsType } from "antd/lib/table";
import { Image } from "antd";
export const defaultConfig =(team,per)=>
[
  {
    type: FormType.input,
    label: "用户名",
    name: "user_name",
    value: "",
    rules: [{ required: true, message: "请输入用户名称!" }],
  },
  {
    type: FormType.radio,
    label: "性别",
    name: "sex",
    radioData: [
      {
        key: "男",
        val: 1,
      },
      {
        key: "女",
        val: 2,
      },
    ],
    value: 0,
    rules: [{ required: true, message: "请选择性别" }],
  },
  {
    type: FormType.inputNumber,
    label: "年龄",
    name: "age",
    value: "",
    rules: [{ required: true, message: "请输入年龄" }],
  },
  {
    type: FormType.input,
    label: "身份证",
    name: "id_card",
    value: "",
    rules: [{ required: true, message: "请输入身份证" }],
  },
  {
    type: FormType.input,
    label: "登录账号",
    name: "account",
    value: "",
    rules: [{ required: true, message: "请输入登录账号" }],
  },
  {
    type: FormType.input,
    label: "初始密码",
    name: "password",
    value: "123456",
    rules: [{ required: true, message: "请输入初始密码" }],
  },
  {
    type: FormType.input,
    label: "家庭住址",
    name: "home_addr",
    value: "",
    rules: [{ required: true, message: "请输入家庭住址" }],
  },
  
  {
    type: FormType.input,
    label: "担任职务",
    name: "pos_held",
    value: "",
    rules: [{ required: true, message: "请输入担任职务" }],
  },
  {
    type: FormType.input,
    label: "通讯地址",
    name: "mail_addr",
    value: "",
    rules: [{ required: true, message: "请输入通讯地址" }],
  },
  {
    type: FormType.input,
    label: "服役部队",
    name: "serv_unit",
    value: "",
    rules: [{ required: true, message: "请输入服役部队" }],
  },
  {
    type: FormType.input,
    label: "贯籍",
    name: "porig",
    value: "",
    rules: [{ required: true, message: "请输入贯籍" }],
  },
  {
    type: FormType.input,
    label: "专业特长",
    name: "spec",
    value: "",
    rules: [{ required: true, message: "请输入专业特长" }],
  },

  {
    type: FormType.input,
    label: "邮箱",
    name: "email",
    value: "",
    rules: [{ required: true, message: "请输入邮箱" }],
  },
  {
    type: FormType.input,
    label: "联系电话",
    name: "tel",
    value: "",
    rules: [{ required: true, message: "请输入联系电话" }],
  },
  {
    type: FormType.input,
    label: "民族",
    name: "eth",
    value: "",
    rules: [{ required: true, message: "请输入民族" }],
  },
  {
    type: FormType.cehckboxGroup,
    label: "所属队伍",
    name: "team_link_user",
    checkboxData:team,
    value: "",
    rules: [{ required: true, message: "请选择所属队伍" }],
  },
  {
    type: FormType.cehckboxGroup,
    label: "个人身份属性",
    name: "pers_link_user",
    checkboxData:per,
    value: "",
    rules: [{ required: true, message: "请选择个人身份属性" }],
  },
  {
    type: FormType.radio,
    label: "是否党员",
    name: "p_member",
    value: 1,
    radioData: [
      {
        key: "是",
        val: 1,
      },
      {
        key: "否",
        val: 2,
      },
    ],
    rules: [{ required: true, message: "是否党员不能为空" }],
  },
  {
    type: FormType.radio,
    label: "是否退役军人",
    name: "vet",
    value: 0,
    radioData: [
      {
        key: "是",
        val: 1,
      },
      {
        key: "否",
        val: 2,
      },
    ],
    rules: [{ required: true, message: "是否退役军人不能为空" }],
  },
  
  {
    type: FormType.textarea,
    label: "描述",
    name: "remark",
    value: "",
  },
  {
    type: FormType.upload,
    label: "头像",
    name: "head_img",
    value: [],
    rules: [{ required: true, message: "请上传头像" }],
  },
];

export const columns: ColumnsType<UserDataType> = [
  {
    title: "用户名",
    dataIndex: "user_name",
    width: 150,
    fixed: "left",
  },
  {
    title: "性别",
    dataIndex: "sex",
    width: 150,
    render: (sex) => <span>{sex === "0" ? "男" : "女"}</span>,
    fixed: "left",
  },
  {
    title: "年龄",
    width: 150,
    dataIndex: "age",
  },
  {
    title: "头像",
    dataIndex: "head_img",
    width: 150,
    render: (headImg) => <Image src={headImg}></Image>,
  },

  {
    title: "登录账号",
    width: 150,
    dataIndex: "account",
  },
  {
    title: "家庭住址",
    width: 150,
    dataIndex: "home_addr",
  },
  {
    title: "身份证",
    width: 150,
    dataIndex: "id_card",
  },
  {
    title: "担任职务",
    width: 150,
    dataIndex: "pos_held",
  },
  {
    title: "通讯地址",
    width: 150,
    dataIndex: "mail_addr",
  },
  {
    title: "服役部队",
    width: 150,
    dataIndex: "serv_unit",
  },
  {
    title: "贯籍",
    width: 150,
    dataIndex: "porig",
  },
  {
    title: "专业特长",
    width: 150,
    dataIndex: "spec",
  },
  {
    title: "邮箱",
    width: 150,
    dataIndex: "email",
  },
  {
    title: "联系电话",
    width: 150,
    dataIndex: "tel",
  },
  {
    title: "民族",
    width: 150,
    dataIndex: "eth",
  },
  {
    title: "是否党员",
    width: 150,
    dataIndex: "p_member",
    render: (p_member) => <span>{p_member === 1 ? "是" : "否"}</span>,
  },
  {
    title: "是否退役军人",
    width: 150,
    dataIndex: "vet",
    render: (vet) => <span>{vet === 1 ? "是" : "否"}</span>,
  },
  {
    title: "备注",
    width: 150,
    dataIndex: "remark",
  },
];
