desc: 增加区段配置
This commit is contained in:
parent
10cd98fe6f
commit
c2400c07e1
@ -15,7 +15,7 @@ export default class Section extends Group {
|
||||
this._type = _type;
|
||||
this.zlevel = zlevel;
|
||||
this.z = 5 + parseInt(model.layer || 0);
|
||||
console.log(model.layer);
|
||||
// console.log(model.layer);
|
||||
this.model = model;
|
||||
this.state = state;
|
||||
this.style = style;
|
||||
|
@ -311,7 +311,7 @@ export default class Switch extends Group {
|
||||
}
|
||||
|
||||
setLocateType(state) {
|
||||
console.log(this.state.sectionCstatus);
|
||||
// console.log(this.state.sectionCstatus);
|
||||
this.setSectionState(this.relocShelter.getSection(), 'fill', this.state.sectionCstatus);
|
||||
switch (state.locateType) {
|
||||
case '01':
|
||||
|
@ -32,24 +32,29 @@ export function getAttrList(code, key, that) {
|
||||
}
|
||||
|
||||
export function getAttrRules(code, key) {
|
||||
const data = JSON.parse(JSON.stringify(attribute[code][key]));
|
||||
return data.rules;
|
||||
return Object.assign({}, attribute[code][key]);
|
||||
}
|
||||
|
||||
export const attribute = {
|
||||
/*
|
||||
* select optionCode 表示 循环列表名称
|
||||
* select 有点change事件 deviceChange 表示事件名称
|
||||
* 有判断 显隐问题 使用 hiddenName 表示判断属性名称
|
||||
* 有判断 是否禁用 使用 isDisabled 表示判断属性名称
|
||||
*/
|
||||
link: {
|
||||
attr: {
|
||||
labelWidth: '130px',
|
||||
items: [
|
||||
{ prop: 'code', label: 'Link编码:', type: 'select', optionLabel: 'name&&code', required: true, options: [], optionCode: 'linkList', change: true, deviceChange: 'deviceChange' },
|
||||
{ prop: 'code', label: 'Link编码:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', required: true, options: [], optionCode: 'linkList', change: true, deviceChange: 'deviceChange' },
|
||||
{ prop: 'name', label: 'Link名称:', type: 'input', required: true },
|
||||
{ prop: 'lengthShow', label: 'Link显示长度:', type: 'number' },
|
||||
{ prop: 'lengthFact', label: 'Link实际长度:', type: 'number', required: true },
|
||||
{ prop: 'color', label: 'Link颜色:', type: 'color' },
|
||||
{ prop: 'leftFdCode', label: '左侧正向Link:', type: 'select', optionLabel: 'name&&code', options: [], optionCode: 'linkList' },
|
||||
{ prop: 'leftSdCode', label: '左侧侧向Link:', type: 'select', optionLabel: 'name&&code', options: [], optionCode: 'linkList' },
|
||||
{ prop: 'rightFdCode', label: '右侧正向Link:', type: 'select', optionLabel: 'name&&code', options: [], optionCode: 'linkList' },
|
||||
{ prop: 'rightSdCode', label: '右侧侧向Link:', type: 'select', optionLabel: 'name&&code', options: [], optionCode: 'linkList' },
|
||||
{ prop: 'leftFdCode', label: '左侧正向Link:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: [], optionCode: 'linkList' },
|
||||
{ prop: 'leftSdCode', label: '左侧侧向Link:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: [], optionCode: 'linkList' },
|
||||
{ prop: 'rightFdCode', label: '右侧正向Link:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: [], optionCode: 'linkList' },
|
||||
{ prop: 'rightSdCode', label: '右侧侧向Link:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: [], optionCode: 'linkList' },
|
||||
{ prop: 'lp', label: 'Link 起点坐标:', type: 'coordinate', children: [
|
||||
{ prop: 'x', label: 'x:', type: 'number', labelWidth: '20px', disabled: true },
|
||||
{ prop: 'y', label: 'y:', type: 'number', labelWidth: '20px', disabled: true }
|
||||
@ -72,23 +77,22 @@ export const attribute = {
|
||||
}
|
||||
}
|
||||
},
|
||||
// model model数据名称 disabledType 判断禁用类型 disabledValue 判断值
|
||||
section: {
|
||||
attr: {
|
||||
labelWidth: '160px',
|
||||
items: [
|
||||
{ prop: 'stationCode', label: '所属设备集中站:', type: 'select', optionLabel: 'name&&code', disabled: false, options: [], optionCode: 'stationList', isDisabled: 'isStationCodeDisabled'},
|
||||
{ prop: 'parentCode', label: '关联物理区段:', type: 'select', optionLabel: 'code&&name', disabled: true, options: [], optionCode: 'stationList', isHidden: true, hiddenName: 'isParentCode' },
|
||||
{ prop: 'code', label: '区段编码:', type: 'select', optionLabel: 'code&&name', required: true, options: [], optionCode: 'stationList', change: true, deviceChange: 'deviceChange' },
|
||||
{ prop: 'type', label: '区段类型:', type: 'select', optionLabel: 'name', required: true, options: [], optionCode: 'SectionTypeList' },
|
||||
{ prop: 'stationCode', label: '所属设备集中站:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', disabled: false, options: [], optionCode: 'stationList', isDisabled: 'isStationCodeDisabled'},
|
||||
{ prop: 'parentCode', label: '关联物理区段:', type: 'select', optionLabel: 'code&&name', optionValue: 'code', disabled: true, options: [], optionCode: 'sectionList', isHidden: true, hiddenName: 'isParentCode' },
|
||||
{ prop: 'code', label: '区段编码:', type: 'select', optionLabel: 'code&&name', optionValue: 'code', required: true, options: [], optionCode: 'sectionList', change: true, deviceChange: 'deviceChange' },
|
||||
{ prop: 'type', label: '区段类型:', type: 'select', optionLabel: 'name', optionValue: 'code', required: true, options: [], optionCode: 'SectionTypeList' },
|
||||
{ prop: 'name', label: '区段名称:', type: 'input', required: true },
|
||||
{ prop: 'namePoint', label: '区段名称偏移量:', type: 'coordinate', children: [
|
||||
{ prop: 'namePoint', label: '区段名称偏移量:', type: 'coordinate', width: '160px', children: [
|
||||
{ prop: 'x', label: 'x:', type: 'number', labelWidth: '20px', required: true },
|
||||
{ prop: 'y', label: 'y:', type: 'number', labelWidth: '20px', required: true }
|
||||
] },
|
||||
{ prop: 'kmRangeLeft', label: '左侧公里标(米):', type: 'number' },
|
||||
{ prop: 'kmRangeRight', label: '右侧公里标(米):', type: 'number' },
|
||||
{ prop: 'region', label: '区间:', type: 'select', optionLabel: 'label', options: [], optionCode: 'regionList' },
|
||||
{ prop: 'region', label: '区间:', type: 'select', optionLabel: 'label', optionValue: 'value', options: [], optionCode: 'regionList' },
|
||||
{ prop: 'nameShow', label: '是否显示区段名称:', type: 'checkbox', isHidden: true, hiddenName: 'isSectionType' },
|
||||
{ prop: 'axleShow', label: '是否显示计轴:', type: 'checkbox', disabled: false, isHidden: true, hiddenName: 'isSectionType', isDisabled: 'isStationAxleShow' },
|
||||
{ prop: 'logicSectionShow', label: '是否显示逻辑区段:', type: 'checkbox', isHidden: true, hiddenName: 'isSectionType' },
|
||||
@ -99,7 +103,7 @@ export const attribute = {
|
||||
{ prop: 'x', label: 'x:', type: 'number', labelWidth: '20px', disabled: true },
|
||||
{ prop: 'y', label: 'y:', type: 'number', labelWidth: '20px', disabled: true }
|
||||
] },
|
||||
{ prop: 'relStandCode', label: '站台编码:', type: 'selectHover', optionLabel: 'code&&name', required: true, options: [], optionCode: 'stationStandList', buttonType: 'relStandCode', hover: 'hover', isButtonType: 'isButtonType', buttonShowType: false, isHidden: true, hiddenName: 'isrelStandCode' },
|
||||
{ prop: 'relStandCode', label: '站台编码:', type: 'selectHover', optionLabel: 'code&&name', optionValue: 'code', required: true, options: [], optionCode: 'stationStandList', buttonType: 'relStandCode', hover: 'hover', isButtonType: 'isButtonType', buttonShowType: false, isHidden: true, hiddenName: 'isrelStandCode' },
|
||||
{ prop: 'isReentryTrack', label: '是否折返轨:', type: 'checkbox', isHidden: true, hiddenName: 'isSectionType' },
|
||||
{ prop: 'reentryTrackName', label: '折返轨名称:', type: 'input', isHidden: true, hiddenName: 'isreentryTrackName' },
|
||||
{ prop: 'reentryTrackNamePosition', label: '折返轨名称偏移量:', type: 'coordinate', isHidden: true, hiddenName: 'isreentryTrackName', children: [
|
||||
@ -118,18 +122,18 @@ export const attribute = {
|
||||
{ prop: 'y', label: 'y:', type: 'number', labelWidth: '20px', disabled: true, required: true }
|
||||
] },
|
||||
{ prop: 'destinationCodeShow', label: '是否显示目的地码:', type: 'checkbox', isHidden: true, hiddenName: 'isdestinationCode' },
|
||||
{ prop: 'leftStopPointOffset', label: '左向停车点偏移量:', type: 'number', required: true },
|
||||
{ prop: 'rightStopPointOffset', label: '右向停车点偏移量:', type: 'number', required: true },
|
||||
{ prop: 'leftStopPointOffset', label: '左向停车点偏移量:', type: 'number', required: true, isHidden: true, hiddenName: 'isStopPointOffset' },
|
||||
{ prop: 'rightStopPointOffset', label: '右向停车点偏移量:', type: 'number', required: true, isHidden: true, hiddenName: 'isStopPointOffset' },
|
||||
{ prop: 'isSwitchSection', label: '是否道岔区段:', type: 'checkbox', isHidden: true, hiddenName: 'isSectionType' },
|
||||
// { prop: 'relSwitchCode', label: '关联道岔Code:', type: 'select', optionLabel: 'code&&name', options: [], optionCode: 'switchList', change: true, deviceChange: 'deviceChange', isHidden: true, hiddenName: 'isRelSwitchCode' } (需要用)
|
||||
{ prop: 'relSwitchCode', label: '关联道岔Code:', type: 'select', optionLabel: 'code&&name', optionValue: 'code', options: [], optionCode: 'switchList', change: true, deviceChange: 'deviceChange', isHidden: true, hiddenName: 'isRelSwitchCode' },
|
||||
{ prop: 'logicSectionNameSort', label: '逻辑区段排序:', type: 'radio', isHidden: true, required: true, hiddenName: 'isLogicSectionNameSort', radioList: [
|
||||
{value: true, label: '从小到大'},
|
||||
{value: false, label: '从大到小'}
|
||||
] },
|
||||
{ prop: 'linkCode', label: '关联的Link:', type: 'select', optionLabel: 'name&&code', options: [], optionCode: 'linkList', disabled: true, isHidden: true, hiddenName: 'isSectionType' },
|
||||
{ prop: 'sepTypeLeft', label: '左侧分隔符类型:', type: 'select', optionLabel: 'name', options: [], optionCode: 'SectionSepTypeList', isHidden: true, hiddenName: 'isSectionType' },
|
||||
{ prop: 'linkCode', label: '关联的Link:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: [], optionCode: 'linkList', disabled: true, isHidden: true, hiddenName: 'isSectionType' },
|
||||
{ prop: 'sepTypeLeft', label: '左侧分隔符类型:', type: 'select', optionLabel: 'name', optionValue: 'code', options: [], optionCode: 'SectionSepTypeList', isHidden: true, hiddenName: 'isSectionType' },
|
||||
{ prop: 'offsetLeft', label: '左侧Link偏移量:', type: 'number', required: true, isHidden: true, hiddenName: 'isSectionType' },
|
||||
{ prop: 'sepTypeRight', label: '右侧分隔符类型:', type: 'select', optionLabel: 'name', options: [], optionCode: 'SectionSepTypeList', isHidden: true, hiddenName: 'isSectionType' },
|
||||
{ prop: 'sepTypeRight', label: '右侧分隔符类型:', type: 'select', optionLabel: 'name', optionValue: 'code', options: [], optionCode: 'SectionSepTypeList', isHidden: true, hiddenName: 'isSectionType' },
|
||||
{ prop: 'offsetRight', label: '右侧Link偏移量:', type: 'number', required: true, isHidden: true, hiddenName: 'isSectionType' },
|
||||
{ prop: 'isSegmentation', label: '是否分割:', type: 'checkbox', isHidden: true, hiddenName: 'isSectionType' },
|
||||
{ prop: 'segmentationPosition', label: '默认背景:', type: 'coordinate', isHidden: true, hiddenName: 'issegmentationPosition', children: [
|
||||
@ -137,8 +141,8 @@ export const attribute = {
|
||||
{ prop: 'y', label: 'y:', type: 'number', labelWidth: '20px', disabled: true }
|
||||
] },
|
||||
{ prop: 'isCurve', label: '是否曲线:', type: 'checkbox', isHidden: true, hiddenName: 'isSectionType' },
|
||||
{ prop: 'points', label: '区段显示坐标:', type: 'points', isHidden: true, hiddenName: 'isPointsShow', pointDisabled: true, pointDisabledName: 'pointDisabledName', addPoint: 'addPoint', addPointChange: 'addPoint', delPoint: 'delPoint', delPointChange: 'delPoint' },
|
||||
{ prop: 'trainPosType', label: '列车所在方向:', type: 'select', optionLabel: 'name', options: [], optionCode: 'TrainPositionTypeList', isHidden: true, hiddenName: 'isSectionType' }
|
||||
{ prop: 'points', label: '区段显示坐标:', type: 'points', width: '160px', isHidden: true, hiddenName: 'isPointsShow', pointDisabled: true, pointDisabledName: 'pointDisabledName', addPoint: 'addPoint', addPointChange: 'addPoint', delPoint: 'delPoint', delPointChange: 'delPoint' },
|
||||
{ prop: 'trainPosType', label: '列车所在方向:', type: 'select', optionLabel: 'name', optionValue: 'code', options: [], optionCode: 'TrainPositionTypeList', isHidden: true, hiddenName: 'isSectionType' }
|
||||
],
|
||||
rules: {
|
||||
code: [
|
||||
|
@ -13,9 +13,9 @@
|
||||
>
|
||||
<el-option
|
||||
v-for="option in item.options"
|
||||
:key="option.code"
|
||||
:key="option[item.optionValue]"
|
||||
:label="handleLabel(option, item.optionLabel)"
|
||||
:value="option.code"
|
||||
:value="option[item.optionValue]"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
@ -28,9 +28,9 @@
|
||||
>
|
||||
<el-option
|
||||
v-for="option in item.options"
|
||||
:key="option.code"
|
||||
:key="option[item.optionValue]"
|
||||
:label="handleLabel(option, item.optionLabel)"
|
||||
:value="option.code"
|
||||
:value="option[item.optionValue]"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
@ -82,7 +82,7 @@
|
||||
<!-- 坐标点并列显示 -->
|
||||
<template v-if="checkFieldType(item, 'coordinate')">
|
||||
<div v-if="!item.isHidden" :key="item.prop" class="coordinate">
|
||||
<span class="title">{{ item.label }}</span>
|
||||
<span class="title" :style="item.width">{{ item.label }}</span>
|
||||
<div v-for="opt in item.children" :key="opt.code" class="listWidth">
|
||||
<el-form-item :label="opt.label" :prop="opt.prop" :label-width="opt.labelWidth">
|
||||
<el-input-number v-model="formModel[item.prop][opt.prop]" :label="opt.label" :disabled="opt.disabled" />
|
||||
@ -93,7 +93,7 @@
|
||||
<!-- 多个坐标点绘制 -->
|
||||
<template v-if="checkFieldType(item, 'points')">
|
||||
<div v-if="!item.isHidden" :key="item.prop" class="coordinate">
|
||||
<span class="title">{{ item.label }}</span>
|
||||
<span class="title" :style="item.width">{{ item.label }}</span>
|
||||
<div class="point-section">
|
||||
<template v-for="(point, index) in formModel[item.prop]">
|
||||
<div :key="index" style="overflow: hidden;">
|
||||
@ -187,7 +187,7 @@ export default {
|
||||
return field.type === type;
|
||||
}
|
||||
},
|
||||
validateForm(callback) {
|
||||
validate(callback) {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
callback();
|
||||
|
@ -238,7 +238,7 @@ export default {
|
||||
this.$refs.dataform.clearValidate();
|
||||
});
|
||||
|
||||
return baseRules;
|
||||
return baseRules.rules;
|
||||
},
|
||||
|
||||
// 是否初始link
|
||||
@ -282,23 +282,24 @@ export default {
|
||||
this.$refs.dataform.clearValidate();
|
||||
this.$refs.make.resetFields();
|
||||
if (selected && selected._type.toUpperCase() === 'Link'.toUpperCase()) {
|
||||
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;
|
||||
const model = selected.model;
|
||||
this.editModel.name = model.name;
|
||||
this.editModel.code = this.addModel.code = model.code;
|
||||
this.editModel.type = model.type;
|
||||
this.editModel.lengthShow = Math.sqrt(Math.pow(model.rp.x - model.lp.x, 2) + Math.pow(model.rp.y - model.lp.y, 2));
|
||||
this.editModel.lengthFact = model.lengthFact;
|
||||
this.editModel.color = model.color;
|
||||
this.editModel.leftFdCode = model.leftFdCode;
|
||||
this.editModel.leftSdCode = model.leftSdCode;
|
||||
this.editModel.rightFdCode = model.rightFdCode;
|
||||
this.editModel.rightSdCode = model.rightSdCode;
|
||||
this.editModel.lp = {
|
||||
x: selected.lp.x,
|
||||
y: selected.lp.y
|
||||
x: model.lp.x,
|
||||
y: model.lp.y
|
||||
};
|
||||
this.editModel.rp = {
|
||||
x: selected.rp.x,
|
||||
y: selected.rp.y
|
||||
x: model.rp.x,
|
||||
y: model.rp.y
|
||||
};
|
||||
this.activeName = 'first';
|
||||
} else {
|
||||
@ -463,7 +464,7 @@ export default {
|
||||
},
|
||||
// 修改对象
|
||||
edit() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
this.$refs['dataform'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.$emit('addOrUpdateMapModel', this.buildEditModel());
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ export default {
|
||||
this.$refs.dataform.clearValidate();
|
||||
});
|
||||
|
||||
return baseRules;
|
||||
return baseRules.rules;
|
||||
},
|
||||
PhysicalSectionList() {
|
||||
let list = [];
|
||||
@ -348,6 +348,9 @@ export default {
|
||||
isdestinationCode() {
|
||||
return this.editModel.type !== '03' && (this.editModel.isReentryTrack || this.editModel.isTransferTrack);
|
||||
},
|
||||
isStopPointOffset() {
|
||||
return this.editModel.type !== '03' && (this.editModel.isReentryTrack || this.editModel.isStandTrack || this.editModel.isTransferTrack);
|
||||
},
|
||||
|
||||
isButtonType() {
|
||||
return this.fieldS === 'relStandCode';
|
||||
@ -388,7 +391,9 @@ export default {
|
||||
deep: true
|
||||
},
|
||||
'$store.state.map.mapDataLoadedCount': function() {
|
||||
this.form = getAttrList('section', 'attr', this);
|
||||
if (this.sectionList) {
|
||||
this.form = getAttrList('section', 'attr', this);
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -427,10 +432,12 @@ export default {
|
||||
this.$emit('setCenter', code);
|
||||
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
|
||||
},
|
||||
deviceSelect(selected) {
|
||||
deviceSelect(model) {
|
||||
if (!this.fieldS) { // 判断是否激活选择站台
|
||||
this.editModel.points = [];
|
||||
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
|
||||
if (model && model._type.toUpperCase() === 'Section'.toUpperCase()) {
|
||||
const selected = model.model;
|
||||
// console.log(selected, 111);
|
||||
this.editModel.code = selected.code;
|
||||
this.editModel.name = selected.name;
|
||||
this.editModel.type = selected.type;
|
||||
@ -836,7 +843,7 @@ export default {
|
||||
return model;
|
||||
},
|
||||
edit() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
this.$refs['dataform'].validate((valid) => {
|
||||
if (valid) {
|
||||
const edits = [];
|
||||
const model = this.buildEditModel();
|
||||
@ -1130,7 +1137,6 @@ export default {
|
||||
if (this.switchList && this.switchList.length && this.sectionList && this.sectionList.length) {
|
||||
this.switchList.forEach(elem => {
|
||||
const sectiona = this.$store.getters['map/getDeviceByCode'](elem.sectionACode);
|
||||
console.log(sectiona, elem.sectionACode, elem);
|
||||
const sectionb = this.$store.getters['map/getDeviceByCode'](elem.sectionBCode);
|
||||
const sectionc = this.$store.getters['map/getDeviceByCode'](elem.sectionCCode);
|
||||
if (sectiona && sectionb && sectionc) {
|
||||
|
Loading…
Reference in New Issue
Block a user