
export default function useColumns (){

  const TableColumns = [
  { item: { key: "createName", title: "创建人" ,width:100, }, attr: {} },
  { item: { key: "createTime", title: "创建时间" ,width:150,}, attr: {} },
  { item: { key: "billCode", title: "单据编码" }, attr: {} },
  
  {
    item: { key: "proposerName", title: "申请人",width:100, },
    attr: { },
  },
  { item: { key: "status", title: "单据状态",width:100, }, 
      attr: {
        
        is: "el-dict-tag",
        dictName: "documents_status", // 字典名
      } 
    },

    { item: { key: "oneClassify", title: "物料一级分类" ,width:150,}, attr: {} },
    { item: { key: "materialType", title: "物料基本分类" ,width:150,}, attr: {} },
    { 
      item: { key: "code", title: "物料编码" }, 
      attr: {
   
      } 
    },
    { item: { key: "name", title: "物料名称" }, attr: {} },
     { item: { key: "specification", title: "规格" ,width:150,}, attr: {} },
    { item: { key: "manufacturerName", title: "生产厂家/代理人" ,width:150,}, attr: {} },
     { item: { key: "registrationNo", title: "注册证号" ,width:150,}, attr: {} },
    { item: { key: "registrant", title: "注册人" ,width:150,}, attr: {} },
    { item: { key: "updateTime", title: "最后修改时间" ,width:150,}, attr: {} },
    { item: { key: "reviewedName", title: "最后审批人" ,width:150,}, attr: {} },
     { item: { key: "auditTime", title: "最后审批时间" ,width:150,}, attr: {} },
     { 
      item:{ key: "approveUser", title: "当前审批人" ,},
      attr:{
      },
    },
     // { item: { key: "orgName", title: "审批语" ,width:150,}, attr: {} },




    // { item: { key: "orgName", title: "所属组织" ,width:150,}, attr: {} },
   
    // { item: { key: "createTime", title: "申请时间",width:150, }, attr: {} },
 
    // {
    //   item: { key: "updateName", title: "最后修改人" ,width:150, },
    //   attr: {  },
    // },
    
   
  ].map(({ item, attr }) => ({
    attr,
    item: { 
      ...item, 
      sortabled: true,
      fixedabled: true,
      filterabled: true,
      hiddenabled: true,
    },
  }));

  const SearchColumns = [
    {
      item: { key: "billCode", title: "单据编码" },
      attr: {
        is: "el-input",
        clearable:true,
      },
    },
    {
      item: { key: "status", title: "单据状态" },
      attr: {
        is: "el-select",
        dictName: "documents_status",
        clearable: true,
      },
    },
    {
      item: { key: "name", title: "物料名称" },
      attr: {
        is: "el-popover-select-v2",
        referName: "MATERIAL_PARAM",
        valueKey: "name",
        clearable:true,
      },
    },
    {
      item: { key: "code", title: "物料编码" },
      attr: {
        is: "el-popover-select-v2",
        referName: "MATERIAL_PARAM",
        valueKey: "code",
        clearable:true,
      },
    },
   {
     item: { key: "materialCodes", title: "物料编码" },
     attr: {
       clearable: true,
       is: "el-input",
       placeholder: '多物料编码使用 , 隔开',
     },
   },
    {
      item: { key: "classifySearchList", title: "品类" },
      attr: {
        is: "el-popover-multiple-tree-select",
        referName: "MATERIALCLASSIFY_PARAM",
        valueKey: "id",
        clearable:true,
      },
    },
    {
      item: { key: "proposerName", title: "申请人" },
      attr: {
        is: "el-popover-select-v2",
        referName: "CONTACTS_PARAM",
        valueKey: "name",
        dataMapping: {
          proposerId: "code",
        },
        clearable: true,
      },
    },
    // { 
    //   item: { key: "createName", title: "创建人" ,width:150, }, 
    //   attr: {
    //     is: "el-popover-select-v2",
    //     referName: "CONTACTS_PARAM",
    //     valueKey: "name",
    //     dataMapping: {
    //       create: "code",
    //     },
    //     clearable: true,
    //   } 
    // },
    
    // {
    //   item: { key: "createTimeString", title: "申请时间" },
    //   attr: {
    //     is: "el-date-picker", 
    //     valueFormat: "yyyy-MM-dd" ,
    //     clearable: true,
    //   },
    // },
    {
      item: { key: "reviewedName", title: "最后审批人" },
      attr: {
        is: "el-popover-select-v2",
        referName: "CONTACTS_PARAM",
        valueKey: "name",
        dataMapping: {
          reviewedBy: "code",
        },
        clearable: true,
      },
    },
    // {
    //   item: { key: "auditTimeString", title: "审批时间" },
    //   attr: {
    //     is: "el-date-picker", 
    //     valueFormat: "yyyy-MM-dd" ,
    //     clearable: true,
    //   },
    // },
    {
      item: { key: "manufacturerName", title: "生产厂家/代理人" },
      attr: {
        clearable:true,
        is: "el-popover-select-v2",
        valueKey: "name",
        referName: "MANUFACTURER_PARAM",
        dataMapping: {
          manufacturerId: "id",
        },
      },
    },
    {
      item: { key: "registrationNo", title: "注册证号" },
      attr: {
        clearable:true,
        is: "el-input",
      },
    },
    {
      item:{
        key: "createTimeString",
        title: "申请时间",
        span:12,
      },
      attr: {
        clearable:true,
        // is: "el-date-wrapper",
        is: "el-date-picker",
        type:"daterange",
        rangeSeparator:"-",
        startPlaceholder:"开始日期",
        endPlaceholder:"结束日期",
        valueFormat:"yyyy-MM-dd",
      },
    },
    
    {
      item:{
        key: "auditTimeString",
        title: "审批时间",
        span:12,
      },
      attr: {
        clearable:true,
        is: "el-date-picker",
        type:"daterange",
        rangeSeparator:"-",
        startPlaceholder:"开始日期",
        endPlaceholder:"结束日期",
        valueFormat:"yyyy-MM-dd",
      },
    },
    
  
  ].map(({ item, attr }) => ({
    attr,
    item: { ...item, hidden: true, span: item.span || 6 },
  }));

  return { TableColumns,SearchColumns }

}


