This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
nezha-nezha-fronted/nezha-fronted/src/components/common/mixin/table.js

83 lines
1.7 KiB
JavaScript
Raw Normal View History

export default {
props: {
tableData: {
type: Array
},
customTableTitle: {
type: Array
},
height: {
type: String,
default: '100%'
},
api: {
type: String
},
tableId: {
type: String
}
},
data () {
return {
2021-04-09 13:01:10 +08:00
operationWidth: '165' // 操作列宽
}
},
methods: {
tableOperation ([command, row, param]) {
switch (command) {
case 'edit': {
2021-05-11 16:46:16 +08:00
console.info(1, command, row)
this.$emit('edit', row)
break
}
case 'delete': {
this.$emit('del', row)
break
}
2021-04-13 20:33:12 +08:00
case 'record': {
this.$emit('showBottomBox', 'record', row)
break
}
case 'cli': {
this.$emit('cli', row)
break
}
2021-04-26 21:42:15 +08:00
case 'duplicate': {
this.$emit('duplicate', row)
break
}
case 'copy': {
this.$emit('copy', row)
break
}
default:
break
}
},
2021-04-13 10:00:48 +08:00
selectionChange (objs) {
this.$emit('selectionChange', objs)
},
isBuiltIn (row) {
return (row.buildIn && row.buildIn == 1) || (row.builtIn && row.builtIn == 1)
},
dragend () {
this.$nextTick(() => {
this.$refs.dataTable.doLayout()
})
},
showBottomBox (targetTab, row) {
this.$emit('showBottomBox', targetTab, JSON.parse(JSON.stringify(row)))
},
tableDataSort (item) {
let orderBy = ''
if (item.order === 'ascending') {
orderBy = item.prop
}
if (item.order === 'descending') {
orderBy = '-' + item.prop
}
this.$emit('orderBy', orderBy)
}
}
}