This commit is contained in:
zyy 2019-12-19 13:12:43 +08:00
commit 3abc93cbb8
6 changed files with 499 additions and 91 deletions

View File

@ -113,7 +113,7 @@ export default class Station extends Group {
text: {
position: [0, 0],
x: model.turnBackPoint.x + style.Station.turnBack.lampSpace * index,
y: model.turnBackPoint.y + style.Station.lamp.radiusR + style.Station.text.distance,
y: model.turnBackPoint.y + style.Station.lamp.radiusR + style.Station.StationControl.text.distance,
fontWeight: style.Station.text.fontWeight,
fontSize: style.Station.text.fontSize,
fontFamily: style.fontFamily,

View File

@ -13,14 +13,6 @@
<el-button type="text" class="mapEdit_box" @click="showMap">{{ $t('map.viewLayer') }}</el-button>
</div>
<el-tabs v-model="enabledTab" type="card" class="map_card" @tab-click="changePane">
<el-tab-pane :label="$t('map.continueProtect')" class="tab_pane_box" name="protect">
<protect-operate
ref="protectOperate"
:map-info="mapInfo"
:selected="selected"
@setCenter="setCenter"
/>
</el-tab-pane>
<el-tab-pane :label="$t('map.routeID')" class="tab_pane_box" name="route">
<route-operate
ref="routeOperate"
@ -81,7 +73,6 @@ import RoutingOperate from './routingoperate/index';
import AutomaticOperate from './automaticoperate/index';
import PathOperate from './pathoperate/index';
import SignalOperate from './signaloperate/index';
import ProtectOperate from './protectoperate/index';
import TurnedOperate from './turnedoperate/index';
export default {
@ -92,7 +83,6 @@ export default {
AutomaticOperate,
PathOperate,
SignalOperate,
ProtectOperate,
TurnedOperate
},
props: {
@ -109,7 +99,7 @@ export default {
},
data() {
return {
enabledTab: 'protect',
enabledTab: 'route',
oldDevice: null
};
},
@ -121,9 +111,6 @@ export default {
},
createRouteEvent() {
switch (this.enabledTab) {
case 'protect':
this.$refs.protectOperate.createRouteEvent();
break;
case 'route':
this.$refs.routeOperate.createRouteEvent();
break;
@ -146,9 +133,6 @@ export default {
},
previewRouteEvent() {
switch (this.enabledTab) {
case 'protect':
this.$refs.protectOperate.previewRouteEvent();
break;
case 'route':
this.$refs.routeOperate.previewRouteEvent();
break;
@ -175,9 +159,6 @@ export default {
setSelected(selected) {
this.handleHightLight(selected);
switch (this.enabledTab) {
case 'protect':
this.$refs.protectOperate.setSelected(selected);
break;
case 'route':
this.$refs.routeOperate.setSelected(selected);
break;

View File

@ -14,7 +14,7 @@
<script>
import { mapGetters } from 'vuex';
import { listMap, getRouteNewList, delRouteNew, getRouteNewById, putRouteNew, getContinueProtectList } from '@/api/jmap/mapdraft'; /** listRouteMapRoute*/
import { listMap, getRouteNewList, delRouteNew, getRouteNewById, putRouteNew, getContinueProtectList, delContinueProtect } from '@/api/jmap/mapdraft'; /** listRouteMapRoute*/
import PreViewField from './preview';
export default {
@ -108,20 +108,20 @@ export default {
title: this.$t('map.endingSignalName'),
prop: 'endSignalCode'
},
{
title: '延续保护',
prop: 'overlapCode'
},
// {
// type: 'button',
// title: this.$t('map.continueProtectSwitchData'),
// buttons: [
// {
// name: this.$t('map.preview'),
// handleClick: this.overlapSwitchDetail
// }
// ]
// title: '',
// prop: 'overlapCode'
// },
{
type: 'button',
title: '延续保护',
buttons: [
{
name: this.$t('map.preview'),
handleClick: this.overlapSwitchDetail
}
]
},
{
type: 'button',
title: this.$t('map.accessSideTurnoutData'),
@ -329,24 +329,40 @@ export default {
},
async overlapSwitchDetail(index, row) { //
if (this.$refs && this.$refs.previewField && row) {
const switchDict = {};
const switchTypeDict = {};
this.switchList.map(elem => { switchDict[elem.code] = elem.name; });
this.SwitchLocateTypeList.map(elem => { switchTypeDict[elem.code] = elem.name; });
const fieldList = {
id: row.id,
mapId: this.$route.params.mapId,
title: '延续保护道岔数据',
name: row.name,
model: {
items: [
{ prop: 'switchCode', label: '道岔ID', type: 'text' },
{ prop: 'switchCode', label: '道岔名称', type: 'select', options: switchDict },
{ prop: 'switchLocateType', label: '道岔类型', type: 'select', options: switchTypeDict }
]
}
};
this.$refs.previewField.doShow(fieldList, row.routeOverlapSwitchList);
// const param = {
// code: row.overlapCode,
// pageNum: 10,
// pageSize:1
// };
// getContinueProtectList(this.$route.params.mapId, param).then(resp => {
// if (resp.data.list[0]) {
// const data = resp.data.list[0];
// const overlabList = [];
// data.relSectionSwitchList.forEach( (item) =>{
// if (item.routeOverlapSwitchList.length) {
//
// }
// });
// }
// });
// const switchDict = {};
// const switchTypeDict = {};
// this.switchList.map(elem => { switchDict[elem.code] = elem.name; });
// this.SwitchLocateTypeList.map(elem => { switchTypeDict[elem.code] = elem.name; });
// const fieldList = {
// id: row.id,
// mapId: this.$route.params.mapId,
// title: '',
// name: row.name,
// model: {
// items: [
// { prop: 'switchCode', label: 'ID', type: 'text' },
// { prop: 'switchCode', label: '', type: 'select', options: switchDict },
// { prop: 'switchLocateType', label: '', type: 'select', options: switchTypeDict }
// ]
// }
// };
// this.$refs.previewField.doShow(fieldList, row.routeOverlapSwitchList);
}
},
async flankProtectionSwitchDetail(index, row) { //
@ -445,7 +461,18 @@ export default {
type: 'warning'
}).then(() => {
delRouteNew(row.id).then(response => {
this.$message.success('删除成功');
const param = {
code: row.overlapCode,
pageNum: 10,
pageSize:1
};
getContinueProtectList(this.$route.params.mapId, param).then(resp => {
if (resp.data.list[0]) {
delContinueProtect(resp.data.list[0].id).then( res => {
this.$message.success('删除成功');
});
}
});
this.reloadTable();
}).catch(() => {
this.$messageBox('删除失败');

View File

@ -8,7 +8,7 @@
center
append-to-body
>
<el-table :data="data" border style="width: 100%">
<el-table :data="data" :span-method="objectSpanMethod" border style="width: 100%">
<template v-for="(item, index) in form">
<el-table-column :key="index" :label="item.label">
<template slot-scope="scope">
@ -67,6 +67,12 @@ export default {
},
doClose(done) {
this.show = false;
},
objectSpanMethod() {
return {
rowspan: 1,
colspan: 1
};
}
}
};

View File

@ -0,0 +1,383 @@
<template>
<div style="height: 100%;">
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-form ref="form" :model="addModel" :rules="rules" label-width="190px" size="mini">
<div class="definition">
<el-form-item label="延续保护解锁区段:" prop="unlockSectionCode">
<el-select v-model="addModel.unlockSectionCode">
<el-option
v-for="item in sectionList"
:key="item.code"
:label="item.name + ' (' + item.code+ ')'"
:value="item.code"
/>
</el-select>
<el-button
:type=" field === 'unlockSectionCode' ? 'danger' : 'primary'"
@click="hover('unlockSectionCode')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="延续保护解锁时间(s):" prop="unlockTime">
<el-input-number v-model="addModel.unlockTime" :min="0" />
</el-form-item>
<el-form-item label="延续保护线路:" prop="relSectionSwitchList">
<el-table :data="addModel.relSectionSwitchList" border style="width: 80%">
<el-table-column type="index" label="序号" width="100" />
<el-table-column fixed="right" :label="$t('map.operation')">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click.native.prevent="deleteOverlab(addModel.relSectionSwitchList, scope.$index)"
>
移出
</el-button>
<el-button
type="text"
size="small"
@click.native.prevent="editOverlab(addModel.relSectionSwitchList, scope.$index)"
>
编辑
</el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
</div>
</el-form>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span style="font-size: 14px;">{{ cardTitle }}</span>
<el-button v-if="cardMode === 'generate'" style="float: right; padding: 3px 0" type="text" @click="generateOverlab">生成</el-button>
<el-button-group v-else-if=" cardMode === 'edit'" style="float: right;">
<el-button type="text" style="padding:3px 3px" @click="updateOverlab">修改</el-button>
<el-button type="text" style="padding:3px 0" @click="cancelOverlab">取消</el-button>
</el-button-group>
</div>
<div>
<el-form ref="overlabForm" :model="addOverlapModel" :rules="overLapRules" label-width="135px" size="mini" style="margin-top: 15px">
<el-form-item :label="$t('map.routeProtectsData') + ':'" prop="routeOverlapSectionList">
<el-select v-model="addOverlapModel.routeOverlapSectionList" multiple clearable :filterable="true">
<el-option
v-for="item in sectionList"
:key="item.code"
:label="item.name + ' (' + item.code+ ')'"
:value="item.code"
/>
</el-select>
<el-button
:type=" field === 'routeOverlapSectionList' ? 'danger' : 'primary'"
@click="hover('routeOverlapSectionList')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item :label="$t('map.continueProtectSwitchData') + ':'" prop="routeOverlapSwitchList">
<el-select v-model="overlapCode" clearable :filterable="true" :placeholder="$t('map.pleaseSelect')">
<el-option
v-for="item in switchList"
:key="item.code"
:label="`${item.name}(${item.code})`"
:value="item.code"
/>
</el-select>
<el-button
:type=" field === 'routeOverlapSwitchList' ? 'danger' : 'primary'"
@click="hover('routeOverlapSwitchList')"
>{{ $t('map.activate') }}</el-button>
<el-button
type="primary"
@click="pushSwitch(addOverlapModel.routeOverlapSwitchList, {switchCode: overlapCode, normal: overlapType, switchType: overlapType ? '定位' : '反位'})"
>{{ $t('map.add') }}
</el-button>
<el-select v-model="overlapType" :filterable="true" :placeholder="$t('map.pleaseSelect')">
<el-option
v-for="item in SwitchLocateTypeList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
<el-table :data="addOverlapModel.routeOverlapSwitchList" border style="width: 97%">
<el-table-column prop="switchCode" :label="$t('map.switchId')" width="100">
<template slot-scope="scope">
<span>{{ swictchName(scope.row.switchCode) }}</span>
</template>
</el-table-column>
<el-table-column prop="switchType" :label="$t('map.switchType')" />
<el-table-column fixed="right" :label="$t('map.operation')" width="50">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click.native.prevent="deleteSwitch(addOverlapModel.routeOverlapSwitchList, scope.$index)"
>
{{ $t('map.remove') }}
</el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
</el-form>
</div>
</el-card>
</el-scrollbar>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { getUID } from '@/jmap/utils/Uid';
import { postContinueProtect, putContinueProtect } from '@/api/jmap/mapdraft';
import { ViewMode } from '@/scripts/ConstDic';
import { deepAssign } from '@/utils/index';
export default {
name: 'RouteOperation',
props: {
selected: {
type: Object,
default() {
return null;
}
},
mapInfo: {
type: Object,
default() {
return null;
}
},
protectData: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
ViewMode: ViewMode,
field: '',
overlapCode: '',
isSave: true,
editModel: {},
addModel: {
id: '',
code: '',
mapId: '',
unlockSectionCode:'',
unlockTime: 0,
relSectionSwitchList: []
},
addOverlapModel: {
parentIndex: '',
routeOverlapSectionList: [], //
routeOverlapSwitchList: [] //
},
overlapType: '',
SwitchLocateTypeList: [
{ name: '定位', code: true },
{ name: '反位', code: false }
],
editShow: false,
overLapRules: {
},
rules: {
unlockSectionCode: [
{ required: true, message: '请选择解锁区段', trigger:'change'}
],
unlockTime: [
{ required: true, message: '请输入解锁时间', trigger:'blur'}
],
relSectionSwitchList: [
{ required: true, message: '请生成延续保护线路', trigger: 'change'}
]
},
cardMode: 'generate'
};
},
computed: {
...mapGetters('map', [
'switchList',
'sectionList'
]),
cardTitle() {
if (this.cardMode === 'generate') {
return '生成延续保护线路';
} else if (this.cardMode === 'edit') {
return '编辑延续保护线路';
} else {
return '';
}
}
},
watch: {
mapInfo(val) {
if (val) {
this.addModel.mapId = val.id;
}
},
protectData(val, old) {
if (val) {
this.addModel = val;
this.editShow = true;
}
}
},
mounted() {
},
methods: {
hover(field) {
this.field = field === this.field ? '' : field;
},
pushSwitch(list, data) {
const index = list.findIndex(elem => { return elem.switchCode == data.switchCode; });
if (index < 0) {
list.push(data);
} else {
this.$messageBox(this.$t('tip.routeSameID'));
}
},
deleteSwitch(list, index) {
list.splice(index, 1);
},
swictchName(code) {
let name = '';
if (code) {
const swch = this.$store.getters['map/getDeviceByCode'](code);
if (swch) {
name = `${swch.name}(${swch.code})`;
}
}
return name;
},
setSelected(selected) {
if (selected) {
if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'routeOverlapSectionList'.toUpperCase()) {
if (this.addOverlapModel.routeOverlapSectionList.indexOf(selected.code) === -1) {
this.addOverlapModel.routeOverlapSectionList.push(selected.code);
}
} else if (selected._type.toUpperCase() === 'Switch'.toUpperCase() && this.field.toUpperCase() === 'routeOverlapSwitchList'.toUpperCase()) {
this.overlapCode = selected.code;
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'unlockSectionCode'.toUpperCase()) {
this.addModel.unlockSectionCode = selected.code;
}
}
},
buildModel(code) {
const model = Object.assign({}, this.addModel);
if (code) { model['code'] = code; }
model['mapId'] = this.$route.params.mapId;
return model;
},
save() {
this.$refs.form.validate((valid) => {
if (valid) {
const model = this.buildModel(getUID('Protect'));
postContinueProtect(model).then(resp => {
this.$emit('saveProtectSuccess', model.code);
}).catch(() => {
this.$messageBox('创建延续保护失败!');
});
}
});
},
update() {
this.$refs.form.validate((valid) => {
if (valid) {
const model = this.buildModel();
putContinueProtect(model).then(resp => {
this.$emit('updateProtectSuccess', model.code);
}).catch(() => {
this.$messageBox('更新延续保护失败!');
});
}
});
},
clear() {
if (this.$refs && this.$refs.form) {
delete this.addModel.id;
this.$refs.form.resetFields();
this.addModel.mapId = this.mapInfo.id;
this.addModel.relSectionSwitchList = [];
this.addModel.code = '';
this.addModel.unlockTime = 0;
this.addModel.unlockSectionCode = '';
this.addModel.id = '';
this.isSave = true;
this.cardMode = 'generate';
this.clearOverlab();
}
},
deleteOverlab(list, index) {
list.splice(index, 1);
this.$refs.overlabForm.resetFields();
this.clearOverlab();
this.cardMode = 'generate';
},
editOverlab(list, index) {
this.addOverlapModel = deepAssign({}, list[index]);
this.addOverlapModel.parentIndex = index;
this.cardMode = 'edit';
},
updateOverlab() {
if (this.addOverlapModel.parentIndex || this.addOverlapModel.parentIndex === 0 ) {
this.addModel.relSectionSwitchList[this.addOverlapModel.parentIndex] = {
routeOverlapSectionList:this.addOverlapModel.routeOverlapSectionList,
routeOverlapSwitchList:this.addOverlapModel.routeOverlapSwitchList
};
this.clearOverlab();
this.cardMode = 'generate';
}
},
cancelOverlab() {
this.clearOverlab();
this.cardMode = 'generate';
},
generateOverlab() {
if (!this.addOverlapModel.routeOverlapSectionList.length) {
this.$messageBox('请选择进路延续保护区段!');
} else {
this.addModel.relSectionSwitchList.push({
routeOverlapSectionList:this.addOverlapModel.routeOverlapSectionList,
routeOverlapSwitchList:this.addOverlapModel.routeOverlapSwitchList
});
this.$refs.overlabForm.resetFields();
this.clearOverlab();
}
},
clearOverlab() {
this.addOverlapModel = {
parentIndex: '',
routeOverlapSectionList:[],
routeOverlapSwitchList:[]
};
this.overlapCode = '';
this.overlapType = '';
}
}
};
</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;
}
}
.box-card {
width: 88%;
position: relative;
left: 8%;
}
</style>

View File

@ -182,10 +182,6 @@
@click="hover('routeStationStandList')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="关联延续保护区段:" prop="overlapCode">
<el-input v-model="overlapName" style="width: 178px" readonly="true" />
<el-button type="primary" @click="selectedOverlapCode">选择</el-button>
</el-form-item>
<el-form-item :label="$t('map.hostileApproachData') + ':'" prop="conflictingRouteList">
<el-select v-model="addModel.conflictingRouteList" multiple clearable :filterable="true">
<el-option
@ -196,31 +192,31 @@
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button-group>
<el-button v-if="isSave" type="primary" size="small" :loading="loading" @click="save">{{ $t('map.save') }}
</el-button>
<el-button v-else type="warning" size="small" :loading="loading" @click="update">{{ $t('map.updata') }}</el-button>
</el-button-group>
</el-form-item>
</el-form>
<protect-operate ref="protect" :protect-data="protectData" @saveProtectSuccess="saveProtectSuccess" @updateProtectSuccess="updateProtectSuccess" />
<div class="draft">
<el-button-group>
<el-button v-if="isSave" type="primary" size="small" :loading="loading" @click="save">{{ $t('map.save') }}
</el-button>
<el-button v-else type="warning" size="small" :loading="loading" @click="update">{{ $t('map.updata') }}</el-button>
</el-button-group>
</div>
</el-scrollbar>
<protect-detail ref="protectDetail" :map-info="mapInfo" @setOverlapCode="setOverlapCode" />
<route-detail ref="routeDetail" :map-info="mapInfo" @setRouteCode="setRouteCode" />
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { getUID } from '@/jmap/utils/Uid';
import { postRouteNew, putRouteNew, getContinueProtectList, getRouteNewList } from '@/api/jmap/mapdraft';
import ProtectDetail from '../protectoperate/detail';
import { postRouteNew, putRouteNew, getRouteNewList, getContinueProtectList } from '@/api/jmap/mapdraft';
import RouteDetail from './detail';
import ProtectOperate from './protect';
export default {
name: 'RouteOperation',
components: {
ProtectDetail,
RouteDetail
RouteDetail,
ProtectOperate
},
props: {
selected: {
@ -276,7 +272,7 @@ export default {
overlapCode:'',
conflictingRouteList: [] //
},
overlapName: '',
protectData:null,
routeList: [] //
};
},
@ -339,7 +335,8 @@ export default {
},
routeData(val, old) {
if (val) {
this.handelContinueProtectCode(val);
this.addModel = val;
this.initProtectData(val);
this.addModel.routeFlankProtectionList.forEach(item => {
item.normal ? item.switchType = '定位' : item.switchType = '反位';
});
@ -352,6 +349,11 @@ export default {
if (val) {
this.addModel.name = val;
}
},
'addModel.routeSectionList': function(val) {
if (val && val.length) {
this.$refs.protect.addModel.unlockSectionCode = val[val.length - 1];
}
}
},
mounted() {
@ -375,13 +377,6 @@ export default {
deviceChange(code) {
this.$emit('setCenter', code);
},
setOverlapCode(data) {
this.addModel.overlapCode = data.code;
this.overlapName = data.name;
},
selectedOverlapCode() {
this.$refs.protectDetail.doShow('select');
},
hover(field) {
this.field = field === this.field ? '' : field;
},
@ -396,17 +391,21 @@ export default {
deleteSwitch(list, index) {
list.splice(index, 1);
},
buildModel(code) {
buildModel(overlapCode, code) {
const model = Object.assign({}, this.addModel);
model['mapId'] = this.mapInfo.id;
if (code) { model['code'] = code; }
model['overlapCode'] = overlapCode;
return model;
},
save() {
this.$refs.protect.save();
},
saveProtectSuccess(overlapCode) {
this.$refs.form.validate((valid) => {
if (valid) {
this.loading = true;
postRouteNew(this.buildModel(getUID('Route'))).then(response => {
postRouteNew(this.buildModel(overlapCode, getUID('Route'))).then(response => {
this.$message.success('创建成功');
this.loading = false;
this.routeList.push(this.buildModel(getUID('Route')));
@ -419,10 +418,13 @@ export default {
});
},
update() {
this.$refs.protect.update();
},
updateProtectSuccess(overlapCode) {
this.$refs.form.validate((valid) => {
if (valid) {
this.loading = true;
putRouteNew(this.buildModel()).then(response => {
putRouteNew(this.buildModel(overlapCode)).then(response => {
this.$message.success(this.$t('map.updateSuccessfully'));
this.loading = false;
this.clear();
@ -441,20 +443,29 @@ export default {
this.addModel.mapId = this.mapInfo.id;
this.addModel.routeSwitchList = [];
this.addModel.routeFlankProtectionList = [];
this.overlapName = '';
this.addModel.overlapCode = '';
this.isSave = true;
this.$refs.protect.clear();
}
},
selectedConflictingRouteList() {
this.$refs.routeDetail.doShow('select');
},
setRouteCode(data) {
console.log(data);
if (this.addModel.conflictingRouteList.indexOf(data.code) === -1) {
this.addModel.conflictingRouteList.push(data.code);
}
},
initProtectData(val) {
const param = {
code: val.overlapCode,
pageNum: 10,
pageSize:1
};
getContinueProtectList(this.$route.params.mapId, param).then(resp => {
this.protectData = resp.data.list[0];
});
},
setSelected(selected) {
if (selected) {
if (selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() === 'startSignalCode'.toUpperCase()) {
@ -473,15 +484,10 @@ export default {
if (this.addModel.stationStandList.indexOf(selected.code) === -1) {
this.addModel.stationStandList.push(selected.code);
}
} else {
this.$refs.protect.setSelected(selected);
}
}
},
async handelContinueProtectCode(val) {
if (val.overlapCode) {
const resp = await getContinueProtectList(this.$route.params.mapId, {pageSize:9999, pageNum:1, code:val.overlapCode});
this.overlapName = resp.data.list.length ? resp.data.list[0].name : '';
}
this.addModel = val;
}
}
};
@ -503,5 +509,10 @@ export default {
.el-input__suffix{
right: 2px;
}
.draft {
width: 400px;
text-align: center;
margin: 20px auto;
}
}
</style>