From 78dfa759ed8ba2f7192ce726a2452eb1b9849a51 Mon Sep 17 00:00:00 2001 From: GGJ <357021191@qq.com> Date: Thu, 1 Aug 2024 13:58:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E4=BC=A0=E5=85=A5?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/request.ts | 8 +++++--- src/utils/tableStore.ts | 5 ++++- .../supervise/terminal/components/substationLedger.vue | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/utils/request.ts b/src/utils/request.ts index 50796dbe..77009f4b 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -227,14 +227,16 @@ function getPendingKey(config: AxiosRequestConfig) { /** * 根据请求方法组装请求数据/参数 */ -export function requestPayload(method: Method, data: anyObj) { +export function requestPayload(method: Method, data: anyObj, paramsPOST: boolean) { if (method == 'GET') { return { params: data } } else if (method == 'POST') { - return { - data: data + if (paramsPOST) { + return { params: data } + } else { + return { data: data } } } } diff --git a/src/utils/tableStore.ts b/src/utils/tableStore.ts index 6daa4250..8837fff7 100644 --- a/src/utils/tableStore.ts +++ b/src/utils/tableStore.ts @@ -12,6 +12,7 @@ interface TableStoreParams { method?: Method isWebPaging?: boolean // 是否前端分页 showPage?: boolean + paramsPOST?: boolean publicHeight?: number resetCallback?: () => void loadCallback?: () => void @@ -24,6 +25,7 @@ export default class TableStore { public method: Method public initData: any = null public isWebPaging = false + public paramsPOST = true public showPage = true public table: CnTable = reactive({ ref: null, @@ -47,6 +49,7 @@ export default class TableStore { constructor(public options: TableStoreParams) { this.url = options.url this.pk = options.pk || 'id' + this.paramsPOST = options.paramsPOST || false this.isWebPaging = options.isWebPaging || false this.method = options.method || 'GET' this.table.column = options.column @@ -73,7 +76,7 @@ export default class TableStore { url: this.url, method: this.method }, - requestPayload(this.method, this.table.params) + requestPayload(this.method, this.table.params, this.paramsPOST) ) ).then((res: any) => { if (res.data) { diff --git a/src/views/pqs/supervise/terminal/components/substationLedger.vue b/src/views/pqs/supervise/terminal/components/substationLedger.vue index 7c14e259..0d311fb4 100644 --- a/src/views/pqs/supervise/terminal/components/substationLedger.vue +++ b/src/views/pqs/supervise/terminal/components/substationLedger.vue @@ -31,6 +31,7 @@ const tableStore = new TableStore({ publicHeight: 65, method: 'POST', isWebPaging: true, + paramsPOST: true, column: [ { field: 'substationName', title: '变电站名称', minWidth: 100 }, {