<!--
 * @Author: chris
 * @Date: 2025-09-05 09:39:28
 * @LastEditors: chris
 * @LastEditTime: 2025-09-26 17:37:26
-->
<script setup name="DeviceList">
import DeviceFlatList from '@/components/deviceFlatList'

const props = defineProps({
  modelValue: {
    type: String,
    default: null,
  },
  deviceList: {
    type: Array,
    default: () => [],
  }
})

const emit = defineEmits(['update:modelValue', 'change'])

function handleChangeDevice(device) {
  emit('update:modelValue', device.id)
  emit('change', device)
}
</script>

<template>
  <el-card class="device-tree-card">
    <template #header>
      <div class="list-header">
        <span>设备列表</span>
      </div>
    </template>
    <device-flat-list :list="deviceList" @change="handleChangeDevice" />
  </el-card>
</template>

<style lang="scss" scoped>

</style>