feat: 添加字典重置功能

This commit is contained in:
dap
2026-04-30 14:39:22 +08:00
parent 45cb1aa48c
commit 8e8dae2f6c
4 changed files with 11 additions and 5 deletions

View File

@@ -128,9 +128,14 @@ onMounted(() => {
dictType.value = value;
await tableApi.query();
});
emitter.on('reset', async () => {
dictType.value = '';
await tableApi.reload();
});
});
onBeforeUnmount(() => {
emitter.off('rowClick');
emitter.off('reset');
});
</script>

View File

@@ -1,13 +1,8 @@
<script setup lang="ts">
import { onUnmounted } from 'vue';
import { Page } from '@vben/common-ui';
import DictDataPanel from './data/index.vue';
import { emitter } from './mitt';
import DictTypePanel from './type/index.vue';
onUnmounted(() => emitter.off('rowClick'));
</script>
<template>

View File

@@ -4,6 +4,7 @@ import { mitt } from '@vben/utils';
* dictType: string
*/
type Events = {
reset: void;
rowClick: string;
};

View File

@@ -32,6 +32,11 @@ const formOptions: VbenFormProps = {
},
schema: querySchema(),
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3',
handleReset: () => {
tableApi.formApi.resetForm();
tableApi.reload();
emitter.emit('reset');
},
};
const gridOptions: VxeGridProps = {