调整信号接近区段

This commit is contained in:
zyy 2021-05-27 16:10:58 +08:00
parent 529839b3ac
commit 672c95c6c6
4 changed files with 67 additions and 45 deletions

View File

@ -321,7 +321,7 @@ export function getApproachSectionDetail(id) {
export function putApproachSection(mapId, data) {
return request({
// url: `/api/mapBuild/approachSection/${data.id}`,
url: `/api/draftMap/${mapId}/signalApproachSection/${data.code}`,
url: `/api/draftMap/${mapId}/signalApproachSection/${data.signalCode}`,
method: 'put',
data: data
});

View File

@ -14,7 +14,7 @@
<script>
// import { mapGetters } from 'vuex';
// import { listMap } from '@/api/jmap/mapdraft';
import { getContinueProtectList, delContinueProtect } from '@/api/jmap/mapdraft';
import { getContinueProtectList, delContinueProtect, putContinueProtect } from '@/api/jmap/mapdraft';
export default {
name: 'RouteDetail',
@ -37,13 +37,13 @@ export default {
queryForm: {
labelWidth: '120px',
queryObject: {
stationCode: {
type: 'select',
label: '联锁车站',
config: {
data: []
}
},
// stationCode: {
// type: 'select',
// label: '',
// config: {
// data: []
// }
// },
name: {
type: 'text',
label: '延续保护名称'
@ -58,7 +58,8 @@ export default {
columns: [
{
title: '延续保护名称',
prop: 'name'
prop: 'name',
edit: true
},
{
title: '延续保护code',
@ -70,12 +71,13 @@ export default {
},
{
title: '延续保护解锁时间',
prop: 'unlockTime'
prop: 'unlockTime',
edit: true
},
{
type: 'button',
title: this.$t('map.operation'),
width: '200',
width: '300',
buttons: [
{
name: this.$t('map.compile'),
@ -85,6 +87,10 @@ export default {
name: this.$t('map.deleteObj'),
handleClick: this.deleteObj,
type: 'danger'
},
{
name: '更新',
handleClick: this.handleUpload
}
]
}
@ -111,7 +117,6 @@ export default {
// }
},
mounted() {
// this.acquireMapList();
},
methods: {
doShow() {
@ -126,11 +131,6 @@ export default {
return getContinueProtectList(this.mapInfo.id, params);
}
},
// acquireMapList() { //
// listMap({ drawWay:true}).then(response => {
// this.mapList = response.data;
// });
// },
afterQuery(data) {
if (data && data.list) {
// const that = this;
@ -144,6 +144,13 @@ export default {
}
return data;
},
handleUpload(index, row) {
putContinueProtect(this.$route.params.mapId, row).then(res => {
this.$message.success('更新成功');
}).catch(() => {
this.$messageBox('操作异常');
});
},
editObj(index, row) {
this.$emit('routeSelected', row);
this.doClose();

View File

@ -354,7 +354,6 @@ export default {
},
editOverlab(list, index) {
this.addOverlapModel = deepAssign({}, list[index]);
debugger;
this.addOverlapModel.parentIndex = index;
this.cardMode = 'edit';
},

View File

@ -52,8 +52,8 @@
</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-form-item :label="$t('map.routeProtectsData') + ':'" prop="sectionList">
<el-select v-model="addOverlapModel.sectionList" multiple clearable :filterable="true">
<el-option
v-for="item in sectionList"
:key="item.code"
@ -76,7 +76,7 @@
/>
</el-select>
<el-button
:type=" field === 'switchPositionList' ? 'danger' : 'primary'"
:type="field === 'switchPositionList' ? 'danger' : 'primary'"
@click="hover('switchPositionList')"
>{{ $t('map.activate') }}</el-button>
<el-button
@ -131,7 +131,7 @@
<script>
import { mapGetters } from 'vuex';
import { setUID } from '@/jmapNew/utils/Uid';
import { postApproachSection, putApproachSection, getSignalApproachSectionList } from '@/api/jmap/mapdraft';
import { postApproachSection, putApproachSection } from '@/api/jmap/mapdraft';
import { ViewMode } from '@/scripts/ConstDic';
import { formatName } from '@/jmapNew/theme/parser/util';
import { deepAssign } from '@/utils/index';
@ -178,13 +178,16 @@ export default {
},
addOverlapModel: {
parentIndex: '',
routeOverlapSectionList: [], //
sectionList: [], //
switchPositionList: [] //
},
rules: {
signalCode: [
{ required: true, message: this.$t('map.pleaseSelectSignal'), trigger: 'change' }
]
},
overLapRules: {
},
SwitchLocateTypeList: [
{ name: '定位', code: true },
@ -230,7 +233,6 @@ export default {
}
if (val) {
this.changeSignalSelected(val, true, 'routeSignal');
this.changeSignal(val);
}
}
},
@ -244,27 +246,40 @@ export default {
formatName(code) {
return formatName(code);
},
changeSignal(val) {
if (val && this.mapInfo && this.mapInfo.id) {
getSignalApproachSectionList(this.mapInfo.id).then( resp => {
if (resp.data && resp.data.length) {
this.routeData = resp.data[0];
this.isSave = false;
} else {
this.addModel.id = '';
this.addModel.code = '';
this.addModel.mapId = '';
this.isSave = true;
}
}).catch(error=> {
console.log(error);
});
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'));
}
},
swictchName(code) {
let name = '';
if (code) {
const swch = this.$store.getters['map/getDeviceByCode'](code);
if (swch) {
name = `${swch.name}(${swch.code})`;
}
}
return name;
},
deleteSwitch(list, index) {
list.splice(index, 1);
},
setSelected(selected) {
if (selected) {
if (selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() === 'signalCode'.toUpperCase()) {
this.addModel.signalCode = selected.code;
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'routeOverlapSectionList'.toUpperCase()) {
const sectionIndex = this.addOverlapModel.sectionList.indexOf(selected.code);
if ((selected.type === '01' || selected.type === '03' || selected.type === '02') && sectionIndex === -1) {
this.addOverlapModel.sectionList.push(selected.code);
} else if ( sectionIndex !== -1 ) {
this.addOverlapModel.sectionList.splice(sectionIndex, 1);
}
} else if (selected._type.toUpperCase() === 'Switch'.toUpperCase() && this.field.toUpperCase() === 'switchPositionList'.toUpperCase()) {
this.overlapCode = selected.code;
}
}
},
@ -293,7 +308,8 @@ export default {
this.$refs.form.validate((valid) => {
if (valid) {
this.loading = true;
putApproachSection(this.buildModel()).then(resp => {
console.log(this.addModel, '====');
putApproachSection(this.mapInfo.id, this.addModel).then(resp => {
this.$message.success(this.$t('map.signalSectionUpdateSucceeded'));
this.loading = false;
this.clear();
@ -328,11 +344,11 @@ export default {
this.cardMode = 'edit';
},
generateOverlab() {
if (!this.addOverlapModel.routeOverlapSectionList.length) {
if (!this.addOverlapModel.sectionList.length) {
this.$messageBox('请选择进路延续保护区段!');
} else {
this.addModel.sectionPathList.push({
routeOverlapSectionList:this.addOverlapModel.routeOverlapSectionList,
sectionList:this.addOverlapModel.sectionList,
switchPositionList:this.addOverlapModel.switchPositionList
});
this.$refs.overlabForm.resetFields();
@ -342,7 +358,7 @@ export default {
updateOverlab() {
if (this.addOverlapModel.parentIndex || this.addOverlapModel.parentIndex === 0 ) {
this.addModel.sectionPathList[this.addOverlapModel.parentIndex] = {
routeOverlapSectionList:this.addOverlapModel.routeOverlapSectionList,
sectionList:this.addOverlapModel.sectionList,
switchPositionList:this.addOverlapModel.switchPositionList
};
this.clearOverlab();
@ -356,7 +372,7 @@ export default {
clearOverlab() {
this.addOverlapModel = {
parentIndex: '',
routeOverlapSectionList:[],
sectionList:[],
switchPositionList:[]
};
this.overlapCode = '';