<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { DbHst } from '#/components/db-hst'
const hstRef = ref<any>(null)

const columns = ref<any[]>([
  { type: 'text', data: 'code', title: '序号' },
  { type: 'text', data: 'name', title: '字段名称' },
  { type: 'checkbox', data: 'unit', title: '分部分项隐藏' },
  { type: 'checkbox', data: 'price', title: '措施项目隐藏' },
])

const settings = {
  columns: columns.value,
}

const mockData = Array.from({ length: 20 }, (_, index) => ({
  code: `MAT${String(index + 1).padStart(6, '0')}`,
  name: `工料机${index + 1}`,
  unit: false,
  price: false,
}))
onMounted(() => {
  setTimeout(() => {
    if (hstRef.value) {
      hstRef.value.loadData(mockData)
    }
  }, 100)
})
</script>

<template>
  <div class="h-full">
    <DbHst ref="hstRef" :settings="settings" />
  </div>
</template>
