fix(bid): 修复物料报价对比和租户ID设置问题

1. 为新增物料添加租户ID自动设置逻辑,优先取部门ID,默认值为1
2. 调整报价对比页面初始化加载逻辑,移除空判断限制并优化空数组处理
3. 为供应商报价明细查询添加空值过滤,提升数据准确性
This commit is contained in:
2026-05-29 11:06:11 +08:00
parent e521b0dfeb
commit c871f184d8
3 changed files with 15 additions and 9 deletions

View File

@@ -37,6 +37,12 @@ public class BizMaterialController extends BaseController {
@PostMapping @PostMapping
public AjaxResult add(@RequestBody BizMaterial record) { public AjaxResult add(@RequestBody BizMaterial record) {
record.setCreateBy(getUsername()); record.setCreateBy(getUsername());
// 设置租户ID优先使用部门ID否则使用默认值1
Long tenantId = getDeptId();
if (tenantId == null) {
tenantId = 1L;
}
record.setTenantId(tenantId);
return toAjax(service.insertBizMaterial(record)); return toAjax(service.insertBizMaterial(record));
} }

View File

@@ -180,6 +180,7 @@
</select> </select>
<!-- 根据物料ID列表获取各供应商的详细报价明细用于对比展示 --> <!-- 根据物料ID列表获取各供应商的详细报价明细用于对比展示 -->
<!-- 只通过 rfq_item_id -> material_id 精确关联,确保数据准确性 -->
<select id="selectSupplierQuoteComparison" resultType="java.util.Map"> <select id="selectSupplierQuoteComparison" resultType="java.util.Map">
SELECT SELECT
ri.material_id, ri.material_id,
@@ -200,6 +201,8 @@
JOIN biz_rfq_item ri ON qi.rfq_item_id = ri.item_id JOIN biz_rfq_item ri ON qi.rfq_item_id = ri.item_id
WHERE ri.material_id IN WHERE ri.material_id IN
<foreach collection="list" item="id" open="(" separator="," close=")">#{id}</foreach> <foreach collection="list" item="id" open="(" separator="," close=")">#{id}</foreach>
AND qi.unit_price IS NOT NULL
AND qi.rfq_item_id IS NOT NULL
ORDER BY ri.material_id, qi.unit_price ASC, q.submit_time DESC ORDER BY ri.material_id, qi.unit_price ASC, q.submit_time DESC
</select> </select>

View File

@@ -208,13 +208,11 @@ export default {
async initLoad() { async initLoad() {
this.loadError = null; this.loadError = null;
await this.loadSameNameMaterials(); await this.loadSameNameMaterials();
if (this.sameNameMaterials.length) {
const allIds = this.sameNameMaterials.map(m => m.materialId); const allIds = this.sameNameMaterials.map(m => m.materialId);
this._loadingLock = true; this._loadingLock = true;
await this.loadQuoteComparison(allIds); await this.loadQuoteComparison(allIds);
this.targetIds = allIds; this.targetIds = allIds;
this._loadingLock = false; this._loadingLock = false;
}
}, },
async loadSameNameMaterials() { async loadSameNameMaterials() {
@@ -241,11 +239,10 @@ export default {
}, },
async loadQuoteComparison(materialIds) { async loadQuoteComparison(materialIds) {
if (!materialIds || !materialIds.length) return;
this.loadingQuote = true; this.loadingQuote = true;
this.loadError = null; this.loadError = null;
try { try {
const ids = [Number(this.materialId), ...materialIds]; const ids = [Number(this.materialId), ...(materialIds || [])];
const res = await getQuoteComparison(ids); const res = await getQuoteComparison(ids);
const data = res.data || []; const data = res.data || [];
const map = {}; const map = {};