index.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <script lang="ts" setup>
  2. import { Page } from '@vben/common-ui';
  3. import { Button, message, Modal } from 'ant-design-vue';
  4. import { useVbenVxeGrid } from '#/adapter';
  5. import { LogApi } from '#/api';
  6. import { gridOperateOptions, searchFormOptions } from '../data.config';
  7. const [Grid, { reload }] = useVbenVxeGrid({
  8. formOptions: searchFormOptions,
  9. gridOptions: gridOperateOptions,
  10. });
  11. const handelClear = () => {
  12. Modal.confirm({
  13. iconType: 'info',
  14. title: '删除提示',
  15. content: `确定要清空日志记录吗?`,
  16. cancelText: `关闭`,
  17. onOk: async () => {
  18. await LogApi.clearLog('logOperate');
  19. message.success('数据删除成功');
  20. reload();
  21. },
  22. });
  23. };
  24. </script>
  25. <template>
  26. <Page auto-content-height>
  27. <Grid>
  28. <template #toolbar-tools>
  29. <Button
  30. class="mr-2"
  31. type="primary"
  32. v-access:code="'logOperate:clear'"
  33. @click="() => handelClear()"
  34. >
  35. 清空日志
  36. </Button>
  37. </template>
  38. </Grid>
  39. </Page>
  40. </template>