添加超限区段

This commit is contained in:
fan 2021-08-05 09:50:00 +08:00
parent 69e0e54c6c
commit 5656e77cb2
6 changed files with 595 additions and 3 deletions

View File

@ -690,3 +690,34 @@ export function createOverlap(mapId, data) {
data
});
}
// 创建超限区段
export function createOverrunSection(mapId, data) {
return request({
url: `/api/draftMap/${mapId}/overrun`,
method: 'post',
data
});
}
// 分页查询超限区段
export function queryOverrunSectionPaging(mapId, params) {
return request({
url: `/api/draftMap/${mapId}/overrun/paging`,
method: 'get',
params
});
}
// 更新超限区段
export function updateOverrunSection(mapId, data) {
return request({
url: `/api/draftMap/${mapId}/overrun/${data.code}`,
method: 'put',
data
});
}
// 删除超限区段
export function deleteOverrunSection(mapId, code) {
return request({
url: `/api/draftMap/${mapId}/overrun/${code}`,
method: 'delete'
});
}

View File

@ -2,11 +2,11 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.8.107:9000'; // 袁琪
// BASE_API = 'http://192.168.2.175:9000'; // 旭强 有线
// BASE_API = 'http://192.168.8.114:9000'; // 旭强 无线
// BASE_API = 'http://192.168.2.183:9000'; // 张赛
BASE_API = 'http://192.168.2.183:9010'; // 张赛
// BASE_API = 'http://192.168.8.140:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康

View File

@ -41,6 +41,7 @@ import FlankProtectOperate from './flankProtectOperate/index';
import DwellTimeOperate from './dwellTimeOperate/index';
import DestinationOperate from './destinationOperate/index';
import ContinueProtectOperate from './continueProtectOperate/index';
import OverrunSectionOperate from './overrunSectionOperate/index';
export default {
name: 'DataRelation',
@ -110,7 +111,8 @@ export default {
{label: this.$t('map.automaticSignal'), name:'automatic', menus:AutomaticOperate},
{label: this.$t('map.routing'), name:'routing', menus:RoutingOperate},
{label: '停站时间', name:'dwellTime', menus:DwellTimeOperate},
{label: '设置运行等级', name:'runLevel', menus:RunLevelOperate}
{label: '设置运行等级', name:'runLevel', menus:RunLevelOperate},
{label: '超限区段', name: 'overrun', menus: OverrunSectionOperate }
// ]
];
this.enabledTab = 'route';

View File

@ -0,0 +1,256 @@
<template>
<div v-show="show">
<el-dialog v-dialogDrag v-loading="loading" :title="$t('map.routePreview')" :visible.sync="show" width="95%" top="1vh" class="dialog_content_box" :before-do-close="doClose" append-to-body>
<div>
<QueryListPage
ref="queryListPage"
:pager-config="pagerConfig"
:query-form="queryForm"
:query-list="queryList"
/>
</div>
</el-dialog>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { queryOverrunSectionPaging, deleteOverrunSection} from '@/api/jmap/mapdraft';
// import ProtectDetail from './protectDetail';
export default {
name: 'RouteDetail',
props: {
mapInfo: {
type: Object,
default() {
return null;
}
},
overlapList: {
type: Array,
default() {
return [];
}
}
},
data() {
return {
show: false,
loading: false,
showType: '',
codeType: '',
RouteNatureTypeList: [],
RouteAutoTypeList: [],
SwitchLocateTypeList: [],
ContinueProtectList: [],
// overlapList: [], //
turnBackList: [
{ label: '是', value: true },
{ label: '否', value: false }
],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '120px',
queryObject: {
sectionCode: {
type: 'select',
label: '区段',
config: {
data: []
}
},
ciSwitchCode: {
type: 'select',
label: '道岔',
config: {
data: []
}
},
switchCode: {
type: 'select',
label: '防护道岔',
config: {
data: []
}
}
}
}
};
},
computed: {
...mapGetters('map', [
'signalList',
'switchList',
'sectionList',
'stationList',
'stationStandList'
]),
queryList() {
return {
query: this.queryFunction,
afterQuery: this.afterQuery,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('map.code'),
prop: 'code',
width: 150
},
{
title: '区段',
prop: 'sectionCode',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.sectionCode, this.sectionList, ['code', 'name']); },
tagType: (row) => { return ''; }
},
{
title: '道岔',
prop: 'ciSwitch',
type: 'tag',
columnValue: (row) => { return row.ciSwitch ? this.$convertField(row.ciSwitch.switchCode, this.switchList, ['code', 'name']) : ''; },
tagType: (row) => { return ''; }
},
{
title: '道岔位置',
type: 'tag',
prop: 'ciSwitch',
columnValue: (row) => { return row.ciSwitch ? (row.ciSwitch.normal ? '定位' : '反位') : ''; },
tagType: (row) => { return ''; }
},
{
title: '防护的道岔',
type: 'tag',
prop: 'switchCode',
columnValue: (row) => { return this.$convertField(row.switchCode, this.switchList, ['code', 'name']); },
tagType: (row) => { return ''; }
},
{
type: 'button',
title: this.$t('map.operation'),
width: '250',
buttons: [
{
name: this.$t('map.compile'),
handleClick: this.edit,
showControl: () => { return this.showType !== 'select'; }
},
{
name: this.$t('map.deleteObj'),
handleClick: this.deleteObj,
type: 'danger',
showControl: () => { return this.showType !== 'select'; }
}
]
}
]
};
}
},
watch: {
sectionList: function (val, old) {
const list = [];
if (val && val.length) {
for (let i = 0; i < val.length; i++) {
list.push({ label: `${val[i].name}(${val[i].code})`, value: val[i].code });
}
}
this.queryForm.queryObject.sectionCode.config.data = list;
},
switchList: function (val, old) {
const list = [];
if (val && val.length) {
for (let i = 0; i < val.length; i++) {
list.push({ label: `${val[i].name}(${val[i].code})`, value: val[i].code });
}
}
this.queryForm.queryObject.switchCode.config.data = list;
this.queryForm.queryObject.ciSwitchCode.config.data = list;
}
},
mounted() { //
},
methods: {
doShow(showType, codeType) {
this.show = true;
this.$nextTick(() => {
this.$refs.queryListPage && this.$refs.queryListPage.commitQuery();
});
if (showType && codeType) {
this.showType = showType;
this.codeType = codeType;
}
},
doClose() {
this.show = false;
},
queryFunction(params) {
if (this.mapInfo && this.mapInfo.id) {
return queryOverrunSectionPaging(this.mapInfo.id, params);
}
},
afterQuery(data) {
if (data && data.list) {
const that = this;
const list = data.list;
if (list) {
list.map(elem => {
that.$convertSpecifiedField(elem, that.signalList, 'code', 'name', ['startSignalCode', 'endSignalCode']);
});
}
}
return data;
},
//
saveRelated(row) {
putRouteNew(row).then(response => {
this.$message.success(this.$t('tip.updateSuccessfully'));
}).catch(() => {
this.$messageBox('操作异常');
});
},
edit(index, row) {
this.$emit('routeSelected', row);
this.doClose();
},
deleteObj(index, row) {
if (row) {
this.$confirm('是否确认删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteOverrunSection(this.$route.params.mapId, row.code).then(response => {
this.reloadTable();
}).catch(() => {
this.$messageBox('删除失败');
});
}).catch(() => {
this.$message.info('已取消删除');
});
}
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
selectedObj(index, row) {
this.$emit('setRouteCode', row, this.codeType);
this.show = false;
}
}
};
</script>
<style lang="scss">
.dialog_content_box{
.el-dialog__body{
padding-top: 3px;
}
}
</style>

View File

@ -0,0 +1,66 @@
<template>
<div>
<overrun-detail ref="overrunDetail" :map-info="mapInfo" @routeSelected="routeSelected" />
<overrun-form
ref="overrunForm"
:map-info="mapInfo"
:selected="selected"
:overrun-data="overrunData"
@setCenter="setCenter"
/>
</div>
</template>
<script>
import OverrunDetail from './detail';
import OverrunForm from './overrun';
export default {
name: 'Index',
components: {
OverrunDetail,
OverrunForm
},
props: {
mapInfo: {
type: Object,
default() {
return null;
}
},
selected: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
overrunData: null
};
},
methods: {
setCenter(code) {
this.$emit('setCenter', code);
},
routeSelected(data) {
this.overrunData = data;
if (this.$refs && this.$refs.overrunForm) {
this.$refs.overrunForm.isSave = !data.id;
}
},
previewRouteEvent: function () {
if (this.$refs && this.$refs.overrunDetail) {
this.$refs.overrunDetail.doShow();
}
},
setSelected(selected) {
this.$refs.overrunForm.setSelected(selected);
}
}
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,237 @@
<template>
<div style="height: 100%;" class="route_box_list">
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-form ref="form" :model="addModel" label-width="190px" size="mini">
<el-form-item label="区段" prop="sectionCode">
<el-select v-model="addModel.sectionCode" clearable filterable>
<el-option
v-for="item in sectionList"
:key="item.code"
:label="item.name + ' (' + item.code+ ')'"
:value="item.code"
/>
</el-select>
<el-button
:type=" field === 'overrunSection' ? 'danger' : 'primary'"
@click="hover('overrunSection')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="道岔" prop="ciSwitch.switchCode">
<el-select v-model="addModel.ciSwitch.switchCode" clearable filterable>
<el-option
v-for="item in switchList"
:key="item.code"
:label="item.name + ' (' + item.code+ ')'"
:value="item.code"
/>
</el-select>
<el-button
:type=" field === 'overrunSwitch' ? 'danger' : 'primary'"
@click="hover('overrunSwitch')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="道岔位置" prop="ciSwitch.normal">
<el-select v-model="addModel.ciSwitch.normal">
<el-option
v-for="item in SwitchLocateTypeList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="防护道岔" prop="switchCode">
<el-select v-model="addModel.switchCode" clearable filterable>
<el-option
v-for="item in switchList"
:key="item.code"
:label="item.name + '(' + item.code + ')'"
:value="item.code"
/>
</el-select>
<el-button
:type=" field === 'protectiveSwitch' ? 'danger' : 'primary'"
@click="hover('protectiveSwitch')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
</el-form>
<br>
<div class="draft">
<el-button-group>
<el-button v-if="isSave" type="primary" size="small" :loading="loading" @click="save">保存超限区段</el-button>
<el-button v-else type="warning" size="small" :loading="loading" @click="update">修改超限区段</el-button>
</el-button-group>
</div>
</el-scrollbar>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { updateOverrunSection, createOverrunSection } from '@/api/jmap/mapdraft';
export default {
name: 'RouteOperation',
props: {
selected: {
type: Object,
default() {
return null;
}
},
mapInfo: {
type: Object,
default() {
return null;
}
},
overrunData: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
isSave: true,
field: '',
flankCode: '',
flankType: '',
routeCode: '',
routeType: '',
loading: false,
interBlockStationList:[],
SwitchLocateTypeList: [
{ name: '定位', code: true },
{ name: '反位', code: false }
],
addModel: {
mapId: '',
code: '',
sectionCode: '',
ciSwitch: {
switchCode: '',
normal: true
},
switchCode: ''
},
routeList: [] //
};
},
computed: {
...mapGetters('map', [
'switchList',
'sectionList'
]),
newRouteSectionList() {
return JSON.stringify(this.addModel.routeSectionList);
}
},
watch: {
mapInfo(val) {
if (val) {
this.addModel.mapId = val.id;
}
},
overrunData(val, old) {
if (val) {
this.addModel = val;
}
}
},
mounted() {
},
methods: {
deviceChange(code) {
this.$emit('setCenter', code);
},
hover(field) {
this.field = field === this.field ? '' : field;
},
save() {
// console.log('');createRoute
this.$refs.form.validate((valid) => {
if (valid) {
this.addModel.mapId = this.mapInfo.id;
createOverrunSection(this.mapInfo.id, this.addModel).then(res => {
this.$message.success('保存超限区段成功!');
this.clear();
}).catch(() => {
this.$message.error('保存超限区段失败!');
});
}
});
},
update() {
this.$refs.form.validate((valid) => {
if (valid) {
updateOverrunSection(this.mapInfo.id, this.addModel).then(res => {
this.$message.success('更新超限区段成功!');
this.clear();
}).catch(() => {
this.$message.error('更新超限区段失败!');
});
}
});
},
clear() {
if (this.$refs && this.$refs.form && this.mapInfo) {
delete this.addModel.id;
this.$refs.form.resetFields();
this.addModel.mapId = this.mapInfo.id;
this.addModel.sectionCode = '';
this.addModel.ciSwitch = { switchCode: '', normal: true };
this.addModel.switchCode = '';
}
},
changeSectionSelected(list, flag, type) {
list && list.forEach((item) => {
const section = this.$store.getters['map/getDeviceByCode'](item);
if (section && section.logicSectionCodeList && section.logicSectionCodeList.length) {
section.logicSectionCodeList.forEach( (logicSectionCode) => {
const logicSection = this.$store.getters['map/getDeviceByCode'](logicSectionCode);
logicSection && logicSection.instance.drawBatchSelected(flag, flag ? type : '');
});
} else {
section && section.instance.drawBatchSelected(flag, flag ? type : '');
}
});
},
setSelected(selected) {
if (selected) {
if (selected._type.toUpperCase() === 'Section'.toUpperCase() && selected._type !== '02' && this.field.toUpperCase() === 'overrunSection'.toUpperCase()) {
this.addModel.sectionCode = selected.code;
} else if (selected._type.toUpperCase() === 'Switch'.toUpperCase() && this.field.toUpperCase() === 'overrunSwitch'.toUpperCase()) {
this.addModel.ciSwitch.switchCode = selected.code;
} else if (selected._type.toUpperCase() === 'Switch'.toUpperCase() && this.field.toUpperCase() === 'protectiveSwitch'.toUpperCase()) {
this.addModel.switchCode = selected.code;
}
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
/deep/ .el-radio {
margin-right: 10px;
}
/deep/ {
.el-select .el-tag {
height: auto;
display: flex;
align-items: center;
justify-content: center;
padding-right: 15px;
box-sizing: border-box;
white-space: normal;
}
.el-input__suffix{
right: 2px;
}
.draft {
width: 400px;
text-align: center;
margin: 20px auto;
}
}
</style>