
export default function useColumns(){

 
  const TabColumns = [
    // 基本信息
    {
      item:{
        key: 'sysMaterialApply',
        title: '基本信息',
      },
      attr:{
        is: 'el-super-form',
        
        value:{},
      },
      TableColumns:[
        {
          item:{
            key:'name',
            title:'物料名称',
            required:true,
          },
          attr:{
            is: "el-input",
          },
        },
        {
          item:{
            key:'code',
            title:'物料编码',
          },
          attr:{
            is: "el-input",
            disabled: true,
          },
        },
        {
          item:{
            key:'version',
            title:'版本号',
          },
          attr:{
            is: "el-input",
            disabled: true,
          },
        },
        {
          item:{
            key:'orgName',
            title:'所属组织',
          },
          attr:{
            is: "el-popover-select-v2",
            valueKey: "name",
            referName: "ORG_PARAM",
            dataMapping: {
              orgId:'id'
            },
            disabled:true,
          },
        },
        {
          item:{
            key:'specification',
            title:'规格',
            required: true,
          },
          attr:{
            is: "el-input",
          },
        },
        {
          item:{
            // key:'classifyId',
            key:'classifyName',
            title:'四级分类',
            required: true,
          },
          attr:{
            is: "el-popover-tree-select",
            referName: "MATERIALCLASSIFY_PARAM",
            valueKey: "name",
            // 末级
            onlyFinal: true,
            readonly:true,
            defaultProps: {
              label: function (data, node) {
                return data.code + " " + data.name;
              },
              children: "children",
            },
            dataMapping: {
              classifyId:'id',
              
            }
          },
        },
        {
          item:{
            key:'isMedicine',
            title:'医药物料',
          },
          attr:{
            is: "el-select",
            clearable:true,
            dictName: "sys_number_yes_no", // 字典名
          },
          
        },
        {
          item:{
            key:'failCause',
            title:'同步失败原因',
          },
          attr:{
            is: "el-input",
          },
        },
        {
          item:{
            key:'model',
            title:'型号',
          },
          attr:{
            is: "el-input",
          },
      
        },
        {
          item:{
            key:'packExplain',
            title:'包装说明',
            required: true,
          },
          attr:{
            is: "el-input",
          },
        },
        {
          item:{
            key:'serialNoManager',
            title:'序列号管理',
          },
          attr:{
            is: "el-select",
            clearable:true,
            dictName: "sys_number_yes_no",
          },
        },
        {
          item:{
            key:'barCode',
            title:'条形码',
          },
          attr:{
            is: "el-input",
          },
        },
        {
          // 单位
          item:{
            key:'unitName',
            title:'计量单位',
            required: true,
          },
          attr:{
            is: "el-popover-select-v2",
            valueKey: "name",
            referName: "UNIT_PARAM",
            readonly:true,
            dataMapping: {
              unitId:'id'
            }
          },
        },
        {
          item:{
            key:'deliveryPeriod',
            title:'交货周期',
            required: true,
          },
          attr:{
            is: "el-input-number",
            min: 0,
            controlsPosition: "right",
          },
        },
        {
          item:{
            key:'isInventoryStatus',
            title:'批号及库存状态管理',
          },
          attr:{
            is: "el-select",
            clearable:true,
            dictName: "sys_number_yes_no",
          },
        },
        {
          item:{
            key:'height',
            title:'高度',
          },
          attr:{
            is: "el-input-number",
            min: 0,
            controlsPosition: "right",
            
          },
        },
        {
          item:{
            key:'manufacturerName',
            title:'生产厂家/代理人',
            required: true,
          },
          attr:{
            is: "el-popover-select-v2",
            valueKey: "name",
            referName: "MANUFACTURER_PARAM",
            dataMapping: {
              manufacturerId: 'id',
              brand:"brand" ,
              // originPlaceName: "countryName" ,
              // originPlace: "country",
              registrant: "registrantName" ,
              productionPermit: "productionLicense",
            }
          },
        },
        {
          item:{
            key:'minOrderQty',
            title:'最小起订量',
            required: true,
          },
          attr:{
            is: "el-input-number",
            min: 0,
            controlsPosition: "right",
          },
        },
        {
          item:{
            key:'expiryDateManagerment',
            title:'效期管理',
          },
          attr:{
            is: "el-select",
            clearable:true,
            dictName: "sys_number_yes_no",
          },
        },
        {
          item:{
            key:'width',
            title:'宽度',
          },
          attr:{
            is: "el-input-number",
            min: 0,
            controlsPosition: "right",
          },
        },
        { 
          item:{
            key:'registrant',
            title:'注册人/备案人/上市许可持有人',
            required: true,
          },
          attr:{
            is: "el-input",
          },
        },
        {
          item:{
            key:'minPackQty',
            title:'最小包装量',
            required: true,
          },
          attr:{
            is: "el-input-number",
            min: 0,
            controlsPosition: "right",
          },
        },
        {
          item:{
            key:'expiryUnitId',
            title:'效期单位',
          },
          attr:{
            is: "el-select",
            clearable:true,
            dictName: "period_unit",
          },
        },
        {
          item:{
            key:'length',
            title:'长度',
          },
          attr:{
            is: "el-input-number",
            min: 0,
            controlsPosition: "right",
          },
        },
        {
          item:{
            key:'productionPermit',
            title:'生产许可证',
          },
          attr:{
            is: "el-input",
          },
        },
        {
          item:{
            key:'minBatchQty',
            title:'最小批量',
            required: true,
          },
          attr:{
            is: "el-input-number",
            min: 0,
            controlsPosition: "right",
          },
        },
        {
          item:{
            key:'usefulLife',
            title:'有效期',
          },
          attr:{
            is: "el-input-number",
            min: 0,
            controlsPosition: "right",
          },
        },
        {
          item:{
            key:'oneClass',
            title:'一级分类',
          },
          attr:{
            is: "el-input",
            disabled: true,
          },
        },
        {
          item:{
            key:'storageCondition',
            title:'存储条件',
            required: true,
          },
          attr:{
            is: "el-select",
            clearable:true,
            dictName: "sys_storage_condition",
          },
        },
        {
          item:{
            key:'diCode',
            title:'DI码',
          },
          attr:{
            is: "el-input",
          },
      
        },
        {
          item:{
            key:'usefulLifeUnitId',
            title:'有效期至单位',
          },
          attr:{
            is: "el-select",
            clearable:true,
          dictName: "expiry_date",
          },
        },
        {
          item:{
            key:'twoClass',
            title:'二级分类',
          },
          attr:{
            is: "el-input",
            disabled: true,
          },
        },
        {
          item:{
            key:'transportationCondition',
            title:'运输条件',
          },
          attr:{
            is: "el-select",
            clearable:true,
          dictName: "sys_conditions_carriage",
          },
        },
        {
          item:{
            key:'healthCode',
            title:'医保代码',
          },
          attr:{
            is: "el-input",
          },
        },
        {
          item:{
            key:'nearOnsetManagerment',
            title:'近效期管理',
          },
          attr:{
            is: "el-select",
            clearable:true,
            dictName: "sys_number_yes_no",
          },
        },
        {
          item:{
            key:'threeClass',
            title:'三级分类',
          },
          attr:{
            is: "el-input",
            disabled: true,
          },
        },
        {
          item:{
            key:'originPlaceName',
            title:'产地',
            required: true,
          },
          attr:{
            is: "el-popover-select-v2",
            valueKey: "name",
            referName: "ORIGINPLACE_PARAM",
            dataMapping: {
              originPlace: 'id'
            },
            readonly:true,
            // disabled: true,
          },
          
        },
        {
          item:{
            key:'manufacturersMaterialCode',
            title:'厂家物料编码',
          },
          attr:{
            is: "el-input",
          },
        },
        {
          item:{
            key:'recentWarningPeriod',
            title:'近效期预警天数',
          },
          attr:{
            is: "el-input-number",
            min: 0,
            controlsPosition: "right",
          },
        },
        {
          item:{
            key:'isEnable',
            title:'启用状态',
          },
          attr:{
            is: "el-select",
            clearable:true,
            dictName: "material_enable",
            disabled: true,
          },
        },
        {
          item:{
            key:'serviceLife',
            title:'使用期限/次数',
          },
          attr:{
            is: "el-input",
          },
        },
        {
          item:{
            key:'purchasingOrganizationName',
            title:'默认采购组织',
            required: true,
          },
          attr:{
            is: "el-popover-select-v2",
            valueKey: "name",
            referName: "ORG_PARAM",
            dataMapping: {
              purchasingOrganization:'id'
            },
            readonly:true,
          },
        },
        {
          item:{
            key:'materialRateName',
            title:'物料税类',
            required: true,
          },
          attr:{
            is: "el-popover-select-v2",
            valueKey: "name",
            referName: "MATERIALTAX_PARAM",
            readonly:true,
            dataMapping: {
              materialRate: "id",
              rateCode:'code',
            },
          },
        },
        {
          item:{
            key:'remark',
            title:'备注',
          },
          attr:{
            is: "el-input",
          },
        },
        {
          item:{
            key:'brand',
            title:'品牌',
          },
          attr:{
            is: "el-input",
            disabled: true,
          },
        },
        {
          item:{
            key:'puPersonnelName',
            title:'负责采购员',
            required: true,
          },
          attr:{
            is: "el-popover-select-v2",
            referName: "CONTACTS_PARAM",
            valueKey: "name",
            dataMapping: {
              puPersonnelId: "code",
            },
            readonly:true,
          },
        },
        {
          item:{
            key:'proposerName',
            title:'物料申请人',
          },
          attr:{
            // is: "el-input",
            // PSNLICENSE_PARAM
            disabled: true,
            is: "el-popover-select-v2",
            referName: "CONTACTS_PARAM",
            valueKey: "name",
            dataMapping:{
              proposerId: 'code'
            }
          },
        },
        {
          item:{
            key:'serviceClass',
            title:'服务类',
          },
          attr:{
            is: "el-input",
            // min: 0,
            // controlsPosition: "right",
            disabled: true,
          },
        },

      ].map(({ item, attr }) => ({
        attr,
        item: { ...item, hidden: true, span: item.span || 6 },
      })),
    },
    // 医药属性
    {
      item:{
        key:'sysMaterialMedcineApply',
        title:'医药属性',
      },
      attr:{
        is: 'el-super-form',
        value:{},
      },
      TableColumns:[
        {
          item:{
            key:'isDrug',
            title:'药品',
          },
          attr:{
            is: "el-select",
            clearable:true,
            dictName: "sys_medicine", // 字典名
          },
      
        },
        {
          item:{
            key:'registrationNo',
            title:'注册证号/备案凭证编号',
          },
          attr:{
            is: "el-input",
          },
      
        },
        {
          item:{
            key:'medicalInstruments',
            title:'管理类别',
          },
          attr:{
            is: "el-select",
            clearable:true,
            dictName: "medical_instruments", // 字典名
            
          },
      
        },
        {
          item:{
            key:'commonName',
            title:'通用名称',
          },
          attr:{
            is: "el-input",
          },
      
        },
        {
          item:{
            key:'ratifyBatchNo',
            title:'批准文号',
          },
          attr:{
            is: "el-input",
          },
      
        },
        {
          item:{
            key:'dosageFromName',
            title:'剂型',
          },
          attr:{
            readonly:true,
            is: "el-popover-tree-select",
            referName: "DOSAGEFORM_PARAM",
            valueKey: "name",
            dataMapping: {
              dosageFrom:'id'
            }
          },
        },
        {
          item:{
            key:'oriRegistrationNo',
            title:'旧注册证号',
          },
          attr:{
            is: "el-input",
          },
      
        },
        {
          item:{
            key:'curingType',
            title:'养护类型',
          },
          attr:{
            is: "el-select",
            clearable:true,
            dictName: "curing_type", // 字典名
          },
        }
      ].map(({ item, attr }) => ({
        attr,
        item: { ...item, hidden: true, span: item.span || 6 },
      })),
    },
    // 维护物料类别
    {
      item:{
        key:'sysMaterialMedcineItemApply',
        title:'维护物料类别',
      },
      attr:{
        is: 'el-super-ux-table',
        value:[]
      },
      TableColumns:[
        {
          item:{
            key:'drugId',
            title:'ID',
          },
          attr:{
            is: "el-input",
            readonly:true,
          },
         
        },
        {
          item:{
            key:'drugCode',
            title:'药品类别编码',
            require: true,
          },
          attr:{
            is: "el-input",
            readonly:true,
          },
         
        },
        {
          item:{
            key:'drugName',
            title:'药品类别名称',
            require: true,
          },
          attr:{
            is: "el-input",
            // MEDICINE_DRUG
            // is: "el-popover-select-v2",
            // valueKey: "name",
            // referName: "ORG_PARAM",
            // dataMapping: {
            //   // drugCode: undefined,
            //   // drugId: undefined
            // },
            readonly:true,
          },
         
        },
      ].map(({ item, attr }) => ({
        attr,
        item: { ...item, hidden: true, span: item.span || 6 },
      }))
    }, 
    // 单据信息
    {
      item:{
        key:'applyBillInfo',
        title:'单据信息',
      },
      attr:{
        is: 'el-super-form',
        value:{},
      },
      TableColumns:[
        {
          item:{
            key:'createByName',
            title:'申请人',
          },
          attr:{
            is: "el-input",
            disabled:true,
          },
      
        },
        {
          item:{
            key:'createTime',
            title:'申请时间',
          },
          attr:{
            is: "el-date-picker",
            valueFormat: "yyyy-MM-dd HH:mm:ss",
            disabled:true,
          },
      
        },
        {
          item:{
            key:'createByName',
            title:'创建人',
          },
          attr:{
            is: "el-input",
            disabled:true,
          },
      
        },
        {
          item:{
            key:'createTime',
            title:'创建时间',
          },
          attr:{
            is: "el-date-picker",
            valueFormat: "yyyy-MM-dd HH:mm:ss",
            disabled:true,
          },
      
        },
        {
          item:{
            key:'updateByName',
            title:'最后修改人',
          },
          attr:{
            is: "el-input",
            disabled:true,
          },
      
        },
        {
          item:{
            key:'updateTime',
            title:'最后修改时间',
          },
          attr:{
            is: "el-date-picker",
            valueFormat: "yyyy-MM-dd HH:mm:ss",
            disabled:true,
          },
      
        },
        {
          item:{
            key:'status',
            title:'单据状态',
          },
          attr:{
            is: "el-select",
            clearable:true,
            dictName: "documents_status", // 字典名
            disabled:true,
          },
      
        },
        // {
        //   item:{
        //     key:'reviewedByName',
        //     title:'最后审核人',
        //   },
        //   attr:{
        //     is: "el-input",
        //     disabled:true,
        //   },
      
        // },
        // {
        //   item:{
        //     key:'approvalTime',
        //     title:'最后审核时间',
        //   },
        //   attr:{
        //     is: "el-date-picker",
        //     valueFormat: "yyyy-MM-dd HH:mm:ss",
        //     disabled:true,
        //   },
      
        // },
        
      ].map(({ item, attr }) => ({
        attr,
        item: { ...item, hidden: true, span: item.span || 6 },
      })),
    },
  ]

  const MaterialColums = [
    {
      item:{
        key:'name',
        title:'物料',
      },
      attr:{
        is: "el-popover-select-v2",
        valueKey: "name",
        referName: "MATERIAL_PARAM",
        dataMapping: {
          classifyId: 'classifyId',
          classifyName: 'classifyIdName',
          isMedicine: 'isMedicine',
          unitId: 'unitId',
          unitName: 'unitIdName',
          packExplain: 'packExplain',
          isInventoryStatus: 'isInventoryStatus',
          manufacturerId: 'manufacturerId',
          manufacturerName: 'manufacturerIdName',
          deliveryPeriod: 'deliveryPeriod',
          expiryDateManagerment: 'expiryDateManagerment',
          registrant: 'registrant',
          minOrderQty: 'minOrderQty',
          expiryUnitId: 'expiryUnitId',
          productionPermit: 'productionPermit',
          minPackQty: 'minPackQty',
          usefulLife: 'usefulLife',
          storageCondition: 'storageCondition',
          minBatchQty: 'minBatchQty',
          usefulLifeUnitId: 'usefulLifeUnitId',
          transportationCondition: 'transportationCondition',
          materialRate: 'materialRate',
          materialRateName: 'materialRateName',
          rateCode: 'rateCode',
          nearOnsetManagerment: 'nearOnsetManagerment',
          originPlace: 'originPlace',
          originPlaceName: 'originPlaceName',
          purchasingOrganization: 'purchasingOrganization',
          purchasingOrganizationName: 'purchasingOrganizationName',
          recentWarningPeriod: 'recentWarningPeriod',
          brand:'brand',
          puPersonnelId:'puPersonnelId',
          puPersonnelName:'puPersonnelIdName',
        },
      },
    },
  ]

  return { TabColumns, MaterialColums }
}

