管理端登录日志详情
continuous-integration/drone/push Build is passing Details

uat_us
wangxiaoshuang 2024-12-26 17:55:11 +08:00
parent 3ca1e9d8ed
commit 65d9c7b711
3 changed files with 132 additions and 46 deletions

View File

@ -48,6 +48,7 @@
:show-overflow-tooltip="column.showOverflowTooltip || false" :show-overflow-tooltip="column.showOverflowTooltip || false"
:sortable="column.sortable || false" :sortable="column.sortable || false"
:prop="column.prop" :prop="column.prop"
:fixed="column.fixed"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<!-- 仅仅显示文字 --> <!-- 仅仅显示文字 -->

View File

@ -50,7 +50,7 @@
/> />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
:label=" $t('system:loginLog:table:LoginUserType')" :label="$t('system:loginLog:table:LoginUserType')"
prop="LoginUserTypeEnum" prop="LoginUserTypeEnum"
> >
<el-select <el-select
@ -77,19 +77,15 @@
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button <el-button type="primary" icon="el-icon-search" @click="getList">
type="primary" {{ $t('common:button:search') }}
icon="el-icon-search"
@click="getList"
>
{{ $t("common:button:search") }}
</el-button> </el-button>
<el-button <el-button
type="primary" type="primary"
icon="el-icon-refresh-left" icon="el-icon-refresh-left"
@click="handleReset" @click="handleReset"
> >
{{ $t("common:button:reset") }} {{ $t('common:button:reset') }}
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -110,7 +106,7 @@
sortable="custom" sortable="custom"
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ $fd("UserOptType", scope.row.OptType) }} {{ $fd('UserOptType', scope.row.OptType) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -136,12 +132,12 @@
/> />
<el-table-column <el-table-column
:label="$t('system:loginLog:table:LoginUserName')" :label="$t('system:loginLog:table:LoginUserName')"
prop="LoginUserName" prop="ActionUserName"
min-width="140" min-width="140"
show-overflow-tooltip show-overflow-tooltip
sortable="custom" sortable="custom"
/> />
<el-table-column <!-- <el-table-column
:label="$t('system:loginLog:table:LoginUserType')" :label="$t('system:loginLog:table:LoginUserType')"
prop="LoginUserTypeEnum" prop="LoginUserTypeEnum"
min-width="120" min-width="120"
@ -151,15 +147,15 @@
<template slot-scope="scope"> <template slot-scope="scope">
{{ $fd("UserType", scope.row.LoginUserTypeEnum) }} {{ $fd("UserType", scope.row.LoginUserTypeEnum) }}
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column <el-table-column
:label="$t('system:loginLog:table:OptUserName')" :label="$t('system:loginLog:table:OptUserName')"
prop="OptUserName" prop="TargetIdentityUserName"
min-width="200" min-width="200"
sortable="custom" sortable="custom"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column <!-- <el-table-column
:label="$t('system:loginLog:table:OptUserType')" :label="$t('system:loginLog:table:OptUserType')"
prop="OptUserTypeEnum" prop="OptUserTypeEnum"
min-width="200" min-width="200"
@ -169,6 +165,23 @@
<template slot-scope="scope"> <template slot-scope="scope">
{{ $fd("UserType", scope.row.OptUserTypeEnum) }} {{ $fd("UserType", scope.row.OptUserTypeEnum) }}
</template> </template>
</el-table-column> -->
<el-table-column
:label="$t('system:loginLog:table:detail')"
prop="TargetIdentityUserName"
min-width="120"
sortable="custom"
show-overflow-tooltip
>
<template slot-scope="scope">
<el-button
v-if="scope.row.JsonObj"
type="text"
@click="handleOpenDialog(scope.row)"
>
<span>{{ $t('system:loginLog:message:detail') }}</span>
</el-button>
</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
:label="$t('system:loginLog:table:CreateTime')" :label="$t('system:loginLog:table:CreateTime')"
@ -187,29 +200,62 @@
/> />
</div> </div>
</div> </div>
<base-model v-if="config.visible" :config="config">
<template slot="dialog-body">
<el-form ref="form" :model="curData" max-height="500px">
<template v-for="key in curDataArr">
<el-form-item
:key="key"
:label="$t(`system:loginLog:form:${key}`)"
label-width="120px"
style="margin-bottom: 0px"
>
<span v-if="key !== 'UserRoleList'">{{ curData[key] }}</span>
<template v-else>
<div
v-for="item in curData[key]"
:key="item.UserTypeEnum"
style="margin: 0"
>
{{ item.UserTypeShortName
}}{{ $t('system:loginLog:form:symbol')
}}{{ $fd('IsEnable', !item.IsUserRoleDisabled) }}
</div>
</template>
</el-form-item>
</template>
</el-form>
</template>
<template slot="dialog-footer">
<el-button type="primary" @click="config.visible = false">
{{ $t('common:button:confirm') }}
</el-button>
</template>
</base-model>
</div> </div>
</template> </template>
<script> <script>
import { getUserLogList } from "@/api/user"; import { getUserLogList } from '@/api/user'
import Pagination from "@/components/Pagination"; import Pagination from '@/components/Pagination'
import moment from "moment"; import moment from 'moment'
import BaseModel from '@/components/BaseModel'
const searchDataDefault = () => { const searchDataDefault = () => {
return { return {
OptType: null, OptType: null,
Ip: "", Ip: '',
LoginFaildName: "", LoginFaildName: '',
LoginUserName: '', LoginUserName: '',
LoginUserTypeEnum: null, LoginUserTypeEnum: null,
BeginDate: "", BeginDate: '',
EndDate: "", EndDate: '',
Asc: false, Asc: false,
SortField: "CreateTime", SortField: 'CreateTime',
PageIndex: 1, PageIndex: 1,
PageSize: 20, PageSize: 20,
}; }
}; }
export default { export default {
components: { Pagination }, components: { Pagination, BaseModel },
data() { data() {
return { return {
moment, moment,
@ -218,52 +264,90 @@ export default {
total: 0, total: 0,
loading: false, loading: false,
datetimerange: [], datetimerange: [],
}; config: {
visible: false,
title: this.$t('system:loginLog:dialog:title'),
width: '500px',
},
curData: {},
curKeys: [
'UserName',
'FirstName',
'LastName',
'EMail',
'Phone',
'OrganizationName',
'PositionName',
'DepartmentName',
'UserRoleList',
],
}
}, },
mounted() { mounted() {
this.getList(); this.getList()
},
computed: {
curDataArr() {
if (!this.curData) return []
return Object.keys(this.curData)
},
}, },
methods: { methods: {
handleOpenDialog(row) {
if (!row.JsonObj)
return this.$message.warning(this.$t('system:loginLog:message:noJSON'))
this.config.title = this.$t('system:loginLog:dialog:title').replace(
'xxx',
this.$fd('UserOptType', row.OptType)
)
let obj = JSON.parse(row.JsonObj)
Object.keys(obj).forEach((key) => {
if (this.curKeys.includes(key)) {
this.curData[key] = obj[key]
}
})
this.config.visible = true
},
getList() { getList() {
this.loading = true; this.loading = true
getUserLogList(this.searchData) getUserLogList(this.searchData)
.then((res) => { .then((res) => {
this.loading = false; this.loading = false
this.list = res.Result.CurrentPageData; this.list = res.Result.CurrentPageData
this.total = res.Result.TotalCount; this.total = res.Result.TotalCount
}) })
.catch(() => { .catch(() => {
this.loading = false; this.loading = false
}); })
}, },
handleDatetimeChange(val) { handleDatetimeChange(val) {
if (val) { if (val) {
this.searchData.BeginDate = val[0]; this.searchData.BeginDate = val[0]
this.searchData.EndDate = val[1]; this.searchData.EndDate = val[1]
} else { } else {
this.searchData.BeginDate = ""; this.searchData.BeginDate = ''
this.searchData.EndDate = ""; this.searchData.EndDate = ''
} }
}, },
// //
handleReset() { handleReset() {
this.datetimerange = [] this.datetimerange = []
this.searchData = searchDataDefault(); this.searchData = searchDataDefault()
this.getList(); this.getList()
}, },
// //
handleSortByColumn(column) { handleSortByColumn(column) {
if (column.order === "ascending") { if (column.order === 'ascending') {
this.searchData.Asc = true; this.searchData.Asc = true
} else { } else {
this.searchData.Asc = false; this.searchData.Asc = false
} }
this.searchData.SortField = column.prop; this.searchData.SortField = column.prop
this.searchData.PageIndex = 1; this.searchData.PageIndex = 1
this.getList(); this.getList()
}, },
}, },
}; }
</script> </script>
<style lang="scss"> <style lang="scss">
.log { .log {

View File

@ -213,6 +213,7 @@ export default {
type: 'operate', type: 'operate',
label: this.$t('common:action:action'), label: this.$t('common:action:action'),
minWidth: 200, minWidth: 200,
fixed:"right",
operates: [ operates: [
{ {
name: this.$t('common:button:edit'), name: this.$t('common:button:edit'),