This commit is contained in:
sunzhenyu 2021-09-24 17:20:21 +08:00
commit 8ff4f20e06
5 changed files with 278 additions and 6 deletions

View File

@ -57,6 +57,8 @@ export default class Section extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
model.points = store.getters['map/amendPoints'](this._code, model.points);
// console.log(store.getters['map/amendPoints'](this._code, model.points), '5555555');
this.z = 5 + parseInt(model.layer || 0);
this.model = model;
this.style = style;

View File

@ -194,7 +194,9 @@ function filtrationModel(models) {
});
return models;
}
function findElement(list, code) {
return list.find(element => element.code === code);
}
/**
* 实训状态数据
*/
@ -664,6 +666,24 @@ const map = {
return device;
},
amendPoints: state => (code, points) => {
if (state.map && state.map.displayList && state.map.displayList.length && store.state.training.prdType) {
let returnPoints = points;
state.map.displayList.forEach(item => {
const section = findElement(item.amendPointsList || [], code);
if (store.state.training.prdType === '01' && item.type === 'LOCAL' && section) {
returnPoints = section.points;
} else if (['02', '04', '05'].includes(store.state.training.prdType) && item.type === 'CENTER' && section) {
returnPoints = section.points;
} else if (store.state.training.prdType === '09' && item.type === 'DEPOT_IL' && section) {
returnPoints = section.points;
}
});
return returnPoints;
} else {
return points;
}
},
checkDeviceShow: state => deviceCode => {
if (state.map && state.map.displayList && state.map.displayList.length && store.state.training.prdType) {
let flag = false;

View File

@ -1,7 +1,7 @@
<template>
<div v-loading="loading" class="view-control-content">
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-card class="box-card" shadow="never" style="width: 80%; margin: 0 auto 15px; border-top: none;">
<el-card shadow="never" style="width: 80%; margin: 0 auto 15px; border-top: none;">
<div slot="header">
<span>请选择行调显示设备</span>
</div>
@ -16,6 +16,52 @@
</div>
</div>
</div>
<div style="padding: 10px;font-size: 14px;">
<div class="content-box-list" style="margin-top: 10px">
<div style="height: 30px;line-height: 30px;margin-bottom: 10px;">
<span class="title-box">修正区段列表</span>
<el-button icon="el-icon-plus" size="mini" style="float:right;" circle @click="addAmendPoints" />
</div>
<template v-for="(elem, i) in amendPointsList">
<el-card :key="i" class="box-card">
<el-row>
<el-button icon="el-icon-minus" size="mini" style="float:right;" circle @click="delAmendPoints(i)" />
</el-row>
<el-row style="height: 28px;line-height: 28px">
<el-col :span="5">
<span>修正区段</span>
</el-col>
<el-col :span="19">
<el-select v-model="elem.code" filterable size="mini" placeholder="请选择">
<el-option
v-for="item in sectionList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-col>
</el-row>
<el-row style="margin-top: 10px;height: 28px;line-height: 28px">
<el-col :span="5">
<span>坐标点</span>
</el-col>
<el-col :span="19">
<template v-for="(point, j) in elem.points">
<div :key="j">
<el-input-number v-model="point.x" style="width: 100px" size="mini" controls-position="right" />
<span style="line-height: 28px;">, </span>
<el-input-number v-model="point.y" style="width: 100px" size="mini" controls-position="right" />
<el-button icon="el-icon-plus" size="mini" circle @click="addPoint(j, elem.points)" />
<el-button icon="el-icon-minus" size="mini" circle :disabled="elem.points.length < 3" @click="delPoint(j, elem.points)" />
</div>
</template>
</el-col>
</el-row>
</el-card>
</template>
</div>
</div>
</el-card>
<div style="display: table; margin-left: 120px; margin-top: 12px; margin-bottom: 20px;">
<el-button type="primary" size="small" :loading="dataLoading" @click="generateData">自动生成</el-button>
@ -49,6 +95,7 @@ export default {
type: 'CENTER',
elementList: []
},
amendPointsList: [],
loading: false,
dataLoading:false
};
@ -89,6 +136,7 @@ export default {
(this.$store.state.map.map.displayList || []).forEach(item => {
if (item.type === 'CENTER') {
this.addModel = item;
this.amendPointsList = this.addModel.amendPointsList ? this.addModel.amendPointsList : [];
} else {
this.otherData.push(item);
}
@ -143,8 +191,19 @@ export default {
this.$messageBox('保存行调配置失败');
});
},
addAmendPoints() {
this.amendPointsList.push({ code: '', points: [{ x: 0, y: 0 }, { x:0, y:0 }] });
},
delAmendPoints(index) {
this.amendPointsList.splice(index, 1);
},
save() {
if (this.amendPointsList.find(elem => !elem.code)) {
this.$messageBox('修正区段未选择!');
return;
}
const map = this.$store.state.map.map;
this.addModel.amendPointsList = this.amendPointsList;
const param = {
displayList: [...this.otherData, this.addModel],
mapId: this.$route.params.mapId
@ -204,6 +263,12 @@ export default {
this.loading = false;
this.$messageBox('保存行调配置失败');
});
},
addPoint(index, points) {
points.splice(index, 0, {x:0, y:0});
},
delPoint(index, points) {
points.splice(index, 1);
}
}
};
@ -215,6 +280,35 @@ export default {
border-left: 4px solid red;
margin-bottom: 10px;
}
.box-card {
width: 100%;
padding: 5px;
}
.coordinate {
overflow: hidden;
.title {
text-align: right;
font-size: 14px;
color: #606266;
-webkit-box-sizing: border-box;
box-sizing: border-box;
line-height: 28px;
width: 120px;
font-weight: bold;
display: block;
float: left;
margin-right: 7px;
}
.listWidth{
display: table;
float: left;
margin-right: 20px;
&:last-child{
margin: 0;
}
}
}
.list-box{
overflow: hidden;
.list-content{

View File

@ -20,7 +20,7 @@
</template>
</el-table-column>
</el-table>
<el-card class="box-card" shadow="never" style="width: 80%; margin: 0 auto 15px; border-top: none;">
<el-card shadow="never" style="width: 80%; margin: 0 auto 15px; border-top: none;">
<div slot="header" class="clearfix">
<span style="font-size: 12px;">{{ cardTitle }}</span>
<el-button style="float: right; padding: 3px 3px" type="text" @click="clear">清空</el-button>
@ -52,6 +52,52 @@
</div>
</div>
</div>
<div style="padding: 10px;font-size: 14px;">
<div class="content-box-list" style="margin-top: 10px">
<div style="height: 30px;line-height: 30px;margin-bottom: 10px;">
<span class="title-box">修正区段列表</span>
<el-button icon="el-icon-plus" size="mini" style="float:right;" circle @click="addAmendPoints" />
</div>
<template v-for="(elem, i) in amendPointsList">
<el-card :key="i" class="box-card">
<el-row>
<el-button icon="el-icon-minus" size="mini" style="float:right;" circle @click="delAmendPoints(i)" />
</el-row>
<el-row style="height: 28px;line-height: 28px">
<el-col :span="5">
<span>修正区段</span>
</el-col>
<el-col :span="19">
<el-select v-model="elem.code" filterable size="mini" placeholder="请选择">
<el-option
v-for="item in sectionList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-col>
</el-row>
<el-row style="margin-top: 10px;height: 28px;line-height: 28px">
<el-col :span="5">
<span>坐标点</span>
</el-col>
<el-col :span="19">
<template v-for="(point, j) in elem.points">
<div :key="j">
<el-input-number v-model="point.x" style="width: 100px" size="mini" controls-position="right" />
<span style="line-height: 28px;">, </span>
<el-input-number v-model="point.y" style="width: 100px" size="mini" controls-position="right" />
<el-button icon="el-icon-plus" size="mini" circle @click="addPoint(j, elem.points)" />
<el-button icon="el-icon-minus" size="mini" circle :disabled="elem.points.length < 3" @click="delPoint(j, elem.points)" />
</div>
</template>
</el-col>
</el-row>
</el-card>
</template>
</div>
</div>
</el-card>
<div style="display: table; margin-left: 150px; margin-top: 12px; margin-bottom: 20px;">
<el-button type="primary" size="small" @click="generateData">生成</el-button>
@ -86,6 +132,7 @@ export default {
stationCodeList: [],
elementList: []
},
amendPointsList: [],
list: [],
field: '',
cardMode: 'generate',
@ -172,6 +219,7 @@ export default {
},
editModel(list, index) {
this.addModel = list[index];
this.amendPointsList = this.addModel.amendPointsList ? this.addModel.amendPointsList : [];
this.index = index;
this.cardMode = 'edit';
},
@ -181,12 +229,18 @@ export default {
},
updateOverlab() {
if (this.index || this.index == 0) {
this.clearData();
if (!this.addModel.stationCodeList.length) {
this.$messageBox('请选择车站!');
return;
}
if (this.amendPointsList.find(elem => !elem.code)) {
this.$messageBox('修正区段未选择!');
return;
}
this.addModel.amendPointsList = [...this.amendPointsList];
this.amendPointsList = [];
this.tableData.splice(this.index, 1, this.addModel);
this.clearData();
}
},
//
@ -226,17 +280,37 @@ export default {
this.$messageBox('请选择车站!');
return;
}
if (this.amendPointsList.find(elem => !elem.code)) {
this.$messageBox('修正区段未选择!');
return;
}
this.addModel.amendPointsList = [...this.amendPointsList];
this.amendPointsList = [];
this.tableData.push(this.addModel);
this.clearData();
},
clear() {
this.addModel = { type: 'DEPOT_IL', stationCodeList: [], elementList: [] };
this.amendPointsList = [];
},
clearData() {
this.addModel = { type: 'DEPOT_IL', stationCodeList: [], elementList: [] };
this.amendPointsList = [];
this.index = '';
this.cardMode = 'generate';
},
addAmendPoints() {
this.amendPointsList.push({ code: '', points: [{ x: 0, y: 0 }, { x:0, y:0 }] });
},
delAmendPoints(index) {
this.amendPointsList.splice(index, 1);
},
addPoint(index, points) {
points.splice(index, 0, {x:0, y:0});
},
delPoint(index, points) {
points.splice(index, 1);
},
generateData() {
this.loading = true;
this.tableData = [];
@ -285,6 +359,10 @@ export default {
border-left: 4px solid red;
margin-bottom: 10px;
}
.box-card {
width: 100%;
padding: 5px;
}
.list-box{
overflow: hidden;
.list-content{

View File

@ -20,7 +20,7 @@
</template>
</el-table-column>
</el-table>
<el-card class="box-card" shadow="never" style="width: 80%; margin: 0 auto 15px; border-top: none;">
<el-card shadow="never" style="width: 80%; margin: 0 auto 15px; border-top: none;">
<div slot="header" class="clearfix">
<span style="font-size: 12px;">{{ cardTitle }}</span>
<el-button style="float: right; padding: 3px 3px" type="text" @click="clear">清空</el-button>
@ -63,6 +63,52 @@
</div>
</div>
</div>
<div style="padding: 10px;font-size: 14px;">
<div class="content-box-list" style="margin-top: 10px">
<div style="height: 30px;line-height: 30px;margin-bottom: 10px;">
<span class="title-box">修正区段列表</span>
<el-button icon="el-icon-plus" size="mini" style="float:right;" circle @click="addAmendPoints" />
</div>
<template v-for="(elem, i) in amendPointsList">
<el-card :key="i" class="box-card">
<el-row>
<el-button icon="el-icon-minus" size="mini" style="float:right;" circle @click="delAmendPoints(i)" />
</el-row>
<el-row style="height: 28px;line-height: 28px">
<el-col :span="5">
<span>修正区段</span>
</el-col>
<el-col :span="19">
<el-select v-model="elem.code" filterable size="mini" placeholder="请选择">
<el-option
v-for="item in sectionList"
:key="item.code"
:label="item.name + '(' + item.code + ')'"
:value="item.code"
/>
</el-select>
</el-col>
</el-row>
<el-row style="margin-top: 10px;height: 28px;line-height: 28px">
<el-col :span="5">
<span>坐标点</span>
</el-col>
<el-col :span="19">
<template v-for="(point, j) in elem.points">
<div :key="j">
<el-input-number v-model="point.x" style="width: 100px" size="mini" controls-position="right" />
<span style="line-height: 28px;">, </span>
<el-input-number v-model="point.y" style="width: 100px" size="mini" controls-position="right" />
<el-button icon="el-icon-plus" size="mini" circle @click="addPoint(j, elem.points)" />
<el-button icon="el-icon-minus" size="mini" circle :disabled="elem.points.length < 3" @click="delPoint(j, elem.points)" />
</div>
</template>
</el-col>
</el-row>
</el-card>
</template>
</div>
</div>
</el-card>
<div style="display: table; margin-left: 90px; margin-top: 12px; margin-bottom: 20px;">
<el-button type="primary" size="small" @click="generateData">按集中站生成</el-button>
@ -99,6 +145,7 @@ export default {
switchStationCodeList:[],
elementList: []
},
amendPointsList: [],
list: [],
field: '',
cardMode: 'generate',
@ -193,6 +240,7 @@ export default {
},
editModel(list, index) {
this.addModel = list[index];
this.amendPointsList = this.addModel.amendPointsList ? this.addModel.amendPointsList : [];
this.index = index;
this.cardMode = 'edit';
},
@ -202,7 +250,6 @@ export default {
},
updateOverlab() {
if (this.index || this.index == 0) {
this.clearData();
if (!this.addModel.stationCodeList.length) {
this.$messageBox('请选择车站!');
return;
@ -211,7 +258,14 @@ export default {
this.$messageBox('请选择可切换显示的车站!');
return;
}
if (this.amendPointsList.find(elem => !elem.code)) {
this.$messageBox('修正区段未选择!');
return;
}
this.addModel.amendPointsList = [...this.amendPointsList];
this.amendPointsList = [];
this.tableData.splice(this.index, 1, this.addModel);
this.clearData();
}
},
//
@ -255,14 +309,22 @@ export default {
this.$messageBox('请选择可切换显示的车站!');
return;
}
if (this.amendPointsList.find(elem => !elem.code)) {
this.$messageBox('修正区段未选择!');
return;
}
this.addModel.amendPointsList = [...this.amendPointsList];
this.amendPointsList = [];
this.tableData.push(this.addModel);
this.clearData();
},
clear() {
this.addModel = { type: 'LOCAL', stationCodeList: [], elementList: [], switchStationCodeList:[] };
this.amendPointsList = [];
},
clearData() {
this.addModel = { type: 'LOCAL', stationCodeList: [], elementList: [], switchStationCodeList:[] };
this.amendPointsList = [];
this.index = '';
this.cardMode = 'generate';
},
@ -309,6 +371,18 @@ export default {
this.$messageBox('保存现地配置失败');
});
},
addAmendPoints() {
this.amendPointsList.push({ code: '', points: [{ x: 0, y: 0 }, { x:0, y:0 }] });
},
delAmendPoints(index) {
this.amendPointsList.splice(index, 1);
},
addPoint(index, points) {
points.splice(index, 0, {x:0, y:0});
},
delPoint(index, points) {
points.splice(index, 1);
},
generateData() {
this.loading = true;
this.tableData = [];
@ -358,6 +432,10 @@ export default {
border-left: 4px solid red;
margin-bottom: 10px;
}
.box-card {
width: 100%;
padding: 5px;
}
.list-box{
overflow: hidden;
.list-content{