信号机接近区段信号机change,检索后台数据

This commit is contained in:
fan 2019-12-24 18:24:37 +08:00
parent 52eddbaa3d
commit d1cc62cd99

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) {
@ -133,6 +131,23 @@ 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()) {