Commit 70efb558 by Lin

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

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