Browse Source

日志

master
luobinjie 3 months ago
parent
commit
4383eed668
  1. 126
      src/views/user-list/AuditLog.vue

126
src/views/user-list/AuditLog.vue

@ -7,8 +7,60 @@
<span class="contenttitleBold">安全日志</span>
</div>
</div>
<div style="background-color: #fff; padding: 15px; border-radius: 8px;display: flex;flex-wrap: wrap; margin-bottom: 10px;height:35px;margin-top: 7px;">
<div class="query">
<span>开始时间</span>
<el-date-picker
type="datetime"
placeholder="选择开始时间"
size="small"
v-model="startDate"
value-format="yyyy-MM-dd HH:mm:ss"
editable
style="width: 177px;"
>
</el-date-picker>
</div>
<div class="query">
<span>结束时间</span>
<el-date-picker
type="datetime"
placeholder="选择结束时间"
size="small"
v-model="endDate"
value-format="yyyy-MM-dd HH:mm:ss"
editable
style="width: 177px;"
>
</el-date-picker>
</div>
<div class="query">
<span>操作用户</span>
<el-select
v-model="username"
placeholder="请选择"
size="small"
filterable
>
<el-option
v-for="item in registrardata"
:key="item.id"
:label="item.surname"
:value="item.userName"
>
</el-option>
</el-select>
</div>
<div class="query">
<span>请求地址</span>
<el-input placeholder="请输入" size="small" v-model="url" style="width: 177px;"></el-input>
</div>
<div class="query">
<el-button size="small" @click="onSubmit" class="commonbutton">查询</el-button>
</div>
</div>
<div style="display: block; margin-top: 7px;">
<el-table :data="tableData" :height="window.pageHeight < 600 ? 480 : window.pageHeight - 175" border>
<el-table :data="tableData" :height="window.pageHeight < 600 ? 415 : window.pageHeight - 225" border>
<el-table-column prop="userName" label="用户名" width="70" align="center">
</el-table-column>
<el-table-column prop="httpStatusCode" label="状态" width="50" align="center">
@ -40,23 +92,15 @@
<!-- 详情弹框 -->
<el-dialog title="日志详情" :visible.sync="dialogVisible" width="80%" :close-on-click-modal="false">
<el-table :data="detailedinformationdata" style="width: 100%;margin-bottom: 10px;">
<el-table-column prop="userName" label="用户名" width="80">
<el-table-column prop="serviceName" label="服务名称">
</el-table-column>
<el-table-column prop="httpStatusCode" label="状态" width="80">
<el-table-column prop="methodName" label="方法名称">
</el-table-column>
<el-table-column prop="url" label="地址" width="180">
<el-table-column prop="parameters" label="请求参数">
</el-table-column>
<el-table-column prop="clientIpAddress" label="ip地址" width="120">
</el-table-column>
<el-table-column prop="clientId" label="客户端id" width="100"></el-table-column>
<el-table-column prop="httpMethod" label="请求方法" width="80"></el-table-column>
<el-table-column prop="executionTime" label="时间" width="180">
<template slot-scope="scope">
{{ scope.row.executionTime | dateFormat }}
</template>
</el-table-column>
<el-table-column prop="browserInfo" label="浏览器信息" width="">
<el-table-column prop="executionTime" label="执行时间">
</el-table-column>
<el-table-column prop="executionDuration" label="请求耗时"></el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false" class="difference"> </el-button>
@ -68,6 +112,7 @@
</template>
<script>
import { dailyrecord, querylog } from "@/request/ruquset";
import { getapi, postapi, putapi, deletapi } from "@/api/api";
import { mapState } from "vuex";
export default {
data() {
@ -80,10 +125,15 @@ export default {
},
dialogVisible: false,
detailedinformationdata: [],
registrardata:[],
username: "",
startDate: "",
endDate: "",
url: "",
};
},
created() {
this.cratlist();
// this.cratlist()
},
watch: {
@ -92,37 +142,54 @@ export default {
...mapState(["window"]),
},
mounted() {
this.getList()
},
methods: {
cratlist() {
// /api/app/audit-log
dailyrecord(this.pages).then((res) => {
dailyrecord({
startTime: this.startDate,
endTime: this.endDate,
userName: this.username,
url: this.url,
skipCount: this.pages.skipCount,
maxResultCount: this.pages.maxResultCount,
}).then((res) => {
if (res.code != -1) {
this.tableData = res.data;
}
});
},
getList() {
getapi("/api/identity/users/getlist",{
SkipCount: 0,
MaxResultCount: 1000,
}).then((res) => {
if (res.code != -1) {
this.registrardata = [...res.data.items];
}
});
},
//
handleSizeChange(v) {
this.pages.maxResultCount = v;
this.cratlist();
this.onSubmit();
},
handleCurrentChange(v) {
this.pages.skipCount = v;
this.pages.skipCount = v-1;
(this.pages.currentPage - 1) * this.pages.MaxResultCount;
this.cratlist();
this.onSubmit();
},
//
inquireabout(row) {
this.dialogVisible = true;
this.detailedinformationdata = [];
querylog(row.id).then((res) => {
postapi('/api/app/AuditLog/GetAuditLogActionByAuditLogId',{
auditLogId:row.id
}).then((res) => {
if (res.code != -1) {
if (row.id == res.data.id) {
this.detailedinformationdata.push(res.data);
}
}
});
},
@ -130,6 +197,9 @@ export default {
// this.detailedinformationdata = [];
this.dialogVisible = false;
},
onSubmit(){
this.cratlist()
},
},
};
</script>
@ -178,4 +248,14 @@ export default {
font-family: "NotoSansSC-Regular";
float: right;
}
.query{
margin-right: 10px;
display: flex;
justify-content: center;
align-items: center;
font-size: 14px;
color: #232748;
font-size: 400;
font-family: "NotoSansSC-Regular";
}
</style>
Loading…
Cancel
Save