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