Commit f505b9cb by 李伟康

refactor(SplitPaymentTable): 优化表格组件数据处理逻辑

- 移除不必要的 trafficParty 属性定义
- 调整 tableRows 方法中的变量解构顺序
- 删除冗余的 trafficParty 遍历逻辑
- 使用 componentData 替代 trafficParty 进行数据筛选
- 简化 hasService2 判断条件的实现方式
1 parent 5c526ab2
...@@ -34,7 +34,6 @@ export default { ...@@ -34,7 +34,6 @@ export default {
}, },
shelfType: Number, shelfType: Number,
currentTrafficParty: Object, currentTrafficParty: Object,
trafficParty: Array,
parentName: String, parentName: String,
}, },
data() { data() {
...@@ -86,10 +85,9 @@ export default { ...@@ -86,10 +85,9 @@ export default {
tableRows() { tableRows() {
const rows = [], const rows = [],
{ currentTrafficParty, shelfType, nameMap, trafficParty ,parentName} = this { currentTrafficParty, shelfType, nameMap ,parentName , componentData} = this
// 固定的业务对象类型(平台方、服务商、4s店) // 固定的业务对象类型(平台方、服务商、4s店)
const fixedMerchantTypes = [1, 2, 3] const fixedMerchantTypes = [1, 2, 3]
let hasService2 = trafficParty.every(item => item.serviceMerchant2fId !== null && item.serviceMerchant2fId !== undefined)
// 添加固定的三行 // 添加固定的三行
fixedMerchantTypes.forEach(type => { fixedMerchantTypes.forEach(type => {
let merchantTypeName = this.merchantTypeMap[type] || '' let merchantTypeName = this.merchantTypeMap[type] || ''
...@@ -103,7 +101,7 @@ export default { ...@@ -103,7 +101,7 @@ export default {
rows.push(row) rows.push(row)
}) })
let hasService2 = componentData.some(item => item.targetMerchantType == 5)
if (hasService2) { if (hasService2) {
let service2Name = this.merchantTypeMap[5] || '' let service2Name = this.merchantTypeMap[5] || ''
if (shelfType == 1) { if (shelfType == 1) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!