调整地图绘图数据模型

This commit is contained in:
zyy 2020-07-01 18:08:42 +08:00
parent 07bca42db2
commit 64d415dbb3
16 changed files with 197 additions and 421 deletions

View File

@ -345,7 +345,7 @@ export default {
} else if (deviceList.length === 2) { } else if (deviceList.length === 2) {
let flag = false; let flag = false;
this.routeListFilter.forEach(item => { this.routeListFilter.forEach(item => {
if (item.endSignalCode === deviceList[1].code) { if (item.endButtonSignalCode === deviceList[1].code) { //
operate.over = true; operate.over = true;
operate.cmdType = CMD.Signal.CMD_SIGNAL_SET_ROUTE; operate.cmdType = CMD.Signal.CMD_SIGNAL_SET_ROUTE;
operate.code = deviceList[1].code; operate.code = deviceList[1].code;

View File

@ -2,11 +2,11 @@ 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.41:9000'; // 张赛 // BASE_API = 'http://192.168.3.41:9000'; // 张赛
BASE_API = 'http://192.168.3.82:9000'; // 杜康 // BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛 // BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛

View File

@ -5,9 +5,10 @@ class Model {
this[`${type}Model`](); this[`${type}Model`]();
} }
SectionModel() { SectionModel() {
this._type = 'Section';
this.code = ''; this.code = '';
this.name = ''; this.name = '';
this.type = ''; this.type = '01';
this.relStandCode = ''; // 关联站台编码 this.relStandCode = ''; // 关联站台编码
this.leftStopPointOffset = 0; // 左向停车点偏移量 this.leftStopPointOffset = 0; // 左向停车点偏移量
this.rightStopPointOffset = 0; // 右向停车点偏移量 this.rightStopPointOffset = 0; // 右向停车点偏移量
@ -33,9 +34,8 @@ class Model {
this.relSwitchCode = ''; this.relSwitchCode = '';
this.stationCode = ''; this.stationCode = '';
this.logicSectionNameSort = true; this.logicSectionNameSort = true;
this.sepTypeLeft = ''; this.sepTypeLeft = '00';
this.sepTypeRight = ''; this.sepTypeRight = '00';
this.offsetRight = 0;
this.parentCode = ''; this.parentCode = '';
this.points = []; this.points = [];
this.lengthFact = 0; this.lengthFact = 0;
@ -54,6 +54,110 @@ class Model {
this.rightAxleOffset = { x: 0, y: 0 }; this.rightAxleOffset = { x: 0, y: 0 };
this.leftAxleOffset = { x: 0, y: 0 }; this.leftAxleOffset = { x: 0, y: 0 };
} }
SignalModel() {
this._type = 'Signal';
this.code = '';
this.name = '';
this.type = 'PROTECTION';
this.uniqueName = '';
this.nameShow = false;
this.lampPostType = '01'; // 灯柱类型
this.lampPositionType = '01';
this.leftOrRight = 'L';
this.right = false;
this.virtual = false; // 是否虚拟信号机
this.positionType = '01';
this.namePosition = { x: 0, y: 0 };
this.stationCode = '';
this.sectionOffset = 0;
this.rotate = 0;
this.nameRotated = false;
this.sectionCode = '';
this.guideShow = false;
this.buttonShow = false;
this.position = { x: 0, y: 0 };
this.positionPoint = { x: 0, y: 0 };
this.buttonPosition = { x: 0, y: 0 };
this.guidePosition = { x: 0, y: 0 };
this.interlockStationCode = '';
this.callOn = true;
this.turnBack = false;
this.ctc = true; // 是否灭灯显示
this.noOverlap = false; // 是否无延续保护
}
SwitchModel() {
this._type = 'Switch';
this.code = '';
this.name = '';
this.turnTime = 0;
this.nameShow = false;
this.namePosition = { x: 0, y: 0 };
this.stationCode = '';
this.timeoutShow = false;
this.sectionACode = '';
this.sectionBCode = '';
this.sectionCCode = '';
this.tp = { x: 0, y: 0 };
}
StationModel() {
this._type = 'Station';
this.centralized = false;
this.ciStation = false; // 是否联锁站
this.depot = false; // 是否停车场或者车辆段
this.reentry = false; // 是否折返车站
this.smallRouting = false; // 是否小交路
this.number = ''; // 编号
this.code = '';
this.zcCode = '';
this.visible = true;
this.runPlanName = '';
this.name = '';
this.nameFont = '22';
this.nameFontColor = '#FFFFFF';
this.subheadDisplay = false;
this.subhead = ''; // 副标题
this.subheadFont = '';
this.subheadFontColor = '#FFFFFF';
this.subheadPosition = { x: 0, y: 0 };
this.kmPostShow = true;
this.kmRange = 0;
this.kmPost = '1000km~2000km';
this.kmPostFont = '8';
this.kmPostFontColor = '#FFFFFF';
this.isShowControlMode = '';
this.chargeStationCodeList = [];
this.relStationCodeList = []; // 联锁站关联车站列表
this.position = { x: 0, y: 0 };
this.kilometerPosition = { x: 0, y: 0 }; // 公里标偏移坐标
this.createControlMode = false;
this.createTurnBack = false;
this.turnBackPoint = {x: 0, y: 0}; // 按图折返坐标
this.controlModePoint = { x: 0, y: 0 }; // 控制模式坐标
}
StationStandModel() {
this._type = 'StationStand';
this.code = '';
this.name = '';
this.deviceStationCode = ''; // 设备集中站
this.width = 0;
this.height = 0;
this.stationCode = ''; // 所属车站
this.position = { x: 0, y: 0 };
this.visible = true; // 是否显示
this.inside = false; // 内外站台显示
this.right = true;
this.standTrackCode = ''; // 关联站台轨
this.small = false;
this.defaultReentryStrategy = ''; // 默认折返策略
this.stopJumpLamp = false; // 跳停功能按钮
this.stopJumpLampPoint = {x: 0, y: 0}; // 跳停功能按钮坐标
this.cancelStopJumpLamp = false; // 取消跳停功能按钮
this.cancelStopJumpLampPoint = {x: 0, y: 0}; // 取消跳停功能按钮坐标
this.upDetainLamp = false; // 上行扣车功能按钮
this.upDetainLampPoint = {x: 0, y: 0}; // 上行扣车功能按钮坐标
this.downDetainLamp = false; // 下行扣车功能按钮
this.downDetainLampPoint = {x: 0, y: 0}; // 下行扣车功能按钮坐标
}
} }
export default function getModel(type) { export default function getModel(type) {

View File

@ -99,6 +99,8 @@
<script> <script>
import { getUID } from '@/jmapNew/utils/Uid'; import { getUID } from '@/jmapNew/utils/Uid';
import { deepAssign } from '@/utils/index'; import { deepAssign } from '@/utils/index';
import getModel from '../models.js';
export default { export default {
name: 'Create', name: 'Create',
props: { props: {
@ -183,54 +185,18 @@ export default {
} }
}, },
createModelParam(uid, name) { createModelParam(uid, name) {
return { const model = getModel('Section');
_type: 'Section', const data = {
code: uid, code: uid,
name: name, name: name,
type: '01', type: '01',
standTrack: false,
standTrackName: '',
standTrackNamePosition: { x: 0, y: 0 },
reentryTrack: false,
reentryTrackName: '',
reentryTrackNamePosition: { x: 0, y: 0 },
transferTrack: false,
transferTrackName: '',
transferTrackNamePosition: { x: 0, y: 0 },
switchSection: false, //
segmentationPosition: { x: 0, y: 0 },
relSwitchCode: '',
rightSectionCode: '',
leftSectionCode: '',
kmRangeRight: '',
kmRangeLeft: '',
region: '',
namePosition: { x: 0, y: 0 },
logicSectionCodeList: [],
logicSectionShow: true, logicSectionShow: true,
logicSectionNameSort: true, logicSectionNameSort: true,
sepTypeLeft: '01', // sepTypeLeft: '01', //
sepTypeRight: '01', sepTypeRight: '01',
lengthFact: 0, nameShow: true
parentCode: '',
relStandCode: '',
rightStopPointOffset: 0,
leftStopPointOffset: 0,
destinationCode: '',
trainWindowCode: '',
destinationCodePoint: { x: 0, y: 0 },
curve: false,
nameShow: true,
relevanceSectionList: [],
points: [],
leftAxlePosition: 0,
rightAxlePosition: 0,
roadType: null,
firstTurnBack: false,
belongStation: '',
rightAxleOffset: {x:0, y:0},
leftAxleOffset: {x:0, y:0}
}; };
return Object.assign(model, data);
}, },
// //
batchCreate() { batchCreate() {

View File

@ -62,7 +62,7 @@ import TipInfo from './tipInfo';
import CreateSection from './create'; import CreateSection from './create';
import SplitOrMerge from './splitOrMerge'; import SplitOrMerge from './splitOrMerge';
import BatchSettings from './batchSettings'; import BatchSettings from './batchSettings';
import getModel from '@/views/newMap/newMapdraft/mapoperate/models.js'; import getModel from '../models.js';
export default { export default {
name: 'SectionDraft', name: 'SectionDraft',
@ -455,7 +455,6 @@ export default {
this.clear(); this.clear();
this.activeName = 'first'; this.activeName = 'first';
this.editModel = deepAssign(this.editModel, selected); this.editModel = deepAssign(this.editModel, selected);
console.log(this.editModel, this.editModel.parentCode, '========', selected.parentCode, selected);
this.oldPoint = selected.points; this.oldPoint = selected.points;
this.oldLeftSectionCode = selected.leftSectionCode; this.oldLeftSectionCode = selected.leftSectionCode;
this.oldRightSectionCode = selected.rightSectionCode; this.oldRightSectionCode = selected.rightSectionCode;

View File

@ -71,6 +71,7 @@
import { getUID } from '@/jmapNew/utils/Uid'; import { getUID } from '@/jmapNew/utils/Uid';
import { deepAssign } from '@/utils/index'; import { deepAssign } from '@/utils/index';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
import getModel from '../models.js';
export default { export default {
name: 'SplitOrMerge', name: 'SplitOrMerge',
@ -163,56 +164,28 @@ export default {
const modelY = (selected.points[selected.points.length - 1].y - selected.points[0].y) / this.addModel.splitNumber; // y const modelY = (selected.points[selected.points.length - 1].y - selected.points[0].y) / this.addModel.splitNumber; // y
for (let index = 1; index <= this.addModel.splitNumber; index++) { for (let index = 1; index <= this.addModel.splitNumber; index++) {
const uid = getUID('T', [...this.sectionList, ...models]); const uid = getUID('T', [...this.sectionList, ...models]);
const model = { const sectionModel = getModel('Section');
_type: 'Section', const data = {
code: uid, code: uid,
name: `${selected.name}_${index}`, name: `${selected.name}_${index}`,
type: '01', type: '01',
parentCode: '',
standTrack: false,
kmRangeRight: '',
kmRangeLeft: '',
region: '',
standTrackName: '',
standTrackNamePosition: { x: 0, y: 0 },
reentryTrack: false,
reentryTrackName: '',
reentryTrackNamePosition: { x: 0, y: 0 },
transferTrack: false,
transferTrackName: '',
transferTrackNamePosition: { x: 0, y: 0 },
switchSection: false,
segmentationPosition: { x: 0, y: 0 },
relSwitchCode: '',
trainWindowCode: '',
logicSectionNameSort: selected.logicSectionNameSort, logicSectionNameSort: selected.logicSectionNameSort,
logicSectionShow: selected.logicSectionShow, logicSectionShow: selected.logicSectionShow,
sepTypeLeft: index == 0 ? selected.sepTypeLeft : '01', // ( 01) sepTypeLeft: index == 0 ? selected.sepTypeLeft : '01', // ( 01)
sepTypeRight: index == this.addModel.splitNumber ? selected.sepTypeRight : '01', // ( 01) sepTypeRight: index == this.addModel.splitNumber ? selected.sepTypeRight : '01', // ( 01)
offsetRight: selected.offsetRight,
curve: selected.curve, curve: selected.curve,
nameShow: true, nameShow: true,
lengthFact: 0, points: [{
points: [
{
x: selected.points[0].x + ((index - 1) * modelX), x: selected.points[0].x + ((index - 1) * modelX),
y: selected.points[0].y + ((index - 1) * modelY) y: selected.points[0].y + ((index - 1) * modelY)
}, },
{ {
x: selected.points[0].x + (index * modelX), x: selected.points[0].x + (index * modelX),
y: selected.points[0].y + (index * modelY) y: selected.points[0].y + (index * modelY)
} }],
], roadType: selected.roadType
namePosition: { x: 0, y: 0 },
relevanceSectionList: [],
roadType: selected.roadType,
firstTurnBack: false,
belongStation: '',
rightAxleOffset: {x:0, y:0},
leftAxleOffset: {x:0, y:0},
leftAxlePosition: 0,
rightAxlePosition: 0
}; };
const model = Object.assign(sectionModel, data);
models.push(model); models.push(model);
} }
const leftAssociatedSection = selected.leftSectionCode ? deepAssign({}, this.$store.getters['map/getDeviceByCode'](selected.leftSectionCode) || {}) : {}; const leftAssociatedSection = selected.leftSectionCode ? deepAssign({}, this.$store.getters['map/getDeviceByCode'](selected.leftSectionCode) || {}) : {};
@ -263,39 +236,13 @@ export default {
if (rsection && lsection) { if (rsection && lsection) {
const uid = getUID('T', this.sectionList); const uid = getUID('T', this.sectionList);
const model = { const sectionModel = getModel('Section');
_type: 'Section', const data = {
code: uid, code: uid,
parentCode: '',
name: lsection.name, name: lsection.name,
type: '01', type: '01'
standTrack: false,
standTrackName: '',
standTrackNamePosition: { x: 0, y: 0 },
segmentationPosition: { x: 0, y: 0 },
reentryTrack: false,
reentryTrackName: '',
reentryTrackNamePosition: { x: 0, y: 0 },
transferTrack: false,
transferTrackName: '',
transferTrackNamePosition: { x: 0, y: 0 },
switchSection: false,
relSwitchCode: '',
curve: false,
nameShow: true,
kmRangeRight: '',
kmRangeLeft: '',
region: '',
trainWindowCode: '',
relevanceSectionList: [],
roadType: null,
firstTurnBack: false,
belongStation: '',
rightAxleOffset: {x:0, y:0},
leftAxleOffset: {x:0, y:0},
leftAxlePosition: 0,
rightAxlePosition: 0
}; };
const model = Object.assign(sectionModel, data);
models.push(deepAssign(this.$store.getters['map/getDeviceByCode'](lsection.code), { _dispose: true })); models.push(deepAssign(this.$store.getters['map/getDeviceByCode'](lsection.code), { _dispose: true }));
models.push(deepAssign(this.$store.getters['map/getDeviceByCode'](rsection.code), { _dispose: true })); models.push(deepAssign(this.$store.getters['map/getDeviceByCode'](rsection.code), { _dispose: true }));

View File

@ -90,6 +90,8 @@
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { getUID } from '@/jmapNew/utils/Uid'; import { getUID } from '@/jmapNew/utils/Uid';
import JTriangle from '@/jmapNew/utils/JTriangle'; import JTriangle from '@/jmapNew/utils/JTriangle';
import getModel from '../models.js';
export default { export default {
name: 'SignalCreate', name: 'SignalCreate',
props: { props: {
@ -179,32 +181,19 @@ export default {
uname = this.addModel.name || 'S' + this.signalList.length; uname = this.addModel.name || 'S' + this.signalList.length;
uid = getUID('S', this.signalList); uid = getUID('S', this.signalList);
} }
var model = { const signalModel = getModel('Signal');
_type: 'Signal', const data = {
code: uid, code: uid,
name: uname, name: uname,
type: 'PROTECTION',
uniqueName: uid, uniqueName: uid,
sectionCode: this.addModel.sectionCode, sectionCode: this.addModel.sectionCode,
positionType: this.addModel.positionType, positionType: this.addModel.positionType,
right: this.addModel.right, right: this.addModel.right,
virtual: false,
// leftOrRight: this.addModel.leftOrRight,
nameRotated: false,
nameShow: true, nameShow: true,
namePosition: { x: 0, y: 0 },
positionPoint: { x: 0, y: 0 },
buttonShow: true, buttonShow: true,
potLampType: '01', stationCode: this.addModel.stationCode
lampPostType: '01',
lampPositionType: '01',
guideShow: false,
stationCode: this.addModel.stationCode,
callOn: true,
turnBack: false,
ctc: true,
noOverlap: false
}; };
const model = Object.assign(signalModel, data);
this.sectionList.forEach(elem => { this.sectionList.forEach(elem => {
if (elem.code === this.addModel.sectionCode) { if (elem.code === this.addModel.sectionCode) {

View File

@ -127,6 +127,7 @@ import { mapGetters } from 'vuex';
import ConfigList from '../config/list'; import ConfigList from '../config/list';
import { deepAssign } from '@/utils/index'; import { deepAssign } from '@/utils/index';
import createSignal from './create'; import createSignal from './create';
import getModel from '../models.js';
export default { export default {
name: 'SignalDraft', name: 'SignalDraft',
@ -171,36 +172,7 @@ export default {
], ],
questionList: [], questionList: [],
field:'', field:'',
editModel: { editModel: getModel('Signal'),
code: '',
name: '',
type: 'PROTECTION',
uniqueName: '',
nameShow: false,
lampPostType: '',
lampPositionType: '',
leftOrRight: 'L',
right: false,
virtual: false, //
positionType: '',
namePosition: { x: 0, y: 0 },
stationCode: '',
sectionOffset: 0,
rotate: 0,
nameRotated: false,
sectionCode: '',
guideShow: false,
buttonShow: false,
position: { x: 0, y: 0 },
positionPoint: { x: 0, y: 0 },
buttonPosition: { x: 0, y: 0 },
guidePosition: { x: 0, y: 0 },
interlockStationCode: '',
callOn: true,
turnBack: false,
ctc: true, //
noOverlap: false //
},
addModel: { addModel: {
number: 2 number: 2
}, },
@ -386,6 +358,7 @@ export default {
}, },
deviceSelect(selected) { deviceSelect(selected) {
if (selected && selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() != 'selectSingalCode'.toUpperCase()) { if (selected && selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() != 'selectSingalCode'.toUpperCase()) {
this.editModel = getModel('Signal');
this.$refs.dataform && this.$refs.dataform.resetFields(); this.$refs.dataform && this.$refs.dataform.resetFields();
this.activeName = 'first'; this.activeName = 'first';
this.editModel = deepAssign(this.editModel, selected); this.editModel = deepAssign(this.editModel, selected);

View File

@ -92,47 +92,12 @@
</template> </template>
<script> <script>
function setModel() {
return {
centralized: false,
ciStation: false, //
depot:false, //
reentry:false, //
smallRouting: false, //
number:'', //
code: '',
zcCode: '',
visible: true,
runPlanName: '',
name: '',
nameFont: '',
nameFontColor: '#FFFFFF',
subheadDisplay:false,
subhead:'', //
subheadFont:'',
subheadFontColor:'#FFFFFF',
subheadPosition:{ x: 0, y: 0 },
kmPostShow: '',
kmRange: 0,
kmPost: '',
kmPostFont: '',
kmPostFontColor: '#FFFFFF',
isShowControlMode: '',
chargeStationCodeList:[],
relStationCodeList: [], //
position: { x: 0, y: 0 },
kilometerPosition: { x: 0, y: 0 }, //
createControlMode:false,
createTurnBack:false,
turnBackPoint: {x: 0, y: 0}, //
controlModePoint: { x: 0, y: 0 } //
};
}
import ElFont from '@/views/components/font/index'; import ElFont from '@/views/components/font/index';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { getUID } from '@/jmapNew/utils/Uid'; import { getUID } from '@/jmapNew/utils/Uid';
import ConfigList from './config/list'; import ConfigList from './config/list';
import { deepAssign } from '@/utils/index'; import { deepAssign } from '@/utils/index';
import getModel from './models.js';
export default { export default {
name: 'StationDraft', name: 'StationDraft',
@ -156,7 +121,7 @@ export default {
chargeStation:[], chargeStation:[],
relStationList: [], // relStationList: [], //
controlled:false, controlled:false,
editModel: deepAssign({}, setModel()), editModel: getModel('Station'),
addModel: { addModel: {
modelList: [], modelList: [],
positionY: 0 positionY: 0
@ -300,7 +265,7 @@ export default {
}, },
deviceSelect(selected) { deviceSelect(selected) {
if (selected && selected._type.toUpperCase() === 'Station'.toUpperCase()) { if (selected && selected._type.toUpperCase() === 'Station'.toUpperCase()) {
this.editModel = setModel(); this.editModel = getModel('Station');
this.$refs.dataform && this.$refs.dataform.resetFields(); this.$refs.dataform && this.$refs.dataform.resetFields();
this.activeName = 'first'; this.activeName = 'first';
this.editModel = deepAssign(this.editModel, selected); this.editModel = deepAssign(this.editModel, selected);
@ -404,42 +369,13 @@ export default {
const models = []; const models = [];
this.addModel.modelList.forEach((item) => { this.addModel.modelList.forEach((item) => {
const uid = getUID('Station', [...this.stationList, ...models]); const uid = getUID('Station', [...this.stationList, ...models]);
const model = { const stationModel = getModel('Station');
_type: 'Station', const data = {
code: uid, code: uid,
name: item.stationName, name: item.stationName,
number:'', createControlMode: item.control
subheadDisplay:false,
zcCode: '',
runPlanName: '',
visible: true,
nameFont: '22',
nameFontColor: '#FFFFFF',
kmPost: '1000km~2000km',
kmPostShow: true,
kmPostFont: '8',
kmPostFontColor: '#FFFFFF',
kilometerPosition: { x: 0, y: 0 },
centralized: false,
depot:false,
reentry:false,
smallRouting: false,
chargeStationCodeList:[],
relStationCodeList: [], //
createControlMode: item.control,
createTurnBack: false,
turnBackPoint: {x: 0, y: 0}, //
textControlMode: false, //
textControlModePosition: { x: 0, y: 0},
showUnmanned: false, //
unmannedPosition: {x: 0, y: 0},
showLampFilament: false, //
lampFilamentPosition: {x: 0, y: 0},
showControlSwitch: false, // LCW/ATS
controlSwitchPosition: {x: 0, y: 0},
showFoldbackMode: false, //
foldbackModePosition: {x: 0, y: 0}
}; };
const model = Object.assign(stationModel, data);
this.sectionList.forEach(elem => { this.sectionList.forEach(elem => {
if (elem.code === item.sectionCode) { if (elem.code === item.sectionCode) {
const l = 0; const l = 0;
@ -473,8 +409,7 @@ export default {
edit() { edit() {
this.$refs['dataform'].validate((valid) => { this.$refs['dataform'].validate((valid) => {
if (valid) { if (valid) {
const data = Object.assign({_type: 'Station'}, this.editModel); this.$emit('updateMapModel', this.editModel);
this.$emit('updateMapModel', data);
} }
}); });
}, },

View File

@ -52,6 +52,7 @@ import { mapGetters } from 'vuex';
import { getUID } from '@/jmapNew/utils/Uid'; import { getUID } from '@/jmapNew/utils/Uid';
import ConfigList from './config/list'; import ConfigList from './config/list';
import { deepAssign } from '@/utils/index'; import { deepAssign } from '@/utils/index';
import getModel from './models.js';
export default { export default {
name: 'StationStandDraft', name: 'StationStandDraft',
@ -84,52 +85,17 @@ export default {
{ code: '02', name: '自动无人折返'}, { code: '02', name: '自动无人折返'},
{ code: '03', name: '自动换端'} { code: '03', name: '自动换端'}
], ],
editModel: { editModel: getModel('StationStand'),
code: '',
name: '',
deviceStationCode: '', //
width: 0,
height: 0,
stationCode: '', //
position: { x: 0, y: 0 },
visible: true, //
inside: false, //
right: true,
standTrackCode: '',
small: false,
defaultReentryStrategy: '', //
stopJumpLamp: false, //
stopJumpLampPoint: {x: 0, y: 0}, //
cancelStopJumpLamp: false, //
cancelStopJumpLampPoint: {x: 0, y: 0}, //
upDetainLamp: false, //
upDetainLampPoint: {x: 0, y: 0}, //
downDetainLamp: false, //
downDetainLampPoint: {x: 0, y: 0} //
},
field: '', field: '',
addModel: { addModel: {
stationCode: '', // stationCode: '', //
deviceStationCode: '', //
pointY: 0, // y pointY: 0, // y
width: 60, width: 60,
height: 20, height: 20,
standTrackCode: '', // standTrackCode: '', //
standTrackUpCode: '', //
standTrackDownCode: '', //
stationstandDirection: '02', // stationstandDirection: '02', //
right: true, right: true,
defaultReentryStrategy: '', // small: false
inside: false, //
small: false,
stopJumpLamp: false, //
stopJumpLampPoint: {x: 0, y: 0}, //
cancelStopJumpLamp: false, //
cancelStopJumpLampPoint: {x: 0, y: 0}, //
upDetainLamp: false, //
upDetainLampPoint: {x: 0, y: 0}, //
downDetainLamp: false, //
downDetainLampPoint: {x: 0, y: 0} //
}, },
allModel: { allModel: {
width: '', width: '',
@ -250,29 +216,7 @@ export default {
{ prop: 'height', label: this.$t('map.stationstandHeight'), type: 'number', min: 0, max: 2000, placeholder: 'px' }, { prop: 'height', label: this.$t('map.stationstandHeight'), type: 'number', min: 0, max: 2000, placeholder: 'px' },
{ prop: 'standTrackCode', label: '站台轨:', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.PhysicalSectionList, hover: this.hover, buttonType: 'sectionSelectCode', buttonShowType: this.isButtonTypeS }, { prop: 'standTrackCode', label: '站台轨:', type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', options: this.PhysicalSectionList, hover: this.hover, buttonType: 'sectionSelectCode', buttonShowType: this.isButtonTypeS },
{ prop: 'right', label: '行驶方向:', type: 'radio', optionLabel: 'name', optionValue: 'code', border: true, radioList: this.isRightList }, { prop: 'right', label: '行驶方向:', type: 'radio', optionLabel: 'name', optionValue: 'code', border: true, radioList: this.isRightList },
{ prop: 'defaultReentryStrategy', label: '默认折返策略:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.reentryStrategyList, clearable: true }, { prop: 'small', label: '是否小型站台:', type: 'checkbox' }
{ prop: 'small', label: '是否小型站台:', type: 'checkbox' },
{ prop: 'inside', label: '是否内站台:', type: 'checkbox' },
{ prop: 'stopJumpLamp', label: '跳停按钮:', type: 'checkbox'},
{ prop: 'stopJumpLampPoint', label: '跳停按钮坐标:', type: 'coordinate', width: '120px', isHidden: !this.isStopJumpPointsShow, children: [
{ prop: 'stopJumpLampPoint.x', firstLevel: 'stopJumpLampPoint', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'stopJumpLampPoint.y', firstLevel: 'stopJumpLampPoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] },
{ prop: 'cancelStopJumpLamp', label: '取消跳停按钮:', type: 'checkbox'},
{ prop: 'cancelStopJumpLampPoint', label: '取消跳停按钮坐标:', type: 'coordinate', width: '120px', isHidden: !this.isCancelStopJumpPointsShow, children: [
{ prop: 'cancelStopJumpLampPoint.x', firstLevel: 'cancelStopJumpLampPoint', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'cancelStopJumpLampPoint.y', firstLevel: 'cancelStopJumpLampPoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] },
{ prop: 'upDetainLamp', label: '上行扣车按钮:', type: 'checkbox'},
{ prop: 'upDetainLampPoint', label: '上行扣车按钮坐标:', type: 'coordinate', width: '120px', isHidden: !this.isUpDetainPointsShow, children: [
{ prop: 'upDetainLampPoint.x', firstLevel: 'upDetainLampPoint', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'upDetainLampPoint.y', firstLevel: 'upDetainLampPoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] },
{ prop: 'downDetainLamp', label: '下行扣车按钮:', type: 'checkbox'},
{ prop: 'downDetainLampPoint', label: '下行扣车坐标:', type: 'coordinate', width: '120px', isHidden: !this.isDownDetainPointsShow, children: [
{ prop: 'downDetainLampPoint.x', firstLevel: 'downDetainLampPoint', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
{ prop: 'downDetainLampPoint.y', firstLevel: 'downDetainLampPoint', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] }
] ]
}, },
door: { door: {
@ -309,20 +253,17 @@ export default {
isButtonTypeS() { isButtonTypeS() {
return this.field == 'sectionSelectCode'; return this.field == 'sectionSelectCode';
}, },
isButtonTypeES() {
return this.field === 'editSectionSelectCode';
},
isStopJumpPointsShow() { isStopJumpPointsShow() {
return this.activeName === 'first' ? this.editModel.stopJumpLamp : this.addModel.stopJumpLamp; return this.editModel.stopJumpLamp;
}, },
isCancelStopJumpPointsShow() { isCancelStopJumpPointsShow() {
return this.activeName === 'first' ? this.editModel.cancelStopJumpLamp : this.addModel.cancelStopJumpLamp; return this.editModel.cancelStopJumpLamp;
}, },
isUpDetainPointsShow() { isUpDetainPointsShow() {
return this.activeName === 'first' ? this.editModel.upDetainLamp : this.addModel.upDetainLamp; return this.editModel.upDetainLamp;
}, },
isDownDetainPointsShow() { isDownDetainPointsShow() {
return this.activeName === 'first' ? this.editModel.downDetainLamp : this.addModel.downDetainLamp; return this.editModel.downDetainLamp;
}, },
PhysicalSectionList() { PhysicalSectionList() {
let list = []; let list = [];
@ -355,33 +296,34 @@ export default {
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code)); this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
}, },
hover(field) { hover(field) {
this.field = field === this.field ? '' : field; this.field = field == this.field ? '' : field;
this.$emit('standStationCode', this.field); this.$emit('standStationCode', this.field);
}, },
changeStation(station) { changeStation(station) {
this.editModel.deviceStationCode = this.getDeviceStationCode(station); this.editModel.deviceStationCode = this.getDeviceStationCode(station);
}, },
deviceSelect(selected) { deviceSelect(selected) {
if (this.field.toUpperCase() != 'standSelectStationCode'.toUpperCase() && selected && selected._type.toUpperCase() === 'StationStand'.toUpperCase()) { if (this.field != 'standSelectStationCode' && selected && selected._type == 'StationStand') {
this.editModel = getModel('StationStand');
this.$refs.dataform && this.$refs.dataform.resetFields(); this.$refs.dataform && this.$refs.dataform.resetFields();
this.activeName = 'first'; this.activeName = 'first';
this.editModel = deepAssign(this.editModel, selected); this.editModel = deepAssign(this.editModel, selected);
} }
if (selected && selected._type.toUpperCase() === 'Station'.toUpperCase() && this.field.toUpperCase() === 'standSelectStationCode'.toUpperCase()) { if (selected && selected._type.toUpperCase() === 'Station'.toUpperCase() && this.field == 'standSelectStationCode') {
this.addModel.stationCode = selected.code; this.addModel.stationCode = selected.code;
this.activeName = 'second'; this.activeName = 'second';
this.field = ''; this.field = '';
this.$emit('standStationCode', ''); this.hover(this.field);
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'sectionSelectCode'.toUpperCase()) { } else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field == 'sectionSelectCode') {
this.addModel.standTrackCode = selected.code; this.addModel.standTrackCode = selected.code;
this.activeName = 'second'; this.activeName = 'second';
this.field = ''; this.field = '';
this.$emit('standStationCode', ''); this.hover(this.field);
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'editSectionSelectCode'.toUpperCase()) { } else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field == 'editSectionSelectCode') {
this.editModel.standTrackCode = selected.code; this.editModel.standTrackCode = selected.code;
this.activeName = 'first'; this.activeName = 'first';
this.field = ''; this.field = '';
this.$emit('standStationCode', ''); this.hover(this.field);
} }
}, },
create() { create() {
@ -390,31 +332,22 @@ export default {
const models = []; const models = [];
const space = this.$store.state.map.map.skinVO.code == '07' ? 0 : 8; const space = this.$store.state.map.map.skinVO.code == '07' ? 0 : 8;
const Standuid = getUID('PF', this.stationStandList); const Standuid = getUID('PF', this.stationStandList);
const model = { const stationStandModel = getModel('StationStand');
_type: 'StationStand', const data = {
code: Standuid, code: Standuid,
name: `PF${this.stationStandList.length + 1}`, name: `PF${this.stationStandList.length + 1}`,
width: this.addModel.width, width: this.addModel.width,
height: this.addModel.height, height: this.addModel.height,
deviceStationCode: this.getDeviceStationCode(this.addModel.stationCode), deviceStationCode: this.getDeviceStationCode(this.addModel.stationCode),
visible: true,
position: { position: {
x: 0, x: 0,
y: this.addModel.pointY y: this.addModel.pointY
}, },
standTrackCode: this.addModel.standTrackCode, standTrackCode: this.addModel.standTrackCode,
right: this.addModel.right, right: this.addModel.right,
small: this.addModel.small, small: this.addModel.small
inside: this.addModel.inside,
stopJumpLamp: this.addModel.stopJumpLamp, //
stopJumpLampPoint: this.addModel.stopJumpLampPoint, //
cancelStopJumpLamp: this.addModel.cancelStopJumpLamp, //
cancelStopJumpLampPoint: this.addModel.cancelStopJumpLampPoint, //
upDetainLamp: this.addModel.upDetainLamp, //
upDetainLampPoint: this.addModel.upDetainLampPoint, //
downDetainLamp: this.addModel.downDetainLamp, //
downDetainLampPoint: this.addModel.downDetainLampPoint //
}; };
const model = Object.assign(stationStandModel, data);
this.stationList.forEach(elem => { this.stationList.forEach(elem => {
if (elem.code == this.addModel.stationCode) { if (elem.code == this.addModel.stationCode) {
model.stationCode = elem.code; model.stationCode = elem.code;

View File

@ -2,14 +2,6 @@
<div> <div>
<div class="flex_box"> <div class="flex_box">
<el-button type="primary" @click="create">{{ $t('map.createSwitch') }}</el-button> <el-button type="primary" @click="create">{{ $t('map.createSwitch') }}</el-button>
<!-- <el-button type="" @click="questionList = []">{{ $t('map.clearHint') }}</el-button> -->
</div>
<div style="height: calc(100% - 46px);">
<!-- <el-scrollbar wrap-class="scrollbar-wrapper">
<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>
</el-scrollbar> -->
</div> </div>
</div> </div>
</template> </template>
@ -17,6 +9,8 @@
import { getUID } from '@/jmapNew/utils/Uid'; import { getUID } from '@/jmapNew/utils/Uid';
import { deepAssign } from '@/utils/index'; import { deepAssign } from '@/utils/index';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import getModel from '../models.js';
export default { export default {
name: 'CreateSwitch', name: 'CreateSwitch',
computed: { computed: {
@ -27,7 +21,6 @@ export default {
}, },
methods:{ methods:{
create() { // create() { //
// this.questionList = []; //
const createArr = []; // model const createArr = []; // model
const changeSectionList = this.changeSectionAttr(); const changeSectionList = this.changeSectionAttr();
changeSectionList.forEach(section => { changeSectionList.forEach(section => {
@ -45,8 +38,8 @@ export default {
}); });
if (section.code && sectionB.code && sectionC.code) { if (section.code && sectionB.code && sectionC.code) {
const uname = 'W' + section.name.replace('T', ''); const uname = 'W' + section.name.replace('T', '');
const model = { const switchModel = getModel('Switch');
_type: 'Switch', const data = {
code: getUID('W', [...this.switchList, ...createArr]), code: getUID('W', [...this.switchList, ...createArr]),
name: uname, name: uname,
nameShow: true, nameShow: true,
@ -54,9 +47,7 @@ export default {
sectionACode: section.code, sectionACode: section.code,
sectionBCode: sectionB.code, sectionBCode: sectionB.code,
sectionCCode: sectionC.code, sectionCCode: sectionC.code,
namePosition: { x: 0, y: 0 },
turnTime: 3, turnTime: 3,
tp: { x: 0, y: 0 },
intersection: { intersection: {
x: section.points[section.points.length - 1].x, x: section.points[section.points.length - 1].x,
y: section.points[section.points.length - 1].y y: section.points[section.points.length - 1].y
@ -67,6 +58,7 @@ export default {
}, },
normalPosition: 1 // normalPosition: 1 //
}; };
const model = Object.assign(switchModel, data);
const swch = this.findSwitchData(model.sectionACode, model.sectionBCode, model.sectionCCode); const swch = this.findSwitchData(model.sectionACode, model.sectionBCode, model.sectionCCode);
!swch && createArr.push(model); // !swch && createArr.push(model); //
} }
@ -86,8 +78,8 @@ export default {
}); });
if (section.code && sectionB.code && sectionC.code) { if (section.code && sectionB.code && sectionC.code) {
const uname = 'W' + section.name.replace('T', ''); const uname = 'W' + section.name.replace('T', '');
const model = { const switchModel = getModel('Switch');
_type: 'Switch', const data = {
code: getUID('W', [...this.switchList, ...createArr]), code: getUID('W', [...this.switchList, ...createArr]),
name: uname, name: uname,
nameShow: true, nameShow: true,
@ -95,9 +87,7 @@ export default {
sectionACode: section.code, sectionACode: section.code,
sectionBCode: sectionB.code, sectionBCode: sectionB.code,
sectionCCode: sectionC.code, sectionCCode: sectionC.code,
namePosition: { x: 0, y: 0 },
turnTime: 3, turnTime: 3,
tp: { x: 0, y: 0 },
intersection: { intersection: {
x: section.points[0].x, x: section.points[0].x,
y: section.points[0].y y: section.points[0].y
@ -108,6 +98,7 @@ export default {
}, },
normalPosition: 1 // normalPosition: 1 //
}; };
const model = Object.assign(switchModel, data);
const swch = this.findSwitchData(model.sectionACode, model.sectionBCode, model.sectionCCode); const swch = this.findSwitchData(model.sectionACode, model.sectionBCode, model.sectionCCode);
!swch && createArr.push(model); // !swch && createArr.push(model); //
} }
@ -327,41 +318,22 @@ export default {
if (JSON.stringify(sectiona.points[0]) === JSON.stringify(sectionb.points[sectionb.points.length - 1])) { if (JSON.stringify(sectiona.points[0]) === JSON.stringify(sectionb.points[sectionb.points.length - 1])) {
point = { x: sectiona.points[0].x, y: sectiona.points[0].y }; point = { x: sectiona.points[0].x, y: sectiona.points[0].y };
} }
models.push({ const sectionModel = getModel('Section');
_type: 'Section', const data = {
code: elem.uid, code: elem.uid,
name: sectiona.name, name: sectiona.name,
type: '04', type: '04',
namePosition: point, namePosition: point,
standTrack: false,
kmRangeRight: '',
kmRangeLeft: '',
region: '',
standTrackName: '',
standTrackNamePosition: { x: 0, y: 0 },
reentryTrack: false,
reentryTrackName: '',
reentryTrackNamePosition: { x: 0, y: 0 },
transferTrack: false,
transferTrackName: '',
transferTrackNamePosition: { x: 0, y: 0 },
// segmentation: false,
segmentationPosition: { x: 0, y: 0 },
switchSection: true, switchSection: true,
relSwitchCode: '',
relevanceSectionList: elem.relevanceSectionList, relevanceSectionList: elem.relevanceSectionList,
points: [{ x: 0, y: 0 }, { x: 0, y: 0 }], points: [{ x: 0, y: 0 }, { x: 0, y: 0 }],
logicSectionShow: false,
sepTypeLeft: '00', sepTypeLeft: '00',
offsetLeft: 0,
sepTypeRight: '00', sepTypeRight: '00',
offsetRight: 0,
parentCode: '',
stationCode: sectiona.stationCode, stationCode: sectiona.stationCode,
trainPosType: sectiona.trainPosType, trainPosType: sectiona.trainPosType,
curve: false,
nameShow: true nameShow: true
}); };
models.push(Object.assign(sectionModel, data));
} }
}); });
} }

View File

@ -28,6 +28,7 @@ import { deepAssign } from '@/utils/index';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { getUID } from '@/jmapNew/utils/Uid'; import { getUID } from '@/jmapNew/utils/Uid';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
import getModel from '../models.js';
export default { export default {
name: 'CreateAxle', name: 'CreateAxle',
@ -99,8 +100,8 @@ export default {
if (sectiona.length <= 0) { if (sectiona.length <= 0) {
return false; return false;
} }
models.push({ const sectionModel = getModel('Section');
_type: 'Section', const data = {
code: uid, code: uid,
name: uid, name: uid,
type: '04', type: '04',
@ -108,34 +109,18 @@ export default {
x: sectiona[sectiona.length - 1].x, x: sectiona[sectiona.length - 1].x,
y: sectiona[sectiona.length - 1].y y: sectiona[sectiona.length - 1].y
}, },
standTrack: false,
kmRangeRight: '',
kmRangeLeft: '',
region: '',
standTrackName: '',
standTrackNamePosition: { x: 0, y: 0 },
reentryTrack: false,
reentryTrackName: '',
reentryTrackNamePosition: { x: 0, y: 0 },
transferTrack: false,
transferTrackName: '',
transferTrackNamePosition: { x: 0, y: 0 },
segmentationPosition: { x: 0, y: 0 },
switchSection: true, switchSection: true,
relSwitchCode: this.fromData.relevanceSwitchList[0], relSwitchCode: this.fromData.relevanceSwitchList[0],
relevanceSectionList: this.fromData.relevanceSectionList, relevanceSectionList: this.fromData.relevanceSectionList,
points: [{ x: 0, y: 0 }, { x: 0, y: 0 }], points: [{ x: 0, y: 0 }, { x: 0, y: 0 }],
logicSectionShow: false,
sepTypeLeft: '00', sepTypeLeft: '00',
offsetLeft: 0,
sepTypeRight: '00', sepTypeRight: '00',
offsetRight: 0,
parentCode: '',
stationCode: sectiona.stationCode, stationCode: sectiona.stationCode,
trainPosType: sectiona.trainPosType, trainPosType: sectiona.trainPosType,
curve: false,
nameShow: true nameShow: true
}); };
models.push(Object.assign(sectionModel, data));
this.$emit('updateMapModel', models); this.$emit('updateMapModel', models);
this.fromData.relevanceSectionList = []; this.fromData.relevanceSectionList = [];
this.fromData.relevanceSwitchList = []; this.fromData.relevanceSwitchList = [];

View File

@ -37,7 +37,6 @@ export default {
return { return {
activeName: 'first', activeName: 'first',
lazy: true, lazy: true,
// questionList: [],
field: '' field: ''
}; };
}, },
@ -47,11 +46,6 @@ export default {
'switchList' 'switchList'
]) ])
}, },
watch: {
// selected: function (val, oldVal) {
// this.deviceSelect(val);
// }
},
methods: { methods: {
setCenter(code) { setCenter(code) {
this.$emit('setCenter', code); this.$emit('setCenter', code);

View File

@ -17,6 +17,8 @@
import { deepAssign } from '@/utils/index'; import { deepAssign } from '@/utils/index';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import ConfigList from '../config/list'; import ConfigList from '../config/list';
import getModel from '../models.js';
export default { export default {
name: 'SwitchModle', name: 'SwitchModle',
components: { components: {
@ -24,19 +26,7 @@ export default {
}, },
data() { data() {
return { return {
editModel: { editModel: getModel('Switch')
code: '',
name: '',
turnTime: 0,
nameShow: false,
namePosition: { x: 0, y: 0 },
stationCode: '',
timeoutShow: false,
sectionACode: '',
sectionBCode: '',
sectionCCode: '',
tp: { x: 0, y: 0 }
}
}; };
}, },
computed: { computed: {

View File

@ -78,14 +78,6 @@ export default {
'lineCode' 'lineCode'
]) ])
}, },
watch: {
// selected(val, oldVal) {
// this.deviceSelect(val);
// },
$route() {
// this.activeName = 'first';
}
},
methods: { methods: {
deviceChange(code) { deviceChange(code) {
this.$emit('setCenter', code); this.$emit('setCenter', code);
@ -96,9 +88,6 @@ export default {
this.editModel.code = selected.code; this.editModel.code = selected.code;
this.editModel.modelCode = selected.modelCode; this.editModel.modelCode = selected.modelCode;
this.editModel.groupNumber = selected.groupNumber; this.editModel.groupNumber = selected.groupNumber;
// this.activeName = 'first';
} else {
// this.activeName = 'second';
} }
}, },
create(list) { create(list) {