Commit 70efb558 by Lin

refactor(DetailFiles): 重构客户信息显示逻辑

- 新增 displayInfo 计算属性以优化客户信息的获取和处理。
- 将 displayInfo 相关的状态重命名为 headerSnapshot,提升代码可读性。
- 简化 goodsSubOrderList 计算属性的逻辑,确保数据处理的准确性。
1 parent 7ff40264
......@@ -324,6 +324,14 @@ export default {
name: 'DetailFiles',
components: { CarBrands, ReceptionSence, Employee },
computed: {
displayInfo () {
const info = this.headerSnapshot || {}
return {
customerName: info.customerName || '',
customerStatus: info.customerStatus,
goodsSubOrderDTOS: Array.isArray(info.goodsSubOrderDTOS) ? info.goodsSubOrderDTOS : []
}
},
customerSurname () {
const name = this.displayInfo.customerName || ''
return name ? name.charAt(0) : ''
......@@ -333,9 +341,7 @@ export default {
return [customerInfo.packageName, customerInfo.activityName].filter(Boolean)
},
goodsSubOrderList () {
const list = this.displayInfo.goodsSubOrderDTOS
if (!Array.isArray(list)) return []
return list.filter(item => item)
return this.displayInfo.goodsSubOrderDTOS.filter(item => item)
},
upgradeStatusInfo () {
const { customerInfo } = this
......@@ -365,7 +371,7 @@ export default {
optionalForm: [],
groupForm: [],
customerInfo: {},
displayInfo: {
headerSnapshot: {
customerName: '',
customerStatus: '',
goodsSubOrderDTOS: []
......@@ -579,7 +585,7 @@ export default {
this.groupMemberList = Array.isArray(data) ? data : []
},
syncDisplayInfo (info = this.customerInfo) {
this.displayInfo = {
this.headerSnapshot = {
customerName: info.customerName || '',
customerStatus: info.customerStatus,
goodsSubOrderDTOS: Array.isArray(info.goodsSubOrderDTOS) ? info.goodsSubOrderDTOS : []
......@@ -599,7 +605,7 @@ export default {
this.customerForm = JSON.parse(JSON.stringify(default_customerForm))
this.optionalForm = JSON.parse(JSON.stringify(default_optionalForm))
this.groupForm = JSON.parse(JSON.stringify(default_groupForm))
this.displayInfo = {
this.headerSnapshot = {
customerName: '',
customerStatus: '',
goodsSubOrderDTOS: []
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!