Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
808236a6fa
@ -75,6 +75,14 @@ class SkinCode extends defaultStyle {
|
||||
textPosition: 'inside', // 文字位置
|
||||
textVerticalAlign: 'middle' // 文字垂直对齐方式
|
||||
},
|
||||
mouseOverStyle: {
|
||||
borderColor: '#fff',
|
||||
borderBackgroundColor: '#22DFDF',
|
||||
textShadowColor: '#22DFDF',
|
||||
nameShow: false,
|
||||
lineDash: '',
|
||||
lineWidthMore: 0
|
||||
},
|
||||
line: {
|
||||
width: 5, // 区段宽度
|
||||
beyondWidth: 1, // 区段宽超出宽度
|
||||
@ -632,16 +640,16 @@ class SkinCode extends defaultStyle {
|
||||
}
|
||||
], // 运行方向状态类型对应车头显示状态 1从左往右 0从右往左
|
||||
directionStopType: [
|
||||
{
|
||||
type: 1,
|
||||
lineLShow: false,
|
||||
lineRShow: true
|
||||
},
|
||||
{
|
||||
type: 0,
|
||||
lineLShow: true,
|
||||
lineRShow: false
|
||||
}
|
||||
{
|
||||
type: 1,
|
||||
lineLShow: false,
|
||||
lineRShow: true
|
||||
},
|
||||
{
|
||||
type: 0,
|
||||
lineLShow: true,
|
||||
lineRShow: false
|
||||
}
|
||||
], // 列车停止方向类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行
|
||||
driveModeStatus: [
|
||||
{
|
||||
|
@ -165,6 +165,10 @@ export default class Automactic extends Group {
|
||||
|
||||
setShowMode() {
|
||||
const showMode = this.model.showMode;
|
||||
if (showMode == '04') {
|
||||
this.hideMode();
|
||||
return;
|
||||
}
|
||||
const showConditions = this.style.AutoTurnBack.visibleConditions;
|
||||
if (!showConditions || showConditions === '01' || showMode === showConditions) {
|
||||
this.showMode();
|
||||
|
@ -50,6 +50,10 @@ export default class OutFrame extends Group {
|
||||
setShowMode() {
|
||||
const showMode = this.model.showMode;
|
||||
const showConditions = this.model.showConditions;
|
||||
if (showMode == '04') {
|
||||
this.box && this.box.hide();
|
||||
return;
|
||||
}
|
||||
if (!showConditions || showConditions === '01' || showMode === showConditions) {
|
||||
this.box && this.box.show();
|
||||
this.setState(this.model);
|
||||
|
@ -44,7 +44,6 @@ export default class ELines extends Group {
|
||||
style: {
|
||||
lineWidth: model.style.Section.line.width,
|
||||
stroke: stroke,
|
||||
// fillOpacity: 0,
|
||||
fill: 'rgba(0, 0, 0, 0)'
|
||||
}
|
||||
});
|
||||
@ -68,7 +67,6 @@ export default class ELines extends Group {
|
||||
fill: 'rgba(0, 0, 0, 0)'
|
||||
}
|
||||
});
|
||||
// this.sections.push(this.section);
|
||||
this.add(this.section);
|
||||
}
|
||||
}
|
||||
@ -77,6 +75,7 @@ export default class ELines extends Group {
|
||||
setStyle(styles) {
|
||||
this.eachChild((child) => {
|
||||
if (child.setStyle && child.isLine) {
|
||||
// child.setStyle({ ...styles, fill: 'rgba(0,0,0,0)'});
|
||||
child.setStyle(styles);
|
||||
}
|
||||
});
|
||||
|
@ -1,9 +1,9 @@
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import Text from 'zrender/src/graphic/Text';
|
||||
import Rect from 'zrender/src/graphic/shape/Rect';
|
||||
// import Polygon from 'zrender/src/graphic/shape/Polygon';
|
||||
import Polygon from 'zrender/src/graphic/shape/Polygon';
|
||||
import store from '@/store/index_APP_TARGET';
|
||||
// import JTriangle from '../../utils/JTriangle';
|
||||
import JTriangle from '../../utils/JTriangle';
|
||||
class EMouse extends Group {
|
||||
constructor(device, code) {
|
||||
super();
|
||||
@ -70,69 +70,104 @@ class EMouse extends Group {
|
||||
}
|
||||
// 区段包围框
|
||||
if (this.device.section) {
|
||||
const rect = this.device.section.getBoundingRect();
|
||||
rect.height = rect.height + this.device.style.Section.mouseOverStyle.lineWidthMore;
|
||||
const shape = {
|
||||
x: rect.x,
|
||||
y: rect.y - this.device.style.Section.mouseOverStyle.lineWidthMore / 2,
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
};
|
||||
this.lineBorder = new Rect({
|
||||
zlevel: this.device.zlevel,
|
||||
z: this.device.z - 1,
|
||||
shape: shape,
|
||||
style: {
|
||||
lineDash: this.device.style.Section.mouseOverStyle.lineDash,
|
||||
stroke: this.device.style.Section.mouseOverStyle.borderColor,
|
||||
fill: this.device.style.transparentColor
|
||||
}
|
||||
});
|
||||
// const model = this.device.model;
|
||||
// const arr = JSON.parse(JSON.stringify(model.points));
|
||||
// arr.reverse();
|
||||
// const points = [];
|
||||
// model.points.forEach((ele, index) => {
|
||||
// if (index == model.points.length - 1) {
|
||||
// this.triangle = new JTriangle(model.points[index - 1], ele);
|
||||
// } else {
|
||||
// console.log(ele, model.points[index + 1]);
|
||||
// this.triangle = new JTriangle(ele, model.points[index + 1]);
|
||||
// }
|
||||
// const directx = this.triangle.drictx;
|
||||
// const directy = this.triangle.dricty;
|
||||
// const x = 5 * this.triangle.getSinRate();
|
||||
// console.log(this.triangle.getCosRate(), this.triangle.getSinRate());
|
||||
// const y = 5;
|
||||
// points.push([ele.x - (directx * x), ele.y - (directy * y)]);
|
||||
// });
|
||||
// arr.forEach((ele, index) => {
|
||||
// if (index == arr.length - 1) {
|
||||
// this.triangle = new JTriangle(arr[index - 1], ele);
|
||||
// } else {
|
||||
// this.triangle = new JTriangle(ele, arr[index + 1]);
|
||||
// }
|
||||
// const directx = this.triangle.drictx;
|
||||
// const directy = this.triangle.dricty;
|
||||
// const x = 5 * this.triangle.getSinRate();
|
||||
// const y = 5;
|
||||
// points.push([ele.x + (directx * x), ele.y + (directy * y)]);
|
||||
// });
|
||||
// this.lineBorder = new Polygon({
|
||||
// zlevel: this.device.zlevel,
|
||||
// z: this.device.z - 1,
|
||||
// shape: {
|
||||
// points: points
|
||||
// },
|
||||
// style: {
|
||||
// lineDash: this.device.style.Section.mouseOverStyle.lineDash,
|
||||
// stroke: this.device.style.Section.mouseOverStyle.borderColor,
|
||||
// fill: this.device.style.transparentColor
|
||||
// }
|
||||
// });
|
||||
if (this.device.model.curve) {
|
||||
const rect = this.device.section.getBoundingRect();
|
||||
rect.height = rect.height + this.device.style.Section.mouseOverStyle.lineWidthMore;
|
||||
const shape = {
|
||||
x: rect.x,
|
||||
y: rect.y - this.device.style.Section.mouseOverStyle.lineWidthMore / 2,
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
};
|
||||
this.lineBorder = new Rect({
|
||||
zlevel: this.device.zlevel,
|
||||
z: this.device.z - 1,
|
||||
shape: shape,
|
||||
style: {
|
||||
lineDash: this.device.style.Section.mouseOverStyle.lineDash,
|
||||
stroke: this.device.style.Section.mouseOverStyle.borderColor,
|
||||
fill: this.device.style.transparentColor
|
||||
}
|
||||
});
|
||||
this.add(this.lineBorder);
|
||||
this.lineBorder.hide();
|
||||
} else {
|
||||
const model = this.device.model;
|
||||
const arr = JSON.parse(JSON.stringify(model.points));
|
||||
arr.reverse();
|
||||
const points = [];
|
||||
model.points.forEach((ele, index) => {
|
||||
let flag = false;
|
||||
if (index == model.points.length - 1) {
|
||||
this.triangle = new JTriangle(model.points[index - 1], ele);
|
||||
} else {
|
||||
this.triangle = new JTriangle(ele, model.points[index + 1]);
|
||||
}
|
||||
const directx = this.triangle.drictx;
|
||||
const directy = this.triangle.dricty;
|
||||
const switchWidth = 5; // 超出宽度多少
|
||||
if (index > 0) {
|
||||
if (model.points[index - 1].y == ele.y) {
|
||||
flag = true;
|
||||
}
|
||||
} else {
|
||||
if (model.points[index + 1].y == ele.y) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
const param = [ele.x, ele.y + switchWidth];
|
||||
points.push(param);
|
||||
} else {
|
||||
const param = [ele.x - directx * this.triangle.getAbsSin(switchWidth), ele.y + directy * this.triangle.getAbsCos(switchWidth)];
|
||||
points.push(param);
|
||||
}
|
||||
});
|
||||
model.points.forEach((ele, index) => {
|
||||
let flag = false;
|
||||
if (index == model.points.length - 1) {
|
||||
this.triangle = new JTriangle(model.points[index - 1], ele);
|
||||
} else {
|
||||
this.triangle = new JTriangle(ele, model.points[index + 1]);
|
||||
}
|
||||
const directx = this.triangle.drictx;
|
||||
const directy = this.triangle.dricty;
|
||||
const switchWidth = 5; // 超出宽度多少
|
||||
if (index > 0) {
|
||||
if (model.points[index - 1].y == ele.y) {
|
||||
flag = true;
|
||||
}
|
||||
} else {
|
||||
if (model.points[index + 1].y == ele.y) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
const param = [ele.x, ele.y - switchWidth];
|
||||
points.unshift(param);
|
||||
} else {
|
||||
const param = [ele.x + directx * this.triangle.getAbsSin(switchWidth), ele.y - directy * this.triangle.getAbsCos(switchWidth)];
|
||||
|
||||
this.add(this.lineBorder);
|
||||
this.lineBorder.hide();
|
||||
points.unshift(param);
|
||||
}
|
||||
|
||||
});
|
||||
this.lineBorder = new Polygon({
|
||||
zlevel: this.device.zlevel,
|
||||
z: this.device.z + 10,
|
||||
shape: {
|
||||
points: points
|
||||
},
|
||||
style: {
|
||||
lineDash: this.device.style.Section.mouseOverStyle.lineDash,
|
||||
stroke: this.device.style.Section.mouseOverStyle.borderColor,
|
||||
fill: this.device.style.transparentColor
|
||||
}
|
||||
});
|
||||
|
||||
this.add(this.lineBorder);
|
||||
this.lineBorder.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,8 +240,12 @@ export default class Section extends Group {
|
||||
/** 目的码名称*/
|
||||
if (model.destinationCode && model.destinationNameShow && style.Section.destinationText.show) {
|
||||
const opposite = style.Section.destinationText.opposite ? -1 : 1;
|
||||
const tempx = x + traingle.getSin(style.Section.destinationText.distance);
|
||||
const tempy = y + traingle.getCos(style.Section.destinationText.distance) * (style.Section.destinationText.position || opposite * drict);
|
||||
let tempx = x + traingle.getSin(style.Section.destinationText.distance);
|
||||
let tempy = y + traingle.getCos(style.Section.destinationText.distance) * (style.Section.destinationText.position || opposite * drict);
|
||||
if (!tempx || !tempy) {
|
||||
tempx = 0;
|
||||
tempy = 0;
|
||||
}
|
||||
this.destinationText = new ETextName({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z + 2,
|
||||
@ -267,8 +271,8 @@ export default class Section extends Group {
|
||||
createSection() {
|
||||
const model = this.model;
|
||||
const style = this.style;
|
||||
// 创建区段 model.logicSectionNum 为空 或 0 表明没有逻辑区段 创建 否则过滤
|
||||
if ((model.type == '01' && (model.logicSectionNum[0] == 0 || model.logicSectionNum.length == 0)) || model.type == '02' || model.type == '03') {
|
||||
// 创建区段 model.logicSectionCodeList 为空 或 0 表明没有逻辑区段 创建 否则过滤
|
||||
if ((model.type == '01' && (!model.logicSectionCodeList || !model.logicSectionCodeList.length)) || model.type == '02' || model.type == '03') {
|
||||
this.section = new ELines({
|
||||
zlevel: this.zlevel,
|
||||
z: model.type == '02' ? this.z + 1 : this.z, // 逻辑区段会覆盖物理区段
|
||||
@ -501,7 +505,6 @@ export default class Section extends Group {
|
||||
this.section.stopAnimation(true);
|
||||
this.sectionBlock && this.sectionBlock.hide(); // 因此特殊区段
|
||||
this.section.setStyle({
|
||||
fill: this.style.backgroundColor,
|
||||
stroke: this.style.Section.line.spareColor,
|
||||
lineWidth: this.style.Section.line.width
|
||||
});
|
||||
|
@ -52,6 +52,10 @@ export default class Text2 extends Group {
|
||||
// 设置显示模式
|
||||
setShowMode() {
|
||||
const showMode = this.model.showMode;
|
||||
if (showMode == '04') {
|
||||
this.text && this.text.hide();
|
||||
return;
|
||||
}
|
||||
const showConditions = this.model.showConditions;
|
||||
if (!showConditions || showConditions === '01' || showMode === showConditions) {
|
||||
this.text && this.text.show();
|
||||
|
@ -84,6 +84,7 @@ class TrainWindow extends Group {
|
||||
getInstanceByCode(code) {
|
||||
return (store.getters['map/getDeviceByCode'](code) || {}).instance;
|
||||
}
|
||||
// 设置显示模式
|
||||
setShowMode() {}
|
||||
setShowStation(flag) {
|
||||
if (flag) {
|
||||
|
@ -40,6 +40,12 @@ JTriangle.prototype = {
|
||||
getSin (n) {
|
||||
return this.dricty * Math.sqrt(Math.pow(n, 2) * this.abspowy / this.abspowz);
|
||||
},
|
||||
getAbsCos(n) {
|
||||
return Math.sqrt(Math.pow(n, 2) * this.abspowx / this.abspowz);
|
||||
},
|
||||
getAbsSin(n) {
|
||||
return Math.sqrt(Math.pow(n, 2) * this.abspowy / this.abspowz);
|
||||
},
|
||||
getCosRate () {
|
||||
return Math.sqrt(this.abspowx / this.abspowz);
|
||||
},
|
||||
|
@ -421,6 +421,7 @@ export default {
|
||||
}
|
||||
});
|
||||
this.$jlmap.updateShowMode(list, showMode);
|
||||
EventBus.$emit('select_DrawType', showMode);
|
||||
},
|
||||
setShowStation(stationCode, isTraining) {
|
||||
const nameList = Object.keys(this.$store.state.map.map);
|
||||
|
@ -22,7 +22,7 @@
|
||||
<el-button type="text" style="float: right; padding: 3px 0; margin-right: 5px;" @click="dataRelation">{{ $t('map.advanced') }}</el-button>
|
||||
<el-button type="text" style="float: right; padding: 3px 0; margin-right: 5px;" @click="showMap">绘图显隐</el-button>
|
||||
</div>
|
||||
<el-tabs v-model="enabledTab" class="mapEdit" type="card">
|
||||
<el-tabs v-show="projectType" v-model="enabledTab" class="mapEdit" type="card">
|
||||
<el-tab-pane :label="$t('map.section')" class="tab_pane_box" name="Section" :lazy="lazy">
|
||||
<section-draft
|
||||
ref="Section"
|
||||
@ -192,6 +192,12 @@
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<div v-show="!projectType">
|
||||
<split-screen
|
||||
ref="splitScreen"
|
||||
:selected="selected"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
@ -218,7 +224,9 @@ import CheckboxDraft from './checkboxDraft';
|
||||
import ControlLamp from './controlLamp';
|
||||
import SplitStation from './splitStation';
|
||||
import Arrow from './arrow';
|
||||
import SplitScreen from './splitScreen';
|
||||
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
import { ViewMode } from '@/scripts/ConstDic';
|
||||
|
||||
export default {
|
||||
@ -244,7 +252,8 @@ export default {
|
||||
CheckboxDraft,
|
||||
ControlLamp,
|
||||
SplitStation,
|
||||
Arrow
|
||||
Arrow,
|
||||
SplitScreen
|
||||
},
|
||||
props: {
|
||||
selected: {
|
||||
@ -275,7 +284,8 @@ export default {
|
||||
mapEditShow: false,
|
||||
mapPaintShow: true
|
||||
},
|
||||
oldDevice: null
|
||||
oldDevice: null,
|
||||
projectType: true
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -301,6 +311,13 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
EventBus.$on('select_DrawType', (showMode) => {
|
||||
if (showMode == '04') {
|
||||
this.projectType = false;
|
||||
} else {
|
||||
this.projectType = true;
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
dataRelation() {
|
||||
|
@ -206,7 +206,6 @@ export default {
|
||||
kmRangeLeft: '',
|
||||
region: '',
|
||||
namePosition: { x: 0, y: 0 },
|
||||
logicSectionNum: [0],
|
||||
logicSectionCodeList: [],
|
||||
logicSectionShow: true,
|
||||
logicSectionNameSort: true,
|
||||
|
@ -129,7 +129,6 @@ export default {
|
||||
kmRangeRight: 0,
|
||||
kmRangeLeft: 0,
|
||||
region: '',
|
||||
logicSectionNum: [],
|
||||
logicSectionCodeList: [],
|
||||
logicSectionShow: false, // 是否显示逻辑区段
|
||||
standTrack: false, // 是否站台轨
|
||||
@ -166,7 +165,6 @@ export default {
|
||||
belongStation: '' // 所属车站
|
||||
},
|
||||
oldPoint: [], // 区段未修改前 坐标
|
||||
logicSectionNums: [1],
|
||||
field: '',
|
||||
oldLeftSectionCode: '',
|
||||
oldRightSectionCode: '',
|
||||
@ -924,7 +922,7 @@ export default {
|
||||
if (val === 'four') {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.logicBlock.computedLogicSectionNumList(
|
||||
this.editModel.logicSectionNum
|
||||
this.editModel.logicSectionCodeList
|
||||
);
|
||||
});
|
||||
}
|
||||
@ -975,8 +973,6 @@ export default {
|
||||
this.clear();
|
||||
this.activeName = 'first';
|
||||
this.editModel = deepAssign(this.editModel, selected);
|
||||
this.editModel.logicSectionNum =
|
||||
selected.type === '01' ? selected.logicSectionNum : [0];
|
||||
this.editModel.points = JSON.parse(
|
||||
JSON.stringify(selected.points)
|
||||
);
|
||||
@ -1058,11 +1054,9 @@ export default {
|
||||
addPoint(index) {
|
||||
const data = { x: 0, y: 0 };
|
||||
this.editModel.points.splice(index + 1, 0, data);
|
||||
this.logicSectionNums.splice(index + 1, 0, 1);
|
||||
},
|
||||
delPoint(index) {
|
||||
this.editModel.points.splice(index, 1);
|
||||
this.logicSectionNums.splice(index, 1);
|
||||
},
|
||||
// 修改区段属性
|
||||
edit() {
|
||||
|
@ -2,25 +2,28 @@
|
||||
<div style="height:100%">
|
||||
<div style="height: calc(100% - 46px);">
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper">
|
||||
<el-table :data="tableData" style="width: 80%; margin: 0 auto;">
|
||||
<el-table-column :label="$t('map.sectionPolyline')" width="150">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ $t('map.aux') }}{{ scope.row.index }}{{ $t('map.sectionLine') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('map.sectionLogicalNumber')" width="130">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.num" size="mini" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('map.operation')">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">{{ $t('map.empty') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--<el-table :data="tableData" style="width: 80%; margin: 0 auto;">-->
|
||||
<!--<el-table-column :label="$t('map.sectionPolyline')" width="150">-->
|
||||
<!--<template slot-scope="scope">-->
|
||||
<!--<span style="margin-left: 10px">{{ $t('map.aux') }}{{ scope.row.index }}{{ $t('map.sectionLine') }}</span>-->
|
||||
<!--</template>-->
|
||||
<!--</el-table-column>-->
|
||||
<!--<el-table-column :label="$t('map.sectionLogicalNumber')" width="130">-->
|
||||
<!--<template slot-scope="scope">-->
|
||||
<!--<el-input v-model="scope.row.num" size="mini" />-->
|
||||
<!--</template>-->
|
||||
<!--</el-table-column>-->
|
||||
<!--<el-table-column :label="$t('map.operation')">-->
|
||||
<!--<template slot-scope="scope">-->
|
||||
<!--<el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">{{ $t('map.empty') }}-->
|
||||
<!--</el-button>-->
|
||||
<!--</template>-->
|
||||
<!--</el-table-column>-->
|
||||
<!--</el-table>-->
|
||||
<el-form ref="showDelimiter" label-width="130px" size="mini">
|
||||
<el-form-item label="逻辑区段数量">
|
||||
<el-input-number v-model="logicNum" :min="0" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否显示分隔符" style="margin-top:30px;margin-left:30px;">
|
||||
<el-checkbox v-model="isDelimiter" />
|
||||
</el-form-item>
|
||||
@ -57,9 +60,9 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableData: [],
|
||||
addList: [],
|
||||
isDelimiter:false
|
||||
isDelimiter:false,
|
||||
logicNum: 0
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -70,50 +73,85 @@ export default {
|
||||
methods:{
|
||||
// 生成逻辑区段
|
||||
editSectionNum() {
|
||||
let models = [];
|
||||
const models = [];
|
||||
this.addList = [];
|
||||
let counts = 0;
|
||||
let logicSectionNumList = [];
|
||||
const counts = 0;
|
||||
const sectionPoints = [...this.editModel.points]; // 获取区段点
|
||||
let allNotZeros = true;
|
||||
let totalNum = 0;
|
||||
const lengthFact = this.editModel.lengthFact;
|
||||
this.tableData.forEach((ele, index) => {
|
||||
totalNum += Number(ele.num);
|
||||
});
|
||||
let lineLength = 0; // NaN 由于 0/0 造成的
|
||||
if (totalNum) {
|
||||
lineLength = lengthFact / totalNum; // 均分逻辑区段偏移量
|
||||
if (this.logicNum) {
|
||||
lineLength = lengthFact / this.logicNum; // 均分逻辑区段偏移量
|
||||
}
|
||||
this.tableData.forEach((ele, index) => {
|
||||
models = [...models, ...this.createLogicalSections(Number(ele.num), sectionPoints[index], sectionPoints[index + 1], this.editModel, counts, lineLength, totalNum)];
|
||||
allNotZeros = Number(ele.num) && allNotZeros;
|
||||
logicSectionNumList.push(Number(ele.num));
|
||||
counts += parseInt(ele.num);
|
||||
});
|
||||
if (counts == 0 || allNotZeros) {
|
||||
let logicSectionCodeList = [];
|
||||
models.forEach(item=> {
|
||||
logicSectionCodeList.push(item.code);
|
||||
});
|
||||
this.sectionList.forEach(section => { // 删除之前的逻辑区段
|
||||
if (section.type === '02' && section.parentCode == this.editModel.code) {
|
||||
models.push(deepAssign(section, {_dispose: true}));
|
||||
}
|
||||
});
|
||||
if (counts == 0) {
|
||||
logicSectionNumList = [];
|
||||
logicSectionCodeList = [];
|
||||
if (sectionPoints.length === 2) {
|
||||
const triangle = new JTriangle(sectionPoints[0], sectionPoints[1]);
|
||||
const offset = Math.sqrt(triangle.abspowz) / this.logicNum;
|
||||
for (let i = 0; i < this.logicNum; i++) {
|
||||
const points = [
|
||||
{ x: sectionPoints[0].x + triangle.getCos(offset * i), y: sectionPoints[0].y + triangle.getSin(offset * i) },
|
||||
{ x: sectionPoints[0].x + triangle.getCos(offset * (i + 1)), y: sectionPoints[0].y + triangle.getSin(offset * (i + 1)) }
|
||||
];
|
||||
const param = this.addLogicalSection(this.editModel, points, counts + i, lineLength, this.logicNum);
|
||||
models.push(param);
|
||||
this.addList.push(param);
|
||||
}
|
||||
const model = deepAssign(this.editModel, {_type: 'Section'});
|
||||
model.logicSectionNum = [...logicSectionNumList];
|
||||
model.logicSectionCodeList = [...logicSectionCodeList];
|
||||
models.push(model);
|
||||
this.$emit('updateMapModel', models);
|
||||
} else {
|
||||
this.$messageBox('逻辑区段在个折线上数量要均为0或均不为0');
|
||||
const triangleList = [];
|
||||
const pointLength = [0];
|
||||
let totalLength = 0;
|
||||
for (let i = 1; i < sectionPoints.length; i++) {
|
||||
const triangle = new JTriangle(sectionPoints[i - 1], sectionPoints[i]);
|
||||
triangleList.push(triangle);
|
||||
totalLength += Math.floor(Math.sqrt(triangle.abspowz));
|
||||
pointLength.push(totalLength);
|
||||
}
|
||||
const offset = this.logicNum ? Math.floor(totalLength / this.logicNum) : 0;
|
||||
let startPoint = sectionPoints[0];
|
||||
let startIndex = 1;
|
||||
for (let i = 0; i < this.logicNum; i++) {
|
||||
const rectLength = (i + 1) * offset;
|
||||
let flag = true;
|
||||
for (let index = 0; index < pointLength.length; index++) {
|
||||
if (rectLength <= pointLength[index] && flag) {
|
||||
const points = [{x: startPoint.x, y: startPoint.y}];
|
||||
let surplusLength = rectLength - pointLength[index - 1];
|
||||
if (startIndex === index) {
|
||||
surplusLength = offset;
|
||||
}
|
||||
for (let j = startIndex; j <= index; j++) {
|
||||
if (i === this.logicNum - 1 && j === index) {
|
||||
points.push(sectionPoints[sectionPoints.length - 1]);
|
||||
} else if (j === index) {
|
||||
points.push({x: points[points.length - 1].x + triangleList[index - 1].getCos(surplusLength),
|
||||
y: points[points.length - 1].y + triangleList[index - 1].getSin(surplusLength)});
|
||||
} else if (index - startIndex > 1) {
|
||||
points.push(sectionPoints[j]);
|
||||
}
|
||||
}
|
||||
startIndex = index;
|
||||
const param = this.addLogicalSection(this.editModel, points, counts + i, lineLength, this.logicNum);
|
||||
startPoint = {x:points[points.length - 1].x, y:points[points.length - 1].y };
|
||||
models.push(param);
|
||||
this.addList.push(param);
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let logicSectionCodeList = [];
|
||||
models.forEach(item=> {
|
||||
logicSectionCodeList.push(item.code);
|
||||
});
|
||||
this.editModel.logicSectionCodeList.forEach( logicCode => {
|
||||
const section = this.$store.getters['map/getDeviceByCode'](logicCode);
|
||||
models.push(deepAssign(section, {_dispose: true}));
|
||||
});
|
||||
if (this.logicNum === 0) {
|
||||
logicSectionCodeList = [];
|
||||
}
|
||||
const model = deepAssign(this.editModel, {_type: 'Section'});
|
||||
model.logicSectionCodeList = [...logicSectionCodeList];
|
||||
models.push(model);
|
||||
this.$emit('updateMapModel', models);
|
||||
},
|
||||
handleDelete(index, row) {
|
||||
row.num = 0;
|
||||
@ -168,7 +206,6 @@ export default {
|
||||
logicSectionNameSort: model.logicSectionNameSort,
|
||||
switchSection: model.switchSection,
|
||||
relSwitchCode: model.relSwitchCode,
|
||||
logicSectionNum: [],
|
||||
logicSectionShow: model.logicSectionShow,
|
||||
stationCode: model.stationCode,
|
||||
destinationCode: '', // 目的地码
|
||||
@ -178,7 +215,8 @@ export default {
|
||||
points: points,
|
||||
curve: false,
|
||||
nameShow: true,
|
||||
lengthFact: lineLength ? lineLength.toFixed(3) : lineLength,
|
||||
logicSectionCodeList: [],
|
||||
lengthFact: lineLength ? lineLength.toFixed(3) : 0,
|
||||
trainWindowCode: '',
|
||||
kmRangeRight: model.kmRangeRight,
|
||||
kmRangeLeft: model.kmRangeLeft,
|
||||
@ -194,24 +232,8 @@ export default {
|
||||
return data;
|
||||
},
|
||||
// 计算逻辑区段数量列表展示
|
||||
computedLogicSectionNumList(logicSectionNum) {
|
||||
this.tableData = [];
|
||||
this.logicSectionNums = [...logicSectionNum];
|
||||
|
||||
var i; var num; var len = this.editModel.points.length;
|
||||
if (len > 1 && this.editModel.type === '01') {
|
||||
for (i = 0; i < len - 1; i++) {
|
||||
num = 0;
|
||||
if (Array.isArray(this.logicSectionNums) && this.logicSectionNums[i]) {
|
||||
num = parseInt(this.logicSectionNums[i]);
|
||||
}
|
||||
this.tableData.push({ index: i + 1, num: num });
|
||||
}
|
||||
|
||||
if (this.tableData.length <= 0) {
|
||||
this.tableData.push({ index: i + 1, num: 0 });
|
||||
}
|
||||
}
|
||||
computedLogicSectionNumList(logicSectionCodeList) {
|
||||
this.logicNum = logicSectionCodeList ? logicSectionCodeList.length : 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -186,7 +186,6 @@ export default {
|
||||
relSwitchCode: '',
|
||||
trainWindowCode: '',
|
||||
logicSectionNameSort: selected.logicSectionNameSort,
|
||||
logicSectionNum: selected.logicSectionNum,
|
||||
logicSectionShow: selected.logicSectionShow,
|
||||
sepTypeLeft: index == 0 ? selected.sepTypeLeft : '01', // 左侧分隔符类型 (起始左侧按原来区段类型走 其余 默认 01)
|
||||
sepTypeRight: index == this.addModel.splitNumber ? selected.sepTypeRight : '01', // 右侧分隔符类型 (终点右侧按原来区段类型走 其余 默认 01)
|
||||
@ -208,7 +207,7 @@ export default {
|
||||
relevanceSectionList: [],
|
||||
roadType: selected.roadType,
|
||||
firstTurnBack: false,
|
||||
belongStation: ''
|
||||
belongStation: ''
|
||||
};
|
||||
models.push(model);
|
||||
}
|
||||
@ -287,7 +286,7 @@ export default {
|
||||
relevanceSectionList: [],
|
||||
roadType: null,
|
||||
firstTurnBack: false,
|
||||
belongStation: ''
|
||||
belongStation: ''
|
||||
};
|
||||
models.push(deepAssign(this.$store.getters['map/getDeviceByCode'](lsection.code), { _dispose: true }));
|
||||
models.push(deepAssign(this.$store.getters['map/getDeviceByCode'](rsection.code), { _dispose: true }));
|
||||
@ -312,7 +311,6 @@ export default {
|
||||
});
|
||||
},
|
||||
handleRealLocationRelationships(model, realRigth, realLeft) {
|
||||
model.logicSectionNum = realLeft.logicSectionNum;
|
||||
model.logicSectionShow = realLeft.logicSectionShow;
|
||||
model.sepTypeLeft = realLeft.sepTypeLeft;
|
||||
model.sepTypeRight = realRigth.sepTypeRight;
|
||||
|
177
src/views/newMap/newMapdraft/mapoperate/splitScreen.vue
Normal file
177
src/views/newMap/newMapdraft/mapoperate/splitScreen.vue
Normal file
@ -0,0 +1,177 @@
|
||||
<template>
|
||||
<div style="height:100%">
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper">
|
||||
<el-table :data="tableData" style="width: 80%; margin: 0 auto;">
|
||||
<el-table-column label="区段名称">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.name }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="换行位置">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ scope.row.width }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click.native.prevent="editModel(tableData, scope.$index)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button type="text" size="small" @click.native.prevent="deleteModel(tableData, scope.$index)">
|
||||
移出
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-card class="box-card" shadow="never" style="width: 80%; margin: 0 auto; border-top: none;">
|
||||
<div slot="header" class="clearfix">
|
||||
<span style="font-size: 12px;">{{ cardTitle }}</span>
|
||||
<el-button v-if="cardMode === 'generate'" style="float: right; padding: 3px 0" type="text" @click="generateOverlab">生成</el-button>
|
||||
<el-button-group v-else-if=" cardMode === 'edit'" style="float: right;">
|
||||
<el-button type="text" style="padding:3px 3px" @click="updateOverlab">修改</el-button>
|
||||
<el-button type="text" style="padding:3px 0" @click="cancelOverlab">取消</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
<div>
|
||||
<el-form ref="hostileForm" :model="addModel" label-width="135px" size="mini" style="margin-top: 15px">
|
||||
<el-form-item label="区段:" prop="section">
|
||||
<el-select v-model="addModel.section" clearable :filterable="true">
|
||||
<el-option
|
||||
v-for="item in sectionList"
|
||||
:key="item.code"
|
||||
:label="item.name + ' (' + item.code+ ')'"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button
|
||||
:type=" field === 'selectSection' ? 'danger' : 'primary'"
|
||||
@click="hover('selectSection')"
|
||||
>{{ $t('map.activate') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-card>
|
||||
<div style="display: table; margin-left: 90px; margin-top: 12px; margin-bottom: 10px;">
|
||||
<el-button type="primary" @click="save">保存</el-button>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
export default {
|
||||
props: {
|
||||
selected: {
|
||||
type: Object,
|
||||
default: function () {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableData: [],
|
||||
addModel: {
|
||||
section: ''
|
||||
},
|
||||
field: '',
|
||||
cardMode: 'generate',
|
||||
index: ''
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'sectionList'
|
||||
]),
|
||||
cardTitle() {
|
||||
if (this.cardMode === 'generate') {
|
||||
return '生成数据';
|
||||
} else if (this.cardMode === 'edit') {
|
||||
return '编辑数据';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
selected: function (val, oldVal) {
|
||||
this.deviceSelect(val);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
deviceSelect(selected) {
|
||||
this.$refs.form && this.$refs.form.resetFields();
|
||||
this.$refs.make && this.$refs.make.resetFields();
|
||||
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'selectSection'.toUpperCase()) {
|
||||
if (selected.type === '01' || selected.type === '03') {
|
||||
this.addModel.section = selected.code;
|
||||
this.field = '';
|
||||
}
|
||||
}
|
||||
},
|
||||
hover(field) {
|
||||
this.field = field == this.field ? '' : field;
|
||||
},
|
||||
deleteModel(list, index) {
|
||||
list.splice(index, 1);
|
||||
this.clear();
|
||||
this.cardMode = 'generate';
|
||||
},
|
||||
editModel(list, index) {
|
||||
this.addModel.section = list[index].code;
|
||||
this.index = index;
|
||||
this.cardMode = 'edit';
|
||||
},
|
||||
cancelOverlab() {
|
||||
this.cardMode = 'generate';
|
||||
this.clear();
|
||||
},
|
||||
updateOverlab() {
|
||||
if (this.index || this.index == 0) {
|
||||
if (!this.addModel.section) {
|
||||
this.$messageBox('请选择区段!');
|
||||
} else {
|
||||
const section = this.$store.getters['map/getDeviceByCode'](this.addModel.section);
|
||||
const param = {
|
||||
width: section.points[section.points.length - 1].x,
|
||||
name: `${section.name}(${section.code})`,
|
||||
code: section.code
|
||||
};
|
||||
this.tableData.splice(this.index, 1, param);
|
||||
}
|
||||
this.clear();
|
||||
this.cardMode = 'generate';
|
||||
}
|
||||
},
|
||||
save() {
|
||||
console.log(this.tableData); // 保存
|
||||
},
|
||||
clear() {
|
||||
this.$refs.hostileForm.resetFields();
|
||||
this.addModel.section = '';
|
||||
this.index = '';
|
||||
},
|
||||
generateOverlab() {
|
||||
if (!this.addModel.section) {
|
||||
this.$messageBox('请选择区段!');
|
||||
} else {
|
||||
const section = this.$store.getters['map/getDeviceByCode'](this.addModel.section);
|
||||
this.tableData.push({
|
||||
width: section.points[section.points.length - 1].x,
|
||||
name: `${section.name}(${section.code})`,
|
||||
code: section.code
|
||||
});
|
||||
this.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
|
||||
</style>
|
@ -126,7 +126,6 @@ export default {
|
||||
relSwitchCode: '',
|
||||
relevanceSectionList: this.fromData.relevanceSectionList,
|
||||
points: [{ x: 0, y: 0 }, { x: 0, y: 0 }],
|
||||
logicSectionNum: [0],
|
||||
logicSectionShow: false,
|
||||
sepTypeLeft: '00',
|
||||
offsetLeft: 0,
|
||||
|
@ -204,7 +204,7 @@ export default {
|
||||
this.field = field == this.field ? '' : field;
|
||||
},
|
||||
deviceSelect(selected) {
|
||||
this.$refs.form && this.$refs.form.resetFields();
|
||||
this.$refs.form && this.$refs.form.resetFields();
|
||||
if (selected && selected._type.toUpperCase() === 'TrainWindow'.toUpperCase()) {
|
||||
this.activeName = 'first';
|
||||
this.editModel = deepAssign(this.editModel, selected);
|
||||
@ -311,7 +311,7 @@ export default {
|
||||
if (this.sectionList && this.sectionList.length) {
|
||||
this.sectionList.forEach(elem => {
|
||||
// elem.type !== '03' // 更宽泛的匹配条件 !elem.switchSection 严格匹配条件
|
||||
if (elem.type !== '04' && !elem.switchSection && !elem.trainWindowCode && (elem.logicSectionNum.length == 0 || elem.logicSectionNum.length == 1 && elem.logicSectionNum[0] == 0)) {
|
||||
if (elem.type !== '04' && !elem.switchSection && !elem.trainWindowCode && ( !elem.logicSectionCodeList || elem.logicSectionCodeList.length === 0)) {
|
||||
const triangle = new JTriangle(elem.points[0], elem.points[elem.points.length - 1]);
|
||||
const param = this.createModel({
|
||||
triangle: triangle,
|
||||
|
@ -66,7 +66,6 @@ export default {
|
||||
ProjectList.forEach(item => {
|
||||
this.options.push({label: item.label, value: item.value.toUpperCase()});
|
||||
});
|
||||
console.log(this.options);
|
||||
},
|
||||
doSave() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
|
Loading…
Reference in New Issue
Block a user