修改进路

This commit is contained in:
dong 2022-08-03 13:31:07 +08:00
parent f3a1e22e65
commit 71480564f7
2 changed files with 35 additions and 6 deletions

View File

@ -7,6 +7,16 @@
<el-form-item label="名称:" prop="name">
<el-input v-model="addModel.name" style="width: 220px;" />
</el-form-item>
<el-form-item label="车站选择:">
<el-select v-model="addModel.stationCode" clearable filterable :placeholder="$t('map.pleaseSelect')" @change="stationChange">
<el-option
v-for="item in stationList"
:key="item.code"
:label="`${item.name}(${item.code})`"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="进路类型:" prop="type">
<!-- <el-radio-group v-model="addModel.multiRoute" @change="changeRadio">
<el-radio :label="true">{{ $t('map.are') }}</el-radio>
@ -100,9 +110,9 @@
<el-form-item v-if="addModel.multiRoute" label="多进路引用进路:" prop="routeAspectList">
<el-select v-model="routeCode" clearable filterable>
<el-option
v-for="item in routeList"
v-for="item in routeNameList"
:key="item.code"
:label="`${item.name}(${item.code})`"
:label="`(${item.stationName})${item.name}(${item.code})`"
:value="item.code"
/>
</el-select>
@ -231,9 +241,10 @@ export default {
addModel:{
code:'',
name:'',
stationCode: '',
type: 'RECEIVING',
multiRoute: false,
shutting:false,
// shutting:false,
startSignalCode:'',
signalAspect:1,
startSectionCode:'',
@ -281,6 +292,8 @@ export default {
},
computed: {
...mapGetters('map', [
'getDeviceByCode',
'stationList',
'sectionList',
'switchList',
'signalList',
@ -288,6 +301,17 @@ export default {
]),
btnList() {
return [...this.signalList, ...this.signalButtonList];
},
routeNameList() {
const list = [];
this.routeList.forEach(item => {
const stationObj = this.getDeviceByCode(item.stationCode);
list.push({
...item,
stationName: stationObj ? stationObj.name : ''
});
});
return list;
}
},
watch: {
@ -305,6 +329,9 @@ export default {
this.initPage();
},
methods:{
stationChange(code) {
this.$emit('setCenter', code);
},
setEditData() {
this.isModify = true;
const obj = deepAssign({}, this.routeData);
@ -321,7 +348,7 @@ export default {
getBigRouteList(this.$route.params.mapId).then(response => {
response.data.forEach(route=>{
if (!route.multiRoute) {
this.routeList.push({code:route.code, name:route.name});
this.routeList.push({code:route.code, name:route.name, stationCode: route.stationCode || ''});
}
});
}).catch(()=>{
@ -396,7 +423,7 @@ export default {
api(newModel, that.mapInfo.id, newModel.code).then(res=>{
that.$message.success(that.$t(this.isModify ? 'tip.updateSuccessfully' : 'tip.creatingSuccessful'));
that.loading = false;
if (!this.isModify && !newModel.multiRoute) { that.routeList.push({code:newModel.code, name:newModel.name}); }
if (!this.isModify && !newModel.multiRoute) { that.routeList.push({code:newModel.code, name:newModel.name, stationCode: newModel.stationCode || ''}); }
that.clear();
}).catch(() => {
that.$messageBox(that.$t(this.isModify ? 'tip.updateFailed' : 'tip.operationAbnormal'));
@ -409,10 +436,10 @@ export default {
clear() {
if (this.$refs && this.$refs.form && this.mapInfo) {
// delete this.addModel.id;
this.$refs.form.resetFields();
this.addModel = {
...this.initModelData()
};
this.$refs.form.resetFields();
}
this.isModify = false;
},
@ -420,6 +447,7 @@ export default {
return {
code:'',
name:'',
stationCode: '',
type: 'RECEIVING',
multiRoute:false,
startSignalCode:'',

View File

@ -44,6 +44,7 @@
:selected="selected"
@selectView="selectViewDraft"
@showMap="showMap"
@setCenter="setCenter"
/>
</div>
</div>