<template>
|
<div class="logLog_box">
|
<My-bread
|
:list="[
|
`${$t('operatManage.operatManage')}`,
|
`${$t('operatManage.logLog')}`,
|
]"
|
></My-bread>
|
<el-divider />
|
<div class="inquire subpage_Div" ref="container">
|
<el-form :inline="true" ref="sizeForm" :model="sizeForm">
|
<div class="flex_box">
|
<div style="margin-right: auto">
|
<el-form-item
|
prop="uname"
|
:label="$t('operatManage.operationLogObj.username')"
|
>
|
<el-input
|
size="small"
|
style="width: 200px"
|
v-model="sizeForm.uname"
|
:placeholder="$t('operatManage.operationLogObj.pleaseInput')"
|
/>
|
</el-form-item>
|
<el-form-item
|
prop="type"
|
:label="$t('operatManage.operationLogObj.operationType')"
|
>
|
<el-select
|
size="small"
|
style="width: 200px"
|
:popper-append-to-body="false"
|
v-model="sizeForm.type"
|
:placeholder="$t('operatManage.operationLogObj.operationTypeHolder')"
|
>
|
<el-option :label="$t('loglog.login')" value="1" />
|
<el-option :label="$t('loglog.checkout')" value="2" />
|
<el-option :label="$t('loglog.logout')" value="3" />
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
prop="start"
|
:label="$t('operatManage.operationLogObj.startTime')"
|
>
|
<el-date-picker
|
size="small"
|
format="yyyy-MM-dd HH:mm:ss"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
v-model="sizeForm.start"
|
style="width: 200px"
|
type="datetime"
|
:placeholder="$t('operatManage.operationLogObj.startTimeHolder')"
|
></el-date-picker>
|
</el-form-item>
|
<el-form-item
|
prop="end"
|
:label="$t('operatManage.operationLogObj.endTime')"
|
>
|
<el-date-picker
|
size="small"
|
format="yyyy-MM-dd HH:mm:ss"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
v-model="sizeForm.end"
|
style="width: 200px"
|
type="datetime"
|
:placeholder="$t('operatManage.operationLogObj.endTimeHolder')"
|
>
|
</el-date-picker>
|
</el-form-item>
|
</div>
|
<div>
|
<el-form-item>
|
<el-button
|
@click="onSubmit"
|
icon="el-icon-search"
|
size="small"
|
type="primary"
|
>{{ $t("operatManage.operationLogObj.inquire") }}</el-button
|
>
|
<el-button
|
@click="onEmpty('sizeForm')"
|
icon="el-icon-delete"
|
type="info"
|
size="small"
|
>{{ $t("operatManage.operationLogObj.empty") }}</el-button
|
>
|
</el-form-item>
|
</div>
|
</div>
|
</el-form>
|
</div>
|
<div class="dividing-line"></div>
|
<!-- 表格显示 -->
|
<div class="table_box subpage_Div" :style="styleVar">
|
<el-table :data="tableData" style="width: 100%" height="calc(100% - 65px)" border>
|
<el-table-column
|
width="150"
|
type="index"
|
:label="$t('loglog.serialnumber')"
|
/>
|
<el-table-column sortable prop="uname" :label="$t('loglog.username')" />
|
<el-table-column
|
prop="appid"
|
sortable
|
:label="$t('loglog.applicationProgram')"
|
:formatter="formatAppid"
|
/>
|
<el-table-column sortable prop="ip" :label="$t('loglog.ipadress')" />
|
<el-table-column sortable prop="descr" :label="$t('loglog.describe')" />
|
<el-table-column
|
prop="optime"
|
:formatter="formatData"
|
sortable
|
:label="$t('loglog.operationtime')"
|
/>
|
<el-table-column
|
prop="type"
|
:formatter="formatType"
|
sortable
|
:label="$t('loglog.operationtype')"
|
/>
|
<el-table-column
|
prop="status"
|
:formatter="formatStatus"
|
sortable
|
:label="$t('loglog.operationStatus')"
|
/>
|
</el-table>
|
<!-- 分页 -->
|
<div style="margin-top: 10px" class="pagination_box">
|
<el-pagination
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
:current-page="listData.pageIndex"
|
:page-sizes="[10, 20, 50, 100]"
|
:page-size="listData.pageSize"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="count"
|
>
|
</el-pagination>
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import MyBread from "../../components/MyBread.vue";
|
import { loginSelectByPageAndCount } from "../../api/api";
|
export default {
|
//import引入的组件需要注入到对象中才能使用
|
components: {
|
MyBread,
|
},
|
|
data() {
|
return {
|
currentPage4: 1,
|
sizeForm: {
|
uname: "",
|
start: null,
|
end: null,
|
type: [],
|
},
|
tableData: [],
|
listData: {
|
pageIndex: 1,
|
pageSize: 10,
|
},
|
count: 0,
|
tableHeight: 0,
|
timer: 0,
|
styleVar: {
|
height: "calc(100% - 109px)",
|
},
|
};
|
},
|
beforeDestroy() {
|
this.timer && clearTimeout(this.timer);
|
window.removeEventListener("resize", this.onResize);
|
},
|
methods: {
|
onResize() {
|
this.timer && clearTimeout(this.timer);
|
this.timer = setTimeout(() => {
|
this.calHeight();
|
}, 500);
|
},
|
calHeight() {
|
this.$nextTick(() => {
|
const rect = this.$refs.container.getBoundingClientRect();
|
this.tableHeight = `${rect.height + 97}px`;
|
this.styleVar["height"] = `calc(100% - ${rect.height + 30}px)`;
|
// this.styleVar["height"] = `calc(100% - ${rect.height + 97}px)`;
|
});
|
},
|
//格式化列表
|
formatType(row, column) {
|
let data;
|
switch (row[column.property]) {
|
case 1:
|
data = "登录";
|
break;
|
case 2:
|
data = "校验";
|
break;
|
case 3:
|
data = "登出";
|
break;
|
}
|
return data;
|
},
|
formatStatus(row, column) {
|
let data;
|
switch (row[column.property]) {
|
case 1:
|
data = "成功";
|
break;
|
case 0:
|
data = "失败";
|
break;
|
}
|
return data;
|
},
|
formatAppid(row, column) {
|
let data;
|
switch (row[column.property]) {
|
case 1:
|
data = menuStartName;
|
break;
|
case 2:
|
data = "外部系统集成";
|
break;
|
}
|
return data;
|
},
|
//格式化时间
|
add0(m) {
|
return m < 10 ? "0" + m : m;
|
},
|
//格式化时间
|
format(shijianchuo) {
|
//shijianchuo是整数,否则要parseInt转换
|
var time = new Date(shijianchuo);
|
var y = time.getFullYear();
|
var m = time.getMonth() + 1;
|
var d = time.getDate();
|
var h = time.getHours();
|
var mm = time.getMinutes();
|
var s = time.getSeconds();
|
return (
|
y + "-" + this.add0(m) + "-" + this.add0(d)
|
// " " +
|
// this.add0(h) +
|
// ":" +
|
// this.add0(mm) +
|
// ":" +
|
// this.add0(s)
|
);
|
},
|
//格式化列表
|
formatData(row, column) {
|
let data = row[column.property];
|
if (data == null) {
|
return data;
|
}
|
return this.format(data);
|
},
|
handleSizeChange(val) {
|
this.listData.pageSize = val;
|
this.getList();
|
},
|
handleCurrentChange(val) {
|
this.listData.pageIndex = val;
|
this.getList();
|
},
|
onSubmit() {
|
this.listData = { ...this.listData, ...this.sizeForm };
|
// console.log(this.listData)
|
this.getList();
|
},
|
onEmpty(formData1) {
|
this.$refs[formData1].resetFields(); //重置表单数据
|
// this.sizeForm.start = null;
|
// this.sizeForm.end = null;
|
},
|
async getList() {
|
const data = await loginSelectByPageAndCount(this.listData);
|
|
if (data.code != 200) {
|
return this.$message.error("列表调用失败");
|
}
|
this.tableData = data.result;
|
this.count = data.count;
|
},
|
},
|
mounted() {
|
window.addEventListener("resize", this.onResize);
|
this.calHeight();
|
},
|
created() {
|
var val = this.$store.state.currentPerms;
|
var permsEntity = this.$store.state.permsEntity;
|
for (var i = 0; i < permsEntity.length; i++) {
|
if (permsEntity[i].perms == val) {
|
// this.showPermsMenu(permsEntity[i]);
|
console.log(permsEntity[i].tag);
|
}
|
}
|
this.getList();
|
},
|
};
|
</script>
|
<style lang="less" scoped>
|
//@import url(); 引入公共css类
|
.logLog_box {
|
height: 98%;
|
width: 98%;
|
padding: 0.5% 1%;
|
|
.inquire {
|
|
padding: 0 8px;
|
//margin-top: 20px;
|
|
border-radius: 5px;
|
|
//margin-bottom: 20px;
|
.el-form-item {
|
margin-bottom: 5px;
|
}
|
}
|
|
.text-center {
|
text-align: center;
|
}
|
}
|
</style>
|