From a605cbe83aee47c5c2cadda95fbd7960a1157805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=B2=E4=B9=88=E4=BA=86?= Date: Fri, 29 Dec 2023 13:23:11 +0800 Subject: [PATCH] rsetcallback --- src/components/form/area/index.vue | 2 +- src/utils/tableStore.ts | 11 ++++- .../sags/operationsManagement/index.vue | 44 ++++++++++++++----- types/table.d.ts | 2 + 4 files changed, 45 insertions(+), 14 deletions(-) diff --git a/src/components/form/area/index.vue b/src/components/form/area/index.vue index b747c2d..b227610 100644 --- a/src/components/form/area/index.vue +++ b/src/components/form/area/index.vue @@ -14,7 +14,7 @@ const cascaderProps = { label: 'name', value: 'id', checkStrictly: true, - showAllLevels: false + emitPath: false } const dictData = useDictData() const options = dictData.state.area diff --git a/src/utils/tableStore.ts b/src/utils/tableStore.ts index 0af14bb..45e839c 100644 --- a/src/utils/tableStore.ts +++ b/src/utils/tableStore.ts @@ -9,7 +9,9 @@ interface TableStoreParams { column: TableColumn[] params?: anyObj method?: Method - isWebPaging?: boolean // 是否前端分页 + isWebPaging?: boolean // 是否前端分页 + resetCallback?: () => void + loadCallback?: () => void } export default class TableStore { @@ -29,7 +31,9 @@ export default class TableStore { pageSize: 20 }, loading: true, - column: [] + column: [], + loadCallback: null, + resetCallback: null }) constructor(public options: TableStoreParams) { @@ -38,6 +42,7 @@ export default class TableStore { this.isWebPaging = options.isWebPaging || false this.method = options.method || 'GET' this.table.column = options.column + this.table.resetCallback = options.resetCallback || null Object.assign(this.table.params, options.params) } @@ -61,6 +66,7 @@ export default class TableStore { this.table.webPagingData = window.XEUtils.chunk(this.table.data, this.table.params.pageSize) this.table.data = this.table.webPagingData[this.table.params.pageNum - 1] } + this.table.loadCallback && this.table.loadCallback() this.table.loading = false }) } @@ -85,6 +91,7 @@ export default class TableStore { delete this.initData.pageSize Object.assign(this.table.params, this.initData) this.index() + this.table.resetCallback && this.table.resetCallback() } ], [ diff --git a/src/views/voltage/sags/operationsManagement/index.vue b/src/views/voltage/sags/operationsManagement/index.vue index 6d90b52..4743290 100644 --- a/src/views/voltage/sags/operationsManagement/index.vue +++ b/src/views/voltage/sags/operationsManagement/index.vue @@ -6,24 +6,20 @@ - + - + - + - + @@ -41,7 +38,7 @@ diff --git a/types/table.d.ts b/types/table.d.ts index 7de31df..331044b 100644 --- a/types/table.d.ts +++ b/types/table.d.ts @@ -23,6 +23,8 @@ declare global { pageSize: number [key: string]: any } + loadCallback: () => void | null + resetCallback: () => void | null } /* 表格行 */