From 3aa5d5ec8f08d2f3ac2e238ba7eea5399f12d19a Mon Sep 17 00:00:00 2001 From: yaojn Date: Thu, 20 Mar 2025 11:09:35 +0800 Subject: [PATCH] =?UTF-8?q?-=20[=E5=8A=9F=E8=83=BD]=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E5=80=BC=E7=9A=84=E5=9B=9E=E6=98=BE=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E9=80=9A=E8=BF=87URL=E5=9C=B0=E5=9D=80=E6=9D=A5?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE=E5=AE=9E=E7=8E=B0=E3=80=82?= =?UTF-8?q?=20=20=20=20-=20[=E5=85=B3=E8=81=94]#[1381000238563328]?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E6=9D=A1=E4=BB=B6=E5=80=BC=E7=9A=84=E5=9B=9E?= =?UTF-8?q?=E6=98=BE=E5=8A=9F=E8=83=BD=E9=80=9A=E8=BF=87URL=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E6=9D=A5=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E3=80=82=20http://192.168.0.96:8090/demo/rdm.html#/st?= =?UTF-8?q?ory-detail/939050947543040/939050947543042/1381000238563328?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/pages/report/report/report-show.vue | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/src/views/pages/report/report/report-show.vue b/src/views/pages/report/report/report-show.vue index 2a8ce7e2..c143e5d7 100644 --- a/src/views/pages/report/report/report-show.vue +++ b/src/views/pages/report/report/report-show.vue @@ -200,20 +200,33 @@ export default { this.loadingShow = false; }); }, - getReportById: function() { - if (this.id) { - this.$api.report.report.getReportById(this.id).then(res => { - let d = res.Return; - if (d && d.paramList && d.paramList.length > 0) { - d.paramList.forEach(element => { - if (element.config && element.config.defaultValue) { - this.searchParam[element.name] = element.config.defaultValue; - } - }); - } - this.reportData = d; - }); + getReportById() { + if (!this.id) { + return false; } + let query = this.$route.query || {}; + let queryKeyList = Object.keys(query); + this.$api.report.report.getReportById(this.id).then(res => { + let d = res.Return; + if (d && d.paramList && d.paramList.length > 0) { + d.paramList.forEach(element => { + if (element.config && element.config.defaultValue) { + this.searchParam[element.name] = element.config.defaultValue; + } else { + if (element.name && queryKeyList.includes(element.name)) { + // 处理从地址栏传递过来的参数,并设置默认值 + this.searchParam[element.name] = query[element.name]; + if (element.hasOwnProperty('config')) { + element.config.defaultValue = query[element.name]; + } else { + element.config = { defaultValue: query[element.name] }; + } + } + } + }); + } + this.reportData = d; + }); }, setParam: function(paramName, paramValue) { let obj = {}; -- Gitee