style,feat,fix: 多处业务与样式优化
1. 调整供应商名称样式提升可读性 2. 简化接口id路径匹配规则 3. 修复数据源配置换行格式 4. 新增物料基础信息与性能参数展示 5. 优化报价对比布局与加载逻辑
This commit is contained in:
@@ -65,6 +65,10 @@
|
||||
<!-- 基础信息区 -->
|
||||
<div class="mat-basic-body">
|
||||
<div class="basic-info-grid">
|
||||
<div class="basic-info-item">
|
||||
<span class="basic-label">物料编码</span>
|
||||
<span class="basic-value">{{ mat.materialCode || '—' }}</span>
|
||||
</div>
|
||||
<div class="basic-info-item">
|
||||
<span class="basic-label">规格型号</span>
|
||||
<span class="basic-value">{{ mat.spec || '—' }}</span>
|
||||
@@ -81,6 +85,30 @@
|
||||
<span class="basic-label">单位</span>
|
||||
<span class="basic-value">{{ mat.unit || '—' }}</span>
|
||||
</div>
|
||||
<div class="basic-info-item">
|
||||
<span class="basic-label">所属分类</span>
|
||||
<span class="basic-value">{{ mat.categoryName || '—' }}</span>
|
||||
</div>
|
||||
<div class="basic-info-item">
|
||||
<span class="basic-label">用途</span>
|
||||
<span class="basic-value">{{ mat.purpose || '—' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 性能参数 -->
|
||||
<div v-if="mat.performanceParams" class="perf-params-section">
|
||||
<div class="section-divider">
|
||||
<span class="divider-line"></span>
|
||||
<span class="divider-text"><i class="el-icon-setting"></i> 性能参数</span>
|
||||
<span class="divider-line"></span>
|
||||
</div>
|
||||
<div class="perf-params-grid">
|
||||
<div v-for="(p, pIdx) in parsePerfParams(mat.performanceParams)" :key="pIdx" class="perf-item">
|
||||
<span class="perf-name">{{ p.name }}</span>
|
||||
<span class="perf-value">{{ p.value }}</span>
|
||||
<span class="perf-unit" v-if="p.unit">{{ p.unit }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -212,11 +240,9 @@ export default {
|
||||
async initLoad() {
|
||||
this.loadError = null;
|
||||
await this.loadSameNameMaterials();
|
||||
const allIds = this.sameNameMaterials.map(m => m.materialId);
|
||||
this._loadingLock = true;
|
||||
await this.loadQuoteComparison(allIds);
|
||||
this.targetIds = allIds;
|
||||
this._loadingLock = false;
|
||||
// 仅加载当前物料的报价数据,不自动选择其他物料进行对比
|
||||
await this.loadQuoteComparison([]);
|
||||
this.targetIds = [];
|
||||
},
|
||||
|
||||
async loadSameNameMaterials() {
|
||||
@@ -235,11 +261,8 @@ export default {
|
||||
async handleSelectionChange(selectedIds) {
|
||||
if (this._loadingLock) return;
|
||||
this.loadError = null;
|
||||
if (selectedIds.length) {
|
||||
await this.loadQuoteComparison(selectedIds);
|
||||
} else {
|
||||
this.quoteMap = {};
|
||||
}
|
||||
// 无论是否还有选中物料,都重新加载(空数组时仅加载当前物料报价)
|
||||
await this.loadQuoteComparison(selectedIds || []);
|
||||
},
|
||||
|
||||
async loadQuoteComparison(materialIds) {
|
||||
@@ -284,6 +307,14 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
parsePerfParams(jsonStr) {
|
||||
if (!jsonStr) return [];
|
||||
try {
|
||||
const parsed = JSON.parse(jsonStr);
|
||||
return Array.isArray(parsed) ? parsed : [];
|
||||
} catch { return []; }
|
||||
},
|
||||
|
||||
formatDate(val) {
|
||||
if (!val) return '—';
|
||||
const d = new Date(val);
|
||||
@@ -441,7 +472,7 @@ export default {
|
||||
/* ========== 卡片网格 ========== */
|
||||
.quote-comparison-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
|
||||
grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
@@ -492,7 +523,7 @@ export default {
|
||||
}
|
||||
.basic-info-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
gap: 8px 20px;
|
||||
}
|
||||
.basic-info-item {
|
||||
@@ -690,6 +721,37 @@ export default {
|
||||
}
|
||||
.quote-empty i { font-size: 32px; }
|
||||
|
||||
/* ========== 性能参数 ========== */
|
||||
.perf-params-section {
|
||||
padding: 0 8px 8px;
|
||||
}
|
||||
.perf-params-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
padding: 8px 10px;
|
||||
}
|
||||
.perf-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
background: #f5f7fa;
|
||||
padding: 4px 10px;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.perf-name {
|
||||
color: #909399;
|
||||
}
|
||||
.perf-value {
|
||||
color: #303133;
|
||||
font-weight: 600;
|
||||
}
|
||||
.perf-unit {
|
||||
color: #909399;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
/* ========== 响应式适配 ========== */
|
||||
@media screen and (max-width: 1200px) {
|
||||
.quote-comparison-grid {
|
||||
|
||||
@@ -168,8 +168,8 @@ export default {
|
||||
}
|
||||
|
||||
.supplier-name {
|
||||
font-size: 8px;
|
||||
font-weight: 200;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
margin-bottom: 4px;
|
||||
line-height: 1.4;
|
||||
|
||||
Reference in New Issue
Block a user