From 4c87eaa302c30610882821ea7330ca3728f55a64 Mon Sep 17 00:00:00 2001 From: user Date: Sun, 23 Mar 2025 23:38:41 +0800 Subject: [PATCH] =?UTF-8?q?feat(stock):=20=E4=B8=BA=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=A0=8F=E6=B7=BB=E5=8A=A0=E5=88=B7=E6=96=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=B9=B6=E4=BC=98=E5=8C=96=E7=B1=BB=E5=9E=8B=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为 `vxe-toolbar` 添加了刷新功能,通过 `queryMethod` 方法实现数据同步。同时优化了 `toolbarRef` 和 `tableRef` 的类型定义,移除了未使用的 `toolClickEvent` 方法。 --- .../app/entities/stock/stock.component.ts | 22 +++++++------------ src/main/webapp/app/entities/stock/stock.vue | 2 +- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/main/webapp/app/entities/stock/stock.component.ts b/src/main/webapp/app/entities/stock/stock.component.ts index f78b6aa..50eeb9c 100644 --- a/src/main/webapp/app/entities/stock/stock.component.ts +++ b/src/main/webapp/app/entities/stock/stock.component.ts @@ -4,7 +4,7 @@ import { useRouter } from 'vue-router'; import { useAlertService } from '@/shared/alert/alert.service'; import buildPaginationQuery from '@/shared/sort/sorts'; import axios from 'axios'; -import type { VxePagerEvents } from 'vxe-table'; +import type { VxeToolbarInstance, VxeTableInstance, VxePagerEvents } from 'vxe-table'; export default defineComponent({ compatConfig: { MODE: 3 }, @@ -13,8 +13,8 @@ export default defineComponent({ const { t: $t } = useI18n(); const alertService = useAlertService(); const router = useRouter(); - const tableRef = ref(null); - const toolbarRef = ref(null); + const toolbarRef = ref(); + const tableRef = ref(); const isFetching = ref(false); const stocks = ref([]); @@ -31,13 +31,6 @@ export default defineComponent({ pageSize: 10, }); - const toolClickEvent: VxeToolbarEvents.ButtonClick = ({ code }) => { - VxeUI.modal.message({ - content: `点击了 ${code}`, - status: 'success', - }); - }; - // 过滤参数 const filterParams = ref({ number: { op: '=', value: null }, @@ -174,12 +167,9 @@ export default defineComponent({ watch([tableRef, toolbarRef], ([table, toolbar]) => { if (table && toolbar) { table.connect(toolbar); - console.log('Table and Toolbar connected successfully!'); } }); - handleSyncList(); - const prepareDelete = row => { removeRow.value = { ...row }; if (deleteDialog.value) deleteDialog.value.show(); @@ -203,6 +193,10 @@ export default defineComponent({ handleSyncList(); }; + const queryMethod = () => { + handleSyncList(); + }; + handleSyncList(); return { @@ -224,9 +218,9 @@ export default defineComponent({ statusDicts, tableRef, toolbarRef, - toolClickEvent, pageChange, clearInput, + queryMethod, }; }, }); diff --git a/src/main/webapp/app/entities/stock/stock.vue b/src/main/webapp/app/entities/stock/stock.vue index 1b30fb5..7f95655 100644 --- a/src/main/webapp/app/entities/stock/stock.vue +++ b/src/main/webapp/app/entities/stock/stock.vue @@ -1,6 +1,6 @@