irc_web/src/views/system/login-log/detail.vue

119 lines
3.3 KiB
Vue

<template>
<base-model v-if="config.visible" :config="config">
<template slot="dialog-body">
<el-table :data="curData" border style="width: 100%" size="small">
<el-table-column prop="key" :label="$t('system:loginLog:table:cfgItem')" show-overflow-tooltip />
<el-table-column prop="value" :label="$t('system:loginLog:table:cfgVal')" show-overflow-tooltip>
<template slot-scope="scope">
<el-button v-if="scope.row.prop === 'UserAgreementId'" type="text" size="small"
@click.stop="view(scope.row)">{{
$t('dictionary:agreement:button:view')
}}</el-button>
<span v-else-if="scope.row.prop !== 'UserRoleList'">{{
scope.row.value
}}</span>
<template v-else>
<div v-for="item in scope.row.value" :key="item.UserTypeEnum" style="margin: 0">
{{ item.UserTypeShortName
}}{{ $t('system:loginLog:form:symbol')
}}{{ $fd('IsEnable', !item.IsUserRoleDisabled) }}
</div>
</template>
</template>
</el-table-column>
</el-table>
</template>
<template slot="dialog-footer">
<el-button type="primary" @click="config.visible = false">
{{ $t('common:button:confirm') }}
</el-button>
</template>
</base-model>
</template>
<script>
import BaseModel from '@/components/BaseModel'
export default {
components: { BaseModel },
props: {
JsonObj: {
type: String,
default: '',
},
config: {
type: Object,
default: () => {
return {
visible: false,
title: this.$t('system:loginLog:dialog:title'),
width: '500px',
top: '10vh',
appendToBody: true,
bodyStyle: `min-height: 100px; max-height: 650px;overflow-y: auto;padding: 10px;border: 1px solid #e0e0e0;`,
}
},
},
},
data() {
return {
curKeys: [
'UserName',
'FirstName',
'LastName',
'EMail',
'Phone',
'Status',
'OrganizationName',
'PositionName',
'DepartmentName',
'UserRoleList',
'UserAgreementTypeEnum',
'FileVersion',
'UserAgreementId',
],
IsEn_Us: false
}
},
computed: {
curDataArr() {
if (!this.curData) return []
return Object.keys(this.curData)
},
curData() {
if (!this.JsonObj) return []
let obj = JSON.parse(this.JsonObj)
let curData = []
Object.keys(obj).forEach((key) => {
if (key === 'IsEn_Us') this.IsEn_Us = obj[key]
if (this.curKeys.includes(key)) {
let o = {
key: this.$t(`system:loginLog:form:${key}`),
value: obj[key],
prop: key,
}
if (key === 'Status') {
o.value = this.$fd('IsUserEnable', obj[key])
}
if (key === 'UserAgreementTypeEnum') {
o.value = this.$fd('UserAgreementType', obj[key])
}
curData.push(o)
}
})
return curData
},
},
methods: {
view(row) {
this.$AGR({
Id: row.value,
IsEn_Us: this.IsEn_Us
})
},
}
}
</script>
<style lang="scss" scoped>
::v-deep .el-form-item__label {
font-weight: bold;
}
</style>