<template>
  <view
    class="asset_houses_card"
    v-for="(i, index) in useModel?.dataList?.value"
    :key="`item_${index}`"
  >
    <view class="card_header" @click="method?.handleSelectedHouse(i)">
      <view class="asset_houses_name">
        <view> {{ i?.asset_house?.full_name }} </view>
        <uni-icons
          v-if="i?.asset_houses_id === useModel.selectedHouseEd.value?.id"
          type="checkbox-filled"
          size="20"
          color="#2A7EFB"
        ></uni-icons>
        <uni-icons v-else type="circle" size="20" color="#999"></uni-icons>
      </view>
      <view class="asset_houses_info">
        <view class="item">
          您的身份是：
          <hs-enum-tag :value="i?.house_relation" :Enums="HouseOccupantsHouseRelationEnum" />
        </view>
        <view class="item"> 房屋已绑定：{{ i?.people_num || 0 }}人 </view>
      </view>
    </view>
    <view class="card_footer">
      <view class="btn" v-if="i?.house_relation === 'Owner'"><MyCreateHousehold /></view>
      <view class="btn" @click="method?.handleQueryHouseArchives(i)"> 查看房屋人员 </view>
    </view>
  </view>
</template>
<script setup lang="ts">
import method from '../method'
import { HouseOccupantsHouseRelationEnum } from '@/gen/Enums'
import useModel from '../model'
import MyCreateHousehold from './CreateHousehold.vue'
</script>
