<template>
  <view>
    <view class="show_header">
      <view class="hande_name_info">
        <view v-if="useModel?.showData?.value?.house_meter?.usage_type === 'WaterMeter'" class="table_tab water">
          <image src="/static/svg/water_meter_icon.svg" mode="widthFix" /> <text>水表</text>
        </view>
        <view v-if="useModel?.showData?.value?.house_meter?.usage_type === 'ElectricMeter'"
          class="table_tab electricity">
          <image src="/static/svg/electricity_meter.svg" mode="widthFix" /> <text>电表</text>
        </view>
        <view class="name">
          <text v-for="(res, index) in useModel?.showData?.value?.house_meter?.house_meter_has_houses"
            :key="`house_${index}`">{{
              res?.full_name }}
          </text>
        </view>
      </view>
      <view class="header_cell">
        仪表名称：{{ useModel?.showData?.value?.house_meter?.name || '-' }}
      </view>
      <view class="header_cell">
        抄表读数：{{ useModel?.showData?.value?.current_reading || '-' }}
      </view>
      <view class="header_cell">
        抄表时间：{{ useModel?.showData?.value?.reading_time }}
      </view>
      <view class="header_cell">
        抄表人：{{ useModel?.showData?.value?.company_employee?.name || '-' }}
      </view>
    </view>

    <view class="attachment_img">
      <view class="title">
        抄表附件
      </view>
      <view class="img_list">
        <view v-for="(i, index) in useModel?.showData?.value?.images" class="attachment_img_item"
          :key="`attachment_${index}`" @click="method?.handlePreview(index)">
          <image :src="i?.url" mode="widthFix" />
        </view>
      </view>
      <view v-if="useModel?.showData?.value?.remark" class="remark_info">
        备注：{{ useModel?.showData?.value?.remark || '-' }}
      </view>

    </view>
  </view>
</template>
<script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app'
import method from './method'
import useModel from './model'

onLoad((e) => {
  method?.getShow(e)
})
</script>
<style lang="scss">
@import './style.scss';
</style>
