保存延续保护和进路

This commit is contained in:
fan 2021-08-03 14:58:13 +08:00
parent c79fc46135
commit 69e0e54c6c
4 changed files with 60 additions and 13 deletions

View File

@ -674,3 +674,19 @@ export function noOverlap(mapId) {
method: 'put'
});
}
// 创建进路
export function createRoute(mapId, data) {
return request({
url: `/api/draftMap/${mapId}/route`,
method: 'post',
data
});
}
// 创建延续保护
export function createOverlap(mapId, data) {
return request({
url: `/api/draftMap/${mapId}/overlap`,
method: 'post',
data
});
}

View File

@ -16,8 +16,18 @@
<el-radio :label="false">向左</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="延续保护信号机:" prop="signalCode">
<el-select v-model="addModel.signalCode" filterable>
<el-option
v-for="item in signalList"
:key="item.code"
:label="item.name + '(' + item.code + ')'"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="延续保护解锁区段:" prop="unlockSectionCode">
<el-select v-model="addModel.unlockSectionCode" clearable>
<el-select v-model="addModel.unlockSectionCode" filterable>
<el-option
v-for="item in sectionList"
:key="item.code"
@ -196,7 +206,8 @@ export default {
computed: {
...mapGetters('map', [
'switchList',
'sectionList'
'sectionList',
'signalList'
]),
cardTitle() {
if (this.cardMode === 'generate') {
@ -214,6 +225,12 @@ export default {
const baseRules = {
name: [
{ required: true, message: this.$t('rules.pleaseEnterPathName'), trigger: 'blur' }
],
signalCode: [
{ required: true, message: '请选择延续保护信号机', trigger: 'change' }
],
unlockSectionCode: [
{ required: true, message: '请选择延续保护解锁区段', trigger: 'change' }
]
};
return baseRules;

View File

@ -10,9 +10,8 @@
</div>
</template>
<script>
import { putContinueProtect } from '@/api/jmap/mapdraft';
import { putContinueProtect, createOverlap } from '@/api/jmap/mapdraft';
import ProtectOperate from './protect';
import { EventBus } from '@/scripts/event-bus';
export default {
name:'BigRouteInfo',
@ -67,15 +66,19 @@ export default {
},
save() {
const that = this;
that.$refs.form.validate((valid) => {
if (valid) {
console.log('保存');
}
that.$refs.protect.validate((data) => {
data.mapId = this.$route.params.mapId;
createOverlap(this.$route.params.mapId, data).then(res => {
this.$message.success('保存成功!');
this.$refs.protect.clear();
}).catch(() => {
this.$message.error('保存失败!');
});
});
},
clear() {
if (this.$refs && this.$refs.form && this.mapInfo) {
this.$refs.form.resetFields();
if (this.$refs && this.$refs.protect && this.mapInfo) {
this.$refs.protect.resetFields();
}
},
update() {
@ -84,7 +87,7 @@ export default {
this.$message.success('更新成功!');
this.$refs.protect.clear();
this.isModify = false;
EventBus.$emit('successCI');
// EventBus.$emit('successCI');
}).catch(() => {
this.$message.error('更新失败!');
});

View File

@ -164,7 +164,7 @@
</template>
<script>
import { mapGetters } from 'vuex';
import { getRouteNewList, getFlankProtectionList, putSetDraftMapRouteById } from '@/api/jmap/mapdraft';
import { getRouteNewList, getFlankProtectionList, putSetDraftMapRouteById, createRoute } from '@/api/jmap/mapdraft';
import HostileData from './hostileData';
// import { EventBus } from '@/scripts/event-bus';
@ -400,7 +400,18 @@ export default {
return model;
},
save() {
console.log('暂无接口');
// console.log('');createRoute
this.$refs.form.validate((valid) => {
if (valid) {
this.addModel.mapId = this.mapInfo.id;
createRoute(this.mapInfo.id, this.addModel).then(res => {
this.$message.success('保存进路成功!');
this.clear();
}).catch(() => {
this.$message.error('保存进路失败!');
});
}
});
},
update() {
this.$refs.form.validate((valid) => {