登录日志添加所在地,登录用户查询条件改为下拉框
continuous-integration/drone/push Build is passing Details

uat_us
wangxiaoshuang 2024-05-14 15:10:41 +08:00
parent baf2f9aa10
commit 289230b72c
5 changed files with 137 additions and 97 deletions

View File

@ -157,3 +157,12 @@ export function getUserLogList(params) {
data: params
})
}
// 获取登录用户
export function getTrialUserList(params) {
return request({
url: `/TrialMaintenance/getTrialUserList`,
method: 'get',
params
})
}

View File

@ -181,12 +181,12 @@ const actions = {
// user logout
async logout({ commit, state }) {
try{
await loginOut()
removeToken() // must remove token first
resetRouter()
removeName()
zzSessionStorage.clear()
commit('RESET_STATE')
await loginOut()
}catch(e){
console.log(e)
}

View File

@ -6,7 +6,11 @@
:label="$t('system:loginLog:label:OptType')"
prop="OptType"
>
<el-select v-model="searchData.OptType" clearable style="width:120px;">
<el-select
v-model="searchData.OptType"
clearable
style="width: 120px"
>
<el-option
v-for="item of $d.UserOptType"
:key="'UserOptType' + item.label"
@ -15,15 +19,12 @@
/>
</el-select>
</el-form-item>
<el-form-item
label="IP"
prop="IP"
>
<el-form-item label="IP" prop="IP">
<el-input
v-model="searchData.IP"
size="small"
clearable
style="width:120px;"
style="width: 120px"
/>
</el-form-item>
<el-form-item
@ -34,12 +35,10 @@
v-model="searchData.LoginFaildName"
size="small"
clearable
style="width:120px;"
style="width: 120px"
/>
</el-form-item>
<el-form-item
:label="$t('system:loginLog:label:CreateTime')"
>
<el-form-item :label="$t('system:loginLog:label:CreateTime')">
<el-date-picker
v-model="datetimerange"
type="datetimerange"
@ -55,22 +54,19 @@
size="mini"
@click="getList"
>
{{ $t('common:button:search') }}
{{ $t("common:button:search") }}
</el-button>
</el-form-item>
</el-form>
<el-table
v-loading="loading"
v-adaptive="{bottomOffset:45}"
v-adaptive="{ bottomOffset: 45 }"
height="100"
:data="list"
class="table"
@sort-change="handleSortByColumn"
>
<el-table-column
type="index"
width="50"
/>
<el-table-column type="index" width="50" />
<el-table-column
:label="$t('system:loginLog:table:OptType')"
prop="OptType"
@ -79,7 +75,7 @@
sortable="custom"
>
<template slot-scope="scope">
{{ $fd('UserOptType',scope.row.OptType) }}
{{ $fd("UserOptType", scope.row.OptType) }}
</template>
</el-table-column>
<el-table-column
@ -89,6 +85,13 @@
sortable="custom"
show-overflow-tooltip
/>
<el-table-column
:label="$t('trials:loginLog:table:IPRegion')"
prop="IPRegion"
min-width="120"
show-overflow-tooltip
sortable="custom"
/>
<el-table-column
:label="$t('system:loginLog:table:LoginFaildName')"
prop="LoginFaildName"
@ -111,7 +114,7 @@
show-overflow-tooltip
>
<template slot-scope="scope">
{{ $fd('UserType',scope.row.LoginUserTypeEnum) }}
{{ $fd("UserType", scope.row.LoginUserTypeEnum) }}
</template>
</el-table-column>
<el-table-column
@ -129,7 +132,7 @@
show-overflow-tooltip
>
<template slot-scope="scope">
{{ $fd('UserType',scope.row.OptUserTypeEnum) }}
{{ $fd("UserType", scope.row.OptUserTypeEnum) }}
</template>
</el-table-column>
<el-table-column
@ -140,7 +143,7 @@
show-overflow-tooltip
/>
</el-table>
<div class="pagination" style="text-align: right;margin-top:5px;">
<div class="pagination" style="text-align: right; margin-top: 5px">
<pagination
:total="total"
:page.sync="searchData.PageIndex"
@ -148,27 +151,26 @@
@pagination="getList"
/>
</div>
</div>
</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 moment from "moment";
const searchDataDefault = () => {
return {
OptType: null,
Ip: '',
LoginFaildName: '',
BeginDate: '',
EndDate: '',
Ip: "",
LoginFaildName: "",
BeginDate: "",
EndDate: "",
Asc: false,
SortField: 'CreateTime',
SortField: "CreateTime",
PageIndex: 1,
PageSize: 20
}
}
PageSize: 20,
};
};
export default {
components: { Pagination },
data() {
@ -178,76 +180,78 @@ export default {
list: [],
total: 0,
loading: false,
datetimerange: []
}
datetimerange: [],
};
},
mounted() {
this.getList()
this.getList();
},
methods: {
getList() {
this.loading = true
getUserLogList(this.searchData).then((res) => {
this.loading = false
this.list = res.Result.CurrentPageData
this.total = res.Result.TotalCount
}).catch(() => {
this.loading = false
})
this.loading = true;
getUserLogList(this.searchData)
.then((res) => {
this.loading = false;
this.list = res.Result.CurrentPageData;
this.total = res.Result.TotalCount;
})
.catch(() => {
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.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 {
height: 100%;
box-sizing: border-box;
display: flex;
padding: 10px;
border-radius: 5px;
.left {
display: flex;
flex-direction: column;
width: 0;
flex-grow: 4;
// border-right: 1px solid #ccc;
.filter-container {
display: flex;
align-items: center;
margin: 5px;
}
.data-table {
flex: 1;
padding: 5px 0px;
}
.pagination-container {
text-align: right;
}
}
}
</script>
<style lang="scss">
.log {
height: 100%;
box-sizing: border-box;
display: flex;
padding: 10px;
border-radius: 5px;
.left {
display: flex;
flex-direction: column;
width: 0;
flex-grow: 4;
// border-right: 1px solid #ccc;
.filter-container {
display: flex;
align-items: center;
margin: 5px;
}
.data-table {
flex: 1;
padding: 5px 0px;
}
.pagination-container {
text-align: right;
}
}
}
</style>

View File

@ -29,7 +29,7 @@
:IsCanConnectInternet="IsCanConnectInternet"
v-if="activeIndex === '2'"
/>
<login-log v-if="activeIndex === '3'" :name="userName" :isMine="true" />
<login-log v-if="activeIndex === '3'" :id="userId" :isMine="true" />
</div>
</div>
</template>

View File

@ -45,12 +45,14 @@
prop="LoginUserName"
v-if="!isMine"
>
<el-input
v-model="searchData.LoginUserName"
size="small"
clearable
style="width: 120px"
/>
<el-select v-model="searchData.UserId" clearable style="width: 120px">
<el-option
v-for="item of trialUserList"
:key="item.UserId"
:value="item.UserId"
:label="item.UserName"
/>
</el-select>
</el-form-item>
<el-form-item
:label="$t('trials:loginLog:table:userType')"
@ -126,6 +128,13 @@
show-overflow-tooltip
sortable="custom"
/>
<el-table-column
:label="$t('trials:loginLog:table:IPRegion')"
prop="IPRegion"
min-width="90"
show-overflow-tooltip
sortable="custom"
/>
<el-table-column
v-if="!isMine"
:label="$t('trials:loginLog:table:incorrectUserName')"
@ -156,7 +165,7 @@
v-if="!isMine"
:label="$t('trials:loginLog:table:optUserName')"
prop="OptUserName"
min-width="90"
min-width="160"
show-overflow-tooltip
sortable="custom"
/>
@ -164,7 +173,7 @@
v-if="!isMine"
:label="$t('trials:loginLog:table:optUserType')"
prop="OptUserTypeEnum"
min-width="90"
min-width="160"
show-overflow-tooltip
sortable="custom"
>
@ -192,7 +201,7 @@
</BaseContainer>
</template>
<script>
import { getUserLogList } from "@/api/user";
import { getUserLogList, getTrialUserList } from "@/api/user";
import BaseContainer from "@/components/BaseContainer";
import Pagination from "@/components/Pagination";
import moment from "moment";
@ -210,6 +219,7 @@ const searchDataDefault = () => {
SortField: "CreateTime",
PageIndex: 1,
PageSize: 20,
UserId: "",
};
};
export default {
@ -219,7 +229,7 @@ export default {
type: Boolean,
default: false,
},
name: {
id: {
type: String,
default: "",
},
@ -232,18 +242,35 @@ export default {
total: 0,
loading: false,
datetimerange: [],
trialUserList: [],
};
},
mounted() {
console.log(this.$d.UserOptType);
if (!this.isMine) {
this.getTrialUserList();
}
this.getList();
},
methods: {
//
async getTrialUserList() {
try {
let params = {
TrialId: this.$route.query.trialId,
};
let res = await getTrialUserList(params);
if (res.IsSuccess) {
this.trialUserList = res.Result;
}
} catch (err) {
console.log(err);
}
},
getList() {
this.loading = true;
this.searchData.TrialId = this.$route.query.trialId;
if (this.isMine) {
this.searchData.LoginUserName = this.name;
this.searchData.UserId = this.id;
}
getUserLogList(this.searchData)
.then((res) => {