This commit is contained in:
fan 2019-12-25 09:19:54 +08:00
commit 7328b7adb6
3 changed files with 29 additions and 18 deletions

View File

@ -257,10 +257,8 @@ export default {
setSelected(selected) {
if (selected) {
if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'routeOverlapSectionList'.toUpperCase()) {
if ((selected.type === '01' || selected.type === '03') && this.addOverlapModel.routeOverlapSectionList.indexOf(selected.code) === -1) {
if ((selected.type === '01' || selected.type === '03' || selected.tyoe === '02') && this.addOverlapModel.routeOverlapSectionList.indexOf(selected.code) === -1) {
this.addOverlapModel.routeOverlapSectionList.push(selected.code);
} else if ( selected.type === '02' && this.addOverlapModel.routeOverlapSectionList.indexOf(selected.code) === -1) {
this.addOverlapModel.routeOverlapSectionList.push(selected.parentCode);
}
} else if (selected._type.toUpperCase() === 'Switch'.toUpperCase() && this.field.toUpperCase() === 'routeOverlapSwitchList'.toUpperCase()) {
this.overlapCode = selected.code;

View File

@ -4,7 +4,7 @@
<el-form ref="form" :model="addModel" :rules="rules" label-width="120px" size="mini">
<div class="definition">
<el-form-item :label="$t('map.signalID')" prop="signalCode">
<el-select v-model="addModel.signalCode" clearable :filterable="true">
<el-select v-model="addModel.signalCode" clearable :filterable="true" @change="changeSignal">
<el-option
v-for="item in signalList"
:key="item.code"
@ -45,7 +45,7 @@
<script>
import { mapGetters } from 'vuex';
import { setUID } from '@/jmapNew/utils/Uid';
import { postApproachSection, putApproachSection } from '@/api/jmap/mapdraft';
import { postApproachSection, putApproachSection, getApproachSectionList } from '@/api/jmap/mapdraft';
import { ViewMode } from '@/scripts/ConstDic';
import { formatName } from '@/utils/runPlan';
@ -85,7 +85,6 @@ export default {
signalCode: '',
routeSectionList: []
},
editShow: false,
rules: {
signalCode: [
{ required: true, message: this.$t('map.pleaseSelectSignal'), trigger: 'change' }
@ -111,7 +110,6 @@ export default {
routeData(val, old) {
if (val) {
this.addModel = val;
this.editShow = true;
}
},
'addModel.routeSectionList': function(val, old) {
@ -141,15 +139,30 @@ export default {
formatName(code) {
return formatName(code);
},
changeSignal(val) {
if (val && this.mapInfo && this.mapInfo.id) {
const params = {
signalCode : val,
pageSize: 10,
pageNum: 1
};
getApproachSectionList(this.mapInfo.id, params).then( resp => {
if (resp.data && resp.data.list && resp.data.list.length) {
this.routeData = resp.data.list[0];
this.isSave = false;
}
}).catch(error=> {
console.log(error);
});
}
},
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() === 'routeSectionList'.toUpperCase()) {
if ((selected.type === '01' || selected.type === '03') && this.addModel.routeSectionList.indexOf(selected.code) === -1) {
if ((selected.type === '01' || selected.type === '03' || selected.type === '02') && this.addModel.routeSectionList.indexOf(selected.code) === -1) {
this.addModel.routeSectionList.push(selected.code);
} else if (selected.type === '02' && this.addModel.routeSectionList.indexOf(selected.parentCode) === -1) {
this.addModel.routeSectionList.push(selected.parentCode);
}
}
}

View File

@ -76,7 +76,6 @@ export default {
let logicSectionNumList = [];
const sectionPoints = [...this.editModel.points]; //
let allNotZeros = true;
let count = 0;
let totalNum = 0;
const lengthFact = this.editModel.lengthFact;
this.tableData.forEach((ele, index) => {
@ -86,12 +85,11 @@ export default {
this.tableData.forEach((ele, index) => {
models = [...models, ...this.createLogicalSections(Number(ele.num), sectionPoints[index], sectionPoints[index + 1], this.editModel, counts, lineLength, totalNum)];
allNotZeros = Number(ele.num) && allNotZeros;
count += Number(ele.num);
logicSectionNumList.push(Number(ele.num));
counts += parseInt(ele.num);
});
if (count === 0 || allNotZeros) {
const logicSectionCodeList = [];
if (counts === 0 || allNotZeros) {
let logicSectionCodeList = [];
models.forEach(item=> {
logicSectionCodeList.push(item.code);
});
@ -100,12 +98,14 @@ export default {
models.push(deepAssign(section, {_dispose: true}));
}
});
if (count === 0) {
if (counts === 0) {
logicSectionNumList = [];
logicSectionCodeList = [];
}
this.editModel.logicSectionNum = [...logicSectionNumList];
this.editModel.logicSectionCodeList = logicSectionCodeList;
models.push(this.editModel);
const model = deepAssign(this.editModel, {_type: 'Section'});
model.logicSectionNum = [...logicSectionNumList];
model.logicSectionCodeList = [...logicSectionCodeList];
models.push(model);
this.$emit('updateMapModel', models);
} else {
this.$messageBox('逻辑区段在个折线上数量要均为0或均不为0');