<template>

    <div :style="{ height: height }">
        <vxe-table height="auto" auto-resize :data="dataList" v-bind="defaultAttribute" :key="key">
            <vxe-column v-for="item in column" :field="item.field" :title="item.title"
                :formatter="formatter"></vxe-column>

        </vxe-table>
    </div>

</template>
<script setup lang='ts'>
import { mainHeight } from '@/utils/layout'
import { ref, reactive } from 'vue'
import { defaultAttribute } from '@/components/table/defaultAttribute'
const props = defineProps(['tableData'])
const height = mainHeight(325).height
const dataList = ref([])
const key: any = ref(0)
const column: any = ref([])
const setData = (data: any, targetType: any) => {

    dataList.value = JSON.parse(JSON.stringify(data))

   
    if (targetType[0].name == '基本数据' ) {
        column.value = [
            { field: 'otherName', title: '名称', },
            { field: 'valueA', title: 'A相', },
            { field: 'valueB', title: 'B相', },
            { field: 'valueC', title: 'C相', },
            { field: 'valueM', title: '', },
        ]
    }  else {
        column.value = [
            { field: 'otherName', title: '谐波次数', },
            { field: 'valueA', title: 'A相', },
            { field: 'valueB', title: 'B相', },
            { field: 'valueC', title: 'C相', },
        ]
    }
    key.value += 1
}
const formatter = (row: any) => {
  return row.cellValue==null? '/':row.cellValue
}

defineExpose({ setData })
</script>
<style lang="scss" scoped></style>
