哈尔滨线路日志功能添加

This commit is contained in:
joylink_cuiweidong 2020-12-17 16:24:29 +08:00
parent 3b5ed0b399
commit d6b58f5ffb
3 changed files with 119 additions and 25 deletions

View File

@ -421,3 +421,11 @@ export function changePassengerFlowData(group, passengerFlowId) {
});
}
// 哈尔滨线路(仿真行调工作站 获取 日志信息)
export function getLogList(group, params) {
return request({
url: `/simulation/${group}/log`,
method: 'get',
params:params
});
}

View File

@ -383,8 +383,7 @@ export default {
});
},
showLogDetail() {
// this.$refs.logDetail.doShow();
this.undeveloped();
this.$refs.logDetail.doShow();
},
login() {
if (this.loginActive) {

View File

@ -18,26 +18,27 @@
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期时间"
/>
<el-button style="margin-left: 10px;" @click="queryData">查询</el-button>
<el-button style="margin-left: 10px;" :loading="loading" @click="queryData">查询</el-button>
</div>
<el-table
v-loading="loading"
:data="totalData"
border
style="width: 100%"
height="600"
height="520"
>
<el-table-column prop="data" label="日期/时间" header-align="center" align="center" width="200px" />
<el-table-column prop="time" label="日期/时间" header-align="center" align="center" width="200px" />
<el-table-column prop="operateName" label="操作人" header-align="center" align="center" width="100px" />
<el-table-column prop="terminal" label="终端" header-align="center" align="center" width="100px" />
<el-table-column prop="terminal" label="终端" header-align="center" align="center" width="200px" />
<el-table-column prop="operateDes" label="操作" header-align="center" align="center" />
</el-table>
<el-pagination
:current-page="currentPage"
:page-size="100"
:current-page="pageIndex"
:page-size="pageSize"
layout="total, prev, pager, next, jumper"
:total="totalNum"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
@current-change="changePage"
/>
</div>
</el-dialog>
@ -45,39 +46,120 @@
<script>
import {deviceType} from '@/scripts/cmdPlugin/Config';
import {getLogList} from '@/api/simulation';
import command from './commandEnum';
import { mapGetters } from 'vuex';
export default {
name: 'LogDetail',
data() {
return {
currentPage: 1,
pageIndex: 1,
show: false,
level: '',
startTime: '',
endTime: '',
totalData: [{data: '2020-12-02 18:00:00', operateName: 'admin', terminal: '维护HMI', operateDes: '对联锁区“太平桥联锁区”执行命令“交出控制”'}],
tableData: [{data: '2020-12-02 18:00:00', operateName: 'admin', terminal: '维护HMI', operateDes: '对联锁区“太平桥联锁区”执行命令“交出控制”'}],
totalNum: 0
loading:false,
totalData: [],
pageSize: 10,
totalNum:0,
beCentralizedStationMap:{}
};
},
computed:{
...mapGetters('map', [
'stationList'
])
},
mounted() {
this.stationList.forEach(data=>{
if (data.centralized) {
this.beCentralizedStationMap[data.code] = data.code;
data.chargeStationCodeList.forEach(each=>{
this.beCentralizedStationMap[each] = data.code;
});
}
});
},
methods:{
doShow(level) {
doShow() {
this.show = true;
this.level = level;
this.queryData();
},
handleClose() {
this.level = '';
this.startTime = '';
this.endTime = '';
this.show = false;
},
queryData() {
// const params = { level: this.level, startTime: this.startTime, endTime:this.endTime };
// getAlarmList(this.$route.query.group, params).then(resp => {
// this.totalData = resp.data;
// });
const params = { startTime: this.startTime, endTime:this.endTime, pageSize:this.pageSize, pageNum:this.pageIndex };
this.loading = true;
getLogList(this.$route.query.group, params).then(resp => {
this.loading = false;
const totalData = [];
this.totalData = [];
resp.data.list.forEach(element => {
const eachData = {
time:element.time,
operateName:element.member.userId,
terminal:this.getTerminal(element.member.id),
operateDes:this.getOperateDetail(element.event)
};
totalData.push(eachData);
});
this.totalNum = resp.data.total;
this.pageIndex = resp.data.pageNum;
this.pageSize = resp.data.pageSize;
this.totalData = totalData;
}).catch(error=>{
this.loading = false;
console.log(error);
});
},
getTerminal(id) {
const member = this.$store.state.training.memberData[id];
return member ? member.labelName : '';
},
getOperateDetail(event) {
switch (event.type) {
case 'LOGIN': {
return '用户登陆成功';
}
case 'LOGOUT': {
return '用户退出登陆';
}
case 'OPERATE': {
let result = '';
const deviceType = command[event.operation].code;
const deviceCode = event.operationParamMap[deviceType];
if (deviceType == 'routeCode') {
const device = this.$store.getters['map/routeList'].find(route=>{ return route.code == deviceCode; });
result += '对元素 “' + device.name + '”';
} else {
if (deviceCode) {
if (event.operation == 'CM_Surrender_Control' || event.operation == 'CM_Receive_Control' || event.operation == 'Station_Close_AllSignal') {
const device = this.$store.getters['map/getDeviceByCode'](this.beCentralizedStationMap[deviceCode]);
result += '对联锁区 “' + device.name + '联锁区”';
} else {
const device = this.$store.getters['map/getDeviceByCode'](deviceCode);
if (device) {
if (event.operation == 'Station_Set_CI_Auto_Trigger' || event.operation == 'Station_Cancel_CI_Auto_Trigger') {
result += '对联锁区 “' + device.name + '联锁区”';
} else {
result += '对元素 “' + device.name + '”';
}
}
}
}
}
result += ' 执行命令 “' + command[event.operation].name + '”';
const params = command[event.operation].params;
if (params && params.length > 0) {
params.forEach(each=>{
result += ', ' + each.name + event.operationParamMap[each.code];
});
}
return result;
}
}
},
handleDeviceType(code) {
const device = this.$store.getters['map/getDeviceByCode'](code);
@ -87,11 +169,16 @@ export default {
const device = this.$store.getters['map/getDeviceByCode'](code);
return device.name;
},
handleSizeChange() {
// this.handleSizeChange
handleSizeChange(newPageSize) {
if (newPageSize) {
this.pageSize = newPageSize;
// {pageSize:this.pageSize, pageNum:this.pageIndex}
this.changePage(this.pageIndex);
}
},
handleCurrentChange() {
// this.handleCurrentChange
changePage(pageIndex) {
this.pageIndex = pageIndex;
this.queryData();
}
}
};