From 72a88e1b6d1bcc33bfc7d95e68d0dd0080a4cedb Mon Sep 17 00:00:00 2001 From: Zheng Jie <201507802@qq.com> Date: Thu, 24 Nov 2022 15:31:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mixins/crud.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/mixins/crud.js b/src/mixins/crud.js index bb90342..22c1920 100644 --- a/src/mixins/crud.js +++ b/src/mixins/crud.js @@ -5,7 +5,7 @@ import { import { parseTime, downloadFile -} from '@/utils/index' +} from '@/utils' export default { data() { @@ -57,7 +57,7 @@ export default { return new Promise((resolve, reject) => { this.loading = true // 请求数据 - initData(this.url, this.getQueryParame()).then(data => { + initData(this.url, this.getQueryParams()).then(data => { this.total = data.totalElements this.data = data.content // time 毫秒后显示表格 @@ -74,7 +74,14 @@ export default { beforeInit() { return true }, - getQueryParame: function() { + getQueryParams: function() { + // 清除参数无值的情况 + Object.keys(this.query).length !== 0 && Object.keys(this.query).forEach(item => { + if (this.query[item] === null || this.query[item] === '') this.query[item] = undefined + }) + Object.keys(this.params).length !== 0 && Object.keys(this.params).forEach(item => { + if (this.params[item] === null || this.params[item] === '') this.params[item] = undefined + }) return { page: this.page, size: this.size,