<template>
    <BasicModal width="50%" @register="registerModal" @ok="ok" v-bind="$attrs" title="选择">
        <BasicTable @register="registerTable" :rowSelection="rowSelection">
        </BasicTable>
    </BasicModal>
</template>
<script lang="ts" setup>
import { BasicModal, useModalInner } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import { reactive, ref, UnwrapRef, watch, defineEmits } from 'vue';
import { BasicTable, BasicColumn } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { listNoCareTenant } from '../../../system/user/user.api';

const emit = defineEmits(['sumbitTable'])
const props = defineProps({
    data: Object,
})
const columns: BasicColumn[] = [
  {
    title: '用户姓名',
    dataIndex: 'realname',
  },
  {
    title: '部门',
    dataIndex: 'orgCodeTxt',
  },
  {
    title: '电话',
    dataIndex: 'phone',
  },
];
const { createMessage } = useMessage();
const [registerModal, { setModalProps, closeModal }] = useModalInner()
// 注册列表
const { prefixCls, tableContext } = useListPage({
  designScope: 'user-list',
  tableProps: {
    title: '用户列表',
    api: listNoCareTenant,
    columns: columns,
    showTableSetting: false,
    showActionColumn:false,
    size: 'small',
    rowKey: 'id',
    rowSelection: { type: 'radio' },
    useSearchForm:false,
    actionColumn: {
      width: 120,
    },
  },
});
const [registerTable, { reload, updateTableDataRecord }, { rowSelection, selectedRows, selectedRowKeys }] = tableContext;
async function ok(){
    console.log(rowSelection)
    emit('sumbitTable', rowSelection)
}
defineExpose({
    // save,
})

</script>
