feat:【antd】【crm】客户限制配置的重构与修复部分缺陷
This commit is contained in:
@@ -21,16 +21,25 @@ import Form from './modules/form.vue';
|
||||
|
||||
const configType = ref(LimitConfType.CUSTOMER_QUANTITY_LIMIT);
|
||||
|
||||
/** 刷新表格 */
|
||||
function onRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: Form,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
/** 刷新表格 */
|
||||
function handleRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 处理配置类型的切换 */
|
||||
function handleChangeConfigType(key: number | string) {
|
||||
configType.value = key as LimitConfType;
|
||||
gridApi.setGridOptions({
|
||||
columns: useGridColumns(configType.value),
|
||||
});
|
||||
handleRefresh();
|
||||
}
|
||||
|
||||
/** 创建规则 */
|
||||
function handleCreate(type: LimitConfType) {
|
||||
formModalApi.setData({ type }).open();
|
||||
@@ -54,10 +63,8 @@ async function handleDelete(
|
||||
});
|
||||
try {
|
||||
await deleteCustomerLimitConfig(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
|
||||
});
|
||||
onRefresh();
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||
handleRefresh();
|
||||
} finally {
|
||||
hideLoading();
|
||||
}
|
||||
@@ -82,6 +89,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
@@ -89,14 +97,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
},
|
||||
} as VxeTableGridOptions<CrmCustomerLimitConfigApi.CustomerLimitConfig>,
|
||||
});
|
||||
|
||||
function onChangeConfigType(key: number | string) {
|
||||
configType.value = key as LimitConfType;
|
||||
gridApi.setGridOptions({
|
||||
columns: useGridColumns(configType.value),
|
||||
});
|
||||
onRefresh();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -112,10 +112,10 @@ function onChangeConfigType(key: number | string) {
|
||||
/>
|
||||
</template>
|
||||
|
||||
<FormModal />
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid>
|
||||
<template #top>
|
||||
<Tabs class="border-none" @change="onChangeConfigType">
|
||||
<Tabs class="-mt-11" @change="handleChangeConfigType">
|
||||
<Tabs.TabPane
|
||||
tab="拥有客户数限制"
|
||||
:key="LimitConfType.CUSTOMER_QUANTITY_LIMIT"
|
||||
@@ -166,3 +166,8 @@ function onChangeConfigType(key: number | string) {
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
<style scoped>
|
||||
:deep(.vxe-toolbar div) {
|
||||
z-index: 1;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user