优化一波

This commit is contained in:
feng626
2022-06-19 19:48:28 +08:00
parent 3c9a3b693b
commit 57e5452220
7 changed files with 93 additions and 88 deletions

View File

@@ -61,9 +61,12 @@ export default {
}
},
{
prop: 'applicant_display',
prop: 'applicant',
label: this.$t('tickets.user'),
sortable: 'custom'
sortable: 'custom',
formatter: row => {
return row.rel_snapshot.applicant
}
},
{
prop: 'type_display',

View File

@@ -30,74 +30,75 @@ export default {
},
computed: {
detailCardItems() {
const { object } = this
return [
{
key: this.$t('tickets.Applicant'),
value: this.object.rel_snapshot.applicant
value: object.rel_snapshot.applicant
},
{
key: this.$t('tickets.type'),
value: this.object.type_display
value: object.type_display
},
{
key: this.$t('tickets.status'),
value: this.object.status,
value: object.status,
formatter: (item, val) => {
return <el-tag type={this.statusMap.type} size='mini'> { this.statusMap.title }</el-tag>
}
},
{
key: this.$t('common.dateCreated'),
value: toSafeLocalDateStr(this.object.date_created)
value: toSafeLocalDateStr(object.date_created)
}
]
},
specialCardItems() {
const vm = this
const { object } = this
return [
{
key: this.$t('tickets.ApplyRunUser'),
value: this.object.rel_snapshot.apply_run_user
value: object.rel_snapshot.apply_run_user
},
{
key: this.$t('tickets.ApplyRunAsset'),
value: this.object.rel_snapshot.apply_run_asset
value: object.rel_snapshot.apply_run_asset
},
{
key: this.$t('tickets.ApplyRunSystemUser'),
value: this.object.rel_snapshot.apply_run_system_user
value: object.rel_snapshot.apply_run_system_user
},
{
key: this.$t('tickets.ApplyRunCommand'),
value: this.object.apply_run_command
value: object.apply_run_command
},
{
key: this.$t('tickets.ApplyFromSession'),
value: this.object.apply_from_session,
value: object.apply_from_session,
formatter: function(item, value) {
const to = { name: 'SessionDetail', params: { id: value }, query: { oid: vm.object.org_id }}
if (!vm.$hasPerm('terminal.view_session')) {
return <span>{vm.$t('sessions.session')}</span>
const to = { name: 'SessionDetail', params: { id: value }, query: { oid: object.org_id }}
if (!this.$hasPerm('terminal.view_session')) {
return <span>{this.$t('sessions.session')}</span>
}
return <router-link to={to}>{vm.$t('sessions.session')}</router-link>
return <router-link to={to}>{this.$t('sessions.session')}</router-link>
}
},
{
key: this.$t('tickets.ApplyFromCMDFilterRule'),
value: {
cmdFilterRuleId: this.object.apply_from_cmd_filter_rule,
cmdFilterId: this.object.apply_from_cmd_filter
cmdFilterRuleId: object.apply_from_cmd_filter_rule,
cmdFilterId: object.apply_from_cmd_filter
},
formatter: function(item, value) {
const to = {
name: 'CommandFilterRulesUpdate',
params: { id: value.cmdFilterRuleId },
query: { filter: value.cmdFilterId, oid: vm.object.org_id }
query: { filter: value.cmdFilterId, oid: object.org_id }
}
if (!vm.$hasPerm('assets.change_commandfilterrule')) {
return <span>{vm.$t('assets.CommandFilterRules')}</span>
if (!this.$hasPerm('assets.change_commandfilterrule')) {
return <span>{this.$t('assets.CommandFilterRules')}</span>
}
return <router-link to={to}>{vm.$t('assets.CommandFilterRules')}</router-link>
return <router-link to={to}>{this.$t('assets.CommandFilterRules')}</router-link>
}
}
]

View File

@@ -30,44 +30,43 @@ export default {
},
computed: {
detailCardItems() {
const { object } = this
return [
{
key: this.$t('tickets.Applicant'),
value: this.object.rel_snapshot.applicant
value: object.rel_snapshot.applicant
},
{
key: this.$t('tickets.type'),
value: this.object.type_display
value: object.type_display
},
{
key: this.$t('tickets.status'),
value: this.object.status,
value: object.status,
formatter: (item, val) => {
return <el-tag type={this.statusMap.type} size='mini'> { this.statusMap.title }</el-tag>
}
},
{
key: this.$t('common.dateCreated'),
value: toSafeLocalDateStr(this.object.date_created)
value: toSafeLocalDateStr(object.date_created)
}
]
},
specialCardItems() {
return this.object.type === 'login_confirm' ? [] : [
// apply_login_asset: "114.118.2.76(114.118.2.76)"
// apply_login_system_user: "root()"
// apply_login_user: "Administrator(admin)"
const { object } = this
return object.type === 'login_confirm' ? [] : [
{
key: this.$t('acl.apply_login_asset'),
value: this.object.rel_snapshot.apply_login_asset
value: object.rel_snapshot.apply_login_asset
},
{
key: this.$t('acl.apply_login_system_user'),
value: this.object.rel_snapshot.apply_login_system_user
value: object.rel_snapshot.apply_login_system_user
},
{
key: this.$t('acl.apply_login_user'),
value: this.object.rel_snapshot.apply_login_user
value: object.rel_snapshot.apply_login_user
}
]
}

View File

@@ -30,44 +30,43 @@ export default {
},
computed: {
detailCardItems() {
const { object } = this
return [
{
key: this.$t('tickets.Applicant'),
value: this.object.rel_snapshot.applicant
value: object.rel_snapshot.applicant
},
{
key: this.$t('tickets.type'),
value: this.object.type_display
value: object.type_display
},
{
key: this.$t('tickets.status'),
value: this.object.status,
value: object.status,
formatter: (item, val) => {
return <el-tag type={this.statusMap.type} size='mini'> { this.statusMap.title }</el-tag>
}
},
{
key: this.$t('common.dateCreated'),
value: toSafeLocalDateStr(this.object.date_created)
value: toSafeLocalDateStr(object.date_created)
}
]
},
specialCardItems() {
return this.object.type === 'login_confirm' ? [] : [
// apply_login_asset: "114.118.2.76(114.118.2.76)"
// apply_login_system_user: "root()"
// apply_login_user: "Administrator(admin)"
const { object } = this
return object.type === 'login_confirm' ? [] : [
{
key: this.$t('acl.apply_login_asset'),
value: this.object.rel_snapshot.apply_login_asset
value: object.rel_snapshot.apply_login_asset
},
{
key: this.$t('acl.apply_login_system_user'),
value: this.object.rel_snapshot.apply_login_system_user
value: object.rel_snapshot.apply_login_system_user
},
{
key: this.$t('acl.apply_login_user'),
value: this.object.rel_snapshot.apply_login_user
value: object.rel_snapshot.apply_login_user
}
]
}

View File

@@ -39,48 +39,48 @@ export default {
},
computed: {
detailCardItems() {
const obj = this.object || {}
const { object } = this
return [
{
key: this.$t('common.Number'),
value: obj.serial_num
value: object.serial_num
},
{
key: this.$t('tickets.status'),
value: obj.status,
value: object.status,
formatter: (item, val) => {
return <el-tag type={this.statusMap.type} size='mini'> { this.statusMap.title }</el-tag>
}
},
{
key: this.$t('tickets.type'),
value: obj.type_display
value: object.type_display
},
{
key: this.$t('tickets.user'),
value: obj.rel_snapshot.applicant
value: object.rel_snapshot.applicant
},
{
key: this.$t('tickets.OrgName'),
value: obj.org_name
value: object.org_name
},
{
key: this.$t('common.dateCreated'),
value: toSafeLocalDateStr(obj.date_created)
value: toSafeLocalDateStr(object.date_created)
},
{
key: this.$t('common.Comment'),
value: obj.comment
value: object.comment
}
]
},
specialCardItems() {
const vm = this
const rel_snapshot = this.object.rel_snapshot
const { object } = this
const rel_snapshot = object.rel_snapshot
return [
{
key: this.$t('applications.appType'),
value: `${vm.object.apply_category} / ${vm.object.apply_type} `
value: `${object.apply_category} / ${object.apply_type} `
},
{
key: this.$t('applications.appName'),
@@ -92,24 +92,25 @@ export default {
},
{
key: this.$t('common.dateStart'),
value: toSafeLocalDateStr(vm.object.apply_date_start)
value: toSafeLocalDateStr(object.apply_date_start)
},
{
key: this.$t('common.dateExpired'),
value: toSafeLocalDateStr(vm.object.apply_date_expired)
value: toSafeLocalDateStr(object.apply_date_expired)
}
]
},
assignedCardItems() {
const vm = this
const rel_snapshot = this.object.rel_snapshot
const { object } = this
const rel_snapshot = object.rel_snapshot
return [
{
key: this.$t('tickets.PermissionName'),
value: vm.object.apply_permission_name,
formatter: function(item, value) {
const to = { name: 'ApplicationPermissionDetail', params: { id: vm.object.id }, query: { oid: vm.object.org_id }}
if (vm.$hasPerm('perms.view_applicationpermission') && vm.object.status === 'closed' && vm.object.state === 'approved') {
const to = { name: 'ApplicationPermissionDetail', params: { id: object.id }, query: { oid: object.org_id }}
if (vm.$hasPerm('perms.view_applicationpermission') && object.status === 'closed' && object.state === 'approved') {
return <router-link to={to}>{ value }</router-link>
} else {
return <span>{ value }</span>
@@ -126,11 +127,11 @@ export default {
},
{
key: this.$t('common.dateStart'),
value: toSafeLocalDateStr(vm.object.apply_date_start)
value: toSafeLocalDateStr(object.apply_date_start)
},
{
key: this.$t('common.dateExpired'),
value: toSafeLocalDateStr(vm.object.apply_date_expired)
value: toSafeLocalDateStr(object.apply_date_expired)
}
]
},

View File

@@ -40,44 +40,44 @@ export default {
},
computed: {
detailCardItems() {
const obj = this.object || {}
const { object } = this
return [
{
key: this.$t('common.Number'),
value: obj.serial_num
value: object.serial_num
},
{
key: this.$t('tickets.status'),
value: obj.state,
value: object.state,
formatter: (item, val) => {
return <el-tag type={this.statusMap.type} size='mini'> { this.statusMap.title }</el-tag>
}
},
{
key: this.$t('tickets.type'),
value: obj.type_display
value: object.type_display
},
{
key: this.$t('tickets.user'),
value: obj.rel_snapshot.applicant
value: object.rel_snapshot.applicant
},
{
key: this.$t('tickets.OrgName'),
value: obj.org_name
value: object.org_name
},
{
key: this.$t('common.dateCreated'),
value: toSafeLocalDateStr(obj.date_created)
value: toSafeLocalDateStr(object.date_created)
},
{
key: this.$t('common.Comment'),
value: obj.comment
value: object.comment
}
]
},
specialCardItems() {
const vm = this
const rel_snapshot = this.object.rel_snapshot
const { object } = this
const rel_snapshot = object.rel_snapshot
return [
{
key: this.$t('perms.Node'),
@@ -93,28 +93,29 @@ export default {
},
{
key: this.$t('assets.Action'),
value: forMatAction(this, vm.object.apply_actions_display)
value: forMatAction(this, object.apply_actions_display)
},
{
key: this.$t('common.dateStart'),
value: toSafeLocalDateStr(vm.object.apply_date_start)
value: toSafeLocalDateStr(object.apply_date_start)
},
{
key: this.$t('common.dateExpired'),
value: toSafeLocalDateStr(vm.object.apply_date_expired)
value: toSafeLocalDateStr(object.apply_date_expired)
}
]
},
assignedCardItems() {
const vm = this
const rel_snapshot = this.object.rel_snapshot
const { object } = this
const rel_snapshot = object.rel_snapshot
return [
{
key: this.$t('tickets.PermissionName'),
value: this.object.apply_permission_name,
value: object.apply_permission_name,
formatter: function(item, value) {
const to = { name: 'AssetPermissionDetail', params: { id: vm.object.id }, query: { oid: vm.object.org_id }}
if (vm.$hasPerm('perms.view_assetpermission') && vm.object.status === 'closed' && vm.object.state === 'approved') {
const to = { name: 'AssetPermissionDetail', params: { id: object.id }, query: { oid: object.org_id }}
if (vm.$hasPerm('perms.view_assetpermission') && object.status === 'closed' && object.state === 'approved') {
return <router-link to={to}>{ value }</router-link>
} else {
return <span>{ value }</span>
@@ -135,15 +136,15 @@ export default {
},
{
key: this.$t('assets.Action'),
value: forMatAction(this, vm.object.apply_actions_display)
value: forMatAction(this, object.apply_actions_display)
},
{
key: this.$t('common.dateStart'),
value: toSafeLocalDateStr(vm.object.apply_date_start)
value: toSafeLocalDateStr(object.apply_date_start)
},
{
key: this.$t('common.dateExpired'),
value: toSafeLocalDateStr(vm.object.apply_date_expired)
value: toSafeLocalDateStr(object.apply_date_expired)
}
]
}

View File

@@ -30,33 +30,34 @@ export default {
},
computed: {
detailCardItems() {
const { object } = this
return [
{
key: this.$t('tickets.Applicant'),
value: this.object.rel_snapshot.applicant
value: object.rel_snapshot.applicant
},
{
key: this.$t('tickets.type'),
value: this.object.type_display
value: object.type_display
},
{
key: this.$t('tickets.status'),
value: this.object.status,
value: object.status,
formatter: (item, val) => {
return <el-tag type={this.statusMap.type} size='mini'> { this.statusMap.title }</el-tag>
}
},
{
key: this.$t('tickets.Assignees'),
value: this.object.process_map[this.object.approval_step - 1].assignees_display.join(',')
value: object.process_map[object.approval_step - 1].assignees_display.join(',')
},
{
key: this.$t('tickets.Assignee'),
value: this.object.process_map[this.object.approval_step - 1].processor_display
value: object.process_map[object.approval_step - 1].processor_display
},
{
key: this.$t('common.dateCreated'),
value: toSafeLocalDateStr(this.object.date_created)
value: toSafeLocalDateStr(object.date_created)
}
]
}