保存延续保护和进路

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

View File

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

View File

@ -164,7 +164,7 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; 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 HostileData from './hostileData';
// import { EventBus } from '@/scripts/event-bus'; // import { EventBus } from '@/scripts/event-bus';
@ -400,7 +400,18 @@ export default {
return model; return model;
}, },
save() { 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() { update() {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {