Commit 32ad998d by 米嘉伟

操作日志

parent b9867de0
......@@ -36,38 +36,18 @@ let config = {
};
const _axios = axios.create(config);
function nowTime () {//获取当前时间
let now = new Date();
let _month = (10 > (now.getMonth() + 1)) ? '0' + (now.getMonth() + 1) : now.getMonth() + 1;
let _day = (10 > now.getDate()) ? '0' + now.getDate() : now.getDate();
let _hour = (10 > now.getHours()) ? '0' + now.getHours() : now.getHours();
let _minute = (10 > now.getMinutes()) ? '0' + now.getMinutes() : now.getMinutes();
let _second = (10 > now.getSeconds()) ? '0' + now.getSeconds() : now.getSeconds();
return now.getFullYear() + '-' + _month + '-' + _day + ' ' + _hour + ':' + _minute + ':' + _second;
}
let reqParam = { // 用户操作日志
logUserIp: localStorage.getItem("userIP"), // 操作人ip地址
logUserName: JSON.parse(localStorage.getItem("userInfo")) ? JSON.parse(localStorage.getItem("userInfo")).name : "", // 操作人姓名
logUserId: JSON.parse(localStorage.getItem("userInfo")) ? JSON.parse(localStorage.getItem("userInfo")).id : "", // 操作人id
logDwCode: JSON.parse(localStorage.getItem("userInfo")) ? JSON.parse(localStorage.getItem("userInfo")).unitCode : "", // 日志单位代码
logDwName: JSON.parse(localStorage.getItem("userInfo")) ? JSON.parse(localStorage.getItem("userInfo")).unitName : "", // 日志单位名称
logTime: nowTime()
}
let userInfo = Base64.encode(JSON.stringify(reqParam))
_axios.interceptors.request.use(
function (config) {
//判断是否登录
config.headers.BrowserHeader = 'H5';
config.headers.userInfo = userInfo;
console.log(userInfo, 'userInfo')
config.headers.userInfo = user.getHeaderUser();
console.log(config.headers.userInfo, 'userInfo')
if (config.url.indexOf('/login/myLoginForm') <= 0) {
if (localStorage.getItem("token")) {
config.headers.Authorization = localStorage.getItem("token");
}
}
console.log(reqParam)
// 判断当前请求是否设置了不显示Loading,默认显示
if (config.loading !== false) {
showLoading(config.loadingTarget); // 如果设置了targer,使用设置的target,比如el-table
......
......@@ -506,7 +506,9 @@ export default {
nyryXm: '',
nysj: '',
nyryGmsfhm: '',
nyryLxdh: ''
nyryLxdh: '',
ysxtAsjxgrybh: '',// 日志需要
},
rules: {
rybh: [
......@@ -713,6 +715,7 @@ export default {
// 赋值
this.ruleForm.id = this.ryInfo.id
this.ruleForm.rybh = this.ryInfo.ysxtAsjxgrybh
this.ruleForm.ysxtAsjxgrybh = this.ryInfo.ysxtAsjxgrybh // 日志需要
this.ruleForm.jzrybh = this.ryInfo.jzrybh
// 人员档案信息
if (this.ryInfo.cjxxyydm) {
......
......@@ -16,9 +16,13 @@
</el-form-item>
<el-form-item label="查询日期:">
<el-date-picker
v-model="cxsj"
type="date"
placeholder="选择日期"
v-model="startEndDate"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="{
disabledDate: disabledDate,
}"
>
</el-date-picker>
</el-form-item>
......@@ -28,16 +32,76 @@
<el-button
type="text"
class="qk"
@click="clear"
>清空</el-button>
<el-button class="cx">查询</el-button>
<el-button
class="cx"
@click="getLogList"
>查询</el-button>
</el-form-item>
</div>
</el-form>
</div>
<div class="split-line">
<el-table
:height="height"
:data="tableDate"
tooltip-effect="dark"
style="width: 100%"
>
<el-table-column
prop="logTime"
label="日志时间"
:formatter="dateTimeFormat"
show-overflow-tooltip
>
</el-table-column>
<el-table-column
prop="logMessage"
label="日志内容"
show-overflow-tooltip
>
</el-table-column>
<el-table-column
prop="logUserIp"
label="IP地址"
show-overflow-tooltip
>
</el-table-column>
<el-table-column
prop="logDwName"
label="日志单位"
>
</el-table-column>
<el-table-column
prop="logUserName"
label="日志用户"
>
</el-table-column>
</el-table>
</div>
<div class="block">
<span class="record">{{ systemLogParam.total }}条记录 第{{ systemLogParam.currPage }}/{{
Tpage
}}</span>
<el-pagination
class="paging"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="systemLogParam.currPage"
:page-sizes="[10, 20, 30, 40]"
background
layout="prev, pager, next"
:total="systemLogParam.total"
>
</el-pagination>
</div>
</div>
</template>
<script>
import Cascader from "@/components/Cascader.vue";
import moment from "moment";
export default {
name: "systemLog",
components: {
......@@ -49,11 +113,83 @@ export default {
logDwCode: '', // 查询单位代码
logTimeStart: '', // 开始时间
logTimeEnd: '',// 结束时间
pageSize: "",// 显示条数
currPage: '',// 当前页码
pageSize: 10,// 显示条数
currPage: 1,// 当前页码
total: 0,// 总数
},
cxsj: '', // 查询时间
startEndDate: null, // 查询时间
height: "33rem",
tableDate: [],
}
},
mounted () {
this.clear()
},
computed: {
//计算总页数
Tpage () {
return Math.ceil(this.systemLogParam.total / this.systemLogParam.pageSize + 1);
}
},
methods: {
getLogList () {
this.getParam()
this.$axios
.post('/api/log/logList', this.systemLogParam)
.then(response => {
console.log(response, 12121423123)
this.tableDate = response.data.detail.systemLogs
this.systemLogParam.total = response.data.detail.total
})
},
// 清空
clear () {
this.startEndDate = null
this.systemLogParam.logDwCode = ''
this.systemLogParam.pageSize = 10// 显示条数
this.systemLogParam.currPage = 1// 当前页码
this.getLogList()
},
// 格式化时间参数
getParam () {
if (this.startEndDate !== null) {
this.systemLogParam.logTimeStart = moment(
this.startEndDate[0]
).format("YYYY-MM-DD");
this.systemLogParam.logTimeEnd = moment(
this.startEndDate[1]
).format("YYYY-MM-DD");
} else {
this.systemLogParam.logTimeStart = ""
this.systemLogParam.logTimeEnd = ''
}
},
// 时间格式化
dateTimeFormat (row, colnum) {
let prop = colnum.property;
return row[prop] ? moment(row[prop]).format("YYYY-MM-DD HH:mm:ss") : "---";
},
// 日期当日之后不可选择
disabledDate (a) {
if (a.getTime() > new Date().getTime()) {
return true;
} else {
return false;
}
},
// pageSize 改变时会触发
handleSizeChange (pageSize) {
this.systemLogParam.pageSize = pageSize;
//console.log("每页条数", this.reqParam.page.pageSize);
},
// currentPage 改变时会触发
handleCurrentChange (page) {
this.systemLogParam.currPage = page;
//console.log("当前页", this.reqParam.page.currPage);
this.getLogList();
},
}
}
</script>
......@@ -68,10 +204,69 @@ export default {
border-radius: 10px;
padding: 24px;
box-sizing: border-box;
margin-bottom: 24px;
.queryForm {
display: flex;
justify-content: space-between;
.qk {
color: #055fe7;
}
.cx {
width: 72px;
height: 32px;
background: #055fe7;
border-radius: 4px;
color: #fff;
}
}
/deep/ .el-input .el-input__inner {
height: 32px;
}
/deep/.el-date-editor {
height: 32px;
margin-top: 4px;
}
/deep/.el-date-editor .el-range__close-icon {
margin-bottom: 5px;
}
}
.block {
position: absolute;
bottom: 27px;
// width: calc(100vw - 367px);
width: 1544px;
// justify-content: space-between;
// align-items: center;
.record {
font-size: 14px;
font-family: HarmonyOS_Sans_SC;
color: #666666;
}
.paging {
float: right;
}
}
/deep/.el-pager {
.number {
background-color: transparent;
}
.number.active {
background-color: #055fe7 !important;
box-shadow: 0px 12px 16px 1px rgba(0, 21, 51, 0.03);
border-radius: 6px;
}
.el-icon.more.btn-quicknext.el-icon-more,
.el-icon.more.btn-quickprev.el-icon-more {
background-color: transparent !important;
}
}
/deep/ .btn-prev,
/deep/.btn-next {
background-color: transparent !important;
}
/deep/ .el-pagination__sizes {
position: absolute;
right: 0;
}
}
@import "@/assets/css/globalBase.scss";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment