fix conflict

This commit is contained in:
wcy 2024-10-16 09:09:39 +08:00
commit 3ffdfc5fe6
6 changed files with 609 additions and 404 deletions

View File

@ -6,7 +6,7 @@
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"dev": "vue-cli-service serve", "dev": "vue-cli-service serve",
"build:prod": "vue-cli-service build", "build": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging", "build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview", "preview": "node build/index.js --preview",
"lint": "eslint --ext .js,.vue src" "lint": "eslint --ext .js,.vue src"

View File

@ -252,8 +252,8 @@
</template> </template>
<script> <script>
import { addUnit, delUnit, unitInfoAll, updateUnit } from '@/api/base/base' // import { addUnit, delUnit, unitInfoAll, updateUnit } from '@/api/base/base'
import { unitTypeListAll } from '@/api/base/base' // import { unitTypeListAll } from '@/api/base/base'
import { deptTreeSelect } from '@/api/system/user' import { deptTreeSelect } from '@/api/system/user'
import Treeselect from '@riophae/vue-treeselect' import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'

View File

@ -149,7 +149,7 @@
prop="userName" prop="userName"
> >
<!-- <template slot-scope="scope"> <!-- <template slot-scope="scope">
</template> --> </template> -->
</el-table-column> </el-table-column>
@ -200,7 +200,7 @@
v-model="form.deptId" v-model="form.deptId"
:options="deptOptions" :options="deptOptions"
:show-count="true" :show-count="true"
noChildrenText="没有数据了" noOptionsText="没有数据" noResultsText="没有搜索结果" noChildrenText="没有数据了" noOptionsText="没有数据" noResultsText="没有搜索结果"
placeholder="请选择归属部门" placeholder="请选择归属部门"
/> />
</el-form-item> </el-form-item>
@ -287,7 +287,7 @@
<el-form-item label="岗位"> <el-form-item label="岗位">
<el-select <el-select
v-model="form.postIds" v-model="form.postIds"
multiple filterable multiple filterable
placeholder="请选择岗位" placeholder="请选择岗位"
> >
<el-option <el-option
@ -304,7 +304,7 @@
<el-form-item label="角色"> <el-form-item label="角色">
<el-select <el-select
v-model="form.roleIds" v-model="form.roleIds"
multiple filterable multiple filterable
placeholder="请选择角色" placeholder="请选择角色"
> >
<el-option <el-option
@ -381,10 +381,9 @@
</template> </template>
<script> <script>
import { deptTreeSelect } from "@/api/system/user"; import { deptTreeSelect } from "@/api/system/user";
import { getUserList, getTypeList, unitPersonAll, delUnitPerson } from "@/api/base/base"; import { getUserList, getTypeList, unitPersonAll, delUnitPerson } from "@/api/base/base";
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
@ -609,7 +608,7 @@ export default {
}else{ }else{
this.$modal.msgError("请先选择配置人员!"); this.$modal.msgError("请先选择配置人员!");
} }
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */

View File

@ -1,42 +1,98 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<div class="filter-container"> <div class="filter-container">
<el-input
<el-input v-model="listQuery.ip" placeholder="请输入IP地址" v-model="listQuery.ip"
style="width: 200px" class="filter-item ml-20" :maxlength="30" placeholder="请输入IP地址"
style="width: 200px"
class="filter-item ml-20"
:maxlength="30"
@keyup.enter.native="handleFilter" @keyup.enter.native="handleFilter"
/> />
<el-date-picker <el-date-picker
v-model="rangeDate" v-model="rangeDate"
style="width: 300px" style="width: 300px"
class="filter-item ml-20" class="filter-item ml-20"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
type="daterange" type="daterange"
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
/> />
<el-select v-model="listQuery.grade" placeholder="请选择异常等级" style="width: 200px" class="filter-item ml-20"> <el-select
<el-option v-for="item in Object.keys(levelList)" :key="item" :value="levelList[item]" :label="levelList[item]" /> v-model="listQuery.grade"
placeholder="请选择异常等级"
style="width: 200px"
class="filter-item ml-20"
>
<el-option
v-for="item in Object.keys(levelList)"
:key="item"
:value="levelList[item]"
:label="levelList[item]"
/>
</el-select> </el-select>
<!-- <el-input v-model="listQuery.errType" placeholder="请输入异常类型" <!-- <el-input v-model="listQuery.errType" placeholder="请输入异常类型"
style="width: 200px" class="filter-item" :maxlength="30" style="width: 200px" class="filter-item" :maxlength="30"
@keyup.enter.native="handleFilter" @keyup.enter.native="handleFilter"
/> --> /> -->
<el-select v-model="listQuery.errType" placeholder="请选择异常类型" style="width: 200px" class="filter-item ml-20"> <el-select
<el-option v-for="item in Object.keys(typeList)" :key="item" :value="typeList[item]" :label="typeList[item]" /> v-model="listQuery.errType"
placeholder="请选择异常类型"
style="width: 200px"
class="filter-item ml-20"
>
<el-option
v-for="item in Object.keys(typeList)"
:key="item"
:value="typeList[item]"
:label="typeList[item]"
/>
</el-select> </el-select>
<el-select v-model="listQuery.logSort" clearable filterable style="width: 200px" class="filter-item ml-20" placeholder="请选择" > <el-select
<el-option v-for="item in timeList" :key="item.id" :label="item.name" :value="item.id" /> v-model="listQuery.logSort"
clearable
filterable
style="width: 200px"
class="filter-item ml-20"
placeholder="请选择"
>
<el-option
v-for="item in timeList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select> </el-select>
<el-select v-model="listQuery.logDesc" clearable filterable style="width: 200px" class="filter-item ml-20" placeholder="请选择" > <el-select
<el-option v-for="item in sortList" :key="item.id" :label="item.name" :value="item.id" /> v-model="listQuery.logDesc"
clearable
filterable
style="width: 200px"
class="filter-item ml-20"
placeholder="请选择"
>
<el-option
v-for="item in sortList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select> </el-select>
<el-button style="margin-left: 20px" class="filter-item" type="primary" @click="handleFilter"> <el-button
style="margin-left: 20px"
class="filter-item"
type="primary"
@click="handleFilter"
>
查询 查询
</el-button> </el-button>
<el-button style="margin-left: 20px" class="filter-item" @click="resetFilter"> <el-button
style="margin-left: 20px"
class="filter-item"
@click="resetFilter"
>
重置 重置
</el-button> </el-button>
<!-- <el-button @click="handleBackups" class="filter-item" style="margin-left: 20px" type="warning"> <!-- <el-button @click="handleBackups" class="filter-item" style="margin-left: 20px" type="warning">
@ -55,28 +111,33 @@
:max-height="tableHeight" :max-height="tableHeight"
> >
<el-table-column label="序号" align="center" width="80" type="index"> <el-table-column label="序号" align="center" width="80" type="index">
<template scope="scope"> <template slot-scope="scope">
<span>{{ (listQuery.pageNum - 1) * listQuery.pageSize + scope.$index + 1 }}</span> <span>{{
(listQuery.pageNum - 1) * listQuery.pageSize + scope.$index + 1
}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作人" align="center" prop="operaUserName"> <el-table-column label="操作人" align="center" prop="operaUserName">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.operaUserName||'/' }}</span> <span>{{ scope.row.operaUserName || "/" }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作时间" align="center" prop="operTime" width="180"/> <el-table-column
<el-table-column label="IP地址" align="center" prop="ip"/> label="操作时间"
<el-table-column label="操作模块" align="center" prop="model" > align="center"
prop="operTime"
width="180"
/>
<el-table-column label="IP地址" align="center" prop="ip" />
<el-table-column label="操作模块" align="center" prop="model">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.model||'/' }}</span> <span>{{ scope.row.model || "/" }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="异常类型" align="center" prop="errType" /> <el-table-column label="异常类型" align="center" prop="errType" />
<el-table-column label="异常原因" align="center" prop="operateDetail"/> <el-table-column label="异常原因" align="center" prop="operateDetail" />
<el-table-column label="异常等级" align="center" prop="grade"/> <el-table-column label="异常等级" align="center" prop="grade" />
<!-- <el-table-column label="事件结果" align="center" prop="failureReason"/> --> <!-- <el-table-column label="事件结果" align="center" prop="failureReason"/> -->
<el-table-column label="操作类型" align="center" prop="operType" /> <el-table-column label="操作类型" align="center" prop="operType" />
<!-- <!--
<el-table-column label="操作详情" align="center" prop="operateDetail" /> <el-table-column label="操作详情" align="center" prop="operateDetail" />
@ -103,22 +164,21 @@
</template> </template>
<script> <script>
import Pagination from '@/components/Pagination' import Pagination from "@/components/Pagination";
import _ from 'lodash/fp' import _ from "lodash/fp";
import { downloadFile } from '@/utils/download' import { downloadFile } from "@/utils/download";
import { getErrLogs,downloadErrLogs } from '@/api/system/log'
import { getErrLogs, downloadErrLogs } from "@/api/system/log";
const levelList = { const levelList = {
1:'高', 1: "高",
2:'中', 2: "中",
3:'低' 3: "低",
}; };
const typeList = { const typeList = {
1:'越权访问', 1: "越权访问",
2:'IP异常', 2: "IP异常",
// 3:'', // 3:'',
// 4:'', // 4:'',
// 5:'', // 5:'',
@ -139,84 +199,96 @@ export default {
listLoading: false, listLoading: false,
tableHeight: 650, tableHeight: 650,
typeList: typeList, typeList: typeList,
timeList:[{id:1,name:'时间'},{id:2,name:'操作人'},{id:4,name:'ip'},{id:5,name:'异常等级'}], timeList: [
sortList:[{id:1,name:'倒序'},{id:2,name:'升序'}], { id: 1, name: "时间" },
{ id: 2, name: "操作人" },
{ id: 4, name: "ip" },
{ id: 5, name: "异常等级" },
],
sortList: [
{ id: 1, name: "倒序" },
{ id: 2, name: "升序" },
],
listQuery: { listQuery: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
errType: '', errType: "",
ip: '', ip: "",
errLevel: '', errLevel: "",
operTime:'', operTime: "",
// logSort:1, // logSort:1,
logDesc:1, logDesc: 1,
}, },
rangeDate:[], rangeDate: [],
} };
}, },
created() { created() {
// this.getList() // this.getList()
// this.getOperate() // this.getOperate()
}, },
mounted() { mounted() {
this.listQuery.operTime = this.getCurrentDate()+' - '+this.getCurrentDate(); this.listQuery.operTime =
this.rangeDate = [this.getCurrentDate(),this.getCurrentDate()] this.getCurrentDate() + " - " + this.getCurrentDate();
this.getList() this.rangeDate = [this.getCurrentDate(), this.getCurrentDate()];
this.getList();
}, },
methods: { methods: {
getStatus(val) { getStatus(val) {
return this.levelList[val] return this.levelList[val];
}, },
// //
getOperate(){ getOperate() {
// getOperateList().then((response) => { // getOperateList().then((response) => {
// this.typeList = response.data // this.typeList = response.data
// }) // })
}, },
getList() { getList() {
this.listLoading = true this.listLoading = true;
if(this.rangeDate && this.rangeDate.length>0){ if (this.rangeDate && this.rangeDate.length > 0) {
this.listQuery.operTime = this.rangeDate[0]+' - '+this.rangeDate[1]; this.listQuery.operTime = this.rangeDate[0] + " - " + this.rangeDate[1];
} }
getErrLogs(this.listQuery).then((response) => { getErrLogs(this.listQuery).then((response) => {
this.list = response.rows.map(item => { this.list = response.rows.map((item) => {
return item return item;
}) });
this.total = response.total this.total = response.total;
}) });
setTimeout(()=>{ setTimeout(() => {
this.listLoading = false this.listLoading = false;
},500) }, 500);
}, },
// //
handleFilter() { handleFilter() {
this.listQuery.pageNum = 1 this.listQuery.pageNum = 1;
this.getList() this.getList();
}, },
// //
resetFilter() { resetFilter() {
this.listQuery={ this.listQuery = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
errType: '', errType: "",
ip: '', ip: "",
grade: '', grade: "",
// logSort:1, // logSort:1,
logDesc:1, logDesc: 1,
}; };
this.rangeDate=[this.getCurrentDate(),this.getCurrentDate()] this.rangeDate = [this.getCurrentDate(), this.getCurrentDate()];
this.handleFilter() this.handleFilter();
}, },
// //
handleBackups() { handleBackups() {
downloadErrLogs().then(res => { downloadErrLogs().then((res) => {
downloadFile({ fileName: '异常日志.sql', fileData: res, fileType: 'text/html;charset=UTF-8'}) downloadFile({
}) fileName: "异常日志.sql",
fileData: res,
fileType: "text/html;charset=UTF-8",
});
});
}, },
// //
handleExport(){ handleExport() {
// exportCarDetail().then(res => { // exportCarDetail().then(res => {
// downloadFile({ fileName: '.xlsx', fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' }) // downloadFile({ fileName: '.xlsx', fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' })
// }) // })
@ -225,16 +297,15 @@ export default {
let now = new Date(); let now = new Date();
let year = now.getFullYear(); let year = now.getFullYear();
let month = now.getMonth() + 1; let month = now.getMonth() + 1;
if(month<10){ if (month < 10) {
month = '0'+month month = "0" + month;
} }
let day = now.getDate(); let day = now.getDate();
if(day<10){ if (day < 10) {
day = '0'+day day = "0" + day;
} }
return year + "-" + month + "-" + day; return year + "-" + month + "-" + day;
} },
},
} };
}
</script> </script>

View File

@ -1,231 +1,304 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<div class="filter-container"> <div class="filter-container">
<el-input v-model="listQuery.operaUserName" placeholder="请输入操作人" <el-input
style="width: 200px" class="filter-item" :maxlength="30" v-model="listQuery.operaUserName"
@keyup.enter.native="handleFilter" placeholder="请输入操作人"
/> style="width: 200px"
<el-input v-model="listQuery.ip" placeholder="请输入IP地址" class="filter-item"
style="width: 200px" class="filter-item ml-20" :maxlength="30" :maxlength="30"
@keyup.enter.native="handleFilter" @keyup.enter.native="handleFilter"
/> />
<el-date-picker <el-input
v-model="rangeDate" v-model="listQuery.ip"
style="width: 300px" placeholder="请输入IP地址"
class="filter-item ml-20" style="width: 200px"
value-format="yyyy-MM-dd" class="filter-item ml-20"
type="daterange" :maxlength="30"
range-separator="至" @keyup.enter.native="handleFilter"
start-placeholder="开始日期" />
end-placeholder="结束日期" <el-date-picker
/> v-model="rangeDate"
style="width: 300px"
class="filter-item ml-20"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
<!-- <el-input v-model="listQuery.content" placeholder="请输入操作内容" <!-- <el-input v-model="listQuery.content" placeholder="请输入操作内容"
style="width: 200px" class="filter-item ml-20" :maxlength="30" style="width: 200px" class="filter-item ml-20" :maxlength="30"
@keyup.enter.native="handleFilter" @keyup.enter.native="handleFilter"
/> --> /> -->
<el-select v-model="listQuery.result" placeholder="请选择事件结果" style="width: 200px" class="filter-item ml-20"> <el-select
<el-option v-for="item in Object.keys(outcomeList)" :key="item" :value="outcomeList[item]" :label="outcomeList[item]" /> v-model="listQuery.result"
</el-select> placeholder="请选择事件结果"
<el-select v-model="listQuery.operType" placeholder="请选择操作类型" style="width: 200px" class="filter-item ml-20"> style="width: 200px"
<el-option v-for="item in Object.keys(operateList)" :key="item" :value="operateList[item]" :label="operateList[item]" /> class="filter-item ml-20"
</el-select> >
<el-option
v-for="item in Object.keys(outcomeList)"
:key="item"
:value="outcomeList[item]"
:label="outcomeList[item]"
/>
</el-select>
<el-select
v-model="listQuery.operType"
placeholder="请选择操作类型"
style="width: 200px"
class="filter-item ml-20"
>
<el-option
v-for="item in Object.keys(operateList)"
:key="item"
:value="operateList[item]"
:label="operateList[item]"
/>
</el-select>
<el-select v-model="listQuery.logSort" clearable filterable style="width: 200px" class="filter-item ml-20" placeholder="请选择" > <el-select
<el-option v-for="item in timeList" :key="item.id" :label="item.name" :value="item.id" /> v-model="listQuery.logSort"
</el-select> clearable
<el-select v-model="listQuery.logDesc" clearable filterable style="width: 200px" class="filter-item ml-20" placeholder="请选择" > filterable
<el-option v-for="item in sortList" :key="item.id" :label="item.name" :value="item.id" /> style="width: 200px"
</el-select> class="filter-item ml-20"
<el-button style="margin-left: 20px" class="filter-item" type="primary" @click="handleFilter"> placeholder="请选择"
查询 >
</el-button> <el-option
<el-button style="margin-left: 20px" class="filter-item" @click="resetFilter"> v-for="item in timeList"
重置 :key="item.id"
</el-button> :label="item.name"
<!-- <el-button @click="handleBackups" class="filter-item" style="margin-left: 20px" type="warning"> :value="item.id"
/>
</el-select>
<el-select
v-model="listQuery.logDesc"
clearable
filterable
style="width: 200px"
class="filter-item ml-20"
placeholder="请选择"
>
<el-option
v-for="item in sortList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
<el-button
style="margin-left: 20px"
class="filter-item"
type="primary"
@click="handleFilter"
>
查询
</el-button>
<el-button
style="margin-left: 20px"
class="filter-item"
@click="resetFilter"
>
重置
</el-button>
<!-- <el-button @click="handleBackups" class="filter-item" style="margin-left: 20px" type="warning">
备份 备份
</el-button> --> </el-button> -->
</div>
<el-table
:key="tableKey"
v-loading="listLoading"
:data="list"
border
fit
highlight-current-row
style="width: 100%"
:max-height="tableHeight"
>
<el-table-column label="序号" align="center" width="80" type="index">
<template scope="scope">
<span>{{ (listQuery.pageNum - 1) * listQuery.pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="操作人" align="center" prop="operaUserName" />
<el-table-column label="操作时间" align="center" prop="operTime" />
<el-table-column label="IP地址" align="center" prop="ip" />
<el-table-column label="操作模块" align="center" prop="model" />
<el-table-column label="操作类型" align="center" prop="operType" />
<el-table-column label="操作详情" align="center" prop="operateDetail" />
<el-table-column label="操作结果" align="center" prop="result">
<template slot-scope="{ row }">
{{ row.result}}
</template>
</el-table-column>
<el-table-column label="操作参数" align="center" prop="params" />
<el-table-column label="操作方法" align="center" prop="method" />
<el-table-column label="操作路径" align="center" prop="operUri" />
<el-table-column label="执行时间(ms)" align="center" prop="times" />
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.pageNum"
:limit.sync="listQuery.pageSize"
@pagination="getList"
/>
</div> </div>
</template>
<script> <el-table
import Pagination from '@/components/Pagination' :key="tableKey"
v-loading="listLoading"
:data="list"
border
fit
highlight-current-row
style="width: 100%"
:max-height="tableHeight"
>
<el-table-column label="序号" align="center" width="80" type="index">
<template slot-scope="scope">
<span>{{
(listQuery.pageNum - 1) * listQuery.pageSize + scope.$index + 1
}}</span>
</template>
</el-table-column>
<el-table-column label="操作人" align="center" prop="operaUserName" />
<el-table-column label="操作时间" align="center" prop="operTime" />
<el-table-column label="IP地址" align="center" prop="ip" />
<el-table-column label="操作模块" align="center" prop="model" />
<el-table-column label="操作类型" align="center" prop="operType" />
<el-table-column label="操作详情" align="center" prop="operateDetail" />
<el-table-column label="操作结果" align="center" prop="result">
<template slot-scope="{ row }">
{{ row.result }}
</template>
</el-table-column>
<el-table-column label="操作参数" align="center" prop="params" />
<el-table-column label="操作方法" align="center" prop="method" />
<el-table-column label="操作路径" align="center" prop="operUri" />
<el-table-column label="执行时间(ms)" align="center" prop="times" />
</el-table>
import _ from 'lodash/fp' <pagination
import { downloadFile } from '@/utils/download' v-show="total > 0"
:total="total"
:page.sync="listQuery.pageNum"
:limit.sync="listQuery.pageSize"
@pagination="getList"
/>
</div>
</template>
import { getYwLogs,downloadYwLogs } from '@/api/system/log' <script>
import Pagination from "@/components/Pagination";
import _ from "lodash/fp";
import { downloadFile } from "@/utils/download";
const outcomeList = { import { getYwLogs, downloadYwLogs } from "@/api/system/log";
1:'成功',
2:'失败'
};
const operateList = {
1:'新增',
2:'修改',
3:'删除',
4:'查询',
5:'导出',
6:'下载',
7:'备份',
8:'登录',
9:'登出'
};
export default { const outcomeList = {
components: { Pagination }, 1: "成功",
data() { 2: "失败",
return { };
tableKey: 0, const operateList = {
list: [], 1: "新增",
outcomeList: outcomeList, 2: "修改",
total: 0, 3: "删除",
listLoading: false, 4: "查询",
tableHeight: 650, 5: "导出",
operateList: operateList, 6: "下载",
timeList:[{id:1,name:'时间'},{id:2,name:'操作人'},{id:3,name:'操作模块'},{id:4,name:'ip'},], 7: "备份",
sortList:[{id:1,name:'倒序'},{id:2,name:'升序'}], 8: "登录",
listQuery: { 9: "登出",
pageNum: 1, };
pageSize: 10,
operaUserName: '', export default {
ip: '', components: { Pagination },
content:'', data() {
result: '', return {
operTime:'', tableKey: 0,
operType: '', list: [],
logSort:1, outcomeList: outcomeList,
logDesc:1, total: 0,
}, listLoading: false,
rangeDate:[], tableHeight: 650,
operateList: operateList,
timeList: [
{ id: 1, name: "时间" },
{ id: 2, name: "操作人" },
{ id: 3, name: "操作模块" },
{ id: 4, name: "ip" },
],
sortList: [
{ id: 1, name: "倒序" },
{ id: 2, name: "升序" },
],
listQuery: {
pageNum: 1,
pageSize: 10,
operaUserName: "",
ip: "",
content: "",
result: "",
operTime: "",
operType: "",
logSort: 1,
logDesc: 1,
},
rangeDate: [],
};
},
created() {
// this.getList()
// this.getOperate()
},
mounted() {
this.listQuery.operTime =
this.getCurrentDate() + " - " + this.getCurrentDate();
this.rangeDate = [this.getCurrentDate(), this.getCurrentDate()];
this.getList();
},
methods: {
getStatus(val) {
return this.outcomeList[val];
},
//
getOperate() {
// getOperateList().then((response) => {
// this.operateList = response.data
// })
},
getList() {
this.listLoading = true;
if (this.rangeDate && this.rangeDate.length > 0) {
this.listQuery.operTime = this.rangeDate[0] + " - " + this.rangeDate[1];
} }
getYwLogs(this.listQuery).then((response) => {
this.list = response.rows.map((item) => {
return item;
});
this.total = response.total;
});
setTimeout(() => {
this.listLoading = false;
}, 500);
}, },
created() { //
// this.getList() handleFilter() {
// this.getOperate() this.listQuery.pageNum = 1;
this.getList();
}, },
mounted() { //
this.listQuery.operTime = this.getCurrentDate()+' - '+this.getCurrentDate(); resetFilter() {
this.rangeDate = [this.getCurrentDate(),this.getCurrentDate()] this.listQuery = {
this.getList() pageNum: 1,
pageSize: 10,
operaUserName: "",
ip: "",
content: "",
result: "",
operType: "",
logSort: 1,
logDesc: 1,
};
this.rangeDate = [this.getCurrentDate(), this.getCurrentDate()];
this.handleFilter();
}, },
methods: { //
getStatus(val) { handleBackups() {
return this.outcomeList[val] downloadYwLogs().then((res) => {
}, downloadFile({
// fileName: "业务日志.sql",
getOperate(){ fileData: res,
// getOperateList().then((response) => { fileType: "text/html;charset=UTF-8",
// this.operateList = response.data });
// }) });
}, },
//
getList() { handleExport() {
this.listLoading = true // exportCarDetail().then(res => {
if(this.rangeDate && this.rangeDate.length>0){ // downloadFile({ fileName: '.xlsx', fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' })
this.listQuery.operTime = this.rangeDate[0]+' - '+this.rangeDate[1]; // })
} },
getYwLogs(this.listQuery).then((response) => { getCurrentDate() {
this.list = response.rows.map(item => { let now = new Date();
return item let year = now.getFullYear();
}) let month = now.getMonth() + 1;
this.total = response.total if (month < 10) {
}) month = "0" + month;
setTimeout(()=>{
this.listLoading = false
},500)
},
//
handleFilter() {
this.listQuery.pageNum = 1
this.getList()
},
//
resetFilter() {
this.listQuery={
pageNum: 1,
pageSize: 10,
operaUserName: '',
ip: '',
content:'',
result: '',
operType: '',
logSort:1,
logDesc:1,
};
this.rangeDate=[this.getCurrentDate(),this.getCurrentDate()]
this.handleFilter()
},
//
handleBackups() {
downloadYwLogs().then(res => {
downloadFile({ fileName: '业务日志.sql', fileData: res, fileType: 'text/html;charset=UTF-8'})
})
},
//
handleExport(){
// exportCarDetail().then(res => {
// downloadFile({ fileName: '.xlsx', fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' })
// })
},
getCurrentDate() {
let now = new Date();
let year = now.getFullYear();
let month = now.getMonth() + 1;
if(month<10){
month = '0'+month
}
let day = now.getDate();
if(day<10){
day = '0'+day
}
return year + "-" + month + "-" + day;
} }
let day = now.getDate();
} if (day < 10) {
} day = "0" + day;
</script> }
return year + "-" + month + "-" + day;
},
},
};
</script>

View File

@ -1,45 +1,96 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<div class="filter-container"> <div class="filter-container">
<el-input v-model="listQuery.operaUserName" placeholder="请输入操作人" <el-input
style="width: 200px" class="filter-item" :maxlength="30" v-model="listQuery.operaUserName"
placeholder="请输入操作人"
style="width: 200px"
class="filter-item"
:maxlength="30"
@keyup.enter.native="handleFilter" @keyup.enter.native="handleFilter"
/> />
<el-input v-model="listQuery.ip" placeholder="请输入IP地址" <el-input
style="width: 200px" class="filter-item ml-20" :maxlength="30" v-model="listQuery.ip"
placeholder="请输入IP地址"
style="width: 200px"
class="filter-item ml-20"
:maxlength="30"
@keyup.enter.native="handleFilter" @keyup.enter.native="handleFilter"
/> />
<el-date-picker <el-date-picker
v-model="rangeDate" v-model="rangeDate"
style="width: 300px" style="width: 300px"
class="filter-item ml-20" class="filter-item ml-20"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
type="daterange" type="daterange"
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
/> />
<!-- <el-input v-model="listQuery.content" placeholder="请输入操作内容" <!-- <el-input v-model="listQuery.content" placeholder="请输入操作内容"
style="width: 200px" class="filter-item ml-20" :maxlength="30" style="width: 200px" class="filter-item ml-20" :maxlength="30"
@keyup.enter.native="handleFilter" @keyup.enter.native="handleFilter"
/> />
<el-select v-model="listQuery.result" placeholder="请选择事件结果" style="width: 200px" class="filter-item ml-20"> <el-select v-model="listQuery.result" placeholder="请选择事件结果" style="width: 200px" class="filter-item ml-20">
<el-option v-for="item in Object.keys(outcomeList)" :key="item" :value="outcomeList[item]" :label="outcomeList[item]" /> <el-option v-for="item in Object.keys(outcomeList)" :key="item" :value="outcomeList[item]" :label="outcomeList[item]" />
</el-select>--> </el-select>-->
<el-select v-model="listQuery.operType" placeholder="请选择操作类型" style="width: 200px" class="filter-item ml-20"> <el-select
<el-option v-for="item in Object.keys(operateList)" :key="item" :value="operateList[item]" :label="operateList[item]" /> v-model="listQuery.operType"
placeholder="请选择操作类型"
style="width: 200px"
class="filter-item ml-20"
>
<el-option
v-for="item in Object.keys(operateList)"
:key="item"
:value="operateList[item]"
:label="operateList[item]"
/>
</el-select> </el-select>
<el-select v-model="listQuery.logSort" clearable filterable style="width: 200px" class="filter-item ml-20" placeholder="请选择" > <el-select
<el-option v-for="item in timeList" :key="item.id" :label="item.name" :value="item.id" /> v-model="listQuery.logSort"
clearable
filterable
style="width: 200px"
class="filter-item ml-20"
placeholder="请选择"
>
<el-option
v-for="item in timeList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select> </el-select>
<el-select v-model="listQuery.logDesc" clearable filterable style="width: 200px" class="filter-item ml-20" placeholder="请选择" > <el-select
<el-option v-for="item in sortList" :key="item.id" :label="item.name" :value="item.id" /> v-model="listQuery.logDesc"
clearable
filterable
style="width: 200px"
class="filter-item ml-20"
placeholder="请选择"
>
<el-option
v-for="item in sortList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select> </el-select>
<el-button style="margin-left: 20px" class="filter-item" type="primary" @click="handleFilter"> <el-button
style="margin-left: 20px"
class="filter-item"
type="primary"
@click="handleFilter"
>
查询 查询
</el-button> </el-button>
<el-button style="margin-left: 20px" class="filter-item" @click="resetFilter"> <el-button
style="margin-left: 20px"
class="filter-item"
@click="resetFilter"
>
重置 重置
</el-button> </el-button>
<!-- <el-button @click="handleBackups" class="filter-item" style="margin-left: 20px" type="warning"> <!-- <el-button @click="handleBackups" class="filter-item" style="margin-left: 20px" type="warning">
@ -58,8 +109,10 @@
:max-height="tableHeight" :max-height="tableHeight"
> >
<el-table-column label="序号" align="center" width="80" type="index"> <el-table-column label="序号" align="center" width="80" type="index">
<template scope="scope"> <template slot-scope="scope">
<span>{{ (listQuery.pageNum - 1) * listQuery.pageSize + scope.$index + 1 }}</span> <span>{{
(listQuery.pageNum - 1) * listQuery.pageSize + scope.$index + 1
}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作人" align="center" prop="operaUserName" /> <el-table-column label="操作人" align="center" prop="operaUserName" />
@ -90,28 +143,27 @@
</template> </template>
<script> <script>
import Pagination from '@/components/Pagination' import Pagination from "@/components/Pagination";
import _ from 'lodash/fp' import _ from "lodash/fp";
import { downloadFile } from '@/utils/download' import { downloadFile } from "@/utils/download";
import { getSysLogs,downloadSysLogs } from '@/api/system/log'
import { getSysLogs, downloadSysLogs } from "@/api/system/log";
const outcomeList = { const outcomeList = {
1:'成功', 1: "成功",
2:'失败' 2: "失败",
}; };
const operateList = { const operateList = {
1:'新增', 1: "新增",
2:'修改', 2: "修改",
3:'删除', 3: "删除",
4:'查询', 4: "查询",
5:'导出', 5: "导出",
6:'下载', 6: "下载",
7:'备份', 7: "备份",
8:'登录', 8: "登录",
9:'登出' 9: "登出",
}; };
export default { export default {
@ -125,90 +177,101 @@ export default {
listLoading: false, listLoading: false,
tableHeight: 650, tableHeight: 650,
operateList: operateList, operateList: operateList,
timeList:[{id:1,name:'时间'},{id:2,name:'操作人'},{id:3,name:'操作模块'},{id:4,name:'ip'},], timeList: [
sortList:[{id:1,name:'倒序'},{id:2,name:'升序'}], { id: 1, name: "时间" },
{ id: 2, name: "操作人" },
{ id: 3, name: "操作模块" },
{ id: 4, name: "ip" },
],
sortList: [
{ id: 1, name: "倒序" },
{ id: 2, name: "升序" },
],
listQuery: { listQuery: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
operaUserName: '', operaUserName: "",
ip: '', ip: "",
content:'', content: "",
result: '', result: "",
operTime:'', operTime: "",
operaType: '', operaType: "",
logSort:1, logSort: 1,
logDesc:1, logDesc: 1,
}, },
rangeDate:[], rangeDate: [],
} };
}, },
created() { created() {
// this.getList() // this.getList()
// this.getOperate() // this.getOperate()
}, },
mounted() { mounted() {
this.listQuery.operTime = this.getCurrentDate()+' - '+this.getCurrentDate(); this.listQuery.operTime =
this.rangeDate = [this.getCurrentDate(),this.getCurrentDate()] this.getCurrentDate() + " - " + this.getCurrentDate();
this.getList() this.rangeDate = [this.getCurrentDate(), this.getCurrentDate()];
this.getList();
}, },
methods: { methods: {
getStatus(val) { getStatus(val) {
return this.outcomeList[val] return this.outcomeList[val];
}, },
// //
getOperate(){ getOperate() {
// getOperateList().then((response) => { // getOperateList().then((response) => {
// this.operateList = response.data // this.operateList = response.data
// }) // })
}, },
getList() { getList() {
this.listLoading = true this.listLoading = true;
if(this.rangeDate && this.rangeDate.length>0){ if (this.rangeDate && this.rangeDate.length > 0) {
this.listQuery.operTime = this.rangeDate[0]+' - '+this.rangeDate[1]; this.listQuery.operTime = this.rangeDate[0] + " - " + this.rangeDate[1];
} }
getSysLogs(this.listQuery).then((response) => { getSysLogs(this.listQuery).then((response) => {
this.list = response.rows.map(item => { this.list = response.rows.map((item) => {
return item return item;
}) });
this.total = response.total this.total = response.total;
}) });
setTimeout(()=>{ setTimeout(() => {
this.listLoading = false this.listLoading = false;
},500) }, 500);
}, },
// //
handleFilter() { handleFilter() {
this.listQuery.pageNum = 1 this.listQuery.pageNum = 1;
this.getList() this.getList();
}, },
// //
resetFilter() { resetFilter() {
this.listQuery={ this.listQuery = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
operaUserName: '', operaUserName: "",
ip: '', ip: "",
content:'', content: "",
result: '', result: "",
operateType: '', operateType: "",
logSort:1, logSort: 1,
logDesc:1, logDesc: 1,
}; };
this.rangeDate=[this.getCurrentDate(),this.getCurrentDate()] this.rangeDate = [this.getCurrentDate(), this.getCurrentDate()];
this.handleFilter() this.handleFilter();
}, },
// //
handleBackups() { handleBackups() {
downloadSysLogs().then(res => { downloadSysLogs().then((res) => {
downloadFile({ fileName: '系统日志.sql', fileData: res, fileType: 'text/html;charset=UTF-8' }) downloadFile({
}) fileName: "系统日志.sql",
fileData: res,
fileType: "text/html;charset=UTF-8",
});
});
}, },
// //
handleExport(){ handleExport() {
// exportCarDetail().then(res => { // exportCarDetail().then(res => {
// downloadFile({ fileName: '.xlsx', fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' }) // downloadFile({ fileName: '.xlsx', fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' })
// }) // })
@ -217,16 +280,15 @@ export default {
let now = new Date(); let now = new Date();
let year = now.getFullYear(); let year = now.getFullYear();
let month = now.getMonth() + 1; let month = now.getMonth() + 1;
if(month<10){ if (month < 10) {
month = '0'+month month = "0" + month;
} }
let day = now.getDate(); let day = now.getDate();
if(day<10){ if (day < 10) {
day = '0'+day day = "0" + day;
} }
return year + "-" + month + "-" + day; return year + "-" + month + "-" + day;
} },
},
} };
}
</script> </script>