<template>
  <div class="elevator-info">
    <m-form
      :template="[
        'stNameFrst:小区名称|elevatorAddr:项目地址',
        'streetName:所属街道|unitTypeDesc:户型',
        'cmtName:居委会|unitTotFloor:楼层',
        'totUnit:户数|unitBuildTime:建造年份',
        'hocName:业委会|cspName:物业公司',
        'evaluateType:评估类型>whichType|evaluateResultDesc:评估描述',
        'state:加装状态>switchElevatorState|',
      ]"
      :data="info"
      :formatter="formatter"
      label-width=".8rem"
    />
  </div>
</template>

<script lang="ts" setup>
import { PropType } from 'vue'
import { switchElevatorState } from '@/utils'

defineProps({
  info: {
    type: Object as PropType<{ [key: string]: unknown }>,
    default: () => ({}),
  },
})
const formatter = {
  /**
   * 评估类型
   * 0-可加装 1-较难加装 2-不可加装
   */
  whichType: (val) => {
    if (val == 0) {
      return '可加装'
    } else if (val == 1) {
      return '较难加装'
    } else if (val == 2) {
      return '不可加装'
    } else {
      return null
    }
  },
  switchElevatorState,
}
</script>
