mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-25 14:25:23 +00:00
perf: 优化系统用户详情信息
This commit is contained in:
@@ -4,15 +4,21 @@
|
|||||||
<DetailCard :items="detailCardItems" />
|
<DetailCard :items="detailCardItems" />
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
<QuickUpdate v-bind="AutoPushConfig" />
|
<QuickActions type="primary" :actions="quickActions" />
|
||||||
<RelationCard v-if="object.protocol === 'ssh'" ref="RelationCard" type="info" style="margin-top: 15px" v-bind="nodeRelationConfig" />
|
<RelationCard
|
||||||
|
v-if="object.protocol === 'ssh'"
|
||||||
|
ref="RelationCard"
|
||||||
|
v-bind="nodeRelationConfig"
|
||||||
|
type="info"
|
||||||
|
style="margin-top: 15px"
|
||||||
|
/>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import DetailCard from '@/components/DetailCard'
|
import DetailCard from '@/components/DetailCard'
|
||||||
import QuickUpdate from './QuickUpdate'
|
import QuickActions from '@/components/QuickActions'
|
||||||
import RelationCard from '@/components/RelationCard/index'
|
import RelationCard from '@/components/RelationCard/index'
|
||||||
import { toSafeLocalDateStr } from '@/utils/common'
|
import { toSafeLocalDateStr } from '@/utils/common'
|
||||||
|
|
||||||
@@ -20,7 +26,7 @@ export default {
|
|||||||
name: 'Detail',
|
name: 'Detail',
|
||||||
components: {
|
components: {
|
||||||
DetailCard,
|
DetailCard,
|
||||||
QuickUpdate,
|
QuickActions,
|
||||||
RelationCard
|
RelationCard
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
@@ -31,17 +37,29 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
AutoPushConfig: {
|
quickActions: [
|
||||||
icon: 'fa-info',
|
{
|
||||||
title: this.$t('assets.QuickUpdate'),
|
title: this.$t('assets.AutoPush'),
|
||||||
url: `/api/v1/assets/system-users/${this.object.id}/`,
|
type: 'switcher',
|
||||||
content: [
|
attrs: {
|
||||||
{
|
label: this.$t('assets.AutoPush'),
|
||||||
name: this.$t('assets.AutoPush'),
|
model: this.object.auto_push,
|
||||||
auto_push: this.object.auto_push
|
disabled: ['rdp', 'ssh'].indexOf(this.object.protocol) === -1
|
||||||
|
},
|
||||||
|
callbacks: {
|
||||||
|
change: function(val) {
|
||||||
|
this.$axios.patch(
|
||||||
|
`/api/v1/assets/system-users/${this.object.id}/`,
|
||||||
|
{ auto_push: val }
|
||||||
|
).then(res => {
|
||||||
|
this.$message.success(this.$t('common.updateSuccessMsg'))
|
||||||
|
}).catch(err => {
|
||||||
|
this.$message.error(this.$t('common.updateErrorMsg' + ' ' + err))
|
||||||
|
})
|
||||||
|
}.bind(this)
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
},
|
],
|
||||||
nodeRelationConfig: {
|
nodeRelationConfig: {
|
||||||
icon: 'fa-info',
|
icon: 'fa-info',
|
||||||
hasObjectsId: this.object.cmd_filters,
|
hasObjectsId: this.object.cmd_filters,
|
||||||
@@ -97,6 +115,10 @@ export default {
|
|||||||
key: this.$t('assets.Username'),
|
key: this.$t('assets.Username'),
|
||||||
value: this.object.username
|
value: this.object.username
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: this.$t('assets.Protocol'),
|
||||||
|
value: this.object.protocol
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: this.$t('assets.LoginModel'),
|
key: this.$t('assets.LoginModel'),
|
||||||
value: this.object.login_mode_display
|
value: this.object.login_mode_display
|
||||||
|
@@ -1,72 +0,0 @@
|
|||||||
<template>
|
|
||||||
<el-card class="box-card primary box-margin">
|
|
||||||
<div slot="header" class="clearfix">
|
|
||||||
<i v-if="icon" :class="'fa ' + icon" />
|
|
||||||
<span>{{ title }}</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<el-table class="el-table" :data="content" :show-header="false">
|
|
||||||
<el-table-column prop="name" />
|
|
||||||
<el-table-column prop="auto_push" align="right">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<Switcher
|
|
||||||
v-model="scope.row.auto_push"
|
|
||||||
@change="HandleChangeAction(scope.$index, scope.row)"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</div>
|
|
||||||
</el-card>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { Switcher } from '@/components'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'AutoPushCard',
|
|
||||||
components: {
|
|
||||||
Switcher
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
title: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
icon: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
content: {
|
|
||||||
type: Array,
|
|
||||||
default: () => []
|
|
||||||
},
|
|
||||||
url: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
HandleChangeAction(index, row) {
|
|
||||||
this.$axios.patch(this.url, { auto_push: row.auto_push }
|
|
||||||
).then(res => {
|
|
||||||
this.$message.success(this.$t('common.updateSuccessMsg'))
|
|
||||||
}).catch(err => {
|
|
||||||
this.$message.error(this.$t('common.updateErrorMsg' + ' ' + err))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.box-margin {
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
.el-table::before{
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.el-table >>> td{
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
Reference in New Issue
Block a user