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 @@