68 lines
1.2 KiB
JavaScript
68 lines
1.2 KiB
JavaScript
export default {
|
|
props: {
|
|
tableData: {
|
|
type: Array
|
|
},
|
|
customTableTitle: {
|
|
type: Array
|
|
},
|
|
height: {
|
|
type: String,
|
|
default: '100%'
|
|
},
|
|
api: {
|
|
type: String
|
|
},
|
|
tableId: {
|
|
type: String
|
|
}
|
|
},
|
|
computed: {
|
|
customTableTitles () {
|
|
return this.customTableTitle.filter(item => item.show)
|
|
}
|
|
},
|
|
watch: {
|
|
customTableTitle (n) {
|
|
if (n) {
|
|
setTimeout(() => {
|
|
this.$refs.dataTable.doLayout()
|
|
}, 100)
|
|
}
|
|
}
|
|
},
|
|
data () {
|
|
return {
|
|
operationWidth: '165', // 操作列宽
|
|
show: true
|
|
}
|
|
},
|
|
methods: {
|
|
tableOperation ([command, row, param]) {
|
|
switch (command) {
|
|
default:
|
|
this.$emit(command, row)
|
|
break
|
|
}
|
|
},
|
|
selectionChange (objs) {
|
|
this.$emit('selectionChange', objs)
|
|
},
|
|
dragend () {
|
|
this.$nextTick(() => {
|
|
this.$refs.dataTable.doLayout()
|
|
})
|
|
},
|
|
tableDataSort (item) {
|
|
let orderBy = ''
|
|
if (item.order === 'ascending') {
|
|
orderBy = item.prop
|
|
}
|
|
if (item.order === 'descending') {
|
|
orderBy = '-' + item.prop
|
|
}
|
|
this.$emit('orderBy', orderBy)
|
|
}
|
|
}
|
|
}
|