From 80af6a97cec5fe4456d965c20ed60214a6ff4f89 Mon Sep 17 00:00:00 2001
From: fengyuan_yang <1976974459@qq.com>
Date: Fri, 27 Feb 2026 09:42:47 +0800
Subject: [PATCH] =?UTF-8?q?2026-02-27=20=E9=94=80=E5=94=AE=E6=8A=A5?=
=?UTF-8?q?=E4=BB=B7=E9=BB=98=E8=AE=A4=E6=8A=A5=E4=BB=B7=E8=A1=8C=E3=80=90?=
=?UTF-8?q?=E5=88=A0=E9=99=A4=E3=80=91=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../modules/quote/detail/quoteDetail.vue | 42 ++++++++++++++++++-
src/views/modules/quote/index.vue | 10 ++---
2 files changed, 45 insertions(+), 7 deletions(-)
diff --git a/src/views/modules/quote/detail/quoteDetail.vue b/src/views/modules/quote/detail/quoteDetail.vue
index 6b79767..3947dbd 100644
--- a/src/views/modules/quote/detail/quoteDetail.vue
+++ b/src/views/modules/quote/detail/quoteDetail.vue
@@ -7,6 +7,7 @@ import {
updateQuoteDetail,
updateQuoteDetailShowFlag
} from "../../../../api/quote/quoteDetail";
+import {queryQuoteGroupDetail} from "../../../../api/quote/quoteGroupDetail";
import {getProjectPartList} from "../../../../api/project/project";
import QuoteDetailCost from "./primary/quoteDetailCost.vue";
import QuoteDetailTool from "./primary/quoteDetailTool.vue";
@@ -763,6 +764,8 @@ export default {
againVisible:false,
againRow:{},
+ // 平铺视图(不传 quoteGroupDetail 时)内部维护的 quoteGroupDetailId → currentQuoteDetailItemNo 映射
+ internalDefaultItemNoMap: {},
}
},
methods:{
@@ -889,6 +892,9 @@ export default {
}
if (this.quoteGroupDetail){
params.quoteGroupDetailId=this.quoteGroupDetail.id;
+ } else {
+ // 平铺模式:同步加载各报价明细组的默认条目映射,用于删除保护
+ this.loadGroupDetailMap();
}
this.queryLoading = true;
queryQuoteDetail(params).then(({data})=>{
@@ -903,6 +909,28 @@ export default {
this.queryLoading = false;
})
},
+ // 平铺模式下加载 quoteGroupDetail 映射,用于判断哪些条目行是默认报价行(不允许删除)
+ loadGroupDetailMap() {
+ if (!this.quote.id) {
+ this.internalDefaultItemNoMap = {}
+ return
+ }
+ queryQuoteGroupDetail({ quoteId: this.quote.id }).then(({ data }) => {
+ if (data && data.code === 0 && data.rows) {
+ const map = {}
+ data.rows.forEach(group => {
+ if (group.currentQuoteDetailItemNo) {
+ map[group.id] = group.currentQuoteDetailItemNo
+ }
+ })
+ this.internalDefaultItemNoMap = map
+ } else {
+ this.internalDefaultItemNoMap = {}
+ }
+ }).catch(() => {
+ this.internalDefaultItemNoMap = {}
+ })
+ },
handleSaveQuoteDetailClick(){
this.$refs.saveQuoteDetailForm.validate((valid,obj) => {
if (valid){
@@ -1107,7 +1135,17 @@ export default {
this.quoteGroupDetail.currentQuoteDetailItemNo = row.itemNo;
// 直接触发emit事件
this.$emit('currentQuoteDetailItemNo', oldVal);
- }
+ },
+ // 判断某行是否为默认报价行(不允许删除)
+ // 单组视图(quoteGroupDetail 已传入):对比 quoteGroupDetail.currentQuoteDetailItemNo
+ // 平铺视图(quoteGroupDetail 未传):对比内部加载的 internalDefaultItemNoMap
+ isDefaultQuoteRow(row) {
+ if (this.quoteGroupDetail) {
+ return this.quoteGroupDetail.currentQuoteDetailItemNo === row.itemNo;
+ }
+ const defaultItemNo = this.internalDefaultItemNoMap[row.quoteGroupDetailId]
+ return defaultItemNo != null && defaultItemNo === row.itemNo;
+ },
},
watch:{
quote(newVal,oldVal){
@@ -1225,7 +1263,7 @@ export default {
编辑
- 删除
+ 删除
diff --git a/src/views/modules/quote/index.vue b/src/views/modules/quote/index.vue
index 5d93da6..b24c543 100644
--- a/src/views/modules/quote/index.vue
+++ b/src/views/modules/quote/index.vue
@@ -624,7 +624,7 @@ export default {
// 这会导致:如果有20条报价,就会执行1+20=21次数据库查询
// 解决方案:如果需要显示明细,应该在SQL中一次性JOIN查询,而不是循环查询
// this.loadQuoteDetailInfo()
-
+
if (this.dataList[0] !== undefined) {
this.handleSelect(this.dataList[0])
} else {
@@ -1472,8 +1472,8 @@ export default {
if (this.$route.params.ids){
this.handleQueryByIds();
return // 直接返回,避免执行其他逻辑
- }
-
+ }
+
// 从OA系统跳转过来
if (this.$route.params.type === 'tokenLogin') {
if (this.$route.params.docNo) {
@@ -1485,8 +1485,8 @@ export default {
}
this.handleSearch(0);
return
- }
-
+ }
+
// 从项目页面跳转过来
if (this.$route.params.type === 'project'){
this.quoteForm = {