feat:【antd】【member 会员】完成 index 和 form 的重构

This commit is contained in:
YunaiV
2025-10-07 14:18:48 +08:00
parent b9593c7a4a
commit a60c29169b
2 changed files with 100 additions and 58 deletions

View File

@@ -39,23 +39,11 @@ const [LevelFormModal, levelFormModalApi] = useVbenModal({
destroyOnClose: true,
});
/** 刷新表格数据 */
function onRefresh() {
/** 刷新表格 */
function handleRefresh() {
gridApi.query();
}
/** 设置选中 ID */
const checkedIds = ref<number[]>([]);
function setCheckedIds({ records }: { records: MemberUserApi.User[] }) {
checkedIds.value = records.map((item) => item.id!);
}
/** 发送优惠券 */
// TODO @xingyu这个功能没开发对是发送优惠劵哈
function handleSendCoupon() {
formModalApi.setData(null).open();
}
/** 编辑会员 */
function handleEdit(row: MemberUserApi.User) {
formModalApi.setData(row).open();
@@ -76,6 +64,21 @@ function handleUpdateBalance(row: MemberUserApi.User) {
balanceFormModalApi.setData(row).open();
}
/** 发送优惠券 */
// TODO @xingyu这个功能没开发对是发送优惠劵哈
function handleSendCoupon() {
formModalApi.setData(null).open();
}
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: MemberUserApi.User[];
}) {
checkedIds.value = records.map((item) => item.id!);
}
/** 查看会员详情 */
function handleViewDetail(row: MemberUserApi.User) {
router.push({
@@ -86,17 +89,12 @@ function handleViewDetail(row: MemberUserApi.User) {
});
}
// 表格实例
const [Grid, gridApi] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema(),
},
gridOptions: {
columns: useGridColumns(),
checkboxConfig: {
highlight: true,
labelField: 'checkbox',
},
height: 'auto',
keepSource: true,
proxyConfig: {
@@ -112,6 +110,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
rowConfig: {
keyField: 'id',
isHover: true,
},
toolbarConfig: {
refresh: true,
@@ -119,8 +118,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
} as VxeTableGridOptions<MemberUserApi.User>,
gridEvents: {
checkboxAll: setCheckedIds,
checkboxChange: setCheckedIds,
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
},
});
</script>
@@ -134,10 +133,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
/>
</template>
<FormModal @success="onRefresh" />
<PointFormModal @success="onRefresh" />
<BalanceFormModal @success="onRefresh" />
<LevelFormModal @success="onRefresh" />
<FormModal @success="handleRefresh" />
<PointFormModal @success="handleRefresh" />
<BalanceFormModal @success="handleRefresh" />
<LevelFormModal @success="handleRefresh" />
<Grid table-title="会员列表">
<template #toolbar-tools>
<TableAction