<!--
 * @Author: micky
 * @Date: 2024-08-24 20:28:42
 * @LastEditors: micky
 * @LastEditTime: 2024-08-26 16:47:00
 * @FilePath: \chargingpile-uniapp\src\components\widgets\client-device-info\client-device-info.vue
-->
<template>
    <view class="item" v-if="needClient">
        <view>客户名称</view>
        <view>
            {{ formData.clientName || '--' }}
        </view>
    </view>
    <view class="item">
        <view>设备名称</view>
        <view>
            {{ formData.equipment?.name || formData.equipmentName || '--' }}
        </view>
    </view>
    <view class="item">
        <view>设备编号</view>
        <view>
            {{ formData.equipment?.number || formData.equipmentNo || '--' }}
        </view>
    </view>
    <template v-if="needMoreDeviceInfo">
        <view class="item">
            <view>设备型号</view>
            <view>
                {{ formData.equipment?.model || formData.model || '--' }}
            </view>
        </view>
        <view class="item">
            <view>设备厂家</view>
            <view>
                {{ formData.equipment?.manufacturers || formData.manufacturers || '--' }}
            </view>
        </view>
        <view class="item">
            <view>设备规格</view>
            <view>
                {{ formData.equipment?.specification || formData.specification || '--' }}
            </view>
        </view>
    </template>
    <view class="item">
        <view>设备地址</view>
        <view v-if="type == 'detail'">
            {{ detailAddress }}
        </view>
        <view v-else>
            {{ address }}
            <!-- <w-overflow-tooltip
                class="flex-1 overflow-auto"
                :content="address"
            ></w-overflow-tooltip> -->
        </view>
    </view>
</template>

<script setup lang="ts">
import { computed } from 'vue'

const props = defineProps({
    formData: {
        type: Object,
        default: () => {}
    },
    needClient: {
        type: Boolean,
        default: true
    },
    needMoreDeviceInfo: {
        type: Boolean,
        default: false
    },
    type: {
        type: String,
        default: 'detail'
    }
})

const detailAddress = computed(() => {
    return `${props.formData.equipment?.province || ''}${props.formData.equipment?.city || ''}${
        props.formData.equipment?.district || ''
    }${props.formData.equipment?.detailedAddress || ''}`
})
const address = computed(() => {
    return `${props.formData?.province || ''}${props.formData?.city || ''}${
        props.formData?.district || ''
    }${props.formData?.detailedAddress || ''}`
})
</script>
<style scoped lang="scss"></style>
