Merge branch 'main' of https://gitea.frp.extimaging.com/XCKJ/irc_web into main
continuous-integration/drone/push Build is passing Details

uat_us
caiyiling 2024-12-27 10:53:13 +08:00
commit 407f0b85d2
6 changed files with 261 additions and 105 deletions

View File

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

View File

@ -135,7 +135,6 @@ const actions = {
zzSessionStorage.setItem('isTestUser', data.BasicInfo.IsTestUser)
commit('SET_ISTESTUSER', data.BasicInfo.IsTestUser)
commit('SET_USERNAME', data.BasicInfo.UserName)
commit('SET_USERID', data.BasicInfo.IdentityUserId)
setToken(data.JWTStr)
// setName(data.BasicInfo.RealName)
const userString = decodeURIComponent(escape(window.atob(data.JWTStr.split('.')[1].replace(/-/g, '+').replace(/_/g, '/'))))
@ -177,6 +176,8 @@ const actions = {
try {
commit('SET_TOKEN', data)
setToken(data)
commit('SET_USERID', userRoleId)
zzSessionStorage.setItem('userId', userRoleId)
const userString = decodeURIComponent(escape(window.atob(data.split('.')[1].replace(/-/g, '+').replace(/_/g, '/'))))
const user = JSON.parse(userString)
zzSessionStorage.setItem('userTypeShortName', user.userTypeShortName)

View File

@ -0,0 +1,89 @@
<template>
<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>
</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',
}
},
},
},
data() {
return {
curKeys: [
'UserName',
'FirstName',
'LastName',
'EMail',
'Phone',
'OrganizationName',
'PositionName',
'DepartmentName',
'UserRoleList',
],
}
},
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 (this.curKeys.includes(key)) {
curData[key] = obj[key]
}
})
return curData
},
},
}
</script>

View File

@ -77,19 +77,15 @@
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
@click="getList"
>
{{ $t("common:button:search") }}
<el-button type="primary" icon="el-icon-search" @click="getList">
{{ $t('common:button:search') }}
</el-button>
<el-button
type="primary"
icon="el-icon-refresh-left"
@click="handleReset"
>
{{ $t("common:button:reset") }}
{{ $t('common:button:reset') }}
</el-button>
</el-form-item>
</el-form>
@ -110,7 +106,7 @@
sortable="custom"
>
<template slot-scope="scope">
{{ $fd("UserOptType", scope.row.OptType) }}
{{ $fd('UserOptType', scope.row.OptType) }}
</template>
</el-table-column>
<el-table-column
@ -136,12 +132,12 @@
/>
<el-table-column
:label="$t('system:loginLog:table:LoginUserName')"
prop="LoginUserName"
prop="ActionUserName"
min-width="140"
show-overflow-tooltip
sortable="custom"
/>
<el-table-column
<!-- <el-table-column
:label="$t('system:loginLog:table:LoginUserType')"
prop="LoginUserTypeEnum"
min-width="120"
@ -151,15 +147,15 @@
<template slot-scope="scope">
{{ $fd("UserType", scope.row.LoginUserTypeEnum) }}
</template>
</el-table-column>
</el-table-column> -->
<el-table-column
:label="$t('system:loginLog:table:OptUserName')"
prop="OptUserName"
prop="TargetIdentityUserName"
min-width="200"
sortable="custom"
show-overflow-tooltip
/>
<el-table-column
<!-- <el-table-column
:label="$t('system:loginLog:table:OptUserType')"
prop="OptUserTypeEnum"
min-width="200"
@ -169,6 +165,21 @@
<template slot-scope="scope">
{{ $fd("UserType", scope.row.OptUserTypeEnum) }}
</template>
</el-table-column> -->
<el-table-column
:label="$t('system:loginLog:table:detail')"
min-width="120"
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
:label="$t('system:loginLog:table:CreateTime')"
@ -187,29 +198,31 @@
/>
</div>
</div>
<detail :config="config" :JsonObj="JsonObj" />
</div>
</template>
<script>
import { getUserLogList } from "@/api/user";
import Pagination from "@/components/Pagination";
import moment from "moment";
import { getUserLogList } from '@/api/user'
import Pagination from '@/components/Pagination'
import detail from './detail.vue'
import moment from 'moment'
const searchDataDefault = () => {
return {
OptType: null,
Ip: "",
LoginFaildName: "",
Ip: '',
LoginFaildName: '',
LoginUserName: '',
LoginUserTypeEnum: null,
BeginDate: "",
EndDate: "",
BeginDate: '',
EndDate: '',
Asc: false,
SortField: "CreateTime",
SortField: 'CreateTime',
PageIndex: 1,
PageSize: 20,
};
};
}
}
export default {
components: { Pagination },
components: { Pagination, detail },
data() {
return {
moment,
@ -218,52 +231,69 @@ export default {
total: 0,
loading: false,
datetimerange: [],
};
config: {
visible: false,
title: this.$t('system:loginLog:dialog:title'),
width: '500px',
top: '10vh',
},
JsonObj: null,
}
},
mounted() {
this.getList();
this.getList()
},
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)
)
this.JsonObj = row.JsonObj
this.config.visible = true
},
getList() {
this.loading = true;
this.loading = true
getUserLogList(this.searchData)
.then((res) => {
this.loading = false;
this.list = res.Result.CurrentPageData;
this.total = res.Result.TotalCount;
this.loading = false
this.list = res.Result.CurrentPageData
this.total = res.Result.TotalCount
})
.catch(() => {
this.loading = false;
});
this.loading = false
})
},
handleDatetimeChange(val) {
if (val) {
this.searchData.BeginDate = val[0];
this.searchData.EndDate = val[1];
this.searchData.BeginDate = val[0]
this.searchData.EndDate = val[1]
} else {
this.searchData.BeginDate = "";
this.searchData.EndDate = "";
this.searchData.BeginDate = ''
this.searchData.EndDate = ''
}
},
//
handleReset() {
this.datetimerange = []
this.searchData = searchDataDefault();
this.getList();
this.searchData = searchDataDefault()
this.getList()
},
//
handleSortByColumn(column) {
if (column.order === "ascending") {
this.searchData.Asc = true;
if (column.order === 'ascending') {
this.searchData.Asc = true
} else {
this.searchData.Asc = false;
this.searchData.Asc = false
}
this.searchData.SortField = column.prop;
this.searchData.PageIndex = 1;
this.getList();
this.searchData.SortField = column.prop
this.searchData.PageIndex = 1
this.getList()
},
},
};
}
</script>
<style lang="scss">
.log {

View File

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

View File

@ -86,7 +86,7 @@
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleSearch">
{{ $t("common:button:search") }}
{{ $t('common:button:search') }}
</el-button>
<!-- 重置 -->
<el-button
@ -94,7 +94,7 @@
icon="el-icon-refresh-left"
@click="handleReset"
>
{{ $t("common:button:reset") }}
{{ $t('common:button:reset') }}
</el-button>
</el-form-item>
</el-form>
@ -118,7 +118,7 @@
sortable="custom"
>
<template slot-scope="scope">
{{ $fd("UserOptType", scope.row.OptType) }}
{{ $fd('UserOptType', scope.row.OptType) }}
</template>
</el-table-column>
<el-table-column
@ -145,12 +145,12 @@
/>
<el-table-column
:label="$t('trials:loginLog:table:userName')"
prop="LoginUserName"
prop="ActionUserName"
min-width="90"
show-overflow-tooltip
sortable="custom"
/>
<el-table-column
<!-- <el-table-column
:label="$t('trials:loginLog:table:userType')"
prop="LoginUserTypeEnum"
min-width="90"
@ -158,18 +158,18 @@
sortable="custom"
>
<template slot-scope="scope">
{{ $fd("UserType", scope.row.LoginUserTypeEnum) }}
{{ $fd('UserType', scope.row.LoginUserTypeEnum) }}
</template>
</el-table-column>
</el-table-column> -->
<el-table-column
v-if="!isMine"
:label="$t('trials:loginLog:table:optUserName')"
prop="OptUserName"
min-width="160"
prop="TargetIdentityUserName"
min-width="120"
show-overflow-tooltip
sortable="custom"
/>
<el-table-column
<!-- <el-table-column
v-if="!isMine"
:label="$t('trials:loginLog:table:optUserType')"
prop="OptUserTypeEnum"
@ -178,7 +178,22 @@
sortable="custom"
>
<template slot-scope="scope">
{{ $fd("UserType", scope.row.OptUserTypeEnum) }}
{{ $fd('UserType', scope.row.OptUserTypeEnum) }}
</template>
</el-table-column> -->
<el-table-column
:label="$t('trials:loginLog:table:detail')"
min-width="80"
show-overflow-tooltip
>
<template slot-scope="scope">
<el-button
v-if="scope.row.JsonObj"
type="text"
@click="handleOpenDialog(scope.row)"
>
<span>{{ $t('trials:loginLog:message:detail') }}</span>
</el-button>
</template>
</el-table-column>
<el-table-column
@ -198,32 +213,34 @@
@pagination="getList"
/>
</template>
<detail :config="config" :JsonObj="JsonObj" />
</BaseContainer>
</template>
<script>
import { getUserLogList, getTrialUserList } from "@/api/user";
import BaseContainer from "@/components/BaseContainer";
import Pagination from "@/components/Pagination";
import moment from "moment";
import { getUserLogList, getTrialUserList } from '@/api/user'
import BaseContainer from '@/components/BaseContainer'
import Pagination from '@/components/Pagination'
import moment from 'moment'
import detail from '@/views/system/login-log/detail.vue'
const searchDataDefault = () => {
return {
TrialId: "",
TrialId: '',
OptType: null,
Ip: "",
LoginFaildName: "",
LoginUserName: "",
Ip: '',
LoginFaildName: '',
LoginUserName: '',
LoginUserTypeEnum: null,
BeginDate: "",
EndDate: "",
BeginDate: '',
EndDate: '',
Asc: false,
SortField: "CreateTime",
SortField: 'CreateTime',
PageIndex: 1,
PageSize: 20,
UserId: "",
};
};
UserId: '',
}
}
export default {
components: { BaseContainer, Pagination },
components: { BaseContainer, Pagination, detail },
props: {
isMine: {
type: Boolean,
@ -231,7 +248,7 @@ export default {
},
id: {
type: String,
default: "",
default: '',
},
},
data() {
@ -243,75 +260,92 @@ export default {
loading: false,
datetimerange: [],
trialUserList: [],
};
config: {
visible: false,
title: this.$t('trials:loginLog:dialog:title'),
width: '500px',
top: '10vh',
},
JsonObj: null,
}
},
mounted() {
if (!this.isMine) {
this.getTrialUserList();
this.getTrialUserList()
}
this.getList();
this.getList()
},
methods: {
handleOpenDialog(row) {
if (!row.JsonObj)
return this.$message.warning(this.$t('trials:loginLog:message:noJSON'))
this.config.title = this.$t('trials:loginLog:dialog:title').replace(
'xxx',
this.$fd('UserOptType', row.OptType)
)
this.JsonObj = row.JsonObj
this.config.visible = true
},
//
async getTrialUserList() {
try {
let params = {
TrialId: this.$route.query.trialId,
};
let res = await getTrialUserList(params);
}
let res = await getTrialUserList(params)
if (res.IsSuccess) {
this.trialUserList = res.Result;
this.trialUserList = res.Result
}
} catch (err) {
console.log(err);
console.log(err)
}
},
getList() {
this.loading = true;
this.searchData.TrialId = this.$route.query.trialId;
this.loading = true
this.searchData.TrialId = this.$route.query.trialId
if (this.isMine) {
this.searchData.UserId = this.id;
this.searchData.UserId = this.id
}
getUserLogList(this.searchData)
.then((res) => {
this.loading = false;
this.list = res.Result.CurrentPageData;
this.total = res.Result.TotalCount;
this.loading = false
this.list = res.Result.CurrentPageData
this.total = res.Result.TotalCount
})
.catch(() => {
this.loading = false;
});
this.loading = false
})
},
handleDatetimeChange(val) {
if (val) {
this.searchData.BeginDate = val[0];
this.searchData.EndDate = val[1];
this.searchData.BeginDate = val[0]
this.searchData.EndDate = val[1]
} else {
this.searchData.BeginDate = "";
this.searchData.EndDate = "";
this.searchData.BeginDate = ''
this.searchData.EndDate = ''
}
},
handleSearch() {
this.searchData.PageIndex = 1;
this.getList();
this.searchData.PageIndex = 1
this.getList()
},
//
handleReset() {
this.datetimerange = null;
this.searchData = searchDataDefault();
this.getList();
this.datetimerange = null
this.searchData = searchDataDefault()
this.getList()
},
//
handleSortByColumn(column) {
if (column.order === "ascending") {
this.searchData.Asc = true;
if (column.order === 'ascending') {
this.searchData.Asc = true
} else {
this.searchData.Asc = false;
this.searchData.Asc = false
}
this.searchData.SortField = column.prop;
this.searchData.PageIndex = 1;
this.getList();
this.searchData.SortField = column.prop
this.searchData.PageIndex = 1
this.getList()
},
},
};
}
</script>