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-10-13 18:24:09 +08:00
|
|
|
},
|
|
|
|
|
orderByFa: {}
|
2021-04-12 13:00:59 +08:00
|
|
|
},
|
2021-04-07 09:58:34 +08:00
|
|
|
data () {
|
|
|
|
|
return {
|
2021-10-13 18:24:09 +08:00
|
|
|
operationWidth: '165', // 操作列宽
|
|
|
|
|
orderBy: {}
|
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 'delete': {
|
2021-04-12 13:00:59 +08:00
|
|
|
this.$emit('del', row)
|
2021-04-07 09:58:34 +08:00
|
|
|
break
|
|
|
|
|
}
|
2021-05-12 19:36:51 +08:00
|
|
|
case 'recordTab': {
|
|
|
|
|
this.$emit('showBottomBox', 'recordTab', row)
|
2021-04-13 20:33:12 +08:00
|
|
|
break
|
|
|
|
|
}
|
2021-05-19 23:17:24 +08:00
|
|
|
case 'endpointQuery': {
|
|
|
|
|
this.$emit('showBottomBox', 'endpointQuery', row)
|
2021-05-12 19:36:51 +08:00
|
|
|
break
|
|
|
|
|
}
|
2021-05-20 14:07:58 +08:00
|
|
|
case 'sync': {
|
|
|
|
|
// this.$emit('copy', row)
|
|
|
|
|
this.$emit('sync', row)
|
|
|
|
|
break
|
|
|
|
|
}
|
2021-06-01 14:26:09 +08:00
|
|
|
case 'fastSilence': {
|
|
|
|
|
// this.$emit('copy', row)
|
|
|
|
|
this.$emit('addSilence', row, param)
|
|
|
|
|
break
|
|
|
|
|
}
|
2021-04-07 09:58:34 +08:00
|
|
|
default:
|
2021-05-19 23:17:24 +08:00
|
|
|
this.$emit(command, row)
|
2021-04-07 09:58:34 +08:00
|
|
|
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 = ''
|
2021-06-30 17:11:46 +08:00
|
|
|
let str = item.prop
|
|
|
|
|
if (str === 'dc') {
|
|
|
|
|
str = 'datacenter'
|
|
|
|
|
}
|
2021-04-07 09:58:34 +08:00
|
|
|
if (item.order === 'ascending') {
|
2021-06-30 17:11:46 +08:00
|
|
|
orderBy = str
|
2021-04-07 09:58:34 +08:00
|
|
|
}
|
|
|
|
|
if (item.order === 'descending') {
|
2021-06-30 17:11:46 +08:00
|
|
|
orderBy = '-' + str
|
2021-04-07 09:58:34 +08:00
|
|
|
}
|
2021-04-12 13:00:59 +08:00
|
|
|
this.$emit('orderBy', orderBy)
|
2021-04-08 20:28:54 +08:00
|
|
|
}
|
2021-10-13 18:24:09 +08:00
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
orderByFa: {
|
|
|
|
|
immediate: true,
|
|
|
|
|
handler (n) {
|
|
|
|
|
if (n) {
|
|
|
|
|
const index = n.indexOf('-')
|
|
|
|
|
if (index !== -1) {
|
|
|
|
|
this.orderBy[n.slice(index + 1)] = 'descending'
|
|
|
|
|
} else {
|
|
|
|
|
this.orderBy[n] = 'descending'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-07 09:58:34 +08:00
|
|
|
}
|
|
|
|
|
}
|