fix(bid): 修复物料报价对比和租户ID设置问题
1. 为新增物料添加租户ID自动设置逻辑,优先取部门ID,默认值为1 2. 调整报价对比页面初始化加载逻辑,移除空判断限制并优化空数组处理 3. 为供应商报价明细查询添加空值过滤,提升数据准确性
This commit is contained in:
@@ -37,6 +37,12 @@ public class BizMaterialController extends BaseController {
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BizMaterial record) {
|
||||
record.setCreateBy(getUsername());
|
||||
// 设置租户ID:优先使用部门ID,否则使用默认值1
|
||||
Long tenantId = getDeptId();
|
||||
if (tenantId == null) {
|
||||
tenantId = 1L;
|
||||
}
|
||||
record.setTenantId(tenantId);
|
||||
return toAjax(service.insertBizMaterial(record));
|
||||
}
|
||||
|
||||
|
||||
@@ -180,6 +180,7 @@
|
||||
</select>
|
||||
|
||||
<!-- 根据物料ID列表获取各供应商的详细报价明细(用于对比展示) -->
|
||||
<!-- 只通过 rfq_item_id -> material_id 精确关联,确保数据准确性 -->
|
||||
<select id="selectSupplierQuoteComparison" resultType="java.util.Map">
|
||||
SELECT
|
||||
ri.material_id,
|
||||
@@ -200,6 +201,8 @@
|
||||
JOIN biz_rfq_item ri ON qi.rfq_item_id = ri.item_id
|
||||
WHERE ri.material_id IN
|
||||
<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
|
||||
</select>
|
||||
|
||||
|
||||
@@ -208,13 +208,11 @@ export default {
|
||||
async initLoad() {
|
||||
this.loadError = null;
|
||||
await this.loadSameNameMaterials();
|
||||
if (this.sameNameMaterials.length) {
|
||||
const allIds = this.sameNameMaterials.map(m => m.materialId);
|
||||
this._loadingLock = true;
|
||||
await this.loadQuoteComparison(allIds);
|
||||
this.targetIds = allIds;
|
||||
this._loadingLock = false;
|
||||
}
|
||||
const allIds = this.sameNameMaterials.map(m => m.materialId);
|
||||
this._loadingLock = true;
|
||||
await this.loadQuoteComparison(allIds);
|
||||
this.targetIds = allIds;
|
||||
this._loadingLock = false;
|
||||
},
|
||||
|
||||
async loadSameNameMaterials() {
|
||||
@@ -241,11 +239,10 @@ export default {
|
||||
},
|
||||
|
||||
async loadQuoteComparison(materialIds) {
|
||||
if (!materialIds || !materialIds.length) return;
|
||||
this.loadingQuote = true;
|
||||
this.loadError = null;
|
||||
try {
|
||||
const ids = [Number(this.materialId), ...materialIds];
|
||||
const ids = [Number(this.materialId), ...(materialIds || [])];
|
||||
const res = await getQuoteComparison(ids);
|
||||
const data = res.data || [];
|
||||
const map = {};
|
||||
|
||||
Reference in New Issue
Block a user