From fdd1d19c8edaa7b2a332315b9732f166a582aede Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Sat, 5 Oct 2024 22:20:00 +0800 Subject: [PATCH] feat: post --- apps/web-antd/src/views/system/post/data.ts | 4 +- apps/web-antd/src/views/system/post/index.vue | 49 +++++++++++++------ 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/apps/web-antd/src/views/system/post/data.ts b/apps/web-antd/src/views/system/post/data.ts index 8e8a9ce9..fd0702a6 100644 --- a/apps/web-antd/src/views/system/post/data.ts +++ b/apps/web-antd/src/views/system/post/data.ts @@ -74,8 +74,8 @@ export const drawerSchema: FormSchemaGetter = () => [ show: () => false, triggerFields: [''], }, - fieldName: 'id', - label: 'id', + fieldName: 'postId', + label: 'postId', }, { component: 'TreeSelect', diff --git a/apps/web-antd/src/views/system/post/index.vue b/apps/web-antd/src/views/system/post/index.vue index daaab270..3dc1c821 100644 --- a/apps/web-antd/src/views/system/post/index.vue +++ b/apps/web-antd/src/views/system/post/index.vue @@ -16,21 +16,28 @@ import DeptTree from '#/views/system/user/dept-tree.vue'; import { columns, querySchema } from './data'; import postDrawer from './post-drawer.vue'; -const formOptions: VbenFormProps = { - schema: querySchema(), - wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4', -}; - // 左边部门用 const selectDeptId = ref([]); +const formOptions: VbenFormProps = { + commonConfig: { + labelWidth: 80, + }, + schema: querySchema(), + wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4', + handleReset: async () => { + selectDeptId.value = []; + // eslint-disable-next-line no-use-before-define + await tableApi.query(); + }, +}; + const gridOptions: VxeGridProps = { checkboxConfig: { // 高亮 highlight: true, // 翻页时保留选中状态 reserve: true, - // 点击行选中 - // trigger: 'row', + trigger: 'cell', }, columns, height: 'auto', @@ -78,7 +85,20 @@ const gridOptions: VxeGridProps = { showOverflow: true, }; -const [BasicTable, tableApi] = useVbenVxeGrid({ formOptions, gridOptions }); +const checked = ref(false); +const [BasicTable, tableApi] = useVbenVxeGrid({ + formOptions, + gridOptions, + gridEvents: { + checkboxChange: (e: any) => { + checked.value = e.records.length > 0; + }, + checkboxAll: (e: any) => { + checked.value = e.records.length > 0; + }, + }, +}); + const [PostDrawer, drawerApi] = useVbenDrawer({ connectedComponent: postDrawer, }); @@ -95,7 +115,7 @@ async function handleEdit(record: Recordable) { async function handleDelete(row: Recordable) { await postRemove(row.postId); - await tableApi.reload(); + await tableApi.query(); } function handleMultiDelete() { @@ -119,9 +139,9 @@ function handleMultiDelete() { v-model:select-dept-id="selectDeptId" :height="300" class="w-[260px]" - @select="() => tableApi.reload()" + @select="() => tableApi.query()" /> - + @@ -134,9 +154,10 @@ function handleMultiDelete() { {{ $t('pages.common.export') }} {{ $t('pages.common.delete') }} @@ -169,7 +190,7 @@ function handleMultiDelete() { danger size="small" type="link" - v-access:code="['system:post:delete']" + v-access:code="['system:post:remove']" @click.stop="" > {{ $t('pages.common.delete') }} @@ -178,6 +199,6 @@ function handleMultiDelete() { - +