318 lines
8.6 KiB
Vue
318 lines
8.6 KiB
Vue
<template>
|
|
<BaseContainer>
|
|
<template slot="search-container">
|
|
<el-form :inline="true">
|
|
<el-form-item
|
|
:label="$t('trials:loginLog:table:optType')"
|
|
prop="OptType"
|
|
>
|
|
<el-select
|
|
v-model="searchData.OptType"
|
|
clearable
|
|
style="width: 120px"
|
|
>
|
|
<el-option
|
|
v-for="item of $d.UserOptType"
|
|
v-show="item.value !== 3 && item.value !== 10 && item.value !== 9"
|
|
:key="'UserOptType' + item.label"
|
|
:value="item.value"
|
|
:label="item.label"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="IP" prop="IP">
|
|
<el-input
|
|
v-model="searchData.IP"
|
|
size="small"
|
|
clearable
|
|
style="width: 120px"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item
|
|
:label="$t('trials:loginLog:table:incorrectUserName')"
|
|
prop="LoginFaildName"
|
|
v-if="!isMine"
|
|
>
|
|
<el-input
|
|
v-model="searchData.LoginFaildName"
|
|
size="small"
|
|
clearable
|
|
style="width: 120px"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item
|
|
:label="$t('trials:loginLog:table:userName')"
|
|
prop="LoginUserName"
|
|
v-if="!isMine"
|
|
>
|
|
<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')"
|
|
prop="OptType"
|
|
v-if="!isMine"
|
|
>
|
|
<el-select
|
|
v-model="searchData.LoginUserTypeEnum"
|
|
clearable
|
|
style="width: 120px"
|
|
>
|
|
<el-option
|
|
v-for="item of $d.UserType"
|
|
v-show="item.value !== 7 && item.value !== 8"
|
|
:key="'UserType' + item.label"
|
|
:value="item.value"
|
|
:label="item.label"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item :label="$t('trials:loginLog:table:createTime')">
|
|
<el-date-picker
|
|
v-model="datetimerange"
|
|
type="datetimerange"
|
|
:default-time="['00:00:00', '23:59:59']"
|
|
:start-placeholder="$t('trials:loginLog:table:beginTime')"
|
|
:end-placeholder="$t('trials:loginLog:table:endTime')"
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
@change="handleDatetimeChange"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" icon="el-icon-search" @click="handleSearch">
|
|
{{ $t("common:button:search") }}
|
|
</el-button>
|
|
<!-- 重置 -->
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-refresh-left"
|
|
@click="handleReset"
|
|
>
|
|
{{ $t("common:button:reset") }}
|
|
</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
</template>
|
|
<template slot="main-container">
|
|
<el-table
|
|
v-loading="loading"
|
|
v-adaptive="{ bottomOffset: isMine ? 80 : 60 }"
|
|
height="100"
|
|
:data="list"
|
|
class="table"
|
|
@sort-change="handleSortByColumn"
|
|
:default-sort="{ prop: 'CreateTime', order: 'descending' }"
|
|
>
|
|
<el-table-column type="index" width="50" />
|
|
<el-table-column
|
|
:label="$t('trials:loginLog:table:optType')"
|
|
prop="OptType"
|
|
min-width="90"
|
|
show-overflow-tooltip
|
|
sortable="custom"
|
|
>
|
|
<template slot-scope="scope">
|
|
{{ $fd("UserOptType", scope.row.OptType) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="IP"
|
|
prop="IP"
|
|
min-width="90"
|
|
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')"
|
|
prop="LoginFaildName"
|
|
min-width="90"
|
|
show-overflow-tooltip
|
|
sortable="custom"
|
|
/>
|
|
<el-table-column
|
|
:label="$t('trials:loginLog:table:userName')"
|
|
prop="LoginUserName"
|
|
min-width="90"
|
|
show-overflow-tooltip
|
|
sortable="custom"
|
|
/>
|
|
<el-table-column
|
|
:label="$t('trials:loginLog:table:userType')"
|
|
prop="LoginUserTypeEnum"
|
|
min-width="90"
|
|
show-overflow-tooltip
|
|
sortable="custom"
|
|
>
|
|
<template slot-scope="scope">
|
|
{{ $fd("UserType", scope.row.LoginUserTypeEnum) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
v-if="!isMine"
|
|
:label="$t('trials:loginLog:table:optUserName')"
|
|
prop="OptUserName"
|
|
min-width="160"
|
|
show-overflow-tooltip
|
|
sortable="custom"
|
|
/>
|
|
<el-table-column
|
|
v-if="!isMine"
|
|
:label="$t('trials:loginLog:table:optUserType')"
|
|
prop="OptUserTypeEnum"
|
|
min-width="160"
|
|
show-overflow-tooltip
|
|
sortable="custom"
|
|
>
|
|
<template slot-scope="scope">
|
|
{{ $fd("UserType", scope.row.OptUserTypeEnum) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
:label="$t('trials:loginLog:table:createTime')"
|
|
prop="CreateTime"
|
|
min-width="90"
|
|
show-overflow-tooltip
|
|
sortable="custom"
|
|
/>
|
|
</el-table>
|
|
<!-- 分页组件 -->
|
|
<pagination
|
|
class="page"
|
|
:total="total"
|
|
:page.sync="searchData.PageIndex"
|
|
:limit.sync="searchData.PageSize"
|
|
@pagination="getList"
|
|
/>
|
|
</template>
|
|
</BaseContainer>
|
|
</template>
|
|
<script>
|
|
import { getUserLogList, getTrialUserList } from "@/api/user";
|
|
import BaseContainer from "@/components/BaseContainer";
|
|
import Pagination from "@/components/Pagination";
|
|
import moment from "moment";
|
|
const searchDataDefault = () => {
|
|
return {
|
|
TrialId: "",
|
|
OptType: null,
|
|
Ip: "",
|
|
LoginFaildName: "",
|
|
LoginUserName: "",
|
|
LoginUserTypeEnum: null,
|
|
BeginDate: "",
|
|
EndDate: "",
|
|
Asc: false,
|
|
SortField: "CreateTime",
|
|
PageIndex: 1,
|
|
PageSize: 20,
|
|
UserId: "",
|
|
};
|
|
};
|
|
export default {
|
|
components: { BaseContainer, Pagination },
|
|
props: {
|
|
isMine: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
id: {
|
|
type: String,
|
|
default: "",
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
moment,
|
|
searchData: searchDataDefault(),
|
|
list: [],
|
|
total: 0,
|
|
loading: false,
|
|
datetimerange: [],
|
|
trialUserList: [],
|
|
};
|
|
},
|
|
mounted() {
|
|
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.UserId = this.id;
|
|
}
|
|
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];
|
|
} else {
|
|
this.searchData.BeginDate = "";
|
|
this.searchData.EndDate = "";
|
|
}
|
|
},
|
|
handleSearch() {
|
|
this.searchData.PageIndex = 1;
|
|
this.getList();
|
|
},
|
|
// 重置列表查询
|
|
handleReset() {
|
|
this.datetimerange = null;
|
|
this.searchData = searchDataDefault();
|
|
this.getList();
|
|
},
|
|
// 排序
|
|
handleSortByColumn(column) {
|
|
if (column.order === "ascending") {
|
|
this.searchData.Asc = true;
|
|
} else {
|
|
this.searchData.Asc = false;
|
|
}
|
|
this.searchData.SortField = column.prop;
|
|
this.searchData.PageIndex = 1;
|
|
this.getList();
|
|
},
|
|
},
|
|
};
|
|
</script>
|