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; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // 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.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' // 琰培 // BASE_API = 'http://192.168.3.4:9000' // 琰培
} else { } else {
BASE_API = process.env.VUE_APP_BASE_API; BASE_API = process.env.VUE_APP_BASE_API;

View File

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

View File

@ -56,7 +56,6 @@ import { getUID } from '@/jmap/utils/Uid';
import { getUName } from '@/jmap/utils/Uname'; import { getUName } from '@/jmap/utils/Uname';
import ConfigList from './config/list'; import ConfigList from './config/list';
import ConfigData from './config/data'; import ConfigData from './config/data';
import { deepClone } from '@/utils/index';
export default { export default {
name: 'LinkDraft', name: 'LinkDraft',
@ -291,8 +290,24 @@ export default {
this.$refs.make.resetFields(); this.$refs.make.resetFields();
this.activeName = 'first'; this.activeName = 'first';
if (selected && selected._type.toUpperCase() === 'Link'.toUpperCase()) { if (selected && selected._type.toUpperCase() === 'Link'.toUpperCase()) {
const data = deepClone(selected); this.editModel.name = selected.name;
Object.assign(this.editModel, data); 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> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.bothCreate')" name="second"> <el-tab-pane class="view-control" :label="$t('map.bothCreate')" name="second">
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: cardHeight +'px' }"> <el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: cardHeight + 60 +'px' }">
<el-form ref="make"> <div class="flex_box">
<el-form-item> <el-button type="primary" @click="create">一键生成区段</el-button>
<el-transfer <el-card v-if="questionList.length" class="box-card">
v-model="linksCollection" <div v-for="(item, index) in questionList" :key="index" class="text item">
filterable {{ item }}
:filter-method="filterLinks"
:filter-placeholder="$t('rules.linkSelectName')"
:data="DatasCollection"
:titles="[$t('map.linkSet'), $t('map.selectLink')]"
/>
</el-form-item>
</el-form>
</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> </div>
</el-card>
</div>
</el-scrollbar>
</el-tab-pane> </el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.splitMerge')" name="three"> <el-tab-pane class="view-control" :label="$t('map.splitMerge')" name="three">
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: cardHeight+60+'px' }"> <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 { getUID } from '@/jmap/utils/Uid';
import JTriangle from '@/jmap/utils/JTriangle'; import JTriangle from '@/jmap/utils/JTriangle';
import ConfigList from './config/list'; import ConfigList from './config/list';
import { deepClone } from '@/utils/index';
export default { export default {
name: 'SectionDraft', name: 'SectionDraft',
@ -166,6 +156,7 @@ export default {
}, },
data() { data() {
return { return {
questionList: [],
linksCollection: [], linksCollection: [],
activeName: 'first', activeName: 'first',
SectionTypeList: [], SectionTypeList: [],
@ -545,14 +536,78 @@ export default {
this.$refs.dataform.clearValidate(); this.$refs.dataform.clearValidate();
this.activeName = 'first'; this.activeName = 'first';
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) { if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
const data = deepClone(selected); this.editModel.code = selected.code;
Object.assign(this.editModel, data); this.editModel.name = selected.name;
this.editModel.logicSectionNum = selected.type === '01' ? selected.logicSectionNum : [0]; this.editModel.type = selected.type;
this.editModel.isSegmentation = selected.isSegmentation || false; this.editModel.namePosition = {
this.editModel.points = selected.points.slice(); 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.splitOffsetMax = Math.sqrt(new JTriangle(selected.points[0], selected.points[selected.points.length - 1]).abspowz);
this.addModel.splitOffset = this.addModel.splitOffsetMax / 2; this.addModel.splitOffset = this.addModel.splitOffsetMax / 2;
this.computedLogicSectionNumList(this.editModel.logicSectionNum); this.computedLogicSectionNumList(this.editModel.logicSectionNum);
if (this.field.toUpperCase() === 'splitSection'.toUpperCase()) { if (this.field.toUpperCase() === 'splitSection'.toUpperCase()) {
this.addModel.code = selected.code; this.addModel.code = selected.code;
@ -690,9 +745,16 @@ export default {
create() { create() {
const models = []; const models = [];
const remove = []; const remove = [];
this.linksCollection.forEach(elem => {
this.linkList.forEach(link => { this.linkList.forEach(link => {
if (elem === link.code) { 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 uid = getUID('Section');
const uname = 'Section_' + link.name.replace('Link_', ''); const uname = 'Section_' + link.name.replace('Link_', '');
const model = { const model = {
@ -768,14 +830,13 @@ export default {
if (sectionList) { if (sectionList) {
sectionList.forEach(section => { sectionList.forEach(section => {
remove.push({ _type: 'Section', code: section.code }); remove.push({ _type: 'Section', code: section.code });
if (section.type === '02' && section.parentCode === elem.code) { if (section.type === '02' && section.parentCode) {
remove.push(section); remove.push(section);
} }
}); });
} }
} }
}); });
});
const _that = this; const _that = this;
this.$confirm(this.$t('tip.confirmBatchGeneration'), this.$t('tip.hint'), { this.$confirm(this.$t('tip.confirmBatchGeneration'), this.$t('tip.hint'), {
@ -792,78 +853,82 @@ export default {
}); });
}); });
}, },
buildEditModel() { // buildEditModel() {
const pointArr = JSON.stringify(this.editModel.points); // const pointArr = JSON.stringify(this.editModel.points);
const model = { // const model = {
_type: 'Section', // _type: 'Section',
code: this.editModel.code, // code: this.editModel.code,
name: this.editModel.name, // name: this.editModel.name,
type: this.editModel.type, // type: this.editModel.type,
relStandCode: this.editModel.relStandCode, // relStandCode: this.editModel.relStandCode,
leftStopPointOffset: Number(this.editModel.leftStopPointOffset), // leftStopPointOffset: Number(this.editModel.leftStopPointOffset),
rightStopPointOffset: Number(this.editModel.rightStopPointOffset), // rightStopPointOffset: Number(this.editModel.rightStopPointOffset),
axleShow: this.editModel.axleShow, // axleShow: this.editModel.axleShow,
namePosition: { // namePosition: {
x: this.editModel.namePosition.x, // x: this.editModel.namePosition.x,
y: this.editModel.namePosition.y // y: this.editModel.namePosition.y
}, // },
kmRangeRight: this.editModel.kmRangeRight, // kmRangeRight: this.editModel.kmRangeRight,
kmRangeLeft: this.editModel.kmRangeLeft, // kmRangeLeft: this.editModel.kmRangeLeft,
region: this.editModel.region, // region: this.editModel.region,
isStandTrack: this.editModel.isStandTrack, // isStandTrack: this.editModel.isStandTrack,
standTrackName: this.editModel.standTrackName, // standTrackName: this.editModel.standTrackName,
standTrackNamePosition: { // standTrackNamePosition: {
x: this.editModel.standTrackNamePosition.x, // x: this.editModel.standTrackNamePosition.x,
y: this.editModel.standTrackNamePosition.y // y: this.editModel.standTrackNamePosition.y
}, // },
isReentryTrack: this.editModel.isReentryTrack, // isReentryTrack: this.editModel.isReentryTrack, //
reentryTrackName: this.editModel.reentryTrackName, // reentryTrackName: this.editModel.reentryTrackName,
reentryTrackNamePosition: { // reentryTrackNamePosition: {
x: this.editModel.reentryTrackNamePosition.x, // x: this.editModel.reentryTrackNamePosition.x,
y: this.editModel.reentryTrackNamePosition.y // y: this.editModel.reentryTrackNamePosition.y
}, // },
isSegmentation: this.editModel.isSegmentation, // isSegmentation: this.editModel.isSegmentation,
segmentationPosition: { // segmentationPosition: {
x: this.editModel.segmentationPosition.x, // x: this.editModel.segmentationPosition.x,
y: this.editModel.segmentationPosition.y // y: this.editModel.segmentationPosition.y
}, // },
isTransferTrack: this.editModel.isTransferTrack, // isTransferTrack: this.editModel.isTransferTrack, //
transferTrackName: this.editModel.transferTrackName, // transferTrackName: this.editModel.transferTrackName,
transferTrackNamePosition: { // transferTrackNamePosition: {
x: this.editModel.transferTrackNamePosition.x, // x: this.editModel.transferTrackNamePosition.x,
y: this.editModel.transferTrackNamePosition.y // y: this.editModel.transferTrackNamePosition.y
}, // },
logicSectionNameSort: this.editModel.logicSectionNameSort, // logicSectionNameSort: this.editModel.logicSectionNameSort,
isSwitchSection: this.editModel.isSwitchSection, // isSwitchSection: this.editModel.isSwitchSection,
relSwitchCode: this.editModel.relSwitchCode, // relSwitchCode: this.editModel.relSwitchCode,
points: JSON.parse(pointArr), // points: JSON.parse(pointArr),
logicSectionNum: this.editModel.logicSectionNum, // logicSectionNum: this.editModel.logicSectionNum,
logicSectionShow: this.editModel.logicSectionShow, // logicSectionShow: this.editModel.logicSectionShow,
sepTypeLeft: this.editModel.sepTypeLeft, // sepTypeLeft: this.editModel.sepTypeLeft,
offsetLeft: this.editModel.offsetLeft, // offsetLeft: this.editModel.offsetLeft,
sepTypeRight: this.editModel.sepTypeRight, // sepTypeRight: this.editModel.sepTypeRight,
offsetRight: this.editModel.offsetRight, // offsetRight: this.editModel.offsetRight,
stationCode: this.editModel.stationCode, // stationCode: this.editModel.stationCode,
trainPosType: this.editModel.trainPosType, // trainPosType: this.editModel.trainPosType,
linkCode: this.editModel.linkCode, // linkCode: this.editModel.linkCode,
isCurve: this.editModel.isCurve, // isCurve: this.editModel.isCurve,
destinationCodeShow: false // destinationCodeShow: false
}; // };
if (model.isReentryTrack || this.editModel.isTransferTrack) { // if (model.isReentryTrack || this.editModel.isTransferTrack) {
model.destinationCode = this.editModel.destinationCode; // model.destinationCode = this.editModel.destinationCode; //
model.destinationCodePoint = { // model.destinationCodePoint = { //
x: this.editModel.destinationCodePoint.x, // x: this.editModel.destinationCodePoint.x,
y: this.editModel.destinationCodePoint.y // y: this.editModel.destinationCodePoint.y
}; // };
model.destinationCodeShow = this.editModel.destinationCodeShow; // model.destinationCodeShow = this.editModel.destinationCodeShow;
} // }
return model; // return model;
}, // },
edit() { edit() {
this.$refs['dataform'].validate((valid) => { this.$refs['dataform'].validate((valid) => {
if (valid) { if (valid) {
const edits = []; 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 => { this.sectionList.forEach(section => {
if (section.parentCode == model.code) { if (section.parentCode == model.code) {
section.logicSectionShow = model.logicSectionShow; section.logicSectionShow = model.logicSectionShow;
@ -1271,6 +1336,11 @@ export default {
overflow-y: auto; overflow-y: auto;
} }
.flex_box{
display: flex;
justify-content: center;
}
/deep/ { /deep/ {
.card .el-transfer-panel__filter{ .card .el-transfer-panel__filter{
margin: 5px 15px; margin: 5px 15px;

View File

@ -70,7 +70,6 @@ import { mapGetters } from 'vuex';
import { getUID } from '@/jmap/utils/Uid'; import { getUID } from '@/jmap/utils/Uid';
import JTriangle from '@/jmap/utils/JTriangle'; import JTriangle from '@/jmap/utils/JTriangle';
import ConfigList from './config/list'; import ConfigList from './config/list';
import { deepClone } from '@/utils/index';
export default { export default {
name: 'SignalDraft', name: 'SignalDraft',
@ -292,9 +291,34 @@ export default {
this.$refs.make.resetFields(); this.$refs.make.resetFields();
this.activeName = 'first'; this.activeName = 'first';
if (selected && selected._type.toUpperCase() === 'Signal'.toUpperCase()) { if (selected && selected._type.toUpperCase() === 'Signal'.toUpperCase()) {
const data = deepClone(selected); this.editModel.code = selected.code;
Object.assign(this.editModel, data); 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.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()) { } else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
// //
if (selected.type === '02') { if (selected.type === '02') {

View File

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

View File

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