登录日志添加所在地,登录用户查询条件改为下拉框
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 data: params
}) })
} }
// 获取登录用户
export function getTrialUserList(params) {
return request({
url: `/TrialMaintenance/getTrialUserList`,
method: 'get',
params
})
}

View File

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

View File

@ -6,7 +6,11 @@
:label="$t('system:loginLog:label:OptType')" :label="$t('system:loginLog:label:OptType')"
prop="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 <el-option
v-for="item of $d.UserOptType" v-for="item of $d.UserOptType"
:key="'UserOptType' + item.label" :key="'UserOptType' + item.label"
@ -15,15 +19,12 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="IP" prop="IP">
label="IP"
prop="IP"
>
<el-input <el-input
v-model="searchData.IP" v-model="searchData.IP"
size="small" size="small"
clearable clearable
style="width:120px;" style="width: 120px"
/> />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
@ -34,12 +35,10 @@
v-model="searchData.LoginFaildName" v-model="searchData.LoginFaildName"
size="small" size="small"
clearable clearable
style="width:120px;" style="width: 120px"
/> />
</el-form-item> </el-form-item>
<el-form-item <el-form-item :label="$t('system:loginLog:label:CreateTime')">
:label="$t('system:loginLog:label:CreateTime')"
>
<el-date-picker <el-date-picker
v-model="datetimerange" v-model="datetimerange"
type="datetimerange" type="datetimerange"
@ -55,22 +54,19 @@
size="mini" size="mini"
@click="getList" @click="getList"
> >
{{ $t('common:button:search') }} {{ $t("common:button:search") }}
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table <el-table
v-loading="loading" v-loading="loading"
v-adaptive="{bottomOffset:45}" v-adaptive="{ bottomOffset: 45 }"
height="100" height="100"
:data="list" :data="list"
class="table" class="table"
@sort-change="handleSortByColumn" @sort-change="handleSortByColumn"
> >
<el-table-column <el-table-column type="index" width="50" />
type="index"
width="50"
/>
<el-table-column <el-table-column
:label="$t('system:loginLog:table:OptType')" :label="$t('system:loginLog:table:OptType')"
prop="OptType" prop="OptType"
@ -79,7 +75,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
@ -89,6 +85,13 @@
sortable="custom" sortable="custom"
show-overflow-tooltip 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 <el-table-column
:label="$t('system:loginLog:table:LoginFaildName')" :label="$t('system:loginLog:table:LoginFaildName')"
prop="LoginFaildName" prop="LoginFaildName"
@ -111,7 +114,7 @@
show-overflow-tooltip show-overflow-tooltip
> >
<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
@ -129,7 +132,7 @@
show-overflow-tooltip show-overflow-tooltip
> >
<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>
<el-table-column <el-table-column
@ -140,7 +143,7 @@
show-overflow-tooltip show-overflow-tooltip
/> />
</el-table> </el-table>
<div class="pagination" style="text-align: right;margin-top:5px;"> <div class="pagination" style="text-align: right; margin-top: 5px">
<pagination <pagination
:total="total" :total="total"
:page.sync="searchData.PageIndex" :page.sync="searchData.PageIndex"
@ -148,27 +151,26 @@
@pagination="getList" @pagination="getList"
/> />
</div> </div>
</div> </div>
</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";
const searchDataDefault = () => { const searchDataDefault = () => {
return { return {
OptType: null, OptType: null,
Ip: '', Ip: "",
LoginFaildName: '', LoginFaildName: "",
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 },
data() { data() {
@ -178,76 +180,78 @@ export default {
list: [], list: [],
total: 0, total: 0,
loading: false, loading: false,
datetimerange: [] datetimerange: [],
} };
}, },
mounted() { mounted() {
this.getList() this.getList();
}, },
methods: { methods: {
getList() { getList() {
this.loading = true this.loading = true;
getUserLogList(this.searchData).then((res) => { getUserLogList(this.searchData)
this.loading = false .then((res) => {
this.list = res.Result.CurrentPageData this.loading = false;
this.total = res.Result.TotalCount this.list = res.Result.CurrentPageData;
}).catch(() => { this.total = res.Result.TotalCount;
this.loading = false })
}) .catch(() => {
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.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>
<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> </style>

View File

@ -29,7 +29,7 @@
:IsCanConnectInternet="IsCanConnectInternet" :IsCanConnectInternet="IsCanConnectInternet"
v-if="activeIndex === '2'" 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>
</div> </div>
</template> </template>

View File

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