mirror of
https://github.com/imdap/ruoyi-plus-vben5.git
synced 2026-05-05 09:01:25 +08:00
feat: 添加字典重置功能
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { mitt } from '@vben/utils';
|
||||
* dictType: string
|
||||
*/
|
||||
type Events = {
|
||||
reset: void;
|
||||
rowClick: string;
|
||||
};
|
||||
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user