2019-12-30 09:00:16 +08:00
|
|
|
<template>
|
2020-07-08 14:40:04 +08:00
|
|
|
<div v-if="dialogShow" id="faultChoose">
|
2020-06-30 14:41:22 +08:00
|
|
|
<div class="falutChooseTitle">{{ title }}</div>
|
|
|
|
<div class="closeFalutChoose" @click="closeFaultChoose">
|
|
|
|
<span class="el-icon-close closeFalutChooseIn" />
|
|
|
|
</div>
|
2021-01-07 11:13:03 +08:00
|
|
|
<!-- <div class="minimizeFalutChoose">
|
|
|
|
<span class="el-icon-close closeFalutChooseIn" />
|
|
|
|
</div> -->
|
2020-07-03 17:13:24 +08:00
|
|
|
<el-card class="triggerFaultInfo">
|
2021-01-07 11:13:03 +08:00
|
|
|
<el-button type="primary" size="small" style="margin-bottom:10px;" @click="isTableShow=!isTableShow">{{ isTableShow?'隐藏列表':'显示列表' }}</el-button>
|
|
|
|
<el-table v-if="isTableShow" :data="faultList" height="300" border style="width: 100%;font-size:13px;">
|
|
|
|
<el-table-column prop="targetDeviceCode" label="目标设备" width="220">
|
2020-10-12 14:25:33 +08:00
|
|
|
<template slot-scope="scope">
|
|
|
|
<span>{{ `${deviceMap[scope.row.targetDeviceType]}${formatNameByCode(scope.row.targetDeviceCode)}` }}</span>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column prop="faultType" label="故障类型">
|
|
|
|
<template slot-scope="scope">
|
|
|
|
<span>{{ covertFaultType(scope.row) }}</span>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
2020-10-12 17:23:49 +08:00
|
|
|
<!--<el-table-column prop="condition" label="触发方式">-->
|
2020-10-12 17:55:57 +08:00
|
|
|
<!--<template slot-scope="scope">-->
|
|
|
|
<!--<span>{{ scope.row.condition.type === 'DEVICE'?'设备':'时间' }}</span>-->
|
|
|
|
<!--</template>-->
|
2020-10-12 17:23:49 +08:00
|
|
|
<!--</el-table-column>-->
|
2021-01-07 11:13:03 +08:00
|
|
|
<el-table-column prop="condition" label="列车" width="100">
|
2020-10-12 14:25:33 +08:00
|
|
|
<template slot-scope="scope">
|
2020-10-12 16:33:59 +08:00
|
|
|
<span>{{ `${deviceMap[scope.row.condition.triggerDeviceType] || ''}${formatNameByCode(scope.row.condition.triggerDeviceCode)}` }}</span>
|
2020-10-12 14:25:33 +08:00
|
|
|
</template>
|
|
|
|
</el-table-column>
|
2020-10-12 20:09:00 +08:00
|
|
|
<!--<el-table-column prop="condition" label="触发状态">-->
|
2020-10-28 10:22:46 +08:00
|
|
|
<!--<template slot-scope="scope">-->
|
|
|
|
<!--<span>{{ formatTriggerStatus(scope.row.condition) }}</span>-->
|
|
|
|
<!--</template>-->
|
2020-10-12 20:09:00 +08:00
|
|
|
<!--</el-table-column>-->
|
2021-01-07 11:13:03 +08:00
|
|
|
<el-table-column prop="condition" label="到达区段" width="180">
|
2020-10-12 14:25:33 +08:00
|
|
|
<template slot-scope="scope">
|
|
|
|
<span>{{ `${formatNameByCode(scope.row.condition.triggerAssociatedDeviceCode)}` }}</span>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
2021-01-07 11:13:03 +08:00
|
|
|
<el-table-column prop="condition.condition.triggerTime" label="触发时间" width="150" />
|
2020-10-12 14:25:33 +08:00
|
|
|
<el-table-column prop="triggeringTime" label="故障状态">
|
|
|
|
<template slot-scope="scope">
|
|
|
|
<span>{{ scope.row.triggeringTime? '已触发': '未触发' }}</span>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="操作">
|
|
|
|
<template slot-scope="scope">
|
2020-10-12 15:22:39 +08:00
|
|
|
<el-button v-if="!scope.row.triggeringTime" type="text" size="small" @click="handleDelete(scope.row)">取消</el-button>
|
2020-10-12 14:25:33 +08:00
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table>
|
2020-07-03 17:13:24 +08:00
|
|
|
</el-card>
|
2021-01-07 11:13:03 +08:00
|
|
|
<div class="targetCard">
|
|
|
|
<!-- <el-card class="box-card"> -->
|
|
|
|
<div class="targetCardHead">
|
|
|
|
<el-button style="padding:3px 0" type="text" @click="addRulesCreate">新增</el-button>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<el-form ref="form" :model="faultRule" :inline="true" label-width="100px" style="margin-left:15px;">
|
|
|
|
<el-form-item label="目标设备" class="targetFormItem">
|
|
|
|
<!-- faultRule.targetDeviceCode -->
|
|
|
|
<el-input v-model="targetDeviceName" disabled size="small" class="inputModelClass" style="width: 300px;" />
|
|
|
|
<!--<el-button :type="field === 'targetActive' ? 'danger' : 'primary'" size="small" @click="hover('targetActive')">{{ $t('map.activate') }}</el-button>-->
|
|
|
|
</el-form-item>
|
|
|
|
<!--<el-form-item label="触发方式">-->
|
|
|
|
<!--<el-select v-model="triggerMode" size="small" style="width: 200px;" @change="changeTriggerMode">-->
|
|
|
|
<!--<el-option-->
|
|
|
|
<!--v-for="item in triggerModeList"-->
|
|
|
|
<!--:key="item.value"-->
|
|
|
|
<!--:label="item.label"-->
|
|
|
|
<!--:value="item.value"-->
|
|
|
|
<!--/>-->
|
|
|
|
<!--</el-select>-->
|
|
|
|
<!--</el-form-item>-->
|
|
|
|
<el-form-item label="故障类型" class="targetFormItem">
|
|
|
|
<el-select v-model="faultRule.faultType" placeholder="请选择" class="inputModelClass" size="small" style="width: 300px;">
|
|
|
|
<el-option
|
|
|
|
v-for="item in faultTypeList"
|
|
|
|
:key="item.value"
|
|
|
|
:label="item.label"
|
|
|
|
:value="item.value"
|
2020-10-12 14:25:33 +08:00
|
|
|
/>
|
2021-01-07 11:13:03 +08:00
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item v-if="triggerMode === 'DEVICE'" label="列车" class="targetFormItem">
|
|
|
|
<!-- faultRule.condition.triggerDeviceCode -->
|
|
|
|
<el-input v-model="triggerDevice" size="small" disabled class="inputModelClass" style="width: 240px;" />
|
|
|
|
<el-button :type="field === 'triggerActive' ? 'danger' : 'primary'" size="small" @click="hover('triggerActive')">{{ $t('map.activate') }}</el-button>
|
|
|
|
</el-form-item>
|
|
|
|
<!--<el-form-item v-if="triggerMode === 'DEVICE'" label="触发状态">-->
|
|
|
|
<!--<!– <el-input v-model="faultRule.condition.triggerDeviceStatus" size="small" class="inputModelClass" /> –>-->
|
|
|
|
<!--<el-select v-model="faultRule.condition.triggerDeviceStatus" placeholder="请选择" class="inputModelClass" size="small" style="width: 200px;">-->
|
|
|
|
<!--<el-option-->
|
|
|
|
<!--v-for="item in triggerStatusList"-->
|
|
|
|
<!--:key="item.value"-->
|
|
|
|
<!--:label="item.label"-->
|
|
|
|
<!--:value="item.value"-->
|
|
|
|
<!--/>-->
|
|
|
|
<!--</el-select>-->
|
|
|
|
<!--</el-form-item>-->
|
|
|
|
<el-form-item v-if="triggerMode === 'DEVICE'" label="到达区段" class="targetFormItem">
|
|
|
|
<el-input v-model="triggerAssociatedDevice" size="small" disabled class="inputModelClass" style="width: 240px;" />
|
|
|
|
<el-button :type="field === 'triggerAssociated'? 'danger': 'primary'" size="small" @click="hover('triggerAssociated')">{{ $t('map.activate') }}</el-button>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item v-if="triggerMode === 'TIME'" label="触发时间" class="targetFormItem">
|
|
|
|
<el-date-picker
|
|
|
|
v-model="faultRule.condition.triggerTime"
|
|
|
|
size="small"
|
|
|
|
format="yyyy-MM-dd HH:mm:ss"
|
|
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
|
type="datetime"
|
|
|
|
placeholder="选择日期时间"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
</div>
|
|
|
|
<!-- </el-card> -->
|
2019-12-30 09:00:16 +08:00
|
|
|
</div>
|
2020-06-30 14:41:22 +08:00
|
|
|
</div>
|
2019-12-30 09:00:16 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-10-12 14:25:33 +08:00
|
|
|
import { getSimulationFaultRules, setFailureModeNew, deleteFailureRule, cancelFailureModeNew } from '@/api/simulation';
|
2020-06-30 19:17:29 +08:00
|
|
|
import ConstConfig from '@/scripts/ConstConfig';
|
|
|
|
import { FaultStatusEnum } from '@/scripts/FaultDicNew';
|
2020-10-23 18:05:55 +08:00
|
|
|
import ModelType from '@/jmapNew/constant/deviceType';
|
2020-11-13 14:19:52 +08:00
|
|
|
import { deviceFaultType } from '@/scripts/cmdPlugin/Config';
|
2019-12-30 09:00:16 +08:00
|
|
|
|
|
|
|
// 故障列表
|
|
|
|
export default {
|
|
|
|
name: 'FaultChoose',
|
|
|
|
props: {
|
|
|
|
group: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
2020-06-30 14:41:22 +08:00
|
|
|
},
|
|
|
|
offset: {
|
|
|
|
type: Number,
|
|
|
|
required: true
|
2019-12-30 09:00:16 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
dialogShow: false,
|
|
|
|
loading: false,
|
2020-06-30 14:41:22 +08:00
|
|
|
isAdd:false,
|
2021-01-07 11:13:03 +08:00
|
|
|
isTableShow:true,
|
2019-12-30 09:00:16 +08:00
|
|
|
deviceMap: {},
|
2020-07-03 17:13:24 +08:00
|
|
|
simulationFault:{},
|
2020-10-12 14:25:33 +08:00
|
|
|
faultList: [],
|
|
|
|
faultRule:{
|
|
|
|
targetDeviceCode:'',
|
|
|
|
targetDeviceType:'',
|
|
|
|
faultType:'',
|
|
|
|
condition:{
|
|
|
|
triggerDeviceCode:'',
|
|
|
|
triggerDeviceStatus:'',
|
|
|
|
triggerDeviceType :'',
|
|
|
|
type:'DEVICE',
|
2020-10-12 16:33:59 +08:00
|
|
|
triggerTime: '',
|
2020-10-12 14:25:33 +08:00
|
|
|
triggerAssociatedDeviceCode: ''
|
2019-12-30 09:00:16 +08:00
|
|
|
}
|
|
|
|
},
|
2020-10-12 14:25:33 +08:00
|
|
|
triggerDevice:'',
|
|
|
|
triggerAssociatedDevice: '',
|
|
|
|
triggerMode: 'DEVICE',
|
|
|
|
triggerModeList: [
|
|
|
|
{label: '设备触发', value: 'DEVICE'},
|
|
|
|
{label: '时间触发', value: 'TIME'}
|
|
|
|
],
|
|
|
|
field:'',
|
|
|
|
triggerStatusList:[],
|
2020-11-13 14:19:52 +08:00
|
|
|
faultTypeList:[],
|
|
|
|
targetDeviceName: ''
|
2019-12-30 09:00:16 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
title() {
|
2020-07-03 17:13:24 +08:00
|
|
|
return '自动故障设置';
|
2019-12-30 09:00:16 +08:00
|
|
|
},
|
|
|
|
lineCode() {
|
|
|
|
return this.$route.query.lineCode;
|
2020-10-12 14:25:33 +08:00
|
|
|
},
|
|
|
|
targetDevice() {
|
|
|
|
return this.$store.state.training.triggerFaultDevice;
|
2019-12-30 09:00:16 +08:00
|
|
|
}
|
|
|
|
},
|
2020-06-30 14:41:22 +08:00
|
|
|
watch:{
|
2020-07-03 17:13:24 +08:00
|
|
|
'$store.state.socket.autoFaultTrigger':function(val) {
|
2020-07-08 14:40:04 +08:00
|
|
|
this.dialogShow && this.getSimulationFaultRules();
|
2020-10-12 14:25:33 +08:00
|
|
|
},
|
|
|
|
'$store.state.menuOperation.selectedCount':function(em) {
|
|
|
|
const device = this.$store.state.menuOperation.selected;
|
2020-11-10 13:42:29 +08:00
|
|
|
if (device && device.code) {
|
2020-10-12 14:25:33 +08:00
|
|
|
this.deviceSelect(device);
|
|
|
|
}
|
2020-11-13 14:19:52 +08:00
|
|
|
},
|
|
|
|
targetDevice: function(device) {
|
|
|
|
this.targetDeviceName = this.targetDevice.name || this.targetDevice.code;
|
2020-06-30 14:41:22 +08:00
|
|
|
}
|
|
|
|
},
|
2019-12-30 09:00:16 +08:00
|
|
|
mounted() {
|
2020-06-30 19:17:29 +08:00
|
|
|
this.deviceMap = [];
|
|
|
|
ConstConfig.ConstSelect.simulationDeviceList.forEach(elem => {
|
|
|
|
this.deviceMap[elem.value] = elem.label;
|
2019-12-30 09:00:16 +08:00
|
|
|
});
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
formatNameByCode(code) {
|
|
|
|
let name = '';
|
|
|
|
const device = this.$store.getters['map/getDeviceByCode'](code);
|
|
|
|
if (device) {
|
|
|
|
switch (device._type) {
|
|
|
|
case ModelType.Signal:
|
|
|
|
case ModelType.Switch:
|
|
|
|
case ModelType.Station:
|
|
|
|
case ModelType.Section: {
|
2020-07-01 09:32:01 +08:00
|
|
|
if (device.parentName) {
|
|
|
|
name += device.parentName + '-' + device.name;
|
|
|
|
} else {
|
|
|
|
name += device.name;
|
|
|
|
}
|
|
|
|
|
2019-12-30 09:00:16 +08:00
|
|
|
break;
|
|
|
|
}
|
2020-10-12 14:25:33 +08:00
|
|
|
case ModelType.Train:
|
|
|
|
name = device.code;
|
|
|
|
break;
|
2019-12-30 09:00:16 +08:00
|
|
|
}
|
|
|
|
if (device.stationCode) {
|
|
|
|
const station = this.$store.getters['map/getDeviceByCode'](device.stationCode);
|
|
|
|
if (station) {
|
|
|
|
name += '【' + station.name + '】';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return name;
|
|
|
|
},
|
2020-11-13 14:19:52 +08:00
|
|
|
// formatTriggerStatus(condition) {
|
|
|
|
// if (!condition.triggerDeviceType) {
|
|
|
|
// return '';
|
|
|
|
// }
|
|
|
|
// const faultStatus = FaultStatusEnum[condition.triggerDeviceType];
|
|
|
|
// return faultStatus[condition.triggerDeviceStatus];
|
|
|
|
// },
|
2020-10-12 14:25:33 +08:00
|
|
|
hover(field) {
|
|
|
|
if (this.field == '') {
|
|
|
|
this.field = field;
|
2020-07-03 17:13:24 +08:00
|
|
|
} else {
|
2020-10-12 14:25:33 +08:00
|
|
|
this.field = '';
|
2020-07-03 17:13:24 +08:00
|
|
|
}
|
|
|
|
},
|
2020-10-12 14:25:33 +08:00
|
|
|
handleDelete(row) {
|
|
|
|
cancelFailureModeNew(row.id, this.$route.query.group).then(resp => {
|
|
|
|
this.getSimulationFaultRules();
|
2020-11-10 13:42:29 +08:00
|
|
|
}).catch(() => {
|
2020-10-12 15:22:39 +08:00
|
|
|
this.$message.error('取消故障失败!');
|
2020-10-12 14:25:33 +08:00
|
|
|
});
|
|
|
|
},
|
2020-06-30 19:17:29 +08:00
|
|
|
covertType(type) {
|
|
|
|
switch (type) {
|
|
|
|
case 'SECTION':return 'Section';
|
|
|
|
case 'SIGNAL':return 'Signal';
|
|
|
|
case 'SWITCH':return 'Switch';
|
|
|
|
case 'STATION':return 'Station';
|
2020-07-08 09:21:54 +08:00
|
|
|
case 'ZC':return 'ZcControl';
|
2020-06-30 19:17:29 +08:00
|
|
|
case 'STAND':return 'StationStand';
|
|
|
|
case 'TRAIN':return 'Train';
|
2020-10-12 14:25:33 +08:00
|
|
|
case 'Section':return 'SECTION';
|
|
|
|
case 'Signal':return 'SIGNAL';
|
|
|
|
case 'Switch':return 'SWITCH';
|
|
|
|
case 'Station':return 'STATION';
|
|
|
|
case 'ZcControl':return 'ZC';
|
|
|
|
case 'StationStand':return 'STAND';
|
|
|
|
case 'Train':return 'TRAIN';
|
2020-06-30 19:17:29 +08:00
|
|
|
}
|
|
|
|
},
|
2020-07-01 09:32:01 +08:00
|
|
|
covertFaultType(row) {
|
|
|
|
let faultType = '';
|
2020-07-03 17:13:24 +08:00
|
|
|
if (row && row.id) {
|
2020-07-10 10:36:10 +08:00
|
|
|
let type = this.covertType(row.targetDeviceType);
|
|
|
|
if (type == 'Station') {
|
|
|
|
type = 'ZcControl';
|
|
|
|
}
|
2020-07-07 17:08:01 +08:00
|
|
|
const currentList = deviceFaultType[type];
|
2020-07-03 17:13:24 +08:00
|
|
|
currentList.forEach(temp=>{
|
|
|
|
if (temp.value === row.faultType) {
|
|
|
|
faultType = temp.label;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2020-07-01 09:32:01 +08:00
|
|
|
return faultType;
|
|
|
|
},
|
2020-06-30 14:41:22 +08:00
|
|
|
closeFaultChoose() {
|
|
|
|
this.dialogShow = false;
|
|
|
|
this.isAdd = false;
|
2020-07-02 13:28:36 +08:00
|
|
|
if (this.$refs.addFault) {
|
|
|
|
this.$refs.addFault.resetForm();
|
|
|
|
}
|
2020-06-30 14:41:22 +08:00
|
|
|
},
|
2020-06-30 19:17:29 +08:00
|
|
|
closeAddRules() {
|
|
|
|
this.isAdd = false;
|
|
|
|
},
|
2020-10-12 14:25:33 +08:00
|
|
|
getSimulationFaultRules() {
|
2020-07-08 14:40:04 +08:00
|
|
|
if (this.dialogShow) {
|
2020-10-12 14:25:33 +08:00
|
|
|
getSimulationFaultRules(this.$route.query.group).then(resp => {
|
|
|
|
this.faultList = resp.data;
|
2020-10-28 10:22:46 +08:00
|
|
|
}).catch(() => {
|
2020-10-12 14:25:33 +08:00
|
|
|
this.$messageBox('获取数据异常');
|
|
|
|
});
|
2020-07-08 14:40:04 +08:00
|
|
|
}
|
2020-06-30 14:41:22 +08:00
|
|
|
},
|
2020-10-12 14:25:33 +08:00
|
|
|
changeTriggerMode(val) {
|
|
|
|
this.resetForm();
|
|
|
|
this.triggerMode = val;
|
|
|
|
this.faultRule.condition.type = val;
|
2020-07-03 17:13:24 +08:00
|
|
|
},
|
2019-12-30 09:00:16 +08:00
|
|
|
doShow() {
|
|
|
|
this.dialogShow = true;
|
2020-07-03 17:13:24 +08:00
|
|
|
this.getSimulationFaultRules();
|
2020-10-12 15:29:29 +08:00
|
|
|
this.resetForm();
|
2020-10-12 14:25:33 +08:00
|
|
|
this.faultTypeList = deviceFaultType[this.targetDevice._type];
|
|
|
|
this.faultRule.targetDeviceCode = this.targetDevice.code;
|
|
|
|
this.faultRule.targetDeviceType = this.covertType(this.targetDevice._type);
|
2020-10-12 17:55:57 +08:00
|
|
|
this.faultRule.faultType = (this.faultTypeList[0] || {}).value;
|
2020-07-10 10:36:10 +08:00
|
|
|
this.$nextTick(()=>{
|
|
|
|
this.dragEvent();
|
|
|
|
});
|
2020-10-12 14:25:33 +08:00
|
|
|
},
|
|
|
|
resetForm() {
|
|
|
|
this.getSimulationFaultRules();
|
|
|
|
this.field = '';
|
|
|
|
this.triggerDevice = '';
|
|
|
|
this.triggerAssociatedDevice = '';
|
|
|
|
this.faultRule = {
|
|
|
|
targetDeviceCode:this.targetDevice.code,
|
|
|
|
targetDeviceType:this.covertType(this.targetDevice._type),
|
|
|
|
faultType:'',
|
|
|
|
condition:{
|
|
|
|
triggerDeviceCode:'',
|
|
|
|
triggerDeviceStatus:'',
|
|
|
|
triggerDeviceType :'',
|
|
|
|
type:'DEVICE',
|
2020-10-12 16:33:59 +08:00
|
|
|
triggerTime: '',
|
2020-10-12 14:25:33 +08:00
|
|
|
triggerAssociatedDeviceCode: ''
|
|
|
|
}
|
|
|
|
};
|
2020-06-30 14:41:22 +08:00
|
|
|
},
|
2019-12-30 09:00:16 +08:00
|
|
|
doClose() {
|
|
|
|
this.dialogShow = false;
|
|
|
|
},
|
2020-06-30 14:41:22 +08:00
|
|
|
handleAdd() {
|
|
|
|
this.isAdd = true;
|
2020-10-12 14:25:33 +08:00
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$refs.addFault.initValue();
|
|
|
|
});
|
2020-06-30 14:41:22 +08:00
|
|
|
},
|
2020-06-30 19:17:29 +08:00
|
|
|
deleteFailure(index, row) {
|
2020-07-02 10:10:16 +08:00
|
|
|
event.cancelBubble = true;
|
2020-06-30 19:17:29 +08:00
|
|
|
this.$confirm('删除故障规则,是否继续?', '提 示', {
|
|
|
|
confirmButtonText: '确 定',
|
|
|
|
cancelButtonText: '取 消',
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
deleteFailureRule(row.id).then(resp => {
|
|
|
|
}).catch(error => {
|
|
|
|
this.$message.error(`删除故障规则失败: ${error.message}`);
|
|
|
|
});
|
|
|
|
}).catch( () => { });
|
|
|
|
},
|
2020-07-03 17:13:24 +08:00
|
|
|
settingFailure(index, row, idx) {
|
|
|
|
const faultModel = {ruleId: row.id, auto:true};
|
|
|
|
// row['loading' + idx] = true;
|
|
|
|
setFailureModeNew(faultModel, this.group).then(() => {
|
|
|
|
this.getSimulationFaultRules();
|
2020-07-03 18:39:24 +08:00
|
|
|
this.$message.success('设置自动故障成功');
|
2020-07-03 17:13:24 +08:00
|
|
|
}).catch(() => {
|
2020-07-03 18:39:24 +08:00
|
|
|
this.$messageBox('设置自动故障失败');
|
2019-12-30 09:00:16 +08:00
|
|
|
});
|
|
|
|
},
|
2020-07-03 18:39:24 +08:00
|
|
|
cancleAutoFault() {
|
|
|
|
const faultModel = {auto:false};
|
|
|
|
setFailureModeNew(faultModel, this.group).then(() => {
|
|
|
|
this.getSimulationFaultRules();
|
|
|
|
this.$message.success('取消自动故障成功');
|
|
|
|
}).catch(() => {
|
|
|
|
this.$messageBox('取消自动故障失败');
|
|
|
|
});
|
|
|
|
},
|
2020-10-12 14:25:33 +08:00
|
|
|
addRulesCreate() {
|
2020-10-12 15:19:03 +08:00
|
|
|
if (this.triggerMode === 'DEVICE' && this.triggerDevice == '') {
|
2020-10-12 14:25:33 +08:00
|
|
|
this.$messageBox('请选择触发设备');
|
|
|
|
return;
|
|
|
|
}
|
2020-10-12 15:19:03 +08:00
|
|
|
if (this.triggerMode === 'DEVICE' && this.faultRule.condition.triggerDeviceStatus == '') {
|
2020-10-12 14:25:33 +08:00
|
|
|
this.$messageBox('请选择触发状态');
|
|
|
|
return;
|
|
|
|
}
|
2020-10-12 15:50:11 +08:00
|
|
|
if (this.faultRule.faultType == '') {
|
2020-10-12 14:25:33 +08:00
|
|
|
this.$messageBox('请选择故障类型');
|
|
|
|
return;
|
|
|
|
}
|
2020-10-12 16:21:24 +08:00
|
|
|
if (this.triggerMode === 'TIME' && this.faultRule.condition.triggerTime == '') {
|
2020-10-12 15:19:03 +08:00
|
|
|
this.$messageBox('请选择触发时间');
|
|
|
|
return;
|
|
|
|
}
|
2020-10-12 15:25:55 +08:00
|
|
|
if (this.triggerMode === 'DEVICE' && this.faultRule.condition.triggerDeviceType === 'TRAIN' && this.faultRule.condition.triggerDeviceStatus === 'Section' && this.faultRule.condition.triggerAssociatedDeviceCode == '') {
|
|
|
|
this.$messageBox('请选择关联设备');
|
|
|
|
return;
|
|
|
|
}
|
2020-10-12 16:01:12 +08:00
|
|
|
const param = {
|
|
|
|
targetDeviceCode:this.targetDevice.code,
|
|
|
|
targetDeviceType:this.covertType(this.targetDevice._type),
|
|
|
|
faultType: this.faultRule.faultType,
|
|
|
|
condition:{
|
|
|
|
triggerDeviceCode: this.faultRule.condition.triggerDeviceCode || null,
|
|
|
|
triggerDeviceStatus:this.faultRule.condition.triggerDeviceStatus || null,
|
|
|
|
triggerDeviceType :this.faultRule.condition.triggerDeviceType || null,
|
|
|
|
type:this.faultRule.condition.type,
|
2020-10-12 16:33:59 +08:00
|
|
|
triggerTime: this.faultRule.condition.triggerTime || null,
|
2020-10-12 16:01:12 +08:00
|
|
|
triggerAssociatedDeviceCode: this.faultRule.condition.triggerAssociatedDeviceCode || null
|
|
|
|
}
|
|
|
|
};
|
|
|
|
setFailureModeNew(param, this.$route.query.group).then(res=>{
|
2020-10-12 14:25:33 +08:00
|
|
|
this.$message.success('创建故障成功!');
|
|
|
|
this.resetForm();
|
|
|
|
}).catch((error)=>{
|
|
|
|
this.$messageBox('创建故障失败: ' + error.message);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
deviceSelect(em) {
|
2020-10-12 18:08:25 +08:00
|
|
|
if (this.field.toUpperCase() === 'triggerAssociated'.toUpperCase() && em._type.toUpperCase() === 'Section'.toUpperCase()) {
|
2020-10-12 14:25:33 +08:00
|
|
|
// if (em._type == 'Station') {
|
|
|
|
// em = this.$store.getters['map/getDeviceByCode'](em.zcCode);
|
|
|
|
// }
|
|
|
|
// this.faultRule.targetDeviceType = this.covertType(em._type);
|
|
|
|
// this.faultRule.targetDeviceCode = em.code;
|
|
|
|
if (em._type.toUpperCase() === 'Section'.toUpperCase() && em.parentName) {
|
|
|
|
this.triggerAssociatedDevice = em._type + '-' + em.parentName + '-' + em.name;
|
|
|
|
} else {
|
|
|
|
this.triggerAssociatedDevice = em._type + '-' + em.name;
|
|
|
|
}
|
|
|
|
this.faultRule.condition.triggerAssociatedDeviceCode = em.code;
|
2020-10-12 18:08:25 +08:00
|
|
|
} else if (this.field.toUpperCase() === 'triggerActive'.toUpperCase() && em._type.toUpperCase() === 'Train'.toUpperCase()) {
|
2020-10-12 14:25:33 +08:00
|
|
|
this.faultRule.condition.triggerDeviceType = this.covertType(em._type);
|
|
|
|
this.faultRule.condition.triggerDeviceCode = em.code;
|
|
|
|
if (em._type.toUpperCase() === 'Section'.toUpperCase() && em.parentName) {
|
|
|
|
this.triggerDevice = em._type + '-' + em.parentName + '-' + em.name;
|
|
|
|
} else if (em._type.toUpperCase() === 'Train'.toUpperCase()) {
|
|
|
|
this.triggerDevice = em._type + '-' + em.code;
|
|
|
|
} else {
|
|
|
|
this.triggerDevice = em._type + '-' + em.name;
|
|
|
|
}
|
|
|
|
this.triggerStatusList = [];
|
|
|
|
const faultStatus = FaultStatusEnum[this.faultRule.condition.triggerDeviceType];
|
|
|
|
if (faultStatus) {
|
|
|
|
const list = Object.keys(faultStatus);
|
|
|
|
list.forEach(key=>{
|
|
|
|
this.triggerStatusList.push({label:faultStatus[key], value:key});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
this.field = '';
|
2020-10-12 17:55:57 +08:00
|
|
|
this.faultRule.condition.triggerDeviceStatus = (this.triggerStatusList[0] || {}).value;
|
2020-10-12 14:25:33 +08:00
|
|
|
}
|
|
|
|
},
|
2020-06-30 14:41:22 +08:00
|
|
|
dragEvent() {
|
|
|
|
const offset = this.offset;
|
|
|
|
const dialogHeaderEl = document.querySelector('.falutChooseTitle');
|
|
|
|
const dragDom = document.querySelector('#faultChoose');
|
|
|
|
dialogHeaderEl.style.cursor = 'move';
|
|
|
|
|
|
|
|
/** 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);*/
|
|
|
|
const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null);
|
|
|
|
|
|
|
|
dialogHeaderEl.onmousedown = (e) => {
|
2020-07-10 10:36:10 +08:00
|
|
|
/** 鼠标按下,计算当前元素距离可视区的距离*/
|
2020-06-30 14:41:22 +08:00
|
|
|
const disX = e.clientX - dialogHeaderEl.offsetLeft;
|
|
|
|
const disY = e.clientY - dialogHeaderEl.offsetTop;
|
|
|
|
|
|
|
|
/** 获取到的值带px 正则匹配替换*/
|
|
|
|
let styL, styT;
|
|
|
|
|
|
|
|
/** 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px*/
|
|
|
|
if (sty.left.includes('%')) {
|
2020-07-10 10:36:10 +08:00
|
|
|
// eslint-disable-next-line no-useless-escape
|
2020-06-30 14:41:22 +08:00
|
|
|
styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100);
|
|
|
|
styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100);
|
|
|
|
} else {
|
2020-07-10 10:36:10 +08:00
|
|
|
// eslint-disable-next-line no-useless-escape
|
2020-06-30 14:41:22 +08:00
|
|
|
styL = +sty.left.replace(/\px/g, '');
|
|
|
|
// eslint-disable-next-line no-useless-escape
|
|
|
|
styT = +sty.top.replace(/\px/g, '');
|
|
|
|
}
|
|
|
|
|
|
|
|
document.onmousemove = function (e) {
|
2020-07-10 10:36:10 +08:00
|
|
|
/** 通过事件委托,计算移动的距离*/
|
2020-06-30 14:41:22 +08:00
|
|
|
const l = e.clientX - disX;
|
|
|
|
const t = e.clientY - disY;
|
|
|
|
|
|
|
|
/** 移动当前元素*/
|
|
|
|
// dragDom.style.left = `${l + styL}px`;
|
|
|
|
// dragDom.style.top = `${t + styT}px`;
|
|
|
|
|
|
|
|
/** 移动当前元素*/
|
|
|
|
if (l + styL < 0) {
|
|
|
|
dragDom.style.left = `0px`;
|
|
|
|
} else if (l + styL > document.body.clientWidth - dragDom.clientWidth - 10) {
|
|
|
|
dragDom.style.left = `${document.body.clientWidth - dragDom.clientWidth - 10}px`;
|
|
|
|
} else {
|
|
|
|
dragDom.style.left = `${l + styL}px`;
|
|
|
|
}
|
|
|
|
if (t + styT <= offset) {
|
|
|
|
dragDom.style.top = offset + `px`;
|
|
|
|
} else if (t + styT > document.body.clientHeight - dragDom.clientHeight - 10) {
|
|
|
|
dragDom.style.top = `${document.body.clientHeight - dragDom.clientHeight - 10}px`;
|
|
|
|
} else {
|
|
|
|
dragDom.style.top = `${t + styT}px`;
|
|
|
|
}
|
|
|
|
|
2020-07-10 10:36:10 +08:00
|
|
|
/** 将此时的位置传出去*/
|
|
|
|
// binding.value({ x: e.pageX, y: e.pageY });
|
2020-06-30 14:41:22 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
document.onmouseup = function () {
|
|
|
|
document.onmousemove = null;
|
|
|
|
document.onmouseup = null;
|
|
|
|
};
|
|
|
|
};
|
2019-12-30 09:00:16 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
2020-07-03 17:13:24 +08:00
|
|
|
<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;
|
|
|
|
}
|
2020-07-03 18:39:24 +08:00
|
|
|
.triggerFaultListLeft{
|
|
|
|
display: inline-block;
|
|
|
|
float: left;
|
|
|
|
width: 730px;
|
|
|
|
}
|
2020-07-03 17:13:24 +08:00
|
|
|
// 谷歌、safari、qq浏览器、360浏览器滚动条样式
|
|
|
|
// 定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸
|
|
|
|
#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>
|
2019-12-30 09:00:16 +08:00
|
|
|
<style scoped rel="stylesheet/scss" lang="scss">
|
2020-07-03 17:13:24 +08:00
|
|
|
.triggerFaultInfo{
|
|
|
|
margin-bottom:10px;
|
2021-01-07 11:13:03 +08:00
|
|
|
padding: 10px 10px 10px 15px;
|
2020-07-03 17:13:24 +08:00
|
|
|
}
|
|
|
|
.triggerFaultList{
|
|
|
|
font-size: 14px;
|
|
|
|
margin-top: 10px;
|
|
|
|
line-height: 20px;
|
|
|
|
}
|
|
|
|
.triggerFaultTitle{
|
|
|
|
font-size: 15px;
|
|
|
|
font-weight: bold;
|
2019-12-30 09:00:16 +08:00
|
|
|
}
|
2020-06-30 14:41:22 +08:00
|
|
|
.falutChooseTitle{
|
|
|
|
padding: 15px;
|
|
|
|
cursor: all-scroll;
|
|
|
|
}
|
|
|
|
#faultChoose{
|
2020-10-12 14:25:33 +08:00
|
|
|
width: 1000px;
|
2020-06-30 14:41:22 +08:00
|
|
|
position: absolute;
|
|
|
|
left: 30%;
|
|
|
|
top: 20%;
|
|
|
|
background: #fff;
|
|
|
|
padding:0px 0px 15px 0px;
|
|
|
|
// transform: translate3d(-50%,-50%,0);
|
|
|
|
border-radius: 6px;
|
|
|
|
z-index:999;
|
|
|
|
}
|
|
|
|
.faultChooseFoot{
|
|
|
|
display: inline-block;
|
|
|
|
float: right;
|
|
|
|
margin-right: 20px;
|
|
|
|
margin-top: 20px;
|
|
|
|
}
|
|
|
|
.closeFalutChoose{
|
|
|
|
position: absolute;
|
|
|
|
right: 0px;
|
|
|
|
top: 0px;
|
|
|
|
width: 35px;
|
|
|
|
height: 35px;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
.closeFalutChooseIn{
|
|
|
|
font-size: 20px;
|
|
|
|
margin-left: 5px;
|
|
|
|
margin-top: 10px;
|
|
|
|
}
|
2021-01-07 11:13:03 +08:00
|
|
|
.targetCard{
|
|
|
|
box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
|
|
|
|
border-top: 1px #ebeef5 solid;
|
|
|
|
}
|
|
|
|
.targetFormItem{
|
|
|
|
margin-bottom: 12px;
|
|
|
|
}
|
|
|
|
.targetCardHead{
|
|
|
|
padding: 5px;
|
|
|
|
display: inline-block;
|
|
|
|
width: 100%;
|
|
|
|
margin-bottom: 10px;
|
|
|
|
border-bottom: 1px #f4f4f4 solid;
|
|
|
|
text-align: right;
|
|
|
|
padding-right: 15px;
|
|
|
|
}
|
2019-12-30 09:00:16 +08:00
|
|
|
</style>
|