This commit is contained in:
joylink_cuiweidong 2022-09-19 16:04:21 +08:00
commit 402eb691d1
5 changed files with 309 additions and 1 deletions

25
src/api/disStation.js Normal file
View File

@ -0,0 +1,25 @@
import request from '@/utils/request';
// 创建调度台逻辑数据
export function createDisStation(mapId, data) {
return request({
url: `/api/draftMap/${mapId}/disStation`,
method: 'post',
data
});
}
// 更新调度台逻辑数据
export function updateDisStation(mapId, data) {
return request({
url: `/api/draftMap/${mapId}/disStation`,
method: 'put',
data
});
}
// 删除调度台逻辑数据
export function deleteDisStation(mapId, code) {
return request({
url: `/api/draftMap/${mapId}/disStation/${code}`,
method: 'delete'
});
}

View File

@ -204,6 +204,7 @@ const map = {
namespaced: true,
state: {
disStationList: [], // 调度台list
routeData: {}, // 进路数据
routeList: [], // 进路list
mapStationDirectionData:{}, // 大铁项目 车站方向数据
@ -258,6 +259,13 @@ const map = {
},
getters: {
disStationList: state => {
if (state.map) {
return state.disStationList;
} else {
return [];
}
},
trainWindowSectionCode: state => {
return state.trainWindowSectionCode;
},
@ -745,7 +753,11 @@ const map = {
},
mutations: {
// 改变地图数据索引
// 设置调度台列表
setDisStationList: (state, list) => {
state.disStationList = list;
},
// 改变地图数据索引
flushMapRef: state => {
if (state.map) {
state.map.sectionList = [...(state.map.sectionList || [])];
@ -1121,6 +1133,7 @@ const map = {
});
mapData.graphDataNew.overlapList = overlapData;
commit('setDisStationList', mapData.logicDataNew.disStationList || []);
commit('setMapName', mapData.name);
commit('setMapData', mapData.graphDataNew);
commit('setRouteData', mapData.logicDataNew.routeList);

View File

@ -0,0 +1,103 @@
<template>
<div style="height: 100%;">
<DisStationDraft
ref="routeEdit"
:selected="selected"
:map-info="mapInfo"
:route-data="routeData"
@setCenter="setCenter"
/>
</div>
</template>
<script>
import DisStationDraft from './route';
export default {
name: 'DisStationOperate',
components: {
DisStationDraft
},
props: {
mapInfo: {
type: Object,
default() {
return null;
}
},
selected: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
enabledTab: 'Route',
routeData: null,
routeList:[]
};
},
created() {
// filterRouteList() {
// return this.routeList.filter(route=>{ return !route.multiRoute; });
// } 'routeList',
},
methods: {
setEditRouteDate(data) {
this.routeData = data;
this.$nextTick(() => {
this.$refs.routeEdit.setEditData();
});
},
clickEvent(e, model) {
this.onSelect(model);
},
onSelect(model) {
if (model) {
this.selected = model;
} else {
this.selected = null;
}
},
setDelayUnlockStatus(data, status) {
if (data && data.delayShowList) {
data.delayShowList.forEach(elem => {
elem.status = status;
});
}
},
routeSelected: function (data) {
this.routeData = data;
if (this.$refs && this.$refs.routeEdit) {
this.$refs.routeEdit.isModify = data.id;
}
},
previewRouteEvent: function () {
if (this.$refs && this.$refs.routeDetail) {
this.$refs.routeDetail.doShow();
}
},
initLoad() {
this.$refs.routeEdit && this.$refs.routeEdit.initLoad();
},
createRouteEvent: function () {
if (this.$refs && this.$refs.routeEdit) {
this.$refs.routeEdit.clear();
}
},
setSelected(selected) {
this.$refs.routeEdit.setSelected(selected);
},
setCenter(code) {
this.$emit('setCenter', code);
},
batchSectionListFocus(flag) {
this.$refs.routeEdit.batchSectionListFocus(flag);
},
refresh() {
this.$refs.routeEdit.initPage();
}
}
};
</script>

View File

@ -0,0 +1,162 @@
<template>
<div class="BigRouteInfo">
<el-form ref="form" :model="editModel" :rules="rules" label-width="140px" size="mini" class="bigDefinition">
<el-form-item label="编号:">
<el-select v-model="editModel.code" clearable filterable :placeholder="$t('map.pleaseSelect')" @change="deviceChange">
<el-option
v-for="item in disStationList"
:key="item.code"
:label="`${item.name}(${item.code})`"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="调度台名称:" prop="name">
<el-input v-model="editModel.name" style="width: 180px;" />
</el-form-item>
<el-form-item label="下辖车站:" prop="stationList">
<el-select v-model="editModel.stationList" multiple clearable filterable :placeholder="$t('map.pleaseSelect')">
<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>
<div class="button_box">
<el-button-group class="button-group">
<el-button :disabled="!!editModel.code" type="success" size="small" @click="create">{{ $t('map.create') }}</el-button>
<el-button :disabled="!editModel.code" type="primary" size="small" @click="edit">{{ $t('map.updateObj') }}</el-button>
<el-button :disabled="!editModel.code" type="danger" size="small" @click="deleteObj">{{ $t('map.deleteObj') }}</el-button>
</el-button-group>
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { getUID } from '@/jmapNew/utils/Uid';
import { deepAssign } from '@/utils/index';
import { createDisStation, updateDisStation, deleteDisStation } from '@/api/disStation.js';
export default {
name:'DisStationDraft',
props: {
selected: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
editModel: {
code: '',
name: '',
stationList: [] // code
}
};
},
computed: {
...mapGetters('map', [
'disStationList',
'stationList'
]),
mapId() {
return this.$route.params.mapId || '';
},
rules() {
const rules = {
code: [
{ required: true, message: this.$t('rules.pleaseSelect'), trigger: 'change' }
],
name: [
{ required: true, message: this.$t('rules.pleaseInputName'), trigger: 'change' }
],
stationList: [
{ required: true, message: this.$t('rules.selectStation'), trigger: 'change' }
]
};
return rules;
}
},
mounted() {},
methods: {
deviceChange(code) {
let obj = {};
const findObj = this.disStationList.find(item => {
return item.code == code;
});
if (findObj) {
obj = deepAssign({}, findObj);
}
this.editModel = deepAssign(this.editModel, obj);
},
edit() {
this.$refs.form.validate((valid) => {
if (valid) {
const model = deepAssign({}, this.editModel);
console.log('model', model);
updateDisStation(this.mapId, model).then(res => {
this.$message.success('修改成功!');
}).catch(err => {
console.log('修改失败!', err);
this.$message.error('修改失败!');
});
}
});
},
deleteObj() {
this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
deleteDisStation(this.mapId, this.editModel.code).then(res => {
this.$refs.form && this.$refs.form.resetFields();
}).catch(err => {
console.log('删除失败!', err);
this.$message.error('删除失败!');
});
}).catch(() => {
this.$message.info(this.$t('tip.cancelledDelete'));
});
},
create() {
this.$refs.form.validate((valid) => {
if (valid) {
const uid = getUID('DisStation', this.disStationList);
const model = {
mapId: this.mapId,
code: uid,
name: this.editModel.name,
stationList: this.editModel.stationList
};
console.log('model', model);
createDisStation(this.mapId, model).then(res => {
this.$refs.form.resetFields();
this.$message.success('创建成功!');
}).catch(err => {
console.log('创建失败!', err);
this.$message.error('创建失败!');
});
}
});
}
}
};
</script>
<style lang="scss" scoped>
.button_box{
position: absolute;
bottom: 0;
background: #fff;
box-shadow: 4px 5px 10px #565656;
width: 100%;
padding: 8px 10px;
}
.button-group{float: right;}
</style>

View File

@ -33,6 +33,7 @@ import RouteOperate from './routeoperate/index';
import RoutingOperate from './routingoperate/index';
import BigRoutingOperate from './bigroutingoperate/index';
import IndicatorAssociatedInfo from './indicatorAssociatedInfo/index';
import DisStationOperate from './disStationOperate/index';
import AutomaticOperate from './automaticoperate/index';
// import PathOperate from './pathoperate/index';
import RunLevelOperate from './runLeveloperate/index';
@ -58,6 +59,7 @@ export default {
TurnedOperate,
DwellTimeOperate,
ContinueProtectOperate,
DisStationOperate,
IndicatorAssociatedInfo
// DestinationOperate
},
@ -102,6 +104,9 @@ export default {
{label: '出入口', name: 'indicatorAssociatedInfo', menus: IndicatorAssociatedInfo}
// {label: this.$t('map.routing'), name:'routing', menus:RoutingOperate}
];
if (this.$route.query.lineCode == '16') {
this.tabList.push({label: '调度台', name: 'DisStationOperate', menus: DisStationOperate});
}
this.enabledTab = 'bigRoutingOperate';
} else {
this.tabList = [