mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-15 14:24:39 +00:00
perf: 资产授权添加协议
This commit is contained in:
@@ -17,6 +17,11 @@ export default {
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formatterData: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
displayValue() {
|
||||
if ([null, undefined, ''].includes(this.value)) {
|
||||
@@ -65,7 +70,17 @@ export default {
|
||||
},
|
||||
render(h) {
|
||||
if (typeof this.formatter === 'function') {
|
||||
return this.formatter(this.item, this.value)
|
||||
const data = this.formatter(this.item, this.value)
|
||||
if (data instanceof Promise) {
|
||||
data.then(res => {
|
||||
this.formatterData = res
|
||||
})
|
||||
} else {
|
||||
this.formatterData = data
|
||||
}
|
||||
return (
|
||||
<span>{this.formatterData}</span>
|
||||
)
|
||||
}
|
||||
if (this.value instanceof Array) {
|
||||
const newArr = this.value || []
|
||||
|
||||
@@ -68,7 +68,14 @@ export default {
|
||||
},
|
||||
{
|
||||
key: this.$t('assets.Protocols'),
|
||||
value: row.protocols.map(item => item.name).join(', ')
|
||||
formatter: () => {
|
||||
return this.$axios.get(`/api/v1/perms/users/self/assets/${row.id}/`).then(res => {
|
||||
const protocols = res.permed_protocols
|
||||
const names = protocols.map(item => item.name).join(', ')
|
||||
console.log('Names: ', names)
|
||||
return names
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
key: this.$t('assets.Category'),
|
||||
|
||||
@@ -96,7 +96,7 @@ export default {
|
||||
el: {
|
||||
resource: this.$t('assets.Protocol'),
|
||||
select2: {
|
||||
url: '/api/v1/assets/categories/protocols/',
|
||||
url: '/api/v1/assets/protocols/',
|
||||
ajax: {
|
||||
transformOption: (item) => {
|
||||
return { label: item.label, value: item.value }
|
||||
|
||||
Reference in New Issue
Block a user