desc: 修改绘制地图赋值

This commit is contained in:
zyy 2019-09-06 15:54:05 +08:00
parent 1faa4e0add
commit 7b0b0d6d0c
7 changed files with 293 additions and 185 deletions

View File

@ -3,9 +3,9 @@ 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.3.5:9000'; // 袁琪
BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.4:9000' // 琰培
} else {
BASE_API = process.env.VUE_APP_BASE_API;

View File

@ -226,6 +226,7 @@ export default {
this.mapSaveing = true;
this.$store.dispatch('map/saveMapDeviceDefaultRelations').then(() => {
// map.sectionList = [];
saveMap(Object.assign(map, { mapId: this.$route.params.mapId })).then(response => {
this.$message.success(this.$t('tip.saveSuccessfully'));
this.mapSaveing = false;

View File

@ -56,7 +56,6 @@ import { getUID } from '@/jmap/utils/Uid';
import { getUName } from '@/jmap/utils/Uname';
import ConfigList from './config/list';
import ConfigData from './config/data';
import { deepClone } from '@/utils/index';
export default {
name: 'LinkDraft',
@ -291,8 +290,24 @@ export default {
this.$refs.make.resetFields();
this.activeName = 'first';
if (selected && selected._type.toUpperCase() === 'Link'.toUpperCase()) {
const data = deepClone(selected);
Object.assign(this.editModel, data);
this.editModel.name = selected.name;
this.editModel.code = this.addModel.code = selected.code;
this.editModel.type = selected.type;
this.editModel.lengthShow = Math.sqrt(Math.pow(selected.rp.x - selected.lp.x, 2) + Math.pow(selected.rp.y - selected.lp.y, 2));
this.editModel.lengthFact = selected.lengthFact;
this.editModel.color = selected.color;
this.editModel.leftFdCode = selected.leftFdCode;
this.editModel.leftSdCode = selected.leftSdCode;
this.editModel.rightFdCode = selected.rightFdCode;
this.editModel.rightSdCode = selected.rightSdCode;
this.editModel.lp = {
x: selected.lp.x,
y: selected.lp.y
};
this.editModel.rp = {
x: selected.rp.x,
y: selected.rp.y
};
}
});
},

View File

@ -13,25 +13,16 @@
</div>
</el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.bothCreate')" name="second">
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: cardHeight +'px' }">
<el-form ref="make">
<el-form-item>
<el-transfer
v-model="linksCollection"
filterable
:filter-method="filterLinks"
:filter-placeholder="$t('rules.linkSelectName')"
:data="DatasCollection"
:titles="[$t('map.linkSet'), $t('map.selectLink')]"
/>
</el-form-item>
</el-form>
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: cardHeight + 60 +'px' }">
<div class="flex_box">
<el-button type="primary" @click="create">一键生成区段</el-button>
<el-card v-if="questionList.length" class="box-card">
<div v-for="(item, index) in questionList" :key="index" class="text item">
{{ item }}
</div>
</el-card>
</div>
</el-scrollbar>
<div class="button_box">
<el-button-group class="map-draft-group">
<el-button type="primary" size="small" @click="create">{{ $t('map.create') }}</el-button>
</el-button-group>
</div>
</el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.splitMerge')" name="three">
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: cardHeight+60+'px' }">
@ -145,7 +136,6 @@ import { mapGetters } from 'vuex';
import { getUID } from '@/jmap/utils/Uid';
import JTriangle from '@/jmap/utils/JTriangle';
import ConfigList from './config/list';
import { deepClone } from '@/utils/index';
export default {
name: 'SectionDraft',
@ -166,6 +156,7 @@ export default {
},
data() {
return {
questionList: [],
linksCollection: [],
activeName: 'first',
SectionTypeList: [],
@ -545,14 +536,78 @@ export default {
this.$refs.dataform.clearValidate();
this.activeName = 'first';
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
const data = deepClone(selected);
Object.assign(this.editModel, data);
this.editModel.logicSectionNum = selected.type === '01' ? selected.logicSectionNum : [0];
this.editModel.isSegmentation = selected.isSegmentation || false;
this.editModel.points = selected.points.slice();
this.editModel.code = selected.code;
this.editModel.name = selected.name;
this.editModel.type = selected.type;
this.editModel.namePosition = {
x: selected.namePosition.x,
y: selected.namePosition.y
};
this.editModel.nameShow = selected.nameShow;
this.editModel.axleShow = selected.axleShow;
this.editModel.relStandCode = selected.relStandCode;
this.editModel.leftStopPointOffset = selected.leftStopPointOffset;
this.editModel.rightStopPointOffset = selected.rightStopPointOffset;
this.editModel.destinationCode = selected.destinationCode;
if (selected.destinationCodePoint) {
this.editModel.destinationCodePoint = {
x: selected.destinationCodePoint.x,
y: selected.destinationCodePoint.y
};
}
this.editModel.kmRangeRight = selected.kmRangeRight;
this.editModel.kmRangeLeft = selected.kmRangeLeft;
this.editModel.region = selected.region;
this.editModel.destinationCodeShow = selected.destinationCodeShow;
this.editModel.logicSectionNum = selected.type === '01' ? selected.logicSectionNum : [0];
this.editModel.logicSectionShow = selected.logicSectionShow;
this.editModel.logicSectionNameShow = selected.logicSectionNameShow;
this.editModel.isStandTrack = selected.isStandTrack;
this.editModel.standTrackName = selected.standTrackName;
this.editModel.standTrackNamePosition = {
x: selected.standTrackNamePosition.x,
y: selected.standTrackNamePosition.y
};
this.editModel.isReentryTrack = selected.isReentryTrack;
this.editModel.reentryTrackName = selected.reentryTrackName;
this.editModel.reentryTrackNamePosition = {
x: selected.reentryTrackNamePosition.x,
y: selected.reentryTrackNamePosition.y
};
this.editModel.isTransferTrack = selected.isTransferTrack;
this.editModel.transferTrackName = selected.transferTrackName;
this.editModel.transferTrackNamePosition = {
x: selected.transferTrackNamePosition.x,
y: selected.transferTrackNamePosition.y
};
this.editModel.isSegmentation = selected.isSegmentation || false;
if (selected.segmentationPosition) {
this.editModel.segmentationPosition = {
x: selected.segmentationPosition.x,
y: selected.segmentationPosition.y
};
} else {
this.editModel.segmentationPosition = { x: 0, y: 0 };
}
this.editModel.logicSectionNameSort = selected.logicSectionNameSort;
this.editModel.isSwitchSection = selected.isSwitchSection;
this.editModel.relSwitchCode = selected.relSwitchCode;
this.editModel.linkCode = selected.linkCode;
this.editModel.sepTypeLeft = selected.sepTypeLeft;
this.editModel.offsetLeft = selected.offsetLeft;
this.editModel.sepTypeRight = selected.sepTypeRight;
this.editModel.offsetRight = selected.offsetRight;
this.editModel.stationCode = selected.stationCode;
this.editModel.trainPosType = selected.trainPosType;
this.editModel.parentCode = selected.parentCode;
this.editModel.points = selected.points.slice();
this.editModel.isCurve = selected.isCurve;
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);
if (this.field.toUpperCase() === 'splitSection'.toUpperCase()) {
this.addModel.code = selected.code;
@ -690,91 +745,97 @@ export default {
create() {
const models = [];
const remove = [];
this.linksCollection.forEach(elem => {
this.linkList.forEach(link => {
if (elem === link.code) {
const uid = getUID('Section');
const uname = 'Section_' + link.name.replace('Link_', '');
const model = {
_type: 'Section',
code: uid,
name: uname,
type: '01',
axleShow: false,
isStandTrack: false,
standTrackName: '',
standTrackNamePosition: { x: 0, y: 0 },
isReentryTrack: false,
reentryTrackName: '',
reentryTrackNamePosition: { x: 0, y: 0 },
isTransferTrack: false,
transferTrackName: '',
transferTrackNamePosition: { x: 0, y: 0 },
isSwitchSection: false, //
isSegmentation: false,
segmentationPosition: { x: 0, y: 0 },
relSwitchCode: '',
kmRangeRight: '',
kmRangeLeft: '',
region: '',
namePosition: { x: 0, y: 0 },
logicSectionNum: [0],
logicSectionShow: true,
logicSectionNameSort: true,
linkCode: link.code,
sepTypeLeft: '01', //
offsetLeft: 0,
sepTypeRight: '01',
trainPosType: '01',
offsetRight: link.lengthFact,
parentCode: '',
relStandCode: '',
rightStopPointOffset: 0,
leftStopPointOffset: 0,
destinationCode: '',
destinationCodePoint: { x: 0, y: 0 },
destinationCodeShow: false,
points: [
{ x: link.lp.x, y: link.lp.y },
{ x: link.rp.x, y: link.rp.y }
],
isCurve: false
};
//
if (!link.leftFdCode && !link.leftSdcode) {
model.sepTypeLeft = '03';
} else if (link.leftFdCode && link.leftSdCode) {
model.sepTypeLeft = '00';
} else if (link.leftFdCode) {
const node = this.findLinkData(link.leftFdCode);
if (node && node.rightFdCode && node.rightSdCode) {
model.sepTypeLeft = '00';
}
}
//
if (!link.rightFdCode && !link.rightSdCode) {
model.sepTypeRight = '03';
} else if (link.rightFdCode && link.rightSdCode) {
model.sepTypeRight = '00';
} else if (link.rightFdCode) {
const node = this.findLinkData(link.rightFdCode);
if (node && node.leftFdCode && node.leftSdCode) {
model.sepTypeRight = '00';
}
}
models.push(model);
const sectionList = this.findSectionListDataByLinkCode(link.code);
if (sectionList) {
sectionList.forEach(section => {
remove.push({ _type: 'Section', code: section.code });
if (section.type === '02' && section.parentCode === elem.code) {
remove.push(section);
}
});
}
this.linkList.forEach(link => {
let count = 0;
this.sectionList.forEach(setction => {
console.log(setction);
count++;
if (setction.linkCode == link.code) {
count = 0;
}
});
if (count == this.sectionList.length) {
const uid = getUID('Section');
const uname = 'Section_' + link.name.replace('Link_', '');
const model = {
_type: 'Section',
code: uid,
name: uname,
type: '01',
axleShow: false,
isStandTrack: false,
standTrackName: '',
standTrackNamePosition: { x: 0, y: 0 },
isReentryTrack: false,
reentryTrackName: '',
reentryTrackNamePosition: { x: 0, y: 0 },
isTransferTrack: false,
transferTrackName: '',
transferTrackNamePosition: { x: 0, y: 0 },
isSwitchSection: false, //
isSegmentation: false,
segmentationPosition: { x: 0, y: 0 },
relSwitchCode: '',
kmRangeRight: '',
kmRangeLeft: '',
region: '',
namePosition: { x: 0, y: 0 },
logicSectionNum: [0],
logicSectionShow: true,
logicSectionNameSort: true,
linkCode: link.code,
sepTypeLeft: '01', //
offsetLeft: 0,
sepTypeRight: '01',
trainPosType: '01',
offsetRight: link.lengthFact,
parentCode: '',
relStandCode: '',
rightStopPointOffset: 0,
leftStopPointOffset: 0,
destinationCode: '',
destinationCodePoint: { x: 0, y: 0 },
destinationCodeShow: false,
points: [
{ x: link.lp.x, y: link.lp.y },
{ x: link.rp.x, y: link.rp.y }
],
isCurve: false
};
//
if (!link.leftFdCode && !link.leftSdcode) {
model.sepTypeLeft = '03';
} else if (link.leftFdCode && link.leftSdCode) {
model.sepTypeLeft = '00';
} else if (link.leftFdCode) {
const node = this.findLinkData(link.leftFdCode);
if (node && node.rightFdCode && node.rightSdCode) {
model.sepTypeLeft = '00';
}
}
//
if (!link.rightFdCode && !link.rightSdCode) {
model.sepTypeRight = '03';
} else if (link.rightFdCode && link.rightSdCode) {
model.sepTypeRight = '00';
} else if (link.rightFdCode) {
const node = this.findLinkData(link.rightFdCode);
if (node && node.leftFdCode && node.leftSdCode) {
model.sepTypeRight = '00';
}
}
models.push(model);
const sectionList = this.findSectionListDataByLinkCode(link.code);
if (sectionList) {
sectionList.forEach(section => {
remove.push({ _type: 'Section', code: section.code });
if (section.type === '02' && section.parentCode) {
remove.push(section);
}
});
}
}
});
const _that = this;
@ -792,78 +853,82 @@ export default {
});
});
},
buildEditModel() {
const pointArr = JSON.stringify(this.editModel.points);
const model = {
_type: 'Section',
code: this.editModel.code,
name: this.editModel.name,
type: this.editModel.type,
relStandCode: this.editModel.relStandCode,
leftStopPointOffset: Number(this.editModel.leftStopPointOffset),
rightStopPointOffset: Number(this.editModel.rightStopPointOffset),
axleShow: this.editModel.axleShow,
namePosition: {
x: this.editModel.namePosition.x,
y: this.editModel.namePosition.y
},
kmRangeRight: this.editModel.kmRangeRight,
kmRangeLeft: this.editModel.kmRangeLeft,
region: this.editModel.region,
isStandTrack: this.editModel.isStandTrack,
standTrackName: this.editModel.standTrackName,
standTrackNamePosition: {
x: this.editModel.standTrackNamePosition.x,
y: this.editModel.standTrackNamePosition.y
},
isReentryTrack: this.editModel.isReentryTrack,
reentryTrackName: this.editModel.reentryTrackName,
reentryTrackNamePosition: {
x: this.editModel.reentryTrackNamePosition.x,
y: this.editModel.reentryTrackNamePosition.y
},
isSegmentation: this.editModel.isSegmentation,
segmentationPosition: {
x: this.editModel.segmentationPosition.x,
y: this.editModel.segmentationPosition.y
},
isTransferTrack: this.editModel.isTransferTrack,
transferTrackName: this.editModel.transferTrackName,
transferTrackNamePosition: {
x: this.editModel.transferTrackNamePosition.x,
y: this.editModel.transferTrackNamePosition.y
},
logicSectionNameSort: this.editModel.logicSectionNameSort,
isSwitchSection: this.editModel.isSwitchSection,
relSwitchCode: this.editModel.relSwitchCode,
points: JSON.parse(pointArr),
logicSectionNum: this.editModel.logicSectionNum,
logicSectionShow: this.editModel.logicSectionShow,
sepTypeLeft: this.editModel.sepTypeLeft,
offsetLeft: this.editModel.offsetLeft,
sepTypeRight: this.editModel.sepTypeRight,
offsetRight: this.editModel.offsetRight,
stationCode: this.editModel.stationCode,
trainPosType: this.editModel.trainPosType,
linkCode: this.editModel.linkCode,
isCurve: this.editModel.isCurve,
destinationCodeShow: false
};
if (model.isReentryTrack || this.editModel.isTransferTrack) {
model.destinationCode = this.editModel.destinationCode;
model.destinationCodePoint = {
x: this.editModel.destinationCodePoint.x,
y: this.editModel.destinationCodePoint.y
};
model.destinationCodeShow = this.editModel.destinationCodeShow;
}
return model;
},
// buildEditModel() {
// const pointArr = JSON.stringify(this.editModel.points);
// const model = {
// _type: 'Section',
// code: this.editModel.code,
// name: this.editModel.name,
// type: this.editModel.type,
// relStandCode: this.editModel.relStandCode,
// leftStopPointOffset: Number(this.editModel.leftStopPointOffset),
// rightStopPointOffset: Number(this.editModel.rightStopPointOffset),
// axleShow: this.editModel.axleShow,
// namePosition: {
// x: this.editModel.namePosition.x,
// y: this.editModel.namePosition.y
// },
// kmRangeRight: this.editModel.kmRangeRight,
// kmRangeLeft: this.editModel.kmRangeLeft,
// region: this.editModel.region,
// isStandTrack: this.editModel.isStandTrack,
// standTrackName: this.editModel.standTrackName,
// standTrackNamePosition: {
// x: this.editModel.standTrackNamePosition.x,
// y: this.editModel.standTrackNamePosition.y
// },
// isReentryTrack: this.editModel.isReentryTrack, //
// reentryTrackName: this.editModel.reentryTrackName,
// reentryTrackNamePosition: {
// x: this.editModel.reentryTrackNamePosition.x,
// y: this.editModel.reentryTrackNamePosition.y
// },
// isSegmentation: this.editModel.isSegmentation,
// segmentationPosition: {
// x: this.editModel.segmentationPosition.x,
// y: this.editModel.segmentationPosition.y
// },
// isTransferTrack: this.editModel.isTransferTrack, //
// transferTrackName: this.editModel.transferTrackName,
// transferTrackNamePosition: {
// x: this.editModel.transferTrackNamePosition.x,
// y: this.editModel.transferTrackNamePosition.y
// },
// logicSectionNameSort: this.editModel.logicSectionNameSort,
// isSwitchSection: this.editModel.isSwitchSection,
// relSwitchCode: this.editModel.relSwitchCode,
// points: JSON.parse(pointArr),
// logicSectionNum: this.editModel.logicSectionNum,
// logicSectionShow: this.editModel.logicSectionShow,
// sepTypeLeft: this.editModel.sepTypeLeft,
// offsetLeft: this.editModel.offsetLeft,
// sepTypeRight: this.editModel.sepTypeRight,
// offsetRight: this.editModel.offsetRight,
// stationCode: this.editModel.stationCode,
// trainPosType: this.editModel.trainPosType,
// linkCode: this.editModel.linkCode,
// isCurve: this.editModel.isCurve,
// destinationCodeShow: false
// };
// if (model.isReentryTrack || this.editModel.isTransferTrack) {
// model.destinationCode = this.editModel.destinationCode; //
// model.destinationCodePoint = { //
// x: this.editModel.destinationCodePoint.x,
// y: this.editModel.destinationCodePoint.y
// };
// model.destinationCodeShow = this.editModel.destinationCodeShow;
// }
// return model;
// },
edit() {
this.$refs['dataform'].validate((valid) => {
if (valid) {
const edits = [];
const model = this.buildEditModel();
const model = Object.assign({_type: 'Section'}, this.editModel);
model.points = JSON.stringify(model.points);
model.leftStopPointOffset = Number(model.leftStopPointOffset);
model.rightStopPointOffset = Number(model.rightStopPointOffset);
// const model = this.buildEditModel();
this.sectionList.forEach(section => {
if (section.parentCode == model.code) {
section.logicSectionShow = model.logicSectionShow;
@ -1271,6 +1336,11 @@ export default {
overflow-y: auto;
}
.flex_box{
display: flex;
justify-content: center;
}
/deep/ {
.card .el-transfer-panel__filter{
margin: 5px 15px;

View File

@ -70,7 +70,6 @@ import { mapGetters } from 'vuex';
import { getUID } from '@/jmap/utils/Uid';
import JTriangle from '@/jmap/utils/JTriangle';
import ConfigList from './config/list';
import { deepClone } from '@/utils/index';
export default {
name: 'SignalDraft',
@ -292,9 +291,34 @@ export default {
this.$refs.make.resetFields();
this.activeName = 'first';
if (selected && selected._type.toUpperCase() === 'Signal'.toUpperCase()) {
const data = deepClone(selected);
Object.assign(this.editModel, data);
this.editModel.code = selected.code;
this.editModel.name = selected.name;
this.editModel.uniqueName = selected.uniqueName;
this.editModel.nameShow = selected.nameShow;
this.editModel.lampPostType = selected.lampPostType;
this.editModel.lampPositionType = selected.lampPositionType;
this.editModel.potLampType = selected.potLampType || '01';
this.editModel.directionType = selected.directionType;
this.editModel.positionType = selected.positionType;
this.editModel.useType = selected.useType;
this.editModel.stationCode = selected.stationCode;
this.editModel.linkCode = selected.linkCode;
this.editModel.offset = selected.offset;
this.editModel.rotate = selected.rotate || 0; //
this.editModel.guideShow = selected.guideShow;
this.editModel.buttonShow = selected.buttonShow;
if (selected.position) {
this.editModel.position = { x: selected.position.x, y: selected.position.y };
}
if (selected.namePosition) {
this.editModel.namePosition = { x: selected.namePosition.x, y: selected.namePosition.y };
}
if (selected.buttonPosition) {
this.editModel.buttonPosition = { x: selected.buttonPosition.x, y: selected.buttonPosition.y };
}
if (selected.guidePosition) {
this.editModel.guidePosition = { x: selected.guidePosition.x, y: selected.guidePosition.y };
}
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
//
if (selected.type === '02') {

View File

@ -187,7 +187,6 @@ export default {
this.$refs.make.resetFields();
this.activeName = 'first';
if (selected && selected._type.toUpperCase() === 'Station'.toUpperCase()) {
// Object.assign(this.editModel, selected);
this.editModel.runPlanName = selected.runPlanName || '';
this.editModel.centralized = selected.centralized;
this.editModel.concentrateStationCode = selected.concentrateStationCode;

View File

@ -179,7 +179,6 @@ export default {
this.$refs.make.resetFields();
this.activeName = 'first';
if (selected && selected._type.toUpperCase() === 'StationControl'.toUpperCase()) {
// Object.assign(this.editModel, selected);
this.editModel.name = selected.name;
this.editModel.code = selected.code;
this.editModel.zokContent = selected.zokContent;