export default function useColumns() {
  const SearchColumns = [
    {
      item: { key: "orgName", title: "销售组织" },
      attr: {
        is: "el-popover-select-v2",
        referName: "ORG_PARAM",
        valueKey: "name",
        dataMapping: {
          org: 'id', orgName: 'name'
        },
        placeholder: "请输入销售组织",
      },
    },
    {
      item: { key: "code", title: "客户编码" },
      attr: {
        is: "el-input",
        placeholder: "请输入客户编码",
        clearable: true,
      },
    },
    {
      item: { key: "name", title: "客户名称" },
      attr: {
        is: "el-input",
        placeholder: "请输入客户名称",
        clearable: true,
      },
    },
    {
      item: { key: "classification", title: "客户分类" },
      attr: {
        is: "el-select",
        dictName: "mk_cm_classification",
      },
    },
    {
      item: { key: "enterpriseType", title: "企业类型" },
      attr: {
        is: "el-select",
        dictName: "mk_cm_enterprise_type",
      },
    },
    {
      item: { key: "responsiblePersonName", title: "负责人" },
      attr: {
        is: "el-popover-select-v2",
        referName: "CONTACTS_PARAM",
        valueKey: "name",
        dataMapping: {
          responsiblePerson: 'id',
          responsiblePersonName: 'name'
        },
      },
    },

  ];

  const TableColumns = [
    {
      item: { key: "orgName", title: "销售组织" },
      attr: {},
    },
    {
      item: { key: "code", title: "客户编码" },
      attr: {},
    },
    {
      item: { key: "name", title: "客户名称" },
      attr: {},
    },
    {
      item: { key: "classification", title: "客户分类" },
      attr: {
        is: "el-dict-tag",
        dictName: "mk_cm_classification",
      },
    },
    {
      item: { key: "industry", title: "客户行业" },
      attr: {
        is: "el-dict-tag",
        dictName: "mk_cm_industry",
      },
    },
    {
      item: { key: "type", title: "客户类型" },
      attr: {
        is: "el-dict-tag",
        dictName: "mk_cm_type",
      },
    },
    {
      item: { key: "category", title: "客户类别" },
      attr: {
        is: "el-dict-tag",
        dictName: "mk_cm_category",
      },
    },
    {
      item: { key: "firstBattalion", title: "客户首营" },
      attr: {
        is: "el-dict-tag",
        dictName: "mk_cm_yes_no",
      },
    },
    {
      item: { key: "channel", title: "销售渠道" },
      attr: {
        is: "el-dict-tag",
        dictName: "mk_cm_channel",
      },
    },
    {
      item: { key: "businessType", title: "业务类型" },
      attr: {
        is: "el-dict-tag",
        dictName: "mk_cm_business_type",
      },
    },
    {
      item: { key: "taxType", title: "纳税类别" },
      attr: {
        is: "el-dict-tag",
        dictName: "mk_cm_tax_type",
      },
    },
    {
      item: { key: "potential", title: "是否潜客" },
      attr: {
        is: "el-dict-tag",
        dictName: "mk_cm_yes_no",
      },
    },
    {
      item: { key: "responsiblePersonName", title: "负责人" },
      attr: {},
    },

  ].map(({ item, attr }) => ({
    attr,
    item: {
      ...item,
      sortabled: true,
      fixedabled: true,
      filterabled: true,
      hiddenabled: true,
    },
  }));

  // 联系人信息
  const ContactColumns = [
    {
      item: { key: "code", title: "编号", width: 300 },
      attr: {},
    },
    {
      item: { key: "name", title: "姓名" },
      attr: {},
    },
    {
      item: { key: "gander", title: "性别" },
      attr: {
        is: "el-dict-tag",
        dictName: "sys_user_sex",
      },
    },
    {
      item: { key: "telephone", title: "联系电话" },
      attr: {},
    },
    {
      item: { key: "customerName", title: "所属客户" },
      attr: {},
    },
    {
      item: { key: "departmentName", title: "部门名称", width: 200 },
      attr: {},
    },
    {
      item: { key: "position", title: "职务" },
      attr: {
        is: "el-dict-tag",
        dictName: "mk_bo_position",
      },
    },
    {
      item: { key: "power", title: "决策力" },
      attr: {
        is: "el-dict-tag",
        dictName: "mk_bo_power",
      },
    },
    {
      item: { key: "hobby", title: "兴趣爱好" },
      attr: {},
    },
    {
      item: { key: "address", title: "家庭地址", width: 200 },
      attr: {},
    },
    {
      item: { key: "state", title: "状态" },
      attr: {
        is: "el-dict-tag",
        dictName: "mk_bo_contact_state",
      },
    },

  ];

  // 负责人信息
  const PrincipalColumns = [
    {
      item: { key: "personName", title: "人员姓名" },
      attr: {},
    },
    {
      item: { key: "customersName", title: "客户名称" },
      attr: {},
    },
    {
      item: { key: "relationshipType", title: "关系类型" },
      attr: {
        is: "el-dict-tag",
        dictName: "mk_cm_relationship_type",
      },
    },
    {
      item: { key: "productionLine", title: "产线" },
      attr: {
        is: "el-dict-tag",
        dictName: "mk_cm_production_line",
      },
    },
    {
      item: { key: "startDate", title: "开始日期" },
      attr: {},
    },
    {
      item: { key: "endDate", title: "结束日期" },
      attr: {},
    },
  ];


  // 科室信息
  const DepartmentInfoColumns = [
    {
      item: { key: "name", title: "科室名称" },
      attr: {},
    },
    {
      item: { key: "customersName", title: "客户名称" },
      attr: {},
    },
    {
      item: { key: "responsiblePersonName", title: "负责人姓名" },
      attr: {},
    },
    {
      item: { key: "phone", title: "联系人手机" },
      attr: {},
    },
    {
      item: { key: "address", title: "科室位置" },
      attr: {},
    },
    {
      item: { key: "conventionalTherapy", title: "常规治疗" },
      attr: {},
    },
    {
      item: { key: "characteristic", title: "科室特色" },
      attr: {},
    },
  ];
  return { SearchColumns, TableColumns, ContactColumns, PrincipalColumns, DepartmentInfoColumns }
}