<template>
<div class="tabcontainer">
    <BasicTable @register="registerTable"  style="height: 720px" >
        
    </BasicTable>
</div>
</template>
<script lang="ts" setup>
import { ref, defineEmits, onMounted, watch, defineProps } from 'vue';
import { BasicTable, useTable, TableAction } from '@/components/Table';
import { columns, searchFormSchema } from './companydata';
import { PageWrapper } from '@/components/Page';
import { message, Modal } from 'ant-design-vue';
import { GetListDataInfo,GetConpanyInfoById} from '@/api/qydata/index';
const props = defineProps(['getCheckrows'])
const emits = defineEmits(['setCheckRows']);
watch(
    () => props.getCheckrows,
    (newVal, oldVal) => {
        let rows = getSelectRows()
        if(rows.length>0){
            GetConpanyDataById(rows[0].Id)
        }else{
            emits('setCheckRows', false)
        }
    },
    {
    deep: true,
    },
);

const [registerTable, { getSelectRows }] = useTable({
    title: '企业列表',
    api: GetListDataInfo,
    columns,
    rowSelection: {
        type: 'radio',
    },
    formConfig: {
        labelWidth: 120,
        showAdvancedButton: false,
        schemas: searchFormSchema,
    },
    useSearchForm: true,
    showIndexColumn: false,
    showTableSetting: false,
    tableSetting: { fullScreen: false },
});
const GetConpanyDataById = (id) =>{
    GetConpanyInfoById({id:id}).then(res =>{
        emits('setCheckRows', res)
    })
}
</script>
<style lang="less" scoped>
.tabcontainer{
    height: 100%;
}
</style>
  