pay-admin/src/pages/company/components/PropertyBrands.tsx

81 lines
2.2 KiB
TypeScript
Raw Normal View History

2025-09-08 17:22:58 +08:00
import {
MyBetaModalFormProps,
MyButtons,
MyColumns,
MyProTableProps,
} from '@/common';
import { Apis } from '@/gen/Apis';
import { ProTable } from '@ant-design/pro-components';
import { Image, Space } from 'antd';
import PropertyBrandsCreate from './modals/PropertyBrandsCreate';
import PropertyBrandUpdate from './modals/PropertyBrandUpdate';
export default function PropertyBrands(props: MyBetaModalFormProps) {
return (
<>
<ProTable
{...MyProTableProps.props}
request={async (params, sort) =>
MyProTableProps.request(
{ ...params, companies_id: props?.item?.id },
sort,
Apis.Company.CompanyPropertyBrands.List,
)
}
toolBarRender={(action) => [
<PropertyBrandsCreate
key="Create"
reload={action?.reload}
item={props?.item}
title="品牌"
/>,
]}
// search={false}
// options={false}
columns={[
MyColumns.ID(),
{
title: '物业名称',
dataIndex: 'name',
},
{
title: 'logo',
render: (_, item) => {
return (
<Space>
{item?.logo?.[0] && (
<Image
height={30}
src={item?.logo[0]?.url}
placeholder="正面"
/>
)}
</Space>
);
},
},
MyColumns.Option({
render: (_, item: any, index, action) => (
<Space key={index}>
<PropertyBrandUpdate
item={{ ...item, companies_id: props?.item?.id }}
reload={action?.reload}
title="品牌"
/>
<MyButtons.Delete
onConfirm={() =>
Apis.Company.CompanyPropertyBrands.Delete({
id: item.id,
}).then(() => action?.reload())
}
/>
</Space>
),
}),
]}
/>
</>
);
}