import dayjs from 'dayjs'
import { GoodsType } from '../Zother/SonGoodsList/data'
import { myTableTransferSize, resJiLianFu } from '@/utils/dataChange'

const isNull = '（空）'

export const GIrowArr = [
  { key: 'num', name: '藏品登记号' },
  { key: 'oldName', name: '藏品原名' },
  {
    key: 'makeDate',
    name: '制档日期',
    resFu: (info: GoodsType) => (info.makeDate ? dayjs(info.makeDate).format('YYYY-MM-DD') : isNull)
  },
  { key: 'makeUser', name: '制档人' },
  { key: 'level', name: '藏品级别' },
  // // 待完善sg
  // { key: 'typeDictId', name: '藏品类别', resFu: (info: GoodsType) => resJiLianFu(info.typeDictId) },
  { key: 'ageDictId', name: '藏品年代', resFu: (info: GoodsType) => resJiLianFu(info.ageDictId) },
  { key: 'ageInfo', name: '具体年代' },
  {
    key: ['pcs', 'pcsUnitDictId'],
    name: '实际数量',
    resFu: (info: GoodsType) => {
      let jlTxt = resJiLianFu(info.pcsUnitDictId)
      jlTxt = jlTxt === isNull ? '' : jlTxt
      return info.pcs && jlTxt ? info.pcs + jlTxt : isNull
    }
  },
  {
    key: 'textureDictId',
    name: '质地',
    resFu: (info: GoodsType) => resJiLianFu(info.textureDictId)
  },
  { key: 'tornLevel', name: '完残程度' },
  { key: 'tornInfo', name: '完残状况' },
  { key: 'keep', name: '保存状态', full: true },
  { key: 'keepInfo', name: '保护修复情况', full: true },
  {
    key: ['sizeL', 'sizeW', 'sizeH'],
    name: '尺寸（cm）',
    resFu: (info: GoodsType) => myTableTransferSize(info)
  },
  { key: 'sizeInfo', name: '具体尺寸' },
  { key: 'qualityScope', name: '质量范围' },
  {
    key: ['quality', 'qualityUnitDictId'],
    name: '具体质量',
    resFu: (info: GoodsType) => {
      return `${info.quality || isNull}${info.qualityUnitDictId || ''}`
    }
  },
  {
    key: 'inGoodYear',
    name: '入藏年度',
    resFu: (info: GoodsType) => (info.inGoodYear ? dayjs(info.inGoodYear).format('YYYY') : isNull)
  },
  { key: 'inGoodYearScope', name: '入藏时间范围' },
  { key: 'source', name: '文物来源' },
  { key: 'born', name: '产地' },

  {
    key: 'qualityLevelDictId',
    name: '质量等级',
    resFu: (info: GoodsType) => resJiLianFu(info.qualityLevelDictId)
  },
  { key: 'pressAuthor', name: '著者' },
  { key: 'pressFile', name: '存卷' },
  { key: 'pressVersion', name: '版本' },
  { key: 'intro', name: '藏品简介', full: true },
  { key: 'remark', name: '备注', full: true }
]

export type GI5tableType = {
  auditUserIds: string
  audits: any[]
  createTime: string
  creatorId: number
  creatorName: string
  currentAuditUserIds: string
  currentProcessId: number
  date: string
  dateEnd?: any
  dateStart?: any
  deptName: string
  dictIdApply?: any
  fileIds: string
  files: any[]
  goodIds: string
  id: number
  nodeProcessId: number
  num: string
  reason?: any
  remark?: any
  showId?: any
  showName?: any
  snapName: string
  snapNum: string
  snapType?: any
  snaps: any[]
  status: number
  storageId?: any
  storageName?: any
  type: string
  updateTime: string
}
