|
|
|
|
<template>
|
|
|
|
|
<div class="cus-container">
|
|
|
|
|
<el-form :model="searchForm">
|
|
|
|
|
<div class="search">
|
|
|
|
|
<div>
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="searchForm.createBy"
|
|
|
|
|
placeholder="用户"
|
|
|
|
|
class="search-select"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in userList"
|
|
|
|
|
:key="item.createBy"
|
|
|
|
|
:label="item.createBy"
|
|
|
|
|
:value="item.createBy"
|
|
|
|
|
>
|
|
|
|
|
</el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="searchForm.title"
|
|
|
|
|
placeholder="操作模块"
|
|
|
|
|
class="search-select"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in moduleList"
|
|
|
|
|
:key="item"
|
|
|
|
|
:label="item"
|
|
|
|
|
:value="item"
|
|
|
|
|
>
|
|
|
|
|
</el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="searchForm.remoteIp"
|
|
|
|
|
placeholder="IP地址"
|
|
|
|
|
class="search-select"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in ipList"
|
|
|
|
|
:key="item.remoteIp"
|
|
|
|
|
:label="item.remoteIp"
|
|
|
|
|
:value="item.remoteIp"
|
|
|
|
|
>
|
|
|
|
|
</el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
<el-date-picker
|
|
|
|
|
style="width: 314px; margin-right: 20px"
|
|
|
|
|
v-model="searchForm.timeArr"
|
|
|
|
|
format="yyyy-MM-dd HH:mm"
|
|
|
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
|
|
class="search-picker"
|
|
|
|
|
type="datetimerange"
|
|
|
|
|
range-separator="至"
|
|
|
|
|
start-placeholder="开始日期"
|
|
|
|
|
end-placeholder="结束日期"
|
|
|
|
|
></el-date-picker>
|
|
|
|
|
<el-button class="search-btn" @click="searchHandle(1)"
|
|
|
|
|
>查询</el-button
|
|
|
|
|
>
|
|
|
|
|
<div class="search-reset" @click="searchHandle(2)">
|
|
|
|
|
<i class="el-icon-refresh-right" style="font-size: 20px"></i>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div style="margin-top: 30px">
|
|
|
|
|
<avue-crud
|
|
|
|
|
id="avue-id"
|
|
|
|
|
ref="crud"
|
|
|
|
|
:option="option"
|
|
|
|
|
:data="tableData"
|
|
|
|
|
:page.sync="page"
|
|
|
|
|
:table-loading="loading"
|
|
|
|
|
@current-change="currentChange"
|
|
|
|
|
@size-change="sizeChange"
|
|
|
|
|
>
|
|
|
|
|
<template slot="model" slot-scope="scope">
|
|
|
|
|
{{ scope.row.title.split("-")[0] }}
|
|
|
|
|
</template>
|
|
|
|
|
<template slot="title" slot-scope="scope">
|
|
|
|
|
{{ scope.row.title.split("-")[1] }}
|
|
|
|
|
</template>
|
|
|
|
|
</avue-crud>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import { getList, getConditionData } from "@/api/logs";
|
|
|
|
|
import { tableOption } from "@/const/journal/journal.js";
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
searchForm: {
|
|
|
|
|
timeArr: null,
|
|
|
|
|
},
|
|
|
|
|
option: tableOption,
|
|
|
|
|
page: {
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
currentPage: 1,
|
|
|
|
|
total: 0,
|
|
|
|
|
},
|
|
|
|
|
// 表格数据
|
|
|
|
|
tableData: [],
|
|
|
|
|
loading: false,
|
|
|
|
|
parentList: [],
|
|
|
|
|
levelList: [],
|
|
|
|
|
userList: [],
|
|
|
|
|
moduleList: [],
|
|
|
|
|
ipList: [],
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getDict();
|
|
|
|
|
this.onLoad();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 字典请求
|
|
|
|
|
getDict() {
|
|
|
|
|
getConditionData().then((res) => {
|
|
|
|
|
const { user, module, ip } = res.data.data;
|
|
|
|
|
this.userList = user;
|
|
|
|
|
this.moduleList = module;
|
|
|
|
|
this.ipList = ip;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 列表
|
|
|
|
|
onLoad() {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
const { currentPage, pageSize } = this.page;
|
|
|
|
|
if (
|
|
|
|
|
this.searchForm.timeArr !== null &&
|
|
|
|
|
this.searchForm.timeArr !== undefined
|
|
|
|
|
) {
|
|
|
|
|
this.searchForm.startTime = this.searchForm.timeArr[0];
|
|
|
|
|
this.searchForm.endTime = this.searchForm.timeArr[1];
|
|
|
|
|
}
|
|
|
|
|
const { createBy, title, remoteIp, startTime, endTime } = this.searchForm;
|
|
|
|
|
let params = {
|
|
|
|
|
createBy,
|
|
|
|
|
title,
|
|
|
|
|
remoteIp,
|
|
|
|
|
startTime,
|
|
|
|
|
endTime,
|
|
|
|
|
};
|
|
|
|
|
getList({ current:currentPage, size:pageSize, ...params }).then((res) => {
|
|
|
|
|
const { total, records } = res.data.data;
|
|
|
|
|
this.page.total = total;
|
|
|
|
|
this.tableData = records;
|
|
|
|
|
this.loading = false;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 分页
|
|
|
|
|
currentChange(currentPage) {
|
|
|
|
|
this.page.currentPage = currentPage;
|
|
|
|
|
this.onLoad();
|
|
|
|
|
},
|
|
|
|
|
sizeChange(pageSize) {
|
|
|
|
|
this.page.pageSize = pageSize;
|
|
|
|
|
this.onLoad();
|
|
|
|
|
},
|
|
|
|
|
// 查询重置
|
|
|
|
|
searchHandle(index) {
|
|
|
|
|
this.page.currentPage = 1;
|
|
|
|
|
if (index === 2) {
|
|
|
|
|
this.searchForm = {
|
|
|
|
|
timeArr: null,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
this.onLoad();
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.search {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
}
|
|
|
|
|
.search-select {
|
|
|
|
|
width: 150px;
|
|
|
|
|
margin-right: 20px;
|
|
|
|
|
}
|
|
|
|
|
.search-input {
|
|
|
|
|
width: 288px;
|
|
|
|
|
}
|
|
|
|
|
.search-btn {
|
|
|
|
|
width: 130px;
|
|
|
|
|
height: 46px !important;
|
|
|
|
|
background: #2e92f6;
|
|
|
|
|
color: #fff;
|
|
|
|
|
margin-left: 40px;
|
|
|
|
|
margin-right: 20px;
|
|
|
|
|
}
|
|
|
|
|
.search-reset {
|
|
|
|
|
display: inline-block;
|
|
|
|
|
width: 46px;
|
|
|
|
|
height: 44px !important;
|
|
|
|
|
background: #ff9130;
|
|
|
|
|
color: #fff;
|
|
|
|
|
text-align: center;
|
|
|
|
|
line-height: 46px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
/deep/ .el-input__inner {
|
|
|
|
|
height: 46px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|