From facd9db84d1a868d548ae9d2bf6a18c8dd89efa8 Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Sun, 20 Sep 2026 09:50:27 +0800 Subject: [PATCH] =?UTF-8?q?2026-09-20=20=E5=BE=85=E6=8A=A5=E4=BB=B7?= =?UTF-8?q?=E6=B8=85=E5=8D=95=E8=B7=B3=E8=BD=AC=E9=94=80=E5=94=AE=E6=8A=A5?= =?UTF-8?q?=E4=BB=B7=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/quotation/toBeQuoted.vue | 6 ++- src/views/modules/quote/index.vue | 60 ++++++++++++++++++++-- 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/src/views/modules/quotation/toBeQuoted.vue b/src/views/modules/quotation/toBeQuoted.vue index 53b093b..35b27f2 100644 --- a/src/views/modules/quotation/toBeQuoted.vue +++ b/src/views/modules/quotation/toBeQuoted.vue @@ -643,7 +643,11 @@ export default { if (this.$router.resolve('quote-index').resolved.name === '404') { this.$alert('权限不足,访问失败', '警告', {confirmButtonText: '确定',}); } else { - this.$router.push({name:"quote-index",params:{ids:data.rows},}) + const ids = (Array.isArray(data.rows) ? data.rows : [data.rows]) + .map(id => Number(id)) + .filter(id => Number.isFinite(id) && id > 0) + sessionStorage.setItem('plm_quote_locate_ids', JSON.stringify(ids)) + this.$router.push({ name: 'quote-index' }) } }else { this.$message.error(data.msg); diff --git a/src/views/modules/quote/index.vue b/src/views/modules/quote/index.vue index d45a964..9be5515 100644 --- a/src/views/modules/quote/index.vue +++ b/src/views/modules/quote/index.vue @@ -724,6 +724,14 @@ export default { no: this.no, size: this.size, } + if (params.ids != null && params.ids !== '') { + params.ids = this.parseQuoteIds(params.ids) + if (!params.ids.length) { + delete params.ids + } + } else { + delete params.ids + } // 查询前先清空当前选中的报价,确保子组件能正确响应数据变化 this.currentQuote = {} this.searchLoading = true @@ -1318,8 +1326,13 @@ export default { } }, handleQueryByIds(){ + const ids = this.readQuoteLocateIds() + if (!ids.length) { + this.$message.warning('未查询到对应的报价单') + return + } let params = { - ids: pickRouteValue(this.$route, 'ids'), + ids, no:this.no, size:this.size, createBy:this.$store.state.user.name, @@ -1332,7 +1345,8 @@ export default { if (this.total > 0){ this.currentQuote = {...this.dataList[0]} // 跳转成功后清空路由参数,避免后续刷新时重复触发 - this.$router.replace({name: 'quote-index', params: {}}) + this.clearQuoteLocateIds() + this.$router.replace({name: 'quote-index'}) // 提示用户已定位到新建的报价单 this.$message.success(`已定位到新建的报价单:${this.dataList[0].quoteVersionNo || ''}`) }else { @@ -1348,6 +1362,45 @@ export default { this.searchLoading = false }) }, + parseQuoteIds(value) { + if (Array.isArray(value)) { + return value.map(id => Number(id)).filter(id => Number.isFinite(id) && id > 0) + } + if (value == null || String(value).trim() === '') { + return [] + } + const text = String(value).trim() + try { + const parsed = JSON.parse(text) + if (Array.isArray(parsed) || typeof parsed === 'number') { + return this.parseQuoteIds(parsed) + } + } catch (e) { + // 非 JSON 时按逗号分隔处理 + } + return text + .split(/[,\s]+/) + .map(id => Number(id)) + .filter(id => Number.isFinite(id) && id > 0) + }, + readQuoteLocateIds() { + let ids = [] + try { + const cached = sessionStorage.getItem('plm_quote_locate_ids') + if (cached) { + ids = this.parseQuoteIds(JSON.parse(cached)) + } + } catch (e) { + ids = [] + } + if (!ids.length) { + ids = this.parseQuoteIds(pickRouteValue(this.$route, 'ids')) + } + return ids + }, + clearQuoteLocateIds() { + sessionStorage.removeItem('plm_quote_locate_ids') + }, handleInquiryBlur(){ let params = { site:this.$store.state.user.site, @@ -1579,7 +1632,8 @@ export default { if (!this.isMenu) { return false } - const ids = pickRouteValue(this.$route, 'ids') + const locateIds = this.readQuoteLocateIds() + const ids = locateIds.length ? locateIds.join(',') : pickRouteValue(this.$route, 'ids') const quoteVersionNo = pickRouteValue(this.$route, ['quoteVersionNo', 'docNo']) const type = pickRouteValue(this.$route, 'type') const routeKey = [ids, quoteVersionNo, type].join('|')