//清单子目
import { ref } from 'vue'
const columns = ref<any[]>([
{type:'text',data:'code',title:'编码'},
{type:'text',data:'name',title:'名称'},
{type:'text',data:'unit',title:'单位',width:30},
{type:'text',data:'desc',title:'清单说明'},

])

const mockData = ()=>{
   const units = ['m³', 'm²', 'm', 'kg', 't', '个', '套', '台', '块', '根']
   const categories = ['混凝土', '钢材', '木材', '砖瓦', '管材', '电缆', '涂料', '五金', '设备', '其他']
   
   const mockData = Array.from({ length: 30 }, (_, index) => ({
      code: `MAT${String(index + 1).padStart(6, '0')}`,
      name: `${categories[index % categories.length]}材料${index + 1}`,
      unit: units[index % units.length],
      desc: `这是详细说明，`
    }))
    return mockData;
}
let rowSchema: any = {}
// 根据 columns 的 data 字段生成对象结构
columns.value.forEach((col: any) => {
  if (col.data) {
    rowSchema[col.data] = null
  }
})
export let dbSettings = {
  data: mockData(),
  dataSchema: rowSchema,
  colWidths: 100,
  columns: columns.value
}
