70 lines
1.3 KiB
JavaScript
70 lines
1.3 KiB
JavaScript
export default {
|
|
props: {
|
|
tableData: {
|
|
type: Array
|
|
},
|
|
api: {
|
|
type: String
|
|
},
|
|
tableId: {
|
|
type: String
|
|
},
|
|
detailViewRightObj: {},
|
|
orderByFa: {}
|
|
},
|
|
data () {
|
|
return {
|
|
orderBy: '',
|
|
orderType: 'ascending',
|
|
renderFirst: ''
|
|
}
|
|
},
|
|
methods: {
|
|
detailViewRightShow (item) {
|
|
this.$emit('detailViewRightShow', item)
|
|
},
|
|
orderTypeChange () {
|
|
if (this.orderType === 'ascending') {
|
|
this.orderType = 'descending'
|
|
} else {
|
|
this.orderType = 'ascending'
|
|
}
|
|
}
|
|
},
|
|
watch: {
|
|
orderByFa: {
|
|
immediate: true,
|
|
handler (n) {
|
|
console.log(n)
|
|
const index = n.indexOf('-')
|
|
this.renderFirst = false
|
|
if (index !== -1) {
|
|
this.orderBy = n.slice(index + 1)
|
|
this.orderType = 'descending'
|
|
} else {
|
|
this.orderBy = n
|
|
this.orderType = 'ascending'
|
|
}
|
|
setTimeout(() => {
|
|
this.renderFirst = true
|
|
})
|
|
}
|
|
},
|
|
orderBy: {
|
|
handler (n) {
|
|
console.log(n)
|
|
if (this.renderFirst) {
|
|
this.$emit('orderDetail', this.orderBy, this.orderType)
|
|
}
|
|
}
|
|
},
|
|
orderType: {
|
|
handler (n) {
|
|
if (this.renderFirst) {
|
|
this.$emit('orderDetail', this.orderBy, n)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|