export default function useColumns() {
  // 基本信息
  const BasicColumns = [
    {
      item: { key: "code", title: "编码" },
      attr: {
        is: "el-input",
        placeholder: "系统自动生成编码",
        readonly: true,
      },
    },
    {
      item: { key: "name", title: "姓名" },
      attr: {
        is: "el-input",
      },
    },
    {
      item: { key: "gander", title: "性别" },
      attr: {
        is: "el-select",
        dictName: "sys_user_sex",
      },
    },
    {
      item: { key: "customerName", title: "所属客户" },
      attr: {
        is: "el-popover-select-v2",
        referName: "CUSTOMER_PARAM_ZT",
        valueKey: "name",
        dataMapping: {
          customer: 'id',
        },
        disabled: true,
      },
    },
    {
      item: { key: "contactClassification", title: "联系人分类" },
      attr: {
        is: "el-select",
        dictName: "mk_bo_contact_type",
      },
    },
    {
      item: { key: "birthday", title: "生日" },
      attr: {
        is: "el-date-picker",
        clearable: true,
        type: "date",
        valueFormat: "yyyy-MM-dd",
      },
    },
    {
      item: { key: "birthplace", title: "籍贯" },
      attr: {
        is: "el-input",
      },
    },
    {
      item: { key: "hobby", title: "兴趣爱好" },
      attr: {
        is: "el-input",
      },
    },
    {
      item: { key: "state", title: "状态" },
      attr: {
        is: "el-select",
        dictName: "mk_bo_contact_state",
      },
    },

  ].map(({ item, attr }) => ({
    attr,
    item: {
      ...item,
      span: item.span || 6
    },
  }));

  // 工作信息
  const WorkColumns = [
    {
      item: { key: "superiorContactName", title: "上级联系人" },
      attr: {
        is: "el-popover-select-v2",
        referName: "LINKMAN_PARAM",
        valueKey: "name",
        dataMapping: {
          superiorContact: 'id',
        },
        queryParams: (params) => ({
          parame: {
            customer: params.customer ? params.customer : 'xxx'
          }
        }),
      },
    },
    {
      item: { key: "section", title: "任职科室" },
      attr: {
        is: "el-select",
        dictName: "mk_bo_section",
        filterable: true,
      },
    },
    {
      item: { key: "position", title: "职务" },
      attr: {
        is: "el-select",
        dictName: "mk_bo_position",
      },
    },
    {
      item: { key: "jobTitle", title: "职称" },
      attr: {
        is: "el-select",
        dictName: "mk_bo_job_title",
      },
    },
    {
      item: { key: "power", title: "决策力" },
      attr: {
        is: "el-select",
        dictName: "mk_bo_power",
      },
    },
    {
      item: { key: "support", title: "支持度" },
      attr: {
        is: "el-select",
        dictName: "mk_bo_support",
      },
    },
    {
      item: { key: "fieldExpertise", title: "擅长领域" },
      attr: {
        is: "el-select",
        dictName: "mk_bo_field_expertise",
      },
    },
    {
      item: { key: "decisionMaker", title: "关键决策人" },
      attr: {
        is: "el-select",
        dictName: "sys_yes_no",
      },
    },

  ].map(({ item, attr }) => ({
    attr,
    item: {
      ...item,
      span: item.span || 6
    },
  }));

  // 联系信息
  const CancatColumns = [
    {
      item: { key: "telephone", title: "联系电话" },
      attr: {
        is: "el-input",
      },
    },
    {
      item: { key: "mail", title: "微信" },
      attr: {
        is: "el-input",
      },
    },
    {
      item: { key: "address", title: "家庭地址" },
      attr: {
        is: "el-input",
      },
    },
    {
      item: { key: "visitTime", title: "最佳拜访时间" },
      attr: {
        is: "el-input",
      },
    },
    {
      item: { key: "visitPlace", title: "最佳拜访地点" },
      attr: {
        is: "el-input",
      },
    },

  ].map(({ item, attr }) => ({
    attr,
    item: {
      ...item,
      span: item.span || 6
    },
  }));

  // 其他信息
  const OtherColumns = [
    {
      item: { key: "createByName", title: "创建人" },
      attr: {
        is: "el-input",
        readonly: true,
      },
    },
    {
      item: { key: "createTime", title: "创建时间" },
      attr: {
        is: "el-input",
        readonly: true,
      },
    },
    {
      item: { key: "updateByName", title: "修改人" },
      attr: {
        is: "el-input",
        readonly: true,
      },
    },
    {
      item: { key: "updateTime", title: "修改时间" },
      attr: {
        is: "el-input",
        readonly: true,
      },
    },
  ]
  return { BasicColumns, WorkColumns, CancatColumns, OtherColumns };
}
