import { MyBetaModalFormProps, MyColumns, MyProTableProps } from '@/common';
import { Apis } from '@/gen/Apis';
import { ProTable } from '@ant-design/pro-components';
import OrganizationsCreate from '../modals/OrganizationsCreate';

export default function Organizations(props: MyBetaModalFormProps) {
  return (
    <>
      <ProTable
        {...MyProTableProps.props}
        search={false}
        request={async (params, sort) =>
          MyProTableProps.request(
            { ...params, companies_id: props?.item?.id },
            sort,
            Apis.Company.Organizations.List,
          )
        }
        toolBarRender={(action) => [
          <OrganizationsCreate
            key="Create"
            reload={action?.reload}
            title="组织"
          />,
        ]}
        options={false}
        columns={[
          MyColumns.ID(),
          {
            title: '楼栋',
            width: '250px',
            dataIndex: 'name',
          },
        ]}
      />
    </>
  );
}
