2021-10-09 16:47:38 +08:00
|
|
|
export default {
|
|
|
|
|
props: {},
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
detailType: 'list',
|
2021-10-11 14:05:07 +08:00
|
|
|
detailViewRightObj: '',
|
2021-10-12 16:53:59 +08:00
|
|
|
detailViewLoading: false,
|
|
|
|
|
detailTimer: ''
|
2021-10-09 16:47:38 +08:00
|
|
|
}
|
|
|
|
|
},
|
2021-10-11 14:05:07 +08:00
|
|
|
created () {
|
|
|
|
|
this.detailType = localStorage.getItem('detail-view-' + this.tableId) || 'list'
|
|
|
|
|
},
|
2021-10-09 16:47:38 +08:00
|
|
|
methods: {
|
|
|
|
|
changeDetailType (flag) {
|
|
|
|
|
if (this.detailType === flag) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.detailType = flag
|
2021-10-11 14:05:07 +08:00
|
|
|
localStorage.setItem('detail-view-' + this.tableId, this.detailType)
|
2021-10-13 14:44:34 +08:00
|
|
|
if (this.detailType === 'view') {
|
|
|
|
|
// modelIdsDetail
|
|
|
|
|
this.selectValue.modelIdsDetail = []
|
|
|
|
|
this.selectValue.modelIds.forEach(modelId => {
|
|
|
|
|
this.titleSearchList.model.children.forEach(model => {
|
|
|
|
|
const brand = model.children.find(children => modelId == children.id)
|
|
|
|
|
if (brand) {
|
|
|
|
|
console.log(brand)
|
|
|
|
|
this.selectValue.modelIdsDetail.push(brand.brandId + '-' + modelId)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
this.selectValue.fieldsDetail = []
|
|
|
|
|
if (this.selectValue.fields) {
|
|
|
|
|
const obj = JSON.parse(this.selectValue.fields)
|
|
|
|
|
Object.keys(obj).forEach(key => {
|
|
|
|
|
obj[key].forEach(item => {
|
|
|
|
|
this.selectValue.fieldsDetail.push(key + '-' + item)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
const obj = {}
|
|
|
|
|
this.selectValue.modelIds = this.selectValue.modelIdsDetail.map(item => item.split('-')[1])
|
|
|
|
|
this.selectValue.fieldsDetail.forEach(item => {
|
|
|
|
|
const arr = item.split('-')
|
|
|
|
|
if (obj[arr[0]]) {
|
|
|
|
|
obj[arr[0]].push(arr[1])
|
|
|
|
|
} else {
|
|
|
|
|
obj[arr[0]] = [arr[1]]
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.selectValue.fields = JSON.stringify(obj)
|
|
|
|
|
if (this.selectValue.fields === '{}') {
|
|
|
|
|
this.selectValue.fields = ''
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-09 16:47:38 +08:00
|
|
|
this.pageObj.pageNo = 1
|
2021-10-11 14:05:07 +08:00
|
|
|
setTimeout(() => {
|
|
|
|
|
this.detailViewLoading = false
|
2021-10-11 16:12:09 +08:00
|
|
|
this.$refs.clickSearch && this.$refs.clickSearch.needMore()
|
2021-10-11 14:05:07 +08:00
|
|
|
}, 100)
|
2021-10-09 16:47:38 +08:00
|
|
|
},
|
|
|
|
|
detailViewRightShow (item) {
|
|
|
|
|
this.detailViewRightObj = item
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|