This commit is contained in:
fan 2019-12-04 18:41:55 +08:00
commit 117d3a3d0b
13 changed files with 286 additions and 434 deletions

View File

@ -326,7 +326,16 @@ class SkinCode extends defaultStyle {
// },
kmPostShow: true, // 公里标显示
kilometerPosition: 'down', // 公里标位置
fontWeight: 'bold' // 文字错细
fontWeight: 'bold', // 文字错细
text: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
lamp: {
radiusR: 6, // 控制灯大小
controlColor: '#FFFF00' // 控制灯颜色
}
};
this[deviceType.Switch] = {

View File

@ -321,7 +321,16 @@ class SkinCode extends defaultStyle {
// show: true // 公里标名称显示
// },
kmPostShow: false, // 公里标显示
kilometerPosition: 'up' // 公里标朝向
kilometerPosition: 'up', // 公里标朝向
text: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
lamp: {
radiusR: 6, // 控制灯大小
controlColor: '#FFFF00' // 控制灯颜色
}
};
this[deviceType.Switch] = {
@ -391,18 +400,6 @@ class SkinCode extends defaultStyle {
}
};
this[deviceType.ButtonControl] = {
text: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
lamp: {
radiusR: 6, // 控制灯大小
controlColor: '#FFFF00' // 控制灯颜色
}
};
this[deviceType.Line] = {
lineColor: '#FFFFFF' // 线条颜色
};

View File

@ -318,7 +318,16 @@ class SkinCode extends defaultStyle {
// show: true // 公里标名称显示
// },
kmPostShow: false, // 公里标显示
kilometerPosition: 'up' // 公里标朝向
kilometerPosition: 'up', // 公里标朝向
text: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
lamp: {
radiusR: 6, // 控制灯大小
controlColor: '#FFFF00' // 控制灯颜色
}
};
this[deviceType.Switch] = {

View File

@ -308,7 +308,16 @@ class SkinCode extends defaultStyle {
// show: true // 公里标名称显示
// },
kmPostShow: true, // 公里标显示
kilometerPosition: 'up' // 公里标朝向
kilometerPosition: 'up', // 公里标朝向
text: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
lamp: {
radiusR: 6, // 控制灯大小
controlColor: '#FFFF00' // 控制灯颜色
}
};
this[deviceType.Switch] = {

View File

@ -11,7 +11,6 @@ const deviceType = {
StationStand: 'StationStand',
StationControl: 'StationControl',
StationCounter: 'StationCounter',
ButtonControl: 'ButtonControl',
StationDelayUnlock: 'StationDelayUnlock',
Train: 'Train',
TrainWindow: 'TrainWindow',

View File

@ -1,67 +0,0 @@
/*
* lC区域控制模式
*/
import Group from 'zrender/src/container/Group';
import EControl from '../element/EControl';
export default class ButtonControl extends Group {
constructor(model, style) {
super();
this.z = 20;
this._code = model.code;
this._type = model._type;
this.zlevel = 10;
this.model = model;
this.style = style;
this.create();
this.setState(model);
}
create() {
const model = this.model;
this.control = new EControl({
zlevel: this.zlevel,
z: this.z,
arc: {
shape: {
cx: model.position.x,
cy: model.position.y,
r: this.style.ButtonControl.lamp.radiusR
},
lineWidth: 0,
fill: this.style.ButtonControl.lamp.controlColor
},
text: {
position: [0, 0],
x: model.position.x,
y: model.position.y + this.style.ButtonControl.lamp.radiusR + this.style.ButtonControl.text.distance,
fontWeight: this.style.ButtonControl.text.fontWeight,
fontSize: this.style.ButtonControl.text.fontSize,
fontFamily: this.style.fontFamily,
text: model.text || '按图折返',
textFill: '#fff',
textAlign: 'middle',
textVerticalAlign: 'top'
},
style: this.style
});
this.add(this.control);
}
// 设置状态
setState(model) {
}
getShapeTipPoint() {
if (this.control) {
var distance = 2;
var rect = this.control.getBoundingRect();
return {
x: rect.x + rect.width / 2,
y: rect.y - distance
};
}
return null;
}
}

View File

@ -1,26 +0,0 @@
// import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
/** 名称元素*/
export default function ETextName(model) {
const TextName = new Text({
_subType: 'Text',
zlevel: model.zlevel,
z: model.z,
silent: model.silent || false,
style: {
x: model.x,
y: model.y,
fontWeight: model.fontWeight,
fontSize: model.fontSize,
fontFamily: model.fontFamily,
text: model.text,
textStrokeWidth: model.textStrokeWidth,
textFill: model.textFill,
textAlign: model.textAlign,
textPosition: model.textPosition || 'inside',
textVerticalAlign: model.textVerticalAlign || null
}
});
return TextName;
}

View File

@ -3,8 +3,8 @@
*/
import Group from 'zrender/src/container/Group';
import ETextName from '../element/ETextName';
import EHighlight from '../element/EHighlight'; // 名称文字 (共有)
import EturnBack from './EturnBack';
// import EHighlight from '../element/EHighlight'; // 名称文字 (共有)
import EControl from '../element/EControl';
export default class Station extends Group {
constructor(model, style) {
@ -16,9 +16,9 @@ export default class Station extends Group {
this.model = model;
this.style = style;
this.create();
this.createPullBack(); // 创建按图折返
// this.createTurnBack(); // 创建按图折返
this.setState(model);
this.checkIsDrawMap();
// this.checkIsDrawMap();
}
create() {
@ -67,23 +67,35 @@ export default class Station extends Group {
}
}
}
createPullBack() {
createTurnBack() { // 创建按图折返
const model = this.model;
const style = this.style;
if (model.visible && model.isCreateTurnBack) {
this.turnBack = new EturnBack({
this.turnBack = new EControl({
zlevel: this.zlevel,
z: this.z,
arc: {
shape: {
cx: model.pullBackModel.position.x,
cy: model.pullBackModel.position.y,
r: style.Station.lamp.radiusR
},
lineWidth: 0,
fill: style.Station.lamp.controlColor
},
text: {
position: [0, 0],
x: model.position.x,
y: model.position.y,
fontWeight: model.fontWeight,
fontSize: model.kmPostFont || 18,
x: model.pullBackModel.position.x,
y: model.pullBackModel.position.y + style.Station.lamp.radiusR + style.Station.text.distance,
fontWeight: style.Station.text.fontWeight,
fontSize: style.Station.text.fontSize,
fontFamily: style.fontFamily,
text: model.kmPost,
text: '按图折返',
textFill: '#fff',
textAlign: 'middle',
textVerticalAlign: 'top',
textFill: model.kmPostFontColor
textVerticalAlign: 'top'
},
style: this.style
});
this.add(this.turnBack);
}
@ -100,13 +112,13 @@ export default class Station extends Group {
this.highlight && this.highlight.drawSelected(selected);
}
checkIsDrawMap() {
const path = window.location.href;
if (path.includes('/map/draw')) {
this.highlight = new EHighlight(this);
this.add(this.highlight);
this.on('mouseout', () => { this.highlight.mouseout(); });
this.on('mouseover', () => { this.highlight.mouseover(); });
}
}
// checkIsDrawMap() {
// const path = window.location.href;
// if (path.includes('/map/draw')) {
// this.highlight = new EHighlight(this);
// this.add(this.highlight);
// this.on('mouseout', () => { this.highlight.mouseout(); });
// this.on('mouseover', () => { this.highlight.mouseover(); });
// }
// }
}

View File

@ -9,7 +9,6 @@ import LcControl from './LcControl/index.js';
import LimitControl from './LimitControl/index.js';
import Switch from './Switch/index.js';
import ZcControl from './ZcControl/index.js';
import ButtonControl from './ButtonControl/index.js';
import StationCounter from './StationCounter/index.js';
import StationDelayUnlock from './StationDelayUnlock/index.js';
import StationStand from './StationStand/index.js';
@ -31,7 +30,6 @@ mapShape[deviceType.LcControl] = LcControl;
mapShape[deviceType.LimitControl] = LimitControl;
mapShape[deviceType.Switch] = Switch;
mapShape[deviceType.ZcControl] = ZcControl;
mapShape[deviceType.ButtonControl] = ButtonControl;
mapShape[deviceType.StationCounter] = StationCounter;
mapShape[deviceType.StationDelayUnlock] = StationDelayUnlock;
mapShape[deviceType.StationStand] = StationStand;

View File

@ -87,10 +87,6 @@ export function parser(data, skinCode) {
mapDevice[elem.code] = createDevice(deviceType.ZcControl, elem, propConvert);
}, this);
zrUtil.each(data.buttonList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.ButtonControl, elem, propConvert);
}, this);
zrUtil.each(data.lcList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.LcControl, elem, propConvert);
}, this);
@ -198,7 +194,6 @@ export function updateMapData(state, model) {
case deviceType.ZcControl: updateForList(model, state, 'zcControlList'); break;
case deviceType.StationDelayUnlock:updateForList(model, state, 'stationDelayUnlockList'); break;
case deviceType.LcControl: updateForList(model, state, 'lcControlList'); break;
case deviceType.ButtonControl: updateForList(model, state, 'buttonList'); break;
case deviceType.LimitControl: updateForList(model, state, 'tempSpeedLimitList'); break;
case deviceType.ImageControl: updateForList(model, state, 'imageControl'); break;
case deviceType.Train: updateForList(model, state, 'trainList'); break;

View File

@ -41,54 +41,6 @@
</el-button-group>
</div>
</el-tab-pane>
<el-tab-pane v-if="editModel.isCreateControlMode" class="view-control" label="控制模式" name="three">
<div style="height: calc(100% - 46px);">
<el-scrollbar wrap-class="scrollbar-wrapper">
111
</el-scrollbar>
</div>
<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 v-if="editModel.isCreateCounter" class="view-control" label="计数器" name="four">
<div style="height: calc(100% - 46px);">
<el-scrollbar wrap-class="scrollbar-wrapper">
222
</el-scrollbar>
</div>
<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 v-if="editModel.isCreateDelayedUnlock" class="view-control" label="延迟解锁" name="five">
<div style="height: calc(100% - 46px);">
<el-scrollbar wrap-class="scrollbar-wrapper">
333
</el-scrollbar>
</div>
<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 v-if="editModel.isCreateTurnBack" class="view-control" label="按图折返" name="six">
<div style="height: calc(100% - 46px);">
<el-scrollbar wrap-class="scrollbar-wrapper">
<config-list ref="pullBackForm" :form="pullBackForm" :form-model="pullBackModel" :rules="pullBackRules" />
</el-scrollbar>
</div>
<div class="button_box">
<el-button-group class="map-draft-group">
<el-button type="primary" size="small" @click="editPullBack">{{ $t('map.updateObj') }}</el-button>
</el-button-group>
</div>
</el-tab-pane>
</el-tabs>
</template>
@ -136,17 +88,15 @@ export default {
position: { x: 0, y: 0 },
controlled:false,
isCreateControlMode:false,
isCreateCounter:false,
isCreateDelayedUnlock:false,
isCreateTurnBack:false
// isCreateCounter:false,
// isCreateDelayedUnlock:false,
isCreateTurnBack:false,
turnBackList: [], //
controlModePoint: { x: 0, y: 0 } //
},
addModel: {
sectionCode: []
},
pullBackModel: {
code: '',
position: { x: 0, y: 0 }
},
skins: [],
mergeRules: {
sectionCode: [
@ -186,7 +136,9 @@ export default {
{ prop: 'kmRange', label: this.$t('map.stationKmRange'), type: 'number', min: 0, placeholder: this.$t('tip.meter') },
{ prop: 'kmPost', label: this.$t('map.stationKmPost'), type: 'input' },
{ prop: 'kmPostFont', label: this.$t('map.stationKmPostFont'), type: 'font', placeholder: this.$t('tip.kilometerFont') },
{ prop: 'kmPostFontColor', label: this.$t('map.stationKmPostFontColor'), type: 'color' }
{ prop: 'kmPostFontColor', label: this.$t('map.stationKmPostFontColor'), type: 'color' },
{ prop: 'isCreateControlMode', label: '控制模式:', type: 'checkbox' },
{ prop: 'isCreateTurnBack', label: '按图折返:', type: 'checkbox' }
]
},
map: {
@ -196,11 +148,7 @@ export default {
{ prop: 'centralized', label: this.$t('map.centralized'), type: 'checkbox', disabled:this.editModel.controlled, change:true, deviceChange:this.changeCentralized },
{ prop: 'zcCode', label: this.$t('map.zcCode'), type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: this.zcList, isHidden: !this.isZcCode },
{ prop: 'chargeStationCodeList', label: this.$t('map.chargeStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.chargeStation, isHidden: !this.isZcCode, deviceChange:this.changeChargeStation},
{ prop: 'runPlanName', label: this.$t('map.stationRunPlanName'), type: 'input' },
{ prop: 'isCreateControlMode', label: '是否创建控制模式', type: 'checkbox' },
{ prop: 'isCreateCounter', label: '是否创建计数器', type: 'checkbox' },
{ prop: 'isCreateDelayedUnlock', label: '是否创建延迟解锁', type: 'checkbox' },
{ prop: 'isCreateTurnBack', label: '是否创建按图折返', type: 'checkbox' }
{ prop: 'runPlanName', label: this.$t('map.stationRunPlanName'), type: 'input' }
]
}
}
@ -228,41 +176,6 @@ export default {
]
};
},
pullBackForm() {
return {
labelWidth: '120px',
items: {
code: {
name: '',
item: []
},
draw: {
name: this.$t('map.drawData'),
item: [
{ prop: 'code', label: `${this.$t('map.code')}`, type: 'select', optionLabel: 'code', optionValue: 'code', options: this.buttonList, disabled: true },
{ prop: 'position', label: '坐标偏移量:', type: 'coordinate', width: '110px', children: [
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px'},
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] }
]
},
map: {
name: this.$t('map.mapData'),
item: []
}
}
};
},
pullBackRules() {
return {
'position.x': [
{ required: true, message: this.$t('rules.pleaseEnterXCoordinate'), trigger: 'blur' }
],
'position.y': [
{ required: true, message: this.$t('rules.pleaseEnterYCoordinate'), trigger: 'blur' }
]
};
},
PhysicalSectionList() {
let list = [];
if (this.sectionList && this.sectionList.length) {
@ -421,6 +334,13 @@ export default {
this.$refs['dataform'].validate((valid) => {
if (valid) {
const data = Object.assign({_type: 'Station'}, this.editModel);
if (data.isCreateTurnBack && !data.pullBackModel.code) {
data.pullBackModel.position = {
x: data.position.x + 100,
y: data.position.y + 50
};
data.pullBackModel.code = getUID('turnBackCode');
}
this.$emit('updateMapModel', data);
}
});
@ -441,9 +361,6 @@ export default {
_that.$message.info(this.$t('tip.cancelledDelete'));
});
}
},
editPullBack() {
console.log(111);
}
}
};