import { C1GoodType } from '@/pages/A3_ledger/C1ledger/type'
import { resJiLianFu, textFu } from '@/utils/history'
import { selectObj } from '@/utils/select'

export type ArrKeyType = {
  name: string
  key: keyof C1GoodType
  full?: boolean
  backFu?: (info: C1GoodType) => any
}[]

export const Y11infoArr1: ArrKeyType = [
  { name: '编号类型', key: 'numName' },
  { name: '藏品编号', key: 'num' },
  { name: '制档人', key: 'creatorName' },
  { name: '分类号', key: 'numType' },
  { name: '制档日期', key: 'createTime' }
]

export const Y11infoArr2: ArrKeyType = [
  { name: '藏品名称', key: 'name' },
  { name: '藏品原名', key: 'namePrimitive' },
  { name: '文物级别', key: 'dictLevel' },
  {
    name: '文物类别',
    key: 'dictType',
    backFu: info => {
      return resJiLianFu(info.dictType)
    }
  },
  {
    name: '年代',
    key: 'dictAge',

    backFu: info => {
      return info.dictAge === '其他' ? '其他' : resJiLianFu(info.dictAge)
    }
  },
  { name: '制作时间', key: 'dateMaking' },
  {
    name: '具体年代',
    key: 'ageInfo',
    full: true
  },
  { name: '作者', key: 'author' },
  { name: '作者介绍', key: 'authorDesc' },
  {
    name: '数量',
    key: 'pcs',
    backFu: info => {
      return info.pcs + resJiLianFu(info.pcsUnit)
    }
  },
  { name: '实际数量', key: 'pcsActual' },
  {
    name: '质地',
    key: 'dictTexture1',
    backFu: info => {
      let txt1 = resJiLianFu(info.dictTexture1)
      let txt2 = resJiLianFu(info.dictTexture2)
      let txt3 = resJiLianFu(info.dictTexture3)

      txt1 = txt1 ? txt1 + ' - ' : ''
      txt2 = txt2 ? txt2 + ' - ' : ''

      return txt1 + txt2 + txt3
    }
  },
  { name: '保存状态', key: 'preserveState' },
  {
    name: '完残程度',
    key: 'dictTorn',
    backFu: info => {
      return resJiLianFu(info.dictTorn)
    }
  },
  { name: '完残情况', key: 'torn' },
  { name: '色泽', key: 'color' },
  { name: '用途', key: 'uses' },
  { name: '形状描述', key: 'shape' },
  { name: '著者', key: 'pressAuthor' },
  { name: '版本', key: 'pressVersion' },
  { name: '存卷', key: 'pressFile' },
  {
    name: '备注',
    key: 'rtf',
    full: true,
    backFu: info => {
      let txt = textFu(info.rtf)
      return txt ? <div dangerouslySetInnerHTML={{ __html: txt }}></div> : '（空）'
    }
  }
]

export const Y11infoArr3: ArrKeyType = [
  {
    name: '尺寸',
    key: 'sizeL',
    backFu: info => {
      let danWei = resJiLianFu(info.sizeUnit, ' ')

      let txt1 = info.sizeL ? `通长${info.sizeL}` : ''
      let txt2 = info.sizeW ? `通宽${info.sizeW}` : ''
      let txt3 = info.sizeH ? `通高${info.sizeH}` : ''

      txt1 = txt1 ? txt1 + danWei : ''
      txt2 = txt2 ? txt2 + danWei : ''
      txt3 = txt3 ? txt3 + danWei : ''

      let arr = [txt1, txt2, txt3]
      arr = arr.filter(v => v)

      if (!txt1 && !txt2 && !txt3) return '（空）'
      else return arr.join(' - ')
    }
  },
  { name: '具体尺寸', key: 'sizeInfo' },
  {
    name: '质量范围',
    key: 'qualityDictScope',
    backFu: info => {
      return resJiLianFu(info.qualityDictScope)
    }
  },
  {
    name: '具体质量',
    key: 'quality',
    backFu: info => {
      return info.quality + resJiLianFu(info.qualityUnit)
    }
  }
]

export const Y11infoArr4: ArrKeyType = [
  { name: '入馆凭证号', key: 'inHouseNum' },
  { name: '入藏凭证号', key: 'inGoodsNum' },
  { name: '入藏日期', key: 'inGoodsDate' },
  {
    name: '入藏日期范围',
    key: 'inDictDateScope',
    backFu: info => {
      return resJiLianFu(info.inDictDateScope)
    }
  },
  {
    name: '入藏去向',
    key: 'accountType',
    backFu: info => {
      return (selectObj['入藏去向'].find(c => c.value === info.accountType) || {}).label || '（空）'
    }
  },
  {
    name: '来源',
    key: 'source',
    backFu: info => {
      return resJiLianFu(info.source)
    }
  },
  { name: '来源详情', key: 'sourceInfo' },
  { name: '征集经过', key: 'sourcePass' },
  { name: '铭记题跋', key: 'sourcePreface' },
  { name: '鉴藏印记', key: 'sourceStamp' }
]

export const Y11infoArr5: ArrKeyType = [
  { name: '著作及有关书目', key: 'historyWork' },
  { name: '流传经历', key: 'historyUndergo' }
]
