From 89535b60593a37b7254548cb5327a27b528babe1 Mon Sep 17 00:00:00 2001 From: GGJ <357021191@qq.com> Date: Wed, 16 Oct 2024 10:49:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=85=A8=E5=B1=80=E5=8F=98?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/table/header/index.vue | 5 +- src/main.ts | 17 +++---- src/utils/tableStore.ts | 48 ++++++++++--------- .../embed/onlinerate/index.vue | 13 ++++- .../online/gaojingshujutongji/index.vue | 2 +- .../online/shishishuju/index.vue | 2 +- .../online/wentaishujufenxi/index.vue | 2 +- .../online/wentaizhibiaohegelv/index.vue | 2 +- .../online/wentaizonghepinggu/index.vue | 2 +- .../online/xiebopingpu/index.vue | 2 +- .../online/yunxingzhuangtai/index.vue | 2 +- 11 files changed, 57 insertions(+), 40 deletions(-) diff --git a/src/components/table/header/index.vue b/src/components/table/header/index.vue index 29df0322..df46dddc 100644 --- a/src/components/table/header/index.vue +++ b/src/components/table/header/index.vue @@ -23,9 +23,10 @@ - 查询 - 重置 + 查询 + 重置 + { - const app = createApp(App) //开启离线地图 @@ -43,8 +41,8 @@ const setupAll = async () => { // }); app.use(BaiduMap, { ak: 'Yp57V71dkOPiXjiN8VdcFRsVELzlVNKK', - v: '3.0', - }); + v: '3.0' + }) await setupI18n(app) app.use(router) @@ -55,7 +53,10 @@ const setupAll = async () => { registerIcons(app) // icons app.config.globalProperties.eventBus = mitt() - + // 配置全局变量 + app.config.globalProperties.$allVariables = reactive({ + butLoading: false + }) setupFormCreate(app) await router.isReady() diff --git a/src/utils/tableStore.ts b/src/utils/tableStore.ts index 31100aeb..e397f005 100644 --- a/src/utils/tableStore.ts +++ b/src/utils/tableStore.ts @@ -6,16 +6,16 @@ import { mainHeight } from '@/utils/layout' interface TableStoreParams { url: string // 请求地址 - pk?: string + pk?: string column: TableColumn[] - params?: anyObj - method?: Method // 请求方式 + params?: anyObj + method?: Method // 请求方式 isWebPaging?: boolean // 是否前端分页 showPage?: boolean //是否需要分页 paramsPOST?: boolean // post请求 params传参 publicHeight?: number //计算高度 resetCallback?: () => void // 重置 - loadCallback?: () => void // 接口调用后的回调 + loadCallback?: () => void // 接口调用后的回调 beforeSearchFun?: () => void // 接口调用前的回调 } @@ -78,24 +78,28 @@ export default class TableStore { }, requestPayload(this.method, this.table.params, this.paramsPOST) ) - ).then((res: any) => { - if (res.data) { - this.table.data = res.data.records || res.data - this.table.total = res.data?.total || res.data.length || 0 - } else { - this.table.data = [] - this.table.total = 0 - } - if (Array.isArray(res)) { - this.table.data = res - } - if (this.isWebPaging) { - 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 - }) + ) + .then((res: any) => { + if (res.data) { + this.table.data = res.data.records || res.data + this.table.total = res.data?.total || res.data.length || 0 + } else { + this.table.data = [] + this.table.total = 0 + } + if (Array.isArray(res)) { + this.table.data = res + } + if (this.isWebPaging) { + 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 + }) + .catch(() => { + this.table.loading = false + }) } /** diff --git a/src/views/pqs/harmonicMonitoring/embed/onlinerate/index.vue b/src/views/pqs/harmonicMonitoring/embed/onlinerate/index.vue index 866b11c7..0ed72662 100644 --- a/src/views/pqs/harmonicMonitoring/embed/onlinerate/index.vue +++ b/src/views/pqs/harmonicMonitoring/embed/onlinerate/index.vue @@ -1,5 +1,6 @@