故障操作代码调整

This commit is contained in:
joylink_cuiweidong 2020-07-03 17:13:24 +08:00
parent 3ae8582f05
commit 654b79fc27
3 changed files with 119 additions and 59 deletions

View File

@ -50,6 +50,9 @@ function handle(state, data) {
case 'Simulation_Script_Action':// 剧本编制添加指令的推送消息
state.scriptAction = msg;
break;
case 'Simulation_AutoFault_Trigger': // 自动故障触发操作推送消息
state.autoFaultTrigger++;
break;
case 'Simulation_RunFact': // 仿真-列车实际到发车站消息
// let runFactMsg = msg;
// if (runFactMsg.constructor !== Array ) {
@ -215,6 +218,7 @@ const socket = {
simulationRoleList:[], // 设置仿真的聊天角色信息
simulationScriptTip:{}, // 剧本推送提示信息
scriptFinish:0, // 剧本执行完成提示信息
autoFaultTrigger:0, // 自动故障触发操作推送消息
scriptAction:{}, // 剧本编制添加指令的推送消息
playBackFinish:0, // 竞赛裁判系统裁判回放结束推送
jointRoomPrepare: false, // 演练房间准备状态

View File

@ -202,7 +202,7 @@ export default {
width: 100%;
left: 0;
top: 40px;
height: 426px;
height: 410px;
}
.addRulesInner{
position: relative;

View File

@ -1,32 +1,26 @@
<template>
<!-- <el-dialog v-dialogDrag :title="title" :visible.sync="dialogShow" width="800px" :before-close="doClose" :modal="false"> -->
<div v-show="dialogShow" id="faultChoose">
<div class="falutChooseTitle">{{ title }}</div>
<div class="closeFalutChoose" @click="closeFaultChoose">
<span class="el-icon-close closeFalutChooseIn" />
</div>
<div class="draft">
<el-radio-group v-model="auto">
<el-radio :label="false" border>{{ $t('display.faultChoose.manual') }}</el-radio>
<el-radio :label="true" border>{{ $t('display.faultChoose.automatic') }}</el-radio>
</el-radio-group>
</div>
<div v-if="auto" class="card">
<el-card class="triggerFaultInfo">
<div class="triggerFaultTitle">待触发故障信息</div>
<div v-if="simulationFault.id" class="triggerFaultList">
触发条件: {{ getTriangleInfo(simulationFault) }}<br>
故障设备: {{ deviceMap[simulationFault.targetDeviceType]+formatNameByCode(simulationFault.targetDeviceCode) }}<br>
故障类型: {{ covertFaultType(simulationFault) }}
</div>
</el-card>
<div class="card">
<QueryListPage ref="pageRules" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" class="queryList" />
<addFault v-if="isAdd" ref="addFault" @closeAddRules="closeAddRules" @reload="reloadTable" />
</div>
<!-- <span slot="footer" class="dialog-footer"> -->
<span class="faultChooseFoot">
<el-button @click="dialogShow = false">{{ $t('global.cancel') }}</el-button>
<el-button type="primary" :loading="loading" @click="handleConfirm">{{ $t('global.confirm') }}</el-button>
</span>
</div>
<!-- </el-dialog> -->
</template>
<script>
import { getFailureRulesNew, setFailureModeNew, deleteFailureRule } from '@/api/simulation';
import { getFailureRulesNew, setFailureModeNew, deleteFailureRule, getSimulationFaultRules } from '@/api/simulation';
// getFailureGenerateRules
import ConstConfig from '@/scripts/ConstConfig';
import { FaultStatusEnum } from '@/scripts/FaultDicNew';
@ -56,7 +50,7 @@ export default {
loading: false,
isAdd:false,
deviceMap: {},
auto: false,
simulationFault:{},
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
@ -86,13 +80,13 @@ export default {
queryList: {
query: this.getFailureRulesNew,
selectCheckShow: false,
radioShow: true,
indexShow: true,
columns: [
{
type:'basicText',
title: '触发条件',
columnValue: (row) => {
return `${this.deviceMap[row.condition.triggerDeviceType]}${this.formatNameByCode(row.condition.triggerDeviceCode)} 状态:${FaultStatusEnum[row.condition.triggerDeviceType][row.condition.triggerDeviceStatus]}`;
return this.getTriangleInfo(row);
}
},
{
@ -112,12 +106,17 @@ export default {
{
type: 'button',
title: '操 作',
width: '100',
width: '150',
buttons: [
{
name: '设置',
handleClick: this.settingFailure,
type: 'primary'
},
{
name: '删除',
handleClick: this.deleteFailure,
type: 'warning'
type: 'danger'
}
]
}
@ -130,7 +129,7 @@ export default {
},
computed: {
title() {
return this.$t('display.faultChoose.selectFault');
return '自动故障设置';
},
lineCode() {
return this.$route.query.lineCode;
@ -140,6 +139,9 @@ export default {
// $store.state.config.menuBarLoadedCount
'offset': function (val) {
this.dragEvent();
},
'$store.state.socket.autoFaultTrigger':function(val) {
this.getSimulationFaultRules();
}
},
mounted() {
@ -177,6 +179,13 @@ export default {
return name;
},
getTriangleInfo(row) {
if (row && row.id) {
return `${this.deviceMap[row.condition.triggerDeviceType]}${this.formatNameByCode(row.condition.triggerDeviceCode)} 状态:${FaultStatusEnum[row.condition.triggerDeviceType][row.condition.triggerDeviceStatus]}`;
} else {
return '';
}
},
covertType(type) {
switch (type) {
case 'SECTION':return 'Section';
@ -188,13 +197,15 @@ export default {
}
},
covertFaultType(row) {
const currentList = deviceFaultType[this.covertType(row.targetDeviceType)];
let faultType = '';
currentList.forEach(temp=>{
if (temp.value === row.faultType) {
faultType = temp.label;
}
});
if (row && row.id) {
const currentList = deviceFaultType[this.covertType(row.targetDeviceType)];
currentList.forEach(temp=>{
if (temp.value === row.faultType) {
faultType = temp.label;
}
});
}
return faultType;
},
closeFaultChoose() {
@ -211,11 +222,17 @@ export default {
params['lineCode'] = this.$route.query.lineCode;
return getFailureRulesNew(params);
},
getSimulationFaultRules() {
getSimulationFaultRules(this.group).then(res=>{
if (res.data) {
this.simulationFault = res.data;
}
});
},
doShow() {
this.dialogShow = true;
if (this.auto) {
this.reloadTable();
}
this.reloadTable();
this.getSimulationFaultRules();
// this.queryList.data = [];
// getFailureGenerateRules({ skin: this.lineCode, group: this.group }).then(response => {
// const data = response.data;
@ -234,16 +251,6 @@ export default {
handleAdd() {
this.isAdd = true;
},
getFailureModel(auto) {
const model = { auto };
if (auto) {
const choose = this.$refs.pageRules.currentChoose();
if (choose) {
choose.id ? Object.assign(model, { ruleId: choose.id }) : this.$messageBox(this.$t('display.faultChoose.selectRules'));
}
}
return model;
},
deleteFailure(index, row) {
event.cancelBubble = true;
this.$confirm('删除故障规则,是否继续?', '提 示', {
@ -258,20 +265,14 @@ export default {
});
}).catch( () => { });
},
handleConfirm() {
this.$nextTick(() => {
const faultModel = this.getFailureModel(this.auto);
if (faultModel.auto && !faultModel.ruleId) {
this.$messageBox('请选择故障');
return;
}
setFailureModeNew(faultModel, this.group).then(() => {
this.$refs.pageRules.currentChoose();
this.$message.success(this.$t('display.faultChoose.setFaultSuccess'));
}).catch(() => {
this.$messageBox(this.$t('display.faultChoose.setFaultFail'));
});
this.doClose();
settingFailure(index, row, idx) {
const faultModel = {ruleId: row.id, auto:true};
// row['loading' + idx] = true;
setFailureModeNew(faultModel, this.group).then(() => {
this.getSimulationFaultRules();
this.$message.success(this.$t('display.faultChoose.setFaultSuccess'));
}).catch(() => {
this.$messageBox(this.$t('display.faultChoose.setFaultFail'));
});
},
reloadTable() {
@ -344,10 +345,65 @@ export default {
}
};
</script>
<style lang="scss">
#faultChoose .card .queryList .el-card .el-card__body .el-table--border .el-table__body-wrapper{
height: 135px !important;
overflow-y: auto !important;
}
#faultChoose .el-button--mini {
margin-left: 5px;
}
// safariqq360
//
#faultChoose .el-table__body-wrapper::-webkit-scrollbar {
width: 6px;
height: 6px;
// height: 110px;
background-color: #FFFFFF;
}
/*定义滚动条轨道 内阴影+圆角*/
#faultChoose .el-table__body-wrapper::-webkit-scrollbar-track {
// box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
border-radius: 10px;
background-color: #FFFFFF;;
}
/*定义滑块 内阴影+圆角*/
#faultChoose .el-table__body-wrapper::-webkit-scrollbar-thumb {
border-radius: 10px;
// box-shadow: inset 0 0 6px rgba(0,0,0,.3);
background-color: #eaeaea;
}
/*滑块效果*/
#faultChoose .el-table__body-wrapper::-webkit-scrollbar-thumb:hover {
border-radius: 5px;
// box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
background: rgba(0,0,0,0.4);
}
/*IE滚动条颜色*/
html {
scrollbar-face-color:#bfbfbf;/*滚动条颜色*/
scrollbar-highlight-color:#000;
scrollbar-3dlight-color:#000;
scrollbar-darkshadow-color:#000;
scrollbar-Shadow-color:#adadad;/*滑块边色*/
scrollbar-arrow-color:rgba(0,0,0,0.4);/*箭头颜色*/
scrollbar-track-color:#eeeeee;/*背景颜色*/
}
</style>
<style scoped rel="stylesheet/scss" lang="scss">
.draft {
text-align: center;
margin-bottom: 10px;
.triggerFaultInfo{
margin-bottom:10px;
padding: 10px 0px 10px 15px;
}
.triggerFaultList{
font-size: 14px;
margin-top: 10px;
line-height: 20px;
}
.triggerFaultTitle{
font-size: 15px;
font-weight: bold;
}
.falutChooseTitle{
padding: 15px;