This commit is contained in:
sunzhenyu 2021-08-06 10:28:59 +08:00
commit bc47132b21
24 changed files with 1374 additions and 450 deletions

View File

@ -690,3 +690,41 @@ export function createOverlap(mapId, data) {
data data
}); });
} }
// 创建超限区段
export function createOverrunSection(mapId, data) {
return request({
url: `/api/draftMap/${mapId}/overrun`,
method: 'post',
data
});
}
// 分页查询超限区段
export function queryOverrunSectionPaging(mapId, params) {
return request({
url: `/api/draftMap/${mapId}/overrun/paging`,
method: 'get',
params
});
}
// 更新超限区段
export function updateOverrunSection(mapId, data) {
return request({
url: `/api/draftMap/${mapId}/overrun/${data.code}`,
method: 'put',
data
});
}
// 删除超限区段
export function deleteOverrunSection(mapId, code) {
return request({
url: `/api/draftMap/${mapId}/overrun/${code}`,
method: 'delete'
});
}
// 查询超限区段list
export function queryOverunSectionList(mapId) {
return request({
url: `/api/draftMap/${mapId}/overrun/all`,
method: 'get'
});
}

View File

@ -145,6 +145,7 @@ class SkinCode extends defaultStyle {
defaultColor: '#FFFFFF', // 信号灯字体默认色 defaultColor: '#FFFFFF', // 信号灯字体默认色
blockColor: '#FFFFFF', // 信号灯字体锁定颜色 blockColor: '#FFFFFF', // 信号灯字体锁定颜色
checkColor: '#00FF00', // 信号字体 checkColor: '#00FF00', // 信号字体
conflictColor:'#FF0000', // 冲突进路始端信号机颜色
nameBorderShow: true // 信号机名字边框显示 nameBorderShow: true // 信号机名字边框显示
}, },
lamp: { lamp: {

View File

@ -77,6 +77,7 @@ deviceState[deviceType.Signal] = {
redOpen: 1, // 红灯开放(默认状态) redOpen: 1, // 红灯开放(默认状态)
delayTime: 0, // 信号机延迟解锁倒计时 delayTime: 0, // 信号机延迟解锁倒计时
atsControl: 1, // 0是人工1是自动 atsControl: 1, // 0是人工1是自动
checkConflict:0, // 0是不检查冲突1是检测冲突检测冲突进路
fault: 0, // 是否故障 fault: 0, // 是否故障
isStartSignal: 0, // 是否进路排列选中始端信号机 isStartSignal: 0, // 是否进路排列选中始端信号机
isTerminalSignal: 0, // 是否进路排列待选终端信号机 isTerminalSignal: 0, // 是否进路排列待选终端信号机
@ -254,5 +255,5 @@ deviceState[deviceType.Train] = {
deviceState[deviceType.Responder] = { deviceState[deviceType.Responder] = {
}; };
deviceState[deviceType.IndicatorLight] = { deviceState[deviceType.IndicatorLight] = {
} };
export default deviceState; export default deviceState;

View File

@ -568,11 +568,13 @@ class Jlmap {
routeStartSignalData[item.code].forEach((elem, index)=> { routeStartSignalData[item.code].forEach((elem, index)=> {
if (index) { if (index) {
status.atsControl = status.atsControl && elem.atsControl; status.atsControl = status.atsControl && elem.atsControl;
status.checkConflict = status.checkConflict || elem.checkConflict;
status.fleetMode = status.fleetMode || elem.fleetMode; status.fleetMode = status.fleetMode || elem.fleetMode;
status.ciControl = status.ciControl || elem.ciControl; status.ciControl = status.ciControl || elem.ciControl;
status.lock = status.lock || elem.lock; status.lock = status.lock || elem.lock;
} else { } else {
status.atsControl = elem.atsControl; status.atsControl = elem.atsControl;
status.checkConflict = elem.checkConflict;
status.fleetMode = elem.fleetMode; status.fleetMode = elem.fleetMode;
status.ciControl = elem.ciControl; status.ciControl = elem.ciControl;
status.lock = elem.lock; status.lock = elem.lock;

View File

@ -994,6 +994,7 @@ class Signal extends Group {
!model.atsControl && this.setArtificialRouteClose(); /** 进路交人工控或自动控 */ !model.atsControl && this.setArtificialRouteClose(); /** 进路交人工控或自动控 */
} }
} }
// 设置点灯类型 必须在最后设置不能放前面 logicLight 0 物理点灯 1 逻辑点灯 // 设置点灯类型 必须在最后设置不能放前面 logicLight 0 物理点灯 1 逻辑点灯
if (model.logicLight) { if (model.logicLight) {
this.logicalLight(); // 设置逻辑点灯 this.logicalLight(); // 设置逻辑点灯
@ -1061,6 +1062,11 @@ class Signal extends Group {
if (model.noStatus || model.level === 0) { if (model.noStatus || model.level === 0) {
this.setAshShow(); this.setAshShow();
} }
// 冲突检查状态
if (this.style.Signal.text.conflictColor && model.checkConflict) {
this.sigName.setColor(this.style.Signal.text.conflictColor);
}
} }
} }

View File

@ -39,9 +39,14 @@
<span>{{ scope.row.name }}</span> <span>{{ scope.row.name }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="status" label="控制状态" width="100"> <el-table-column prop="status" label="控制状态" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="systemName=='xian-01__systerm'">
{{ scope.row.atsControl == '0' ? '人工' : scope.row.checkConflict?'自动 (进行冲突检查)':'自动 (不进行冲突检查)' }}
</div>
<div v-else>
{{ scope.row.atsControl == '0' ? '人工' : '自动' }} {{ scope.row.atsControl == '0' ? '人工' : '自动' }}
</div>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>

View File

@ -48,6 +48,21 @@
<span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">{{ scope.row.name }}</span> <span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">{{ scope.row.name }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="systemName == 'xian-01__systerm'" prop="atsControl" label="控制状态" style="margin-left:30px">
<template slot-scope="scope">
<span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">{{ scope.row.atsControl==0?'人工':'自动' }}</span>
</template>
</el-table-column>
<el-table-column v-if="systemName == 'xian-01__systerm'" prop="conflict" label="冲突检测" style="margin-left:30px">
<template v-if="title == '进路交ATS自动控'&& scope.row.atsControl==0" slot-scope="scope">
<el-checkbox
v-model="checkConflictList[scope.$index].value"
style="text-align: center; display: block;"
/>
<!-- @change="changeCheckConflit(checkConflictMap[scope.row.code],scope.row.code)" -->
<!-- :disabled="scope.row.disabled" -->
</template>
</el-table-column>
<el-table-column v-if="systemName === 'xian-01__systerm'" width="200"> <el-table-column v-if="systemName === 'xian-01__systerm'" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">{{ getProtectedSectionName(scope.row) }}</span> <span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">{{ getProtectedSectionName(scope.row) }}</span>
@ -113,6 +128,8 @@ export default {
signalName: '', signalName: '',
allSelect: false, allSelect: false,
changeList:[], changeList:[],
checkConflictList:[],
selectedCheckConflict:[],
commitDisabled: true, commitDisabled: true,
disabledLength: 0 disabledLength: 0
}; };
@ -152,7 +169,12 @@ export default {
if (this.operation == OperationEvent.Signal.humanControl.menu.operation) { if (this.operation == OperationEvent.Signal.humanControl.menu.operation) {
return '进路交人工控'; return '进路交人工控';
} else if (this.operation == OperationEvent.Signal.atsAutoControl.menu.operation) { } else if (this.operation == OperationEvent.Signal.atsAutoControl.menu.operation) {
if (this.systemName == 'xian-01__systerm') {
return '进路交ATS自动控';
} else {
return '进路交自动控'; return '进路交自动控';
}
} else { } else {
return ''; return '';
} }
@ -171,6 +193,8 @@ export default {
this.selected = selected; this.selected = selected;
this.allSelect = false; this.allSelect = false;
this.changeList = []; this.changeList = [];
this.checkConflictList = [];
// .splice(0, this.checkConflictList.length - 1);
this.commitDisabled = true; this.commitDisabled = true;
this.selection = []; this.selection = [];
this.disabledLength = 0; this.disabledLength = 0;
@ -187,18 +211,28 @@ export default {
} }
if (tempData && tempData.length > 0) { if (tempData && tempData.length > 0) {
const that = this;
tempData.forEach(elem => { tempData.forEach(elem => {
this.changeList.push(false); that.changeList.push(false);
elem.disabled = false; elem.disabled = false;
// //
if (operate.operation === OperationEvent.Signal.humanControl.menu.operation && if (operate.operation === OperationEvent.Signal.humanControl.menu.operation &&
(elem.atsControl == '0')) { (elem.atsControl == '0')) {
elem.disabled = true; elem.disabled = true;
this.disabledLength++; that.disabledLength++;
} if (operate.operation === OperationEvent.Signal.atsAutoControl.menu.operation && } if (operate.operation === OperationEvent.Signal.atsAutoControl.menu.operation) {
(elem.atsControl == '1')) { if (elem.atsControl == '1') {
elem.disabled = true; elem.disabled = true;
this.disabledLength++; that.disabledLength++;
that.checkConflictList.push({code:elem.code, value:null});
} else {
if (that.systemName == 'xian-01__systerm') {
that.checkConflictList.push({code:elem.code, value:false});
// that.$set('checkConflictMap', elem.code, );
// that.checkConflictMap[elem.code] = false;
}
}
} }
}); });
} }
@ -224,6 +258,16 @@ export default {
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
// mouseCancelState(this.selected); // mouseCancelState(this.selected);
}, },
changeCheckConflit(check, code) {
// debugger;
// this.checkConflictMap;
// this.$set('checkConflictMap', code, check);
// if (check) {
// this.checkConflictMap[code] = false;
// } else {
// this.checkConflictMap[code] = true;
// }
},
changeCheck(check, code) { changeCheck(check, code) {
if (check) { if (check) {
this.selection.push(code); this.selection.push(code);
@ -346,7 +390,7 @@ export default {
operate.message = `命令:进路交人工控<br/>始端信号机:${this.stationName} ${this.signalName}` + msg; operate.message = `命令:进路交人工控<br/>始端信号机:${this.stationName} ${this.signalName}` + msg;
this.$refs.ningBoConfirmTip.doShow(operate); this.$refs.ningBoConfirmTip.doShow(operate);
} }
}).catch((error) => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(); this.$refs.noticeInfo.doShow();
@ -357,7 +401,7 @@ export default {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch((error) => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(); this.$refs.noticeInfo.doShow();
@ -381,13 +425,22 @@ export default {
operate.message = `命令:进路交自动控<br/>始端信号机:${this.stationName} ${this.signalName}` + msg; operate.message = `命令:进路交自动控<br/>始端信号机:${this.stationName} ${this.signalName}` + msg;
this.$refs.ningBoConfirmTip.doShow(operate); this.$refs.ningBoConfirmTip.doShow(operate);
} }
}).catch((error) => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
this.$refs.noticeInfo.doShow(); this.$refs.noticeInfo.doShow();
}); });
} else { } else {
commitOperate(menuOperate.Signal.atsAutoControl, {routeCodeList:this.selection}, 2, {val}).then(({valid})=>{ const params = {routeCodeList:this.selection};
if (this.systemName === 'xian-01__systerm') {
const checkConflictList = [];
this.selection.forEach(each=>{
const checkConflict = this.checkConflictList.find(check=>{ return check.code == each; });
if (checkConflict) { checkConflictList.push(checkConflict.value); }
});
params.checkConflictList = checkConflictList;
}
commitOperate(menuOperate.Signal.atsAutoControl, params, 2, {val}).then(({valid})=>{
this.loading = false; this.loading = false;
if (valid) { if (valid) {
this.doClose(); this.doClose();

View File

@ -149,7 +149,12 @@ export const menuOperate = {
signalTotalCancle:{ // 信号机总取消 signalTotalCancle:{ // 信号机总取消
operation: OperationEvent.Signal.cancelTrainRoute.menu.operation, operation: OperationEvent.Signal.cancelTrainRoute.menu.operation,
cmdType: CMD.Signal.CMD_SIGNAL_TOTAL_CANCLE cmdType: CMD.Signal.CMD_SIGNAL_TOTAL_CANCLE
},
signalConflictRoute:{ // 冲突进路办理
operation: OperationEvent.Signal.signalConflictRoute.menu.operation,
cmdType:CMD.Signal.CMD_SIGNAL_CONFLICT_ROUTE_SET_CONFIRM
} }
// Signal_Conflict_Route_Set_Confirm
}, },
Switch:{ Switch:{
lock:{ lock:{

View File

@ -0,0 +1,186 @@
<template>
<div>
<el-dialog
v-dialogDrag
class="conflictRoute"
:class="systemName+' route-hand-control'"
title="冲突进路办理确认"
:visible.sync="show"
width="435px"
:before-close="closeDialog"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<div>
<div>
<div class="conflictRoute">
<span class="conflictRouteTitle">冲突进路</span>
<span class="conflictRouteName">{{ routeName }}</span>
</div>
</div>
<div class="conflictDescription">冲突描述</div>
<div class="context">
{{ message }}
</div>
<!-- <div class="conflictTips">距离对话框关闭还有{{ minutes }}{{ seconds }}请确认是否办理冲突进路</div> -->
<el-row justify="center" class="button-group">
<el-col :span="7" :offset="3">
<el-button
style="width: 115px;"
:loading="loading"
@click="selectConflict"
>选排冲突进路</el-button>
</el-col>
<!-- :id="domIdConfirm" -->
<!-- :disabled="commitDisabled" -->
<!-- :id="domIdCancel" -->
<el-col :span="7" :offset="3">
<el-button style="width: 115px;" :loading="loading" @click="routeRunplan">按计划执行</el-button>
</el-col>
</el-row>
</div>
</el-dialog>
<notice-info ref="noticeInfo" pop-class="xian-01__systerm" />
</div>
</template>
<script>
import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
export default {
name:'ConflictRoute',
components: {
NoticeInfo
},
props:{
systemName:{
type:String,
required:true
}
},
data() {
return {
dialogShow: false,
message:'',
routeCode:'',
routeName:'',
// allMinutes:10 * 60,
// minutes:10,
// seconds:0,
// inter:null,
loading:false
};
},
computed:{
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
}
},
methods:{
doShow({route, description}) {
if (route) {
this.routeCode = route.code;
const station = this.$store.getters['map/getDeviceByCode'](route.stationCode);
if (station) {
this.routeName = station.name + ' ' + route.name;
} else {
this.routeName = route.name;
}
}
this.message = description;
this.dialogShow = true;
this.$nextTick(function () {
// this.inter = setInterval(()=>{
// if (this.allMinutes <= 0) {
// clearInterval(this.inter);
// this.routeRunplan();
// }
// this.allMinutes--;
// this.minutes = (this.allMinutes - this.allMinutes % 60) / 60;
// this.seconds = this.allMinutes % 60;
// }, 1000);
this.$store.dispatch('training/emitTipFresh');
});
},
closeDialog() {
const that = this;
// clearInterval(this.inter);
commitOperate(menuOperate.Signal.signalConflictRoute, {routeCode:this.routeCode, way:1}, 3).then(({valid, operate})=>{
if (valid) {
that.doClose();
}
}).catch(error=>{
this.dialogShow = false;
console.error(error);
this.$refs.noticeInfo.doShow();
});
},
doClose() {
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
},
selectConflict() {
this.commit(2);
},
routeRunplan() {
this.commit(1);
},
commit(way) {
this.loading = true;
// int way, 1-2-
commitOperate(menuOperate.Signal.signalConflictRoute, {routeCode:this.routeCode, way:way}, 3).then(({valid, operate})=>{
this.loading = false;
if (valid) {
this.doClose();
// this.$refs.routeControl.doShow(operate, this.selected);
}
}).catch(error=>{
this.loading = false;
console.error(error);
this.$refs.noticeInfo.doShow();
});
}
}
};
</script>
<style>
.conflictRoute .context {
margin:5px 13px 13px 13px;
padding-bottom: 10px !important;
border: 1px solid lightgray;
line-height: 138%;
font-size: 15px;
height:115px;
}
.conflictDescription{
margin-left:13px;
font-size: 15px;
margin-top: 5px;
}
.conflictRoute{
padding-left: 13px;
font-size: 15px;
width: 100%;
padding-right: 13px;
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
align-content: center;
justify-content: flex-start;
align-items: flex-start;
}
.conflictRouteName{
font-size: 15px;
height: 23px;
border: 2px inset #E2E2E2;
padding-left: 5px;
flex-grow: 1;
}
.conflictRouteTitle{
}
.conflictTips{
margin-left: 13px;
}
</style>

View File

@ -9,6 +9,7 @@
<route-hand-control ref="routeHandControl" system-name="xian-01__systerm" /> <route-hand-control ref="routeHandControl" system-name="xian-01__systerm" />
<route-detail ref="routeDetail" system-name="xian-01__systerm" /> <route-detail ref="routeDetail" system-name="xian-01__systerm" />
<set-fault ref="setFault" pop-class="xian-01__systerm" /> <set-fault ref="setFault" pop-class="xian-01__systerm" />
<conflict-route ref="conflictRoute" system-name="xian-01__systerm" />
</div> </div>
</template> </template>
@ -27,6 +28,7 @@ import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic'; import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate'; import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import ConflictRoute from './dialog/conflictRoute';
export default { export default {
name: 'SignalMenu', name: 'SignalMenu',
@ -39,6 +41,7 @@ export default {
RouteHandControl, RouteHandControl,
RouteDetail, RouteDetail,
NoticeInfo, NoticeInfo,
ConflictRoute,
SetFault SetFault
}, },
props: { props: {
@ -239,18 +242,39 @@ export default {
} else { } else {
this.doClose(); this.doClose();
} }
},
'$store.state.socket.simulationAlarmInfo': function(val) {
(val || []).forEach(item => {
if (!item.confirmed && !item.recovered) {
if (item.level === '0') {
if (item.type == 'Conflict_Route_Set') {
const route = this.routeList.find(each=>{ return each.code == item.deviceCode; });
this.$refs.conflictRoute.doShow({route:route, description:item.description});
// doShow();
// "":"Route205",
// "description":"(111046(322)[X2112-X2102](311045)(22_G2202)(21_G2102)"
}
}
}
});
} }
}, },
methods: { methods: {
initMenu() { initMenu() {
this.menu = MenuContextHandler.covert(this.menuNormal); this.menu = MenuContextHandler.covert(this.menuNormal);
// //
const menuItem = this.menu.find( item => item.cmdType === CMD.Signal.CMD_SIGNAL_SET_CI_AUTO); const ciAutoMenuItem = this.menu.find( item => item.cmdType === CMD.Signal.CMD_SIGNAL_SET_CI_AUTO);
const menuItemDisabled = menuItem.disabled; const ciAutoTriggerMenuItem = this.menu.find( item => item.cmdType === CMD.Signal.CMD_SIGNAL_SET_CI_AUTO_TRIGGER);
menuItem.disabled = true; const ciAutoMenuItemDisabled = ciAutoMenuItem.disabled;
const ciAutoTriggerMenuItemDisabled = ciAutoTriggerMenuItem.disabled;
ciAutoMenuItem.disabled = true;
ciAutoTriggerMenuItem.disabled = true;
this.routeList.forEach(route => { this.routeList.forEach(route => {
if (route.startSignalCode === this.selected.code && route.flt) { if (route.startSignalCode === this.selected.code && route.flt) {
menuItem.disabled = menuItemDisabled; ciAutoMenuItem.disabled = ciAutoMenuItemDisabled;
}
if (route.startSignalCode === this.selected.code && route.arc ) {
ciAutoTriggerMenuItem.disabled = ciAutoTriggerMenuItemDisabled;
} }
}); });
if (this.operatemode === OperateMode.FAULT) { if (this.operatemode === OperateMode.FAULT) {
@ -299,6 +323,9 @@ export default {
commitOperate(menuOperate.Signal.arrangementRoute, { signalCode: this.selected.code }, 0).then(({valid, operate})=>{ commitOperate(menuOperate.Signal.arrangementRoute, { signalCode: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) { if (valid) {
this.$refs.routeSelection.doShow(operate, this.selected, this.getRouteList(this.selected)); this.$refs.routeSelection.doShow(operate, this.selected, this.getRouteList(this.selected));
// const route = this.routeList.find(each=>{ return each.code == 'Route205'; });
// this.$refs.conflictRoute.doShow({route:route, description:'(111046(322)[X2112-X2102](311045)(22_G2202)(21_G2102)'});
// this.$refs.conflictRoute.doShow({deviceCode:'Route205', });
} }
}); });
}, },

View File

@ -126,7 +126,9 @@ export default {
/** 信号机总取消 */ /** 信号机总取消 */
CMD_SIGNAL_TOTAL_CANCLE:{value:'Signal_Total_Cancel', label: '信号机总取消'}, CMD_SIGNAL_TOTAL_CANCLE:{value:'Signal_Total_Cancel', label: '信号机总取消'},
/** 设置保护 */ /** 设置保护 */
CMD_SIGNAL_SET_OVERLAP : {value: 'Signal_Set_Overlap', label: '设置保护'} CMD_SIGNAL_SET_OVERLAP : {value: 'Signal_Set_Overlap', label: '设置保护'},
/** 冲突进路办理 */
CMD_SIGNAL_CONFLICT_ROUTE_SET_CONFIRM:{value: 'Signal_Conflict_Route_Set_Confirm', label: '冲突进路办理'}
}, },
// 物理区段操作 // 物理区段操作

View File

@ -1703,6 +1703,13 @@ export const OperationEvent = {
operation: '3211', operation: '3211',
domId: '_Tips-Signal-setOverlap-Menu{BOTTOM}' domId: '_Tips-Signal-setOverlap-Menu{BOTTOM}'
} }
},
// 冲突进路办理
signalConflictRoute:{
menu: {
operation: '322',
domId: '_Tips-Signal-conflictRoute-Menu{TOP}'
}
} }
}, },

View File

@ -723,6 +723,7 @@ const map = {
map.stationList.forEach(station => { map.stationList.forEach(station => {
if (station.ciStation) { if (station.ciStation) {
const centrailzedList = [station.code]; const centrailzedList = [station.code];
state.stationControlMap[station.code] = centrailzedList;
station.relStationCodeList.forEach(relStationCode => { station.relStationCodeList.forEach(relStationCode => {
state.stationControlMap[relStationCode] = centrailzedList; state.stationControlMap[relStationCode] = centrailzedList;
if (state.mapDevice[relStationCode].centralized) { if (state.mapDevice[relStationCode].centralized) {

View File

@ -41,6 +41,7 @@ import FlankProtectOperate from './flankProtectOperate/index';
import DwellTimeOperate from './dwellTimeOperate/index'; import DwellTimeOperate from './dwellTimeOperate/index';
import DestinationOperate from './destinationOperate/index'; import DestinationOperate from './destinationOperate/index';
import ContinueProtectOperate from './continueProtectOperate/index'; import ContinueProtectOperate from './continueProtectOperate/index';
import OverrunSectionOperate from './overrunSectionOperate/index';
export default { export default {
name: 'DataRelation', name: 'DataRelation',
@ -110,7 +111,8 @@ export default {
{label: this.$t('map.automaticSignal'), name:'automatic', menus:AutomaticOperate}, {label: this.$t('map.automaticSignal'), name:'automatic', menus:AutomaticOperate},
{label: this.$t('map.routing'), name:'routing', menus:RoutingOperate}, {label: this.$t('map.routing'), name:'routing', menus:RoutingOperate},
{label: '停站时间', name:'dwellTime', menus:DwellTimeOperate}, {label: '停站时间', name:'dwellTime', menus:DwellTimeOperate},
{label: '设置运行等级', name:'runLevel', menus:RunLevelOperate} {label: '设置运行等级', name:'runLevel', menus:RunLevelOperate},
{label: '超限区段', name: 'overrun', menus: OverrunSectionOperate }
// ] // ]
]; ];
this.enabledTab = 'route'; this.enabledTab = 'route';

View File

@ -0,0 +1,223 @@
<template>
<div v-show="show">
<el-dialog v-dialogDrag v-loading="loading" title="超限区段预览" :visible.sync="show" width="95%" top="1vh" class="dialog_content_box" :before-do-close="doClose" append-to-body>
<div>
<QueryListPage
ref="queryListPage"
:pager-config="pagerConfig"
:query-form="queryForm"
:query-list="queryList"
/>
</div>
</el-dialog>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { queryOverrunSectionPaging, deleteOverrunSection} from '@/api/jmap/mapdraft';
// import ProtectDetail from './protectDetail';
export default {
name: 'RouteDetail',
props: {
mapInfo: {
type: Object,
default() {
return null;
}
},
overlapList: {
type: Array,
default() {
return [];
}
}
},
data() {
return {
show: false,
loading: false,
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '120px',
queryObject: {
sectionCode: {
type: 'select',
label: '区段',
config: {
data: []
}
},
ciSwitchCode: {
type: 'select',
label: '道岔',
config: {
data: []
}
},
switchCode: {
type: 'select',
label: '防护道岔',
config: {
data: []
}
}
}
}
};
},
computed: {
...mapGetters('map', [
'switchList',
'sectionList'
]),
queryList() {
return {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('map.code'),
prop: 'code',
width: 150
},
{
title: '区段',
prop: 'sectionCode',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.sectionCode, this.sectionList, ['code', 'name']); },
tagType: (row) => { return ''; }
},
{
title: '道岔',
prop: 'ciSwitch',
type: 'tag',
columnValue: (row) => { return row.ciSwitch ? this.$convertField(row.ciSwitch.switchCode, this.switchList, ['code', 'name']) : ''; },
tagType: (row) => { return ''; }
},
{
title: '道岔位置',
type: 'tag',
prop: 'ciSwitch',
columnValue: (row) => { return row.ciSwitch ? (row.ciSwitch.normal ? '定位' : '反位') : ''; },
tagType: (row) => { return ''; }
},
{
title: '防护的道岔',
type: 'tag',
prop: 'switchCode',
columnValue: (row) => { return this.$convertField(row.switchCode, this.switchList, ['code', 'name']); },
tagType: (row) => { return ''; }
},
{
type: 'button',
title: this.$t('map.operation'),
width: '250',
buttons: [
{
name: this.$t('map.compile'),
handleClick: this.edit
},
{
name: this.$t('map.deleteObj'),
handleClick: this.deleteObj,
type: 'danger'
}
]
}
]
};
}
},
watch: {
sectionList: function (val, old) {
this.initQueryObjectSectionList(val);
},
switchList: function (val, old) {
this.initQueryObjectSwitchList(val);
}
},
mounted() { //
},
methods: {
initQueryObjectSectionList(val) {
const list = [];
if (val && val.length) {
for (let i = 0; i < val.length; i++) {
list.push({ label: `${val[i].name}(${val[i].code})`, value: val[i].code });
}
}
this.queryForm.queryObject.sectionCode.config.data = list;
},
initQueryObjectSwitchList(val) {
const list = [];
if (val && val.length) {
for (let i = 0; i < val.length; i++) {
list.push({ label: `${val[i].name}(${val[i].code})`, value: val[i].code });
}
}
this.queryForm.queryObject.switchCode.config.data = list;
this.queryForm.queryObject.ciSwitchCode.config.data = list;
},
doShow() {
this.show = true;
this.$nextTick(() => {
this.initQueryObjectSectionList(this.sectionList);
this.initQueryObjectSwitchList(this.switchList);
this.$refs.queryListPage && this.$refs.queryListPage.commitQuery();
});
},
doClose() {
this.show = false;
},
queryFunction(params) {
if (this.mapInfo && this.mapInfo.id) {
return queryOverrunSectionPaging(this.mapInfo.id, params);
}
},
edit(index, row) {
this.$emit('routeSelected', row);
this.doClose();
},
deleteObj(index, row) {
if (row) {
this.$confirm('是否确认删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteOverrunSection(this.$route.params.mapId, row.code).then(response => {
this.reloadTable();
}).catch(() => {
this.$messageBox('删除失败');
});
}).catch(() => {
this.$message.info('已取消删除');
});
}
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
selectedObj(index, row) {
this.$emit('setRouteCode', row);
this.show = false;
}
}
};
</script>
<style lang="scss">
.dialog_content_box{
.el-dialog__body{
padding-top: 3px;
}
}
</style>

View File

@ -0,0 +1,66 @@
<template>
<div>
<overrun-detail ref="overrunDetail" :map-info="mapInfo" @routeSelected="routeSelected" />
<overrun-form
ref="overrunForm"
:map-info="mapInfo"
:selected="selected"
:overrun-data="overrunData"
@setCenter="setCenter"
/>
</div>
</template>
<script>
import OverrunDetail from './detail';
import OverrunForm from './overrun';
export default {
name: 'Index',
components: {
OverrunDetail,
OverrunForm
},
props: {
mapInfo: {
type: Object,
default() {
return null;
}
},
selected: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
overrunData: null
};
},
methods: {
setCenter(code) {
this.$emit('setCenter', code);
},
routeSelected(data) {
this.overrunData = data;
if (this.$refs && this.$refs.overrunForm) {
this.$refs.overrunForm.isSave = !data.id;
}
},
previewRouteEvent: function () {
if (this.$refs && this.$refs.overrunDetail) {
this.$refs.overrunDetail.doShow();
}
},
setSelected(selected) {
this.$refs.overrunForm.setSelected(selected);
}
}
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,262 @@
<template>
<div style="height: 100%;" class="route_box_list">
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-form ref="form" :model="addModel" :rules="rules" label-width="190px" size="mini">
<el-form-item label="区段" prop="sectionCode">
<el-select v-model="addModel.sectionCode" clearable filterable>
<el-option
v-for="item in sectionList"
:key="item.code"
:label="item.name + ' (' + item.code+ ')'"
:value="item.code"
/>
</el-select>
<el-button
:type=" field === 'overrunSection' ? 'danger' : 'primary'"
@click="hover('overrunSection')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="道岔" prop="ciSwitch.switchCode">
<el-select v-model="addModel.ciSwitch.switchCode" clearable filterable>
<el-option
v-for="item in switchList"
:key="item.code"
:label="item.name + ' (' + item.code+ ')'"
:value="item.code"
/>
</el-select>
<el-button
:type=" field === 'overrunSwitch' ? 'danger' : 'primary'"
@click="hover('overrunSwitch')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="道岔位置" prop="ciSwitch.normal">
<el-select v-model="addModel.ciSwitch.normal">
<el-option
v-for="item in SwitchLocateTypeList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="防护道岔" prop="switchCode">
<el-select v-model="addModel.switchCode" clearable filterable>
<el-option
v-for="item in switchList"
:key="item.code"
:label="item.name + '(' + item.code + ')'"
:value="item.code"
/>
</el-select>
<el-button
:type=" field === 'protectiveSwitch' ? 'danger' : 'primary'"
@click="hover('protectiveSwitch')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
</el-form>
<br>
<div class="draft">
<el-button-group>
<el-button v-if="isSave" type="primary" size="small" :loading="loading" @click="save">保存超限区段</el-button>
<el-button v-else type="warning" size="small" :loading="loading" @click="update">修改超限区段</el-button>
</el-button-group>
</div>
</el-scrollbar>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { updateOverrunSection, createOverrunSection } from '@/api/jmap/mapdraft';
export default {
name: 'RouteOperation',
props: {
selected: {
type: Object,
default() {
return null;
}
},
mapInfo: {
type: Object,
default() {
return null;
}
},
overrunData: {
type: Object,
default() {
return null;
}
}
},
data() {
var validateSection = (rule, value, callback) => {
if (!value && !this.addModel.ciSwitch.switchCode) {
callback(new Error('区段和道岔必须选填其一'));
} else {
if (!this.addModel.ciSwitch.switchCode) {
this.$refs.form.validateField('ciSwitch.switchCode');
}
callback();
}
};
var validateSwitch = (rule, value, callback) => {
if (!value && !this.addModel.sectionCode) {
callback(new Error('区段和道岔必须选填其一'));
} else {
if (!this.addModel.sectionCode) {
this.$refs.form.validateField('sectionCode');
}
callback();
}
};
return {
isSave: true,
field: '',
loading: false,
SwitchLocateTypeList: [
{ name: '定位', code: true },
{ name: '反位', code: false }
],
addModel: {
mapId: '',
code: '',
sectionCode: '',
ciSwitch: {
switchCode: '',
normal: true
},
switchCode: ''
},
rules: {
sectionCode: [
{ validator: validateSection, trigger: 'change' }
],
'ciSwitch.switchCode': [
{ validator: validateSwitch, trigger: 'change' }
]
}
};
},
computed: {
...mapGetters('map', [
'switchList',
'sectionList'
])
},
watch: {
mapInfo(val) {
if (val) {
this.addModel.mapId = val.id;
}
},
overrunData(val, old) {
if (val) {
this.addModel = {
mapId: val.mapId,
code: val.code,
sectionCode: val.sectionCode,
ciSwitch: val.ciSwitch ? val.ciSwitch : { switchCode: '', normal: true },
switchCode: val.switchCode
};
}
}
},
mounted() {
},
methods: {
deviceChange(code) {
this.$emit('setCenter', code);
},
hover(field) {
this.field = field === this.field ? '' : field;
},
save() {
// console.log('');createRoute
this.$refs.form.validate((valid) => {
if (valid) {
const modle = {
mapId: this.mapInfo.id,
code: '',
sectionCode: this.addModel.sectionCode,
ciSwitch: this.addModel.ciSwitch.switchCode ? this.addModel.ciSwitch : null,
switchCode: this.addModel.switchCode
};
createOverrunSection(this.mapInfo.id, modle).then(res => {
this.$message.success('保存超限区段成功!');
this.clear();
}).catch(() => {
this.$message.error('保存超限区段失败!');
});
}
});
},
update() {
this.$refs.form.validate((valid) => {
if (valid) {
const modle = {
mapId: this.mapInfo.id,
code: this.addModel.code,
sectionCode: this.addModel.sectionCode,
ciSwitch: this.addModel.ciSwitch.switchCode ? this.addModel.ciSwitch : null,
switchCode: this.addModel.switchCode
};
updateOverrunSection(this.mapInfo.id, modle).then(res => {
this.$message.success('更新超限区段成功!');
this.clear();
}).catch(() => {
this.$message.error('更新超限区段失败!');
});
}
});
},
clear() {
if (this.$refs && this.$refs.form && this.mapInfo) {
delete this.addModel.id;
this.$refs.form.resetFields();
this.addModel.mapId = this.mapInfo.id;
this.addModel.sectionCode = '';
this.addModel.ciSwitch = { switchCode: '', normal: true };
this.addModel.switchCode = '';
}
},
setSelected(selected) {
if (selected) {
if (selected._type.toUpperCase() === 'Section'.toUpperCase() && selected._type !== '02' && this.field.toUpperCase() === 'overrunSection'.toUpperCase()) {
this.addModel.sectionCode = selected.code;
} else if (selected._type.toUpperCase() === 'Switch'.toUpperCase() && this.field.toUpperCase() === 'overrunSwitch'.toUpperCase()) {
this.addModel.ciSwitch.switchCode = selected.code;
} else if (selected._type.toUpperCase() === 'Switch'.toUpperCase() && this.field.toUpperCase() === 'protectiveSwitch'.toUpperCase()) {
this.addModel.switchCode = selected.code;
}
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
/deep/ .el-radio {
margin-right: 10px;
}
/deep/ {
.el-select .el-tag {
height: auto;
display: flex;
align-items: center;
justify-content: center;
padding-right: 15px;
box-sizing: border-box;
white-space: normal;
}
.el-input__suffix{
right: 2px;
}
.draft {
width: 400px;
text-align: center;
margin: 20px auto;
}
}
</style>

View File

@ -149,6 +149,16 @@
@click="hover('routeStationStandList')" @click="hover('routeStationStandList')"
>{{ $t('map.activate') }}</el-button> >{{ $t('map.activate') }}</el-button>
</el-form-item> </el-form-item>
<el-form-item label="关联超限区段" prop="overrunList">
<el-select v-model="addModel.overrunList" multiple clearable filterable style="width: 220px;">
<el-option
v-for="item in overrunSectionList"
:key="item.code"
:label="getOverrunName(item)"
:value="item.code"
/>
</el-select>
</el-form-item>
</el-form> </el-form>
<hostile-data ref="hostile" :conflicting-signal-list="addModel.conflictingSignalList" @hover="hover" /> <hostile-data ref="hostile" :conflicting-signal-list="addModel.conflictingSignalList" @hover="hover" />
<br> <br>
@ -164,7 +174,7 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { getRouteNewList, getFlankProtectionList, putSetDraftMapRouteById, createRoute } from '@/api/jmap/mapdraft'; import { getRouteNewList, getFlankProtectionList, putSetDraftMapRouteById, createRoute, queryOverunSectionList } from '@/api/jmap/mapdraft';
import HostileData from './hostileData'; import HostileData from './hostileData';
// import { EventBus } from '@/scripts/event-bus'; // import { EventBus } from '@/scripts/event-bus';
@ -232,9 +242,11 @@ export default {
flankProtectionList: [], flankProtectionList: [],
stationStandList: [], // stationStandList: [], //
overlapCode:'', overlapCode:'',
overrunList: [], //
conflictingSignalList: [] // conflictingSignalList: [] //
}, },
// overlapList: [], // // overlapList: [], //
overrunSectionList: [], //
routeList: [] // routeList: [] //
}; };
}, },
@ -343,6 +355,7 @@ export default {
mounted() { mounted() {
this.getRouteList(); this.getRouteList();
this.getFlankProtectList(); this.getFlankProtectList();
this.getOverrunSectionList();
// this.initProtectData(); // this.initProtectData();
// EventBus.$on('successCI', () => { // EventBus.$on('successCI', () => {
// this.initProtectData(); // this.initProtectData();
@ -354,6 +367,17 @@ export default {
return station.ciStation; return station.ciStation;
}); });
}, },
getOverrunName(overrun) {
if (overrun.ciSwitch && overrun.ciSwitch.switchCode) {
const switchDevice = this.$store.getters['map/getDeviceByCode'](overrun.ciSwitch.switchCode);
return switchDevice ? overrun.code + '(' + switchDevice.name + '-' + (overrun.ciSwitch.normal ? '定位' : '反位') + ')' : overrun.code;
} else if (overrun.sectionCode) {
const section = this.$store.getters['map/getDeviceByCode'](overrun.sectionCode);
return section ? overrun.code + '(' + section.name + ')' : overrun.code;
} else {
return overrun.code;
}
},
async getRouteList() { async getRouteList() {
const response = await getRouteNewList(this.$route.params.mapId, { pageSize: 9999, pageNum: 1 }); const response = await getRouteNewList(this.$route.params.mapId, { pageSize: 9999, pageNum: 1 });
this.routeList = response.data.list; this.routeList = response.data.list;
@ -364,6 +388,11 @@ export default {
this.$store.dispatch('map/setFlankProtectList', item); this.$store.dispatch('map/setFlankProtectList', item);
}); });
}, },
getOverrunSectionList() {
queryOverunSectionList(this.$route.params.mapId).then(resp => {
this.overrunSectionList = resp.data;
});
},
swictchName(code) { swictchName(code) {
let name = ''; let name = '';
if (code) { if (code) {
@ -436,6 +465,7 @@ export default {
this.addModel.overlapCode = ''; this.addModel.overlapCode = '';
this.addModel.code = ''; this.addModel.code = '';
this.addModel.conflictingSignalList = []; this.addModel.conflictingSignalList = [];
this.addModel.overrunList = [];
this.isSave = true; this.isSave = true;
this.routeCode = ''; this.routeCode = '';
this.routeType = ''; this.routeType = '';

View File

@ -50,9 +50,6 @@ export default {
if (this.type == 'Text') { if (this.type == 'Text') {
data.content = `${this.editModel.prepend}::${this.editModel.content}`; data.content = `${this.editModel.prepend}::${this.editModel.content}`;
} }
if (data.type !== 'VB') {
data.signalCode = '';
}
this.$emit('updateMapModel', data); this.$emit('updateMapModel', data);
this.$emit('clearDeviceSelect'); this.$emit('clearDeviceSelect');
} else { } else {

View File

@ -8,7 +8,7 @@
:centralized-station-list="centralizedStationList" :centralized-station-list="centralizedStationList"
:responder-list="responderList" :responder-list="responderList"
:section-list="filterSectionList" :section-list="filterSectionList"
:signalList="signalList" :signal-list="signalList"
v-on="$listeners" v-on="$listeners"
@hover="hover" @hover="hover"
@deviceChange="deviceChange" @deviceChange="deviceChange"
@ -38,11 +38,12 @@
:centralized-station-list="centralizedStationList" :centralized-station-list="centralizedStationList"
:responder-list="responderList" :responder-list="responderList"
:section-list="filterSectionList" :section-list="filterSectionList"
:signalList="signalList" :signal-list="signalList"
v-on="$listeners" v-on="$listeners"
@hover="hover" @hover="hover"
@deviceChange="deviceChange" @deviceChange="deviceChange"
@deviceSelect="deviceSelect" /> @deviceSelect="deviceSelect"
/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane class="view-control" label="批量操作" name="fourth" :lazy="lazy"> <el-tab-pane class="view-control" label="批量操作" name="fourth" :lazy="lazy">
<responder-batch-operate <responder-batch-operate
@ -172,12 +173,12 @@ export default {
}, },
edit() { edit() {
if (this.$refs.respModel) { if (this.$refs.respModel) {
this.$refs.respModel.edit() this.$refs.respModel.edit();
} }
}, },
deleteObj() { deleteObj() {
if (this.$refs.respModel) { if (this.$refs.respModel) {
this.$refs.respModel.deleteObj() this.$refs.respModel.deleteObj();
} }
} }
} }

View File

@ -23,12 +23,12 @@
/> />
</el-select> </el-select>
<el-button <el-button
@click="handleHover(-1, 'RelBatchSectionCode')"
:type=" :type="
field === 'RelBatchSectionCode' && row === -1 field === 'RelBatchSectionCode' && row === -1
? 'danger' ? 'danger'
: 'primary' : 'primary'
" "
@click="handleHover(-1, 'RelBatchSectionCode')"
> >
激活 激活
</el-button> </el-button>
@ -68,7 +68,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<div class="sub-form" v-if="subFormData.length"> <div v-if="subFormData.length" class="sub-form">
<template v-for="(item, index) in subFormData"> <template v-for="(item, index) in subFormData">
<div :key="`subFormUnit${index}`" class="sub-form-unit"> <div :key="`subFormUnit${index}`" class="sub-form-unit">
<el-row> <el-row>
@ -103,7 +103,7 @@
<el-input-number v-model="item.offset" /> <el-input-number v-model="item.offset" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="14" v-if="item.type === 'VB'"> <el-col v-if="item.type === 'VB'" :span="14">
<el-form-item label="信号机"> <el-form-item label="信号机">
<el-select <el-select
v-model="item.signalCode" v-model="item.signalCode"
@ -118,15 +118,15 @@
/> />
</el-select> </el-select>
<el-button <el-button
@click="
handleHover(index, 'RelBatchSignalCode')
"
:type=" :type="
field === 'RelBatchSignalCode' && field === 'RelBatchSignalCode' &&
row === index row === index
? 'danger' ? 'danger'
: 'primary' : 'primary'
" "
@click="
handleHover(index, 'RelBatchSignalCode')
"
> >
激活 激活
</el-button> </el-button>
@ -137,20 +137,24 @@
</template> </template>
</div> </div>
<div class="btn-area"> <div class="btn-area">
<el-button size="small" type="primary" @click="doBatchCreate" <el-button
>批量创建</el-button size="small"
> type="primary"
<el-button size="small" type="danger" @click="resetForm" @click="doBatchCreate"
>重置</el-button >批量创建</el-button>
> <el-button
size="small"
type="danger"
@click="resetForm"
>重置</el-button>
</div> </div>
</el-form> </el-form>
</template> </template>
<script> <script>
import * as utils from "./utils"; import * as utils from './utils';
export default { export default {
name: "responderBatch", name: 'ResponderBatch',
props: { props: {
selected: { selected: {
type: Object, type: Object,
@ -160,7 +164,7 @@ export default {
}, },
field: { field: {
type: String, type: String,
default: "" default: ''
}, },
responderTypeList: { responderTypeList: {
type: Array, type: Array,
@ -182,8 +186,8 @@ export default {
data() { data() {
return { return {
formData: { formData: {
sectionCode: "", sectionCode: '',
type: "", type: '',
count: 0 count: 0
}, },
subFormData: [], subFormData: [],
@ -192,19 +196,19 @@ export default {
sectionCode: [ sectionCode: [
{ {
required: true, required: true,
message: "请选择区段" message: '请选择区段'
} }
], ],
type: [ type: [
{ {
required: true, required: true,
message: "请选择类型" message: '请选择类型'
} }
], ],
count: [ count: [
{ {
validator: (rule, value, cb) => { validator: (rule, value, cb) => {
value !== 0 ? cb() : cb(new Error("至少创建一个")); value !== 0 ? cb() : cb(new Error('至少创建一个'));
} }
} }
] ]
@ -213,11 +217,11 @@ export default {
}, },
methods: { methods: {
setModelProp(selected, prop) { setModelProp(selected, prop) {
if (prop === "sectionCode") { if (prop === 'sectionCode') {
// //
this.formData[prop] = selected.code; this.formData[prop] = selected.code;
} else if (prop === "signalCode") { } else if (prop === 'signalCode') {
// //
this.subFormData[this.row][prop] = selected.code; this.subFormData[this.row][prop] = selected.code;
} }
}, },
@ -236,10 +240,10 @@ export default {
createSubForm(length) { createSubForm(length) {
return Array.from({ length }, _ => { return Array.from({ length }, _ => {
return { return {
name: "", name: '',
type: this.formData.type, type: this.formData.type,
offset: 0, offset: 0,
signalCode: "" signalCode: ''
}; };
}); });
}, },
@ -250,7 +254,7 @@ export default {
}, },
handleHover(row, prop) { handleHover(row, prop) {
this.row = row; this.row = row;
this.$emit("hover", prop); this.$emit('hover', prop);
}, },
doBatchCreate() { doBatchCreate() {
this.$refs.form.validate(valid => { this.$refs.form.validate(valid => {
@ -259,7 +263,7 @@ export default {
const models = []; const models = [];
// //
this.subFormData.forEach(el => { this.subFormData.forEach(el => {
if (el.type !== "VB") el.signalCode = ""; if (el.type !== 'VB') el.signalCode = '';
el.sectionCode = this.formData.sectionCode; el.sectionCode = this.formData.sectionCode;
if (!groupMap[el.sectionCode]) { if (!groupMap[el.sectionCode]) {
groupMap[el.sectionCode] = []; groupMap[el.sectionCode] = [];
@ -270,7 +274,7 @@ export default {
// //
Object.keys(groupMap).forEach(code => { Object.keys(groupMap).forEach(code => {
const section = this.$store.getters[ const section = this.$store.getters[
"map/getDeviceByCode" 'map/getDeviceByCode'
](code); ](code);
const list = groupMap[code]; const list = groupMap[code];
const length = list.length; const length = list.length;
@ -296,14 +300,14 @@ export default {
}); });
}); });
// //
this.$emit("updateMapModel", models); this.$emit('updateMapModel', models);
} }
}); });
}, },
resetForm() { resetForm() {
this.formData = { this.formData = {
sectionCode: "", sectionCode: '',
type: "", type: '',
count: 0 count: 0
}; };
this.numBlur(); this.numBlur();

View File

@ -1,35 +1,37 @@
<template> <template>
<div class="content"> <div class="content">
<el-button type="primary" size="mini" @click="batchConnectHandler" <el-button
>一键关联信号机</el-button type="primary"
> size="mini"
@click="batchConnectHandler"
>一键关联信号机</el-button>
<div class="desc">一键将未关联信号机的可变应答器关联到最近的信号机</div> <div class="desc">一键将未关联信号机的可变应答器关联到最近的信号机</div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: "responderBatchOperate", name: 'ResponderBatchOperate',
props: ["responderList", "signalList"], props: ['responderList', 'signalList'],
data() { data() {
return {}; return {};
}, },
methods: { methods: {
batchConnectHandler() { batchConnectHandler() {
try { try {
let models = this.responderList.filter( const models = this.responderList.filter(
el => el.type === "VB" && !el.signalCode el => el.type === 'VB' && !el.signalCode
); );
models.forEach(responder => { models.forEach(responder => {
const sectionCode = responder.sectionCode; const sectionCode = responder.sectionCode;
let signals = this.signalList.filter( const signals = this.signalList.filter(
signal => signal.sectionCode === sectionCode signal => signal.sectionCode === sectionCode
); );
if (signals.length === 1) { if (signals.length === 1) {
responder.signalCode = signals[0].code; responder.signalCode = signals[0].code;
} else if (signals.length > 1) { } else if (signals.length > 1) {
let signalsPosition = signals.map(_ => _.position); const signalsPosition = signals.map(_ => _.position);
let nearestSignalCode = const nearestSignalCode =
signals[ signals[
this.chooseNearestSignal( this.chooseNearestSignal(
responder.position, responder.position,
@ -39,8 +41,8 @@ export default {
responder.signalCode = nearestSignalCode; responder.signalCode = nearestSignalCode;
} }
}); });
this.$emit("updateMapModel", models); this.$emit('updateMapModel', models);
this.$message.success("关联成功"); this.$message.success('关联成功');
} catch (error) { } catch (error) {
this.$message.info(error); this.$message.info(error);
} }
@ -56,7 +58,7 @@ export default {
chooseNearestSignal(respPos, sigPos) { chooseNearestSignal(respPos, sigPos) {
let [minDistance, idx] = [Infinity, -1]; let [minDistance, idx] = [Infinity, -1];
sigPos.forEach((s, i) => { sigPos.forEach((s, i) => {
let distance = this.distanceOf(respPos, s); const distance = this.distanceOf(respPos, s);
if (distance < minDistance) [minDistance, idx] = [distance, i]; if (distance < minDistance) [minDistance, idx] = [distance, i];
}); });
return idx; return idx;

View File

@ -85,7 +85,7 @@ export default {
{ prop: 'name', label: '应答器名称', type: 'input' }, { prop: 'name', label: '应答器名称', type: 'input' },
{ prop: 'type', label: `应答器类型`, type: 'select', optionLabel: 'name&&value', optionValue: 'value', options: this.responderTypeList }, { prop: 'type', label: `应答器类型`, type: 'select', optionLabel: 'name&&value', optionValue: 'value', options: this.responderTypeList },
{ prop: 'sectionCode', label: '关联区段', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.sectionList, buttonType: 'RelSectionCode', hover: this.hover, buttonShowType: this.isSectionButtonType }, { prop: 'sectionCode', label: '关联区段', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.sectionList, buttonType: 'RelSectionCode', hover: this.hover, buttonShowType: this.isSectionButtonType },
{ prop: 'signalCode', label: '关联信号机', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.signalList, buttonType: 'RelSignalCode', hover: this.hover, buttonShowType: this.isSignalButtonType }, { prop: 'signalCode', label: '关联信号机', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.signalList, buttonType: 'RelSignalCode', hover: this.hover, buttonShowType: this.isSignalButtonType }
] ]
} }
} }

View File

@ -145,7 +145,7 @@ export default {
] }, ] },
{ prop:'textRotate', label: '文字旋转', type: 'number' }, { prop:'textRotate', label: '文字旋转', type: 'number' },
{ prop: 'sectionCode', label: '关联区段', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.sectionList, buttonType: 'RelModelSectionCode', hover: this.hover, buttonShowType: this.isSectionButtonType }, { prop: 'sectionCode', label: '关联区段', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.sectionList, buttonType: 'RelModelSectionCode', hover: this.hover, buttonShowType: this.isSectionButtonType },
this.editModel.type === 'VB'? { prop: 'signalCode', label: '关联信号机', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.signalList, buttonType: 'RelModelSignalCode', hover: this.hover, buttonShowType: this.isSignalButtonType } :'', this.editModel.type === 'VB' || this.editModel.type === 'IB' ? { prop: 'signalCode', label: '关联信号机', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.signalList, buttonType: 'RelModelSignalCode', hover: this.hover, buttonShowType: this.isSignalButtonType } : '',
{ prop: 'stationCode', label: '关联集中站' + ':', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.centralizedStationList } { prop: 'stationCode', label: '关联集中站' + ':', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.centralizedStationList }
] ]
}, },
@ -183,6 +183,9 @@ export default {
this.$refs.dataform.edit(); this.$refs.dataform.edit();
}, },
updateMapModel(data) { updateMapModel(data) {
if (data.type !== 'VB' && data.type !== 'IB') {
data.signalCode = '';
}
this.$emit('updateMapModel', data); this.$emit('updateMapModel', data);
} }
} }