Merge branch 'dev' of https://git.code.tencent.com/lian-cbtc/jl-client into dev
# Conflicts: # src/views/newMap/newMapdraft/mapoperate/section.vue
This commit is contained in:
commit
ff177f1f3b
@ -175,38 +175,7 @@
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane class="view-control" :label="$t('map.logicBlock')" name="four">
|
||||
<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-form ref="showDelimiter" label-width="130px" size="mini">
|
||||
<el-form-item label="是否显示分隔符" style="margin-top:30px;margin-left:30px;">
|
||||
<el-checkbox v-model="isDelimiter" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
<div class="button_box">
|
||||
<el-button-group class="map-draft-group">
|
||||
<el-button type="primary" size="small" @click="editSectionNum">{{ $t('map.updateObj') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
<logic-block ref="logicBlock" :edit-model="editModel" @updateMapModel="updateMapModel" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</template>
|
||||
@ -217,11 +186,13 @@ import { getUID } from '@/jmapNew/utils/Uid';
|
||||
import JTriangle from '@/jmapNew/utils/JTriangle';
|
||||
import ConfigList from './config/list';
|
||||
import { deepAssign } from '@/utils/index';
|
||||
import LogicBlock from './section/logicBlock';
|
||||
|
||||
export default {
|
||||
name: 'SectionDraft',
|
||||
components: {
|
||||
ConfigList
|
||||
ConfigList,
|
||||
LogicBlock
|
||||
},
|
||||
props: {
|
||||
selected: {
|
||||
@ -240,7 +211,6 @@ export default {
|
||||
TrainPositionTypeList: [],
|
||||
regionList: [],
|
||||
viewSelect: false,
|
||||
isDelimiter:false,
|
||||
editModel: {
|
||||
code: '',
|
||||
name: '',
|
||||
@ -285,7 +255,6 @@ export default {
|
||||
rightSectionCode: '',
|
||||
relevanceSectionList: []
|
||||
},
|
||||
tableData: [],
|
||||
oldPoint: [], // 区段未修改前 坐标
|
||||
addModel: {
|
||||
code: '',
|
||||
@ -652,31 +621,13 @@ export default {
|
||||
this.regionList = this.$ConstSelect.RegionTypeList;
|
||||
},
|
||||
methods: {
|
||||
// 计算逻辑区段数量列表展示
|
||||
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 });
|
||||
}
|
||||
}
|
||||
},
|
||||
deviceChange(code) {
|
||||
this.$emit('setCenter', code);
|
||||
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
|
||||
},
|
||||
deviceSelect(selected) {
|
||||
const obj = this;
|
||||
if (!this.fieldS) { // 判断是否激活选择站台
|
||||
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
|
||||
if (this.field === 'leftSection') {
|
||||
@ -710,7 +661,9 @@ export default {
|
||||
|
||||
this.addModel.splitOffsetMax = Math.sqrt(new JTriangle(selected.points[0], selected.points[selected.points.length - 1]).abspowz);
|
||||
this.addModel.splitOffset = this.addModel.splitOffsetMax / 2;
|
||||
this.computedLogicSectionNumList(this.editModel.logicSectionNum);
|
||||
|
||||
obj.$refs.logicBlock.computedLogicSectionNumList(this.editModel.logicSectionNum);
|
||||
|
||||
if (this.field.toUpperCase() === 'splitSection'.toUpperCase()) {
|
||||
this.addModel.code = selected.code;
|
||||
this.activeName = 'three';
|
||||
@ -760,104 +713,6 @@ export default {
|
||||
this.$emit('fieldSelect', this.field);
|
||||
}
|
||||
},
|
||||
handleDelete(index, row) {
|
||||
row.num = 0;
|
||||
},
|
||||
// 逻辑区段模型
|
||||
addLogicalSection(model, points, index, middleOffset) {
|
||||
const data = {
|
||||
_type: 'Section',
|
||||
code: getUID('T', this.sectionList),
|
||||
name: String.fromCharCode(index + 'A'.charCodeAt()),
|
||||
parentCode: model.code,
|
||||
axleShow: false,
|
||||
type: '02',
|
||||
namePosition: { x: 0, y: 0 },
|
||||
isStandTrack: false,
|
||||
standTrackName: model.standTrackName,
|
||||
standTrackNamePosition: {
|
||||
x: model.standTrackNamePosition.x,
|
||||
y: model.standTrackNamePosition.y
|
||||
},
|
||||
isReentryTrack: false,
|
||||
reentryTrackName: model.reentryTrackName,
|
||||
reentryTrackNamePosition: {
|
||||
x: model.reentryTrackNamePosition.x,
|
||||
y: model.reentryTrackNamePosition.y
|
||||
},
|
||||
isTransferTrack: false,
|
||||
transferTrackName: model.transferTrackName,
|
||||
transferTrackNamePosition: {
|
||||
x: model.transferTrackNamePosition.x,
|
||||
y: model.transferTrackNamePosition.y
|
||||
},
|
||||
isSegmentation: false,
|
||||
segmentationPosition: {
|
||||
x: model.segmentationPosition.x,
|
||||
y: model.segmentationPosition.y
|
||||
},
|
||||
logicSectionNameSort: model.logicSectionNameSort,
|
||||
isSwitchSection: model.isSwitchSection,
|
||||
relSwitchCode: model.relSwitchCode,
|
||||
logicSectionNum: [],
|
||||
logicSectionShow: model.logicSectionShow,
|
||||
stationCode: model.stationCode,
|
||||
offsetLeft: middleOffset * (index) + model.offsetLeft,
|
||||
offsetRight: middleOffset * (index + 1) + model.offsetLeft,
|
||||
sepTypeLeft: '00',
|
||||
sepTypeRight: '00',
|
||||
trainPosType: model.trainPosType,
|
||||
points: points,
|
||||
isCurve: false,
|
||||
lengthFact: 0,
|
||||
kmRangeRight: model.kmRangeRight,
|
||||
kmRangeLeft: model.kmRangeLeft,
|
||||
region: model.region,
|
||||
relevanceSectionList: []
|
||||
};
|
||||
if (this.isDelimiter) {
|
||||
data.sepTypeLeft = '01';
|
||||
data.sepTypeRight = '01';
|
||||
}
|
||||
return data;
|
||||
},
|
||||
// 创建逻辑区段
|
||||
createLogicalSections(num, beg, end, model, counts) {
|
||||
const models = [];
|
||||
const triangle = new JTriangle(beg, end);
|
||||
const offset = Math.sqrt(triangle.abspowz) / num;
|
||||
const middleOffset = parseFloat((model.offsetRight - model.offsetLeft) / num);
|
||||
for (let i = 0; i < num; i++) {
|
||||
const points = [
|
||||
{ x: beg.x + triangle.getCos(offset * i), y: beg.y + triangle.getSin(offset * i) },
|
||||
{ x: beg.x + triangle.getCos(offset * (i + 1)), y: beg.y + triangle.getSin(offset * (i + 1)) }
|
||||
];
|
||||
models.push(this.addLogicalSection(model, points, counts + i, middleOffset));
|
||||
}
|
||||
return models;
|
||||
},
|
||||
// 生成逻辑区段
|
||||
editSectionNum() {
|
||||
let models = [];
|
||||
let counts = 0;
|
||||
const logicSectionNumList = [];
|
||||
const sectionPoints = [...this.editModel.points]; // 获取区段点
|
||||
this.tableData.forEach((ele, index) => {
|
||||
models = [...models, ...this.createLogicalSections(Number(ele.num), sectionPoints[index], sectionPoints[index + 1], this.editModel, counts)];
|
||||
logicSectionNumList.push(Number(ele.num));
|
||||
counts += parseInt(ele.num);
|
||||
});
|
||||
this.sectionList.forEach(section => { // 删除之前的逻辑区段
|
||||
if (section.type === '02' && section.parentCode == this.editModel.code) {
|
||||
models.push(deepAssign(section, {_dispose: true}));
|
||||
}
|
||||
});
|
||||
|
||||
this.editModel.logicSectionNum = [...logicSectionNumList];
|
||||
models.push(this.editModel);
|
||||
this.activeName = 'first';
|
||||
this.$emit('updateMapModel', models);
|
||||
},
|
||||
addPoint(index) {
|
||||
const data = { x: 0, y: 0 };
|
||||
this.editModel.points.splice(index + 1, 0, data);
|
||||
@ -1031,6 +886,10 @@ export default {
|
||||
}
|
||||
return null;
|
||||
},
|
||||
updateMapModel(models) {
|
||||
this.activeName = 'first';
|
||||
this.$emit('updateMapModel', models);
|
||||
},
|
||||
// 删除对象
|
||||
deleteObj() {
|
||||
const models = [];
|
||||
@ -1043,6 +902,16 @@ export default {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
models.push(deepAssign(selected, { _dispose: true }));
|
||||
const delLeftSection = this.getSectionByCode(selected.leftSectionCode);
|
||||
const delRightSection = this.getSectionByCode(selected.rightSectionCode);
|
||||
if (delLeftSection) {
|
||||
delLeftSection.rightSectionCode = '';
|
||||
models.push(delLeftSection);
|
||||
}
|
||||
if (delRightSection) {
|
||||
delRightSection.leftSectionCode = '';
|
||||
models.push(delRightSection);
|
||||
}
|
||||
_that.$emit('updateMapModel', models);
|
||||
_that.deviceSelect();
|
||||
}).catch((error) => {
|
||||
|
189
src/views/newMap/newMapdraft/mapoperate/section/logicBlock.vue
Normal file
189
src/views/newMap/newMapdraft/mapoperate/section/logicBlock.vue
Normal file
@ -0,0 +1,189 @@
|
||||
<template>
|
||||
<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-form ref="showDelimiter" label-width="130px" size="mini">
|
||||
<el-form-item label="是否显示分隔符" style="margin-top:30px;margin-left:30px;">
|
||||
<el-checkbox v-model="isDelimiter" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
<div class="button_box">
|
||||
<el-button-group class="map-draft-group">
|
||||
<el-button type="primary" size="small" @click="editSectionNum">{{ $t('map.updateObj') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { deepAssign } from '@/utils/index';
|
||||
import JTriangle from '@/jmapNew/utils/JTriangle';
|
||||
import { getUID } from '@/jmapNew/utils/Uid';
|
||||
import { mapGetters } from 'vuex';
|
||||
export default {
|
||||
name: 'LogicBlock',
|
||||
props: {
|
||||
selected: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
editModel:{
|
||||
type:Object,
|
||||
default() {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableData: [],
|
||||
isDelimiter:false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'sectionList'
|
||||
])
|
||||
},
|
||||
methods:{
|
||||
// 生成逻辑区段
|
||||
editSectionNum() {
|
||||
let models = [];
|
||||
let counts = 0;
|
||||
const logicSectionNumList = [];
|
||||
const sectionPoints = [...this.editModel.points]; // 获取区段点
|
||||
this.tableData.forEach((ele, index) => {
|
||||
models = [...models, ...this.createLogicalSections(Number(ele.num), sectionPoints[index], sectionPoints[index + 1], this.editModel, counts)];
|
||||
logicSectionNumList.push(Number(ele.num));
|
||||
counts += parseInt(ele.num);
|
||||
});
|
||||
this.sectionList.forEach(section => { // 删除之前的逻辑区段
|
||||
if (section.type === '02' && section.parentCode == this.editModel.code) {
|
||||
models.push(deepAssign(section, {_dispose: true}));
|
||||
}
|
||||
});
|
||||
|
||||
this.editModel.logicSectionNum = [...logicSectionNumList];
|
||||
models.push(this.editModel);
|
||||
this.$emit('updateMapModel', models);
|
||||
},
|
||||
handleDelete(index, row) {
|
||||
row.num = 0;
|
||||
},
|
||||
// 创建逻辑区段
|
||||
createLogicalSections(num, beg, end, model, counts) {
|
||||
const models = [];
|
||||
const triangle = new JTriangle(beg, end);
|
||||
const offset = Math.sqrt(triangle.abspowz) / num;
|
||||
const middleOffset = parseFloat((model.offsetRight - model.offsetLeft) / num);
|
||||
for (let i = 0; i < num; i++) {
|
||||
const points = [
|
||||
{ x: beg.x + triangle.getCos(offset * i), y: beg.y + triangle.getSin(offset * i) },
|
||||
{ x: beg.x + triangle.getCos(offset * (i + 1)), y: beg.y + triangle.getSin(offset * (i + 1)) }
|
||||
];
|
||||
models.push(this.addLogicalSection(model, points, counts + i, middleOffset));
|
||||
}
|
||||
return models;
|
||||
},
|
||||
// 逻辑区段模型
|
||||
addLogicalSection(model, points, index, middleOffset) {
|
||||
const data = {
|
||||
_type: 'Section',
|
||||
code: getUID('Section', this.sectionList),
|
||||
name: String.fromCharCode(index + 'A'.charCodeAt()),
|
||||
parentCode: model.code,
|
||||
axleShow: false,
|
||||
type: '02',
|
||||
namePosition: { x: 0, y: 0 },
|
||||
isStandTrack: false,
|
||||
standTrackName: model.standTrackName,
|
||||
standTrackNamePosition: {
|
||||
x: model.standTrackNamePosition.x,
|
||||
y: model.standTrackNamePosition.y
|
||||
},
|
||||
isReentryTrack: false,
|
||||
reentryTrackName: model.reentryTrackName,
|
||||
reentryTrackNamePosition: {
|
||||
x: model.reentryTrackNamePosition.x,
|
||||
y: model.reentryTrackNamePosition.y
|
||||
},
|
||||
isTransferTrack: false,
|
||||
transferTrackName: model.transferTrackName,
|
||||
transferTrackNamePosition: {
|
||||
x: model.transferTrackNamePosition.x,
|
||||
y: model.transferTrackNamePosition.y
|
||||
},
|
||||
isSegmentation: false,
|
||||
segmentationPosition: {
|
||||
x: model.segmentationPosition.x,
|
||||
y: model.segmentationPosition.y
|
||||
},
|
||||
logicSectionNameSort: model.logicSectionNameSort,
|
||||
isSwitchSection: model.isSwitchSection,
|
||||
relSwitchCode: model.relSwitchCode,
|
||||
logicSectionNum: [],
|
||||
logicSectionShow: model.logicSectionShow,
|
||||
stationCode: model.stationCode,
|
||||
offsetLeft: middleOffset * (index) + model.offsetLeft,
|
||||
offsetRight: middleOffset * (index + 1) + model.offsetLeft,
|
||||
sepTypeLeft: '00',
|
||||
sepTypeRight: '00',
|
||||
trainPosType: model.trainPosType,
|
||||
points: points,
|
||||
isCurve: false,
|
||||
lengthFact: 0,
|
||||
kmRangeRight: model.kmRangeRight,
|
||||
kmRangeLeft: model.kmRangeLeft,
|
||||
region: model.region,
|
||||
relevanceSectionList: []
|
||||
};
|
||||
if (this.isDelimiter) {
|
||||
data.sepTypeLeft = '01';
|
||||
data.sepTypeRight = '01';
|
||||
}
|
||||
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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user