import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'

export const PackagemergeMain = useCrudSchemas(reactive<CrudSchema[]>([
  {
    label: '单据号',
    field: 'number',
    sort: 'custom',
    isSearch: true,
    table: {
      width: 180
    },
  },
  {
    label: '仓库代码',
    field: 'warehouseCode',
    sort: 'custom',
    table: {
      width: 120
    },
  },
  {
    label: '出库事务类型',
    field: 'outTransactionType',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '入库事务类型',
    field: 'inTransactionType',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '执行时间',
    field: 'executeTime',
    sort: 'custom',
    formatter: dateFormatter,
    detail: {
      dateFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    table: {
      width: 180
    },
    form: {
      component: 'DatePicker',
      componentProps: {
        style: {width:'100%'},
        type: 'datetime',
        dateFormat: 'YYYY-MM-DD HH:mm:ss',
        valueFormat: 'x',
      }
    },
    isForm: false
  },
  {
    label: '生效日期',
    field: 'activeDate',
    sort: 'custom',
    formatter: dateFormatter,
    detail: {
      dateFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    table: {
      width: 180
    },
    form: {
      component: 'DatePicker',
      componentProps: {
        style: {width:'100%'},
        type: 'datetime',
        dateFormat: 'YYYY-MM-DD HH:mm:ss',
        valueFormat: 'x',
      }
    },
    isForm: false
  },
  {
    label: '申请时间',
    field: 'requestTime',
    sort: 'custom',
    formatter: dateFormatter,
    detail: {
      dateFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    table: {
      width: 180
    },
    form: {
      component: 'DatePicker',
      componentProps: {
        style: {width:'100%'},
        type: 'datetime',
        dateFormat: 'YYYY-MM-DD HH:mm:ss',
        valueFormat: 'x',
      }
    },
    isForm: false
  },
  {
    label: '截止时间',
    field: 'dueTime',
    sort: 'custom',
    formatter: dateFormatter,
    detail: {
      dateFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    table: {
      width: 180
    },
    form: {
      component: 'DatePicker',
      componentProps: {
        style: {width:'100%'},
        type: 'datetime',
        dateFormat: 'YYYY-MM-DD HH:mm:ss',
        valueFormat: 'x',
      }
    },
    isForm: false
  },
  {
    label: '部门',
    field: 'departmentCode',
    sort: 'custom',
    isTable:false
  },
  {
    label: '用户组',
    field: 'userGroupCode',
    sort: 'custom',
    isTable:false
  },
  {
    label: '接口类型',
    field: 'interfaceType',
    sort: 'custom',
    isTable:false
  },

  {
    label: '业务类型',
    field: 'businessType',
    sort: 'custom',
    isTable:false
  },
  {
    label: '是否可用',
    field: 'available',
    dictType: DICT_TYPE.TRUE_FALSE,
    dictClass: 'string',
    isTable: true,
    isSearch: true,
    sort: 'custom',
    table: {
      width: 150
    },
    form: {
      component: 'Switch',
      value: 'TRUE',
      componentProps: {
        inactiveValue: 'FALSE',
        activeValue: 'TRUE'
      }
    },
  },
  {
    label: '备注',
    field: 'remark',
    sort: 'custom',
    isTable:false
  },
  {
    label: '创建时间',
    field: 'createTime',
    sort: 'custom',
    formatter: dateFormatter,
    detail: {
      dateFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    table: {
      width: 180
    },
    form: {
      component: 'DatePicker',
      componentProps: {
        style: {width:'100%'},
        type: 'datetime',
        dateFormat: 'YYYY-MM-DD HH:mm:ss',
        valueFormat: 'x',
      }
    },
    isForm: false
  }
]))

// 表单校验
export const PackagemergeMainRules = reactive({
})

export const PackagemergeDetail = useCrudSchemas(reactive<CrudSchema[]>([
  {
    label: '单据号',
    field: 'number',
    sort: 'custom',
    table: {
      width: 180
    },
  },
  {
    label: '库位代码',
    field: 'locationCode',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '库位组代码',
    field: 'locationGroupCode',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '库区代码',
    field: 'areaCode',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '从包装号',
    field: 'fromPackingNumber',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '到包装号',
    field: 'toPackingNumber',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '从数量',
    field: 'fromQty',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '到数量',
    field: 'toQty',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '从批次',
    field: 'fromBatch',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '到批次',
    field: 'toBatch',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '从库存状态',
    field: 'fromInventoryStatus',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '到库存状态',
    field: 'toInventoryStatus',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '从器具号',
    field: 'fromContainerNumber',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '到器具号',
    field: 'toContainerNumber',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '从货主代码',
    field: 'fromOwnerCode',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '到货主代码',
    field: 'toOwnerCode',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '物料代码',
    field: 'itemCode',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '物料名称',
    field: 'itemName',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '物料描述1',
    field: 'itemDesc1',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '物料描述2',
    field: 'itemDesc2',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '项目代码',
    field: 'projectCode',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '计量单位',
    field: 'uom',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '备注',
    field: 'remark',
    sort: 'custom',
    table: {
      width: 150
    },
  },
  {
    label: '创建时间',
    field: 'createTime',
    formatter: dateFormatter,
    detail: {
      dateFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    table: {
      width: 180
    },
    form: {
      component: 'DatePicker',
      componentProps: {
        style: {width:'100%'},
        type: 'datetime',
        dateFormat: 'YYYY-MM-DD HH:mm:ss',
        valueFormat: 'x',
      }
    },
    isForm: false
  },
]))

// 表单校验
export const PackagemergeDetailRules = reactive({
})