调整进路保存

This commit is contained in:
zyy 2019-12-17 14:34:09 +08:00
parent 0bb01b4e4c
commit 24fd0890dd
3 changed files with 51 additions and 26 deletions

View File

@ -199,16 +199,17 @@
<el-form-item :label="$t('map.hostileApproachData') + ':'" prop="conflictingRouteList">
<el-select v-model="addModel.conflictingRouteList" multiple clearable :filterable="true">
<el-option
v-for="item in sectionList"
v-for="item in routeList"
:key="item.code"
:label="item.name + ' (' + item.code+ ')'"
:label="item.name"
:value="item.code"
/>
</el-select>
<el-button
<!-- <el-button type="primary" @click="selectedConflictingRouteList">选择</el-button> -->
<!-- <el-button
:type=" field === 'conflictingRouteList' ? 'danger' : 'primary'"
@click="hover('conflictingRouteList')"
>{{ $t('map.activate') }}</el-button>
>{{ $t('map.activate') }}</el-button> -->
</el-form-item>
<el-form-item>
<el-button-group>
@ -219,19 +220,22 @@
</el-form-item>
</el-form>
</el-scrollbar>
<protect-detail ref="routeDetail" :map-info="mapInfo" @setOverlapCode="setOverlapCode" />
<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 } from '@/api/jmap/mapdraft';
import { postRouteNew, putRouteNew, getContinueProtectList, getRouteNewList } from '@/api/jmap/mapdraft';
import ProtectDetail from '../protectoperate/detail';
import RouteDetail from './detail';
export default {
name: 'RouteOperation',
components: {
ProtectDetail
ProtectDetail,
RouteDetail
},
props: {
selected: {
@ -262,7 +266,7 @@ export default {
routeCode: '',
routeType: '',
loading: false,
interBlockStationList:[],
// interBlockStationList:[],
SwitchLocateTypeList: [
{ name: '定位', code: true },
{ name: '反位', code: false }
@ -288,7 +292,8 @@ export default {
overlapCode:'',
conflictingRouteList: [] //
},
overlapName: ''
overlapName: '',
routeList: [] //
};
},
computed: {
@ -337,6 +342,11 @@ export default {
]
};
return baseRules;
},
interBlockStationList() { //
return this.stationList.filter(station=>{
return station.isCIStation;
});
}
},
watch: {
@ -366,11 +376,13 @@ export default {
// this.$Dictionary.normal().then(list => {
// this.SwitchLocateTypeList = list;
// });
this.interBlockStationList = this.stationList.filter(station=>{
return station.isCIStation;
});
this.getRouteList();
},
methods: {
async getRouteList() {
const response = await getRouteNewList(this.$route.params.mapId, { pageSize: 9999, pageNum: 1 });
this.routeList = response.data.list;
},
swictchName(code) {
let name = '';
if (code) {
@ -389,7 +401,7 @@ export default {
this.overlapName = data.name;
},
selectedOverlapCode() {
this.$refs.routeDetail.doShow('select');
this.$refs.protectDetail.doShow('select');
},
hover(field) {
this.field = field === this.field ? '' : field;
@ -418,6 +430,7 @@ export default {
postRouteNew(this.buildModel(getUID('Route'))).then(response => {
this.$message.success('创建成功');
this.loading = false;
this.routeList.push(this.buildModel(getUID('Route')));
this.clear();
}).catch(() => {
this.$messageBox(this.$t('tip.operationAbnormal'));
@ -434,6 +447,7 @@ export default {
this.$message.success(this.$t('map.updateSuccessfully'));
this.loading = false;
this.clear();
this.getRouteList();
}).catch(() => {
this.$messageBox(this.$t('tip.operationAbnormal'));
this.loading = false;
@ -450,24 +464,35 @@ export default {
this.addModel.routeFlankProtectionList = [];
this.overlapName = '';
this.addModel.overlapCode = '';
if (this.selected && this.selected._type.toUpperCase() === 'Station'.toUpperCase()) {
this.addModel.stationCode = this.selected.code;
}
// if (this.selected && this.selected._type.toUpperCase() === 'Station'.toUpperCase()) {
// this.addModel.stationCode = this.selected.code;
// }
this.isSave = true;
}
},
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);
}
},
setSelected(selected) {
if (selected) {
if (selected._type.toUpperCase() === 'Station'.toUpperCase()) {
this.addModel.stationCode = selected.code;
} else if (selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() === 'startSignalCode'.toUpperCase()) {
// if (selected._type.toUpperCase() === 'Station'.toUpperCase()) {
// this.addModel.stationCode = selected.code;
// } else
// else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'conflictingRouteList'.toUpperCase()) {
// if (this.addModel.conflictingRouteList.indexOf(selected.code) === -1) {
// this.addModel.conflictingRouteList.push(selected.code);
// }
// }
if (selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() === 'startSignalCode'.toUpperCase()) {
this.addModel.startSignalCode = selected.code;
} else if (selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() === 'endSignalCode'.toUpperCase()) {
this.addModel.endSignalCode = selected.code;
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'conflictingRouteList'.toUpperCase()) {
if (this.addModel.conflictingRouteList.indexOf(selected.code) === -1) {
this.addModel.conflictingRouteList.push(selected.code);
}
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'routeSectionList'.toUpperCase()) {
if (this.addModel.routeSectionList.indexOf(selected.code) === -1) {
this.addModel.routeSectionList.push(selected.code);

View File

@ -180,8 +180,8 @@ export default {
edit() {
this.$refs.dataform.validate((valid) => {
if (valid) {
// const data = Object.assign({_type: 'Esp'}, this.editModel);
// console.log(data);
const data = Object.assign({_type: 'Esp'}, this.editModel);
this.$emit('updateMapModel', data);
}
});
},