import { FormType } from "@/components/form/interface";
import { UserDataType } from "@/model/userModel";
import { CompanyConfig, UserConfig } from "@/service/user_config";
import { ColumnsType } from "antd/lib/table";
export const defaultConfig = [
  {
    type: FormType.input,
    label: "单位名称",
    name: "name",
    value: "",
    rules: [{ required: true, message: "请输入单位名称!" }],
  },
  {
    type: FormType.input,
    label: "单位描述",
    name: "desc",
    value: "",
    rules: [{ required: true, message: "请输入单位描述" }],
  },
  {
    type: FormType.select,
    label: "分管领导",
    name: "leader_charge",
    value: "",
    model: "multiple",
    selectUrl: UserConfig.LIST,
    keys:"user_name",
    rules: [],
  },
  {
    type: FormType.input,
    label: "单位负责人",
    name: "head",
    value: "",
    rules: [{ required: true, message: "请输入单位负责人" }],
  },
  {
    type: FormType.input,
    label: "单位电话",
    name: "phone",
    value: "",
    rules: [{ required: true, message: "请输入单位电话" }],
  },

  {
    type: FormType.input,
    label: "单位邮箱",
    name: "email",
    value: "",
    rules: [{ required: true, message: "请输入单位邮箱" }],
  },
  {
    type: FormType.treeSelect,
    label: "上级单位",
    name: "p_id",
    value: 0,
    selectUrl: CompanyConfig.LIST,
    keys: "name",
    rules: [],
  },
];

export const columns: ColumnsType<UserDataType> = [
  {
    title: "单位名称",
    dataIndex: "name",
    width: 200,
    fixed: "left",
  },
  {
    title: "单位描述",
    dataIndex: "desc",
  },

  {
    title: "负责人",
    dataIndex: "head",
  },
  {
    title: "单位电话",
    width: 150,
    dataIndex: "phone",
  },
  {
    title: "单位邮箱",
    width: 150,
    dataIndex: "email",
  },
];
