增加信号机构建偏移量关联关系逻辑, 调整车次窗批量修改

This commit is contained in:
zyy 2019-12-13 18:00:12 +08:00
parent 3df3e162bd
commit 70ae531eff
5 changed files with 177 additions and 21 deletions

View File

@ -27,8 +27,8 @@ export default {
],
SignalLeftOrRightList: [
{ label: '左侧', value: '0' },
{ label: '右侧', value: '1' }
{ label: '左侧', value: 'L' },
{ label: '右侧', value: 'R' }
],
roleList: [

View File

@ -133,11 +133,11 @@
<el-form-item :label="$t('map.breakUpNumber')" prop="splitNumber">
<el-input-number v-model="addModel.splitNumber" :min="1" :max="addModel.splitOffsetMax" />
</el-form-item>
<el-form-item :label="$t('map.trainDirection')" prop="trainPosType">
<!-- <el-form-item :label="$t('map.trainDirection')" prop="trainPosType">
<el-radio-group v-model="addModel.trainPosType">
<el-radio v-for="item in TrainPositionTypeList" :key="item.code" :label="item.code" border size="mini">{{ item.name }}</el-radio>
</el-radio-group>
</el-form-item>
</el-form-item> -->
<el-form-item>
<el-button-group>
<el-button type="primary" size="big" @click="split">{{ $t('map.split') }}</el-button>
@ -256,7 +256,7 @@ export default {
offsetLeft: 0,
sepTypeRight: '',
offsetRight: 0,
trainPosType: '', //
// trainPosType: '', //
parentCode: '',
points: [],
lengthFact: 0,
@ -270,7 +270,7 @@ export default {
addModel: {
code: '',
splitNumber: 2,
trainPosType: '01', //
// trainPosType: '01', //
splitOffsetMax: 15
},
operationModel: { //
@ -290,10 +290,10 @@ export default {
],
splitNumber: [
{ required: true, message: this.$t('rules.pleaseEnterSplit'), trigger: 'blur' }
],
trainPosType: [
{ required: true, message: this.$t('rules.pleaseSelectTrainDir'), trigger: 'change' }
]
// trainPosType: [
// { required: true, message: this.$t('rules.pleaseSelectTrainDir'), trigger: 'change' }
// ]
},
mergeRules: {
lsectioncode: [
@ -444,8 +444,8 @@ export default {
{ prop: 'rightStopPointOffset', label: this.$t('map.rightStopPointOffset'), type: 'number', min: 0, isHidden: !this.isStopPointOffset },
{ prop: 'region', label: this.$t('map.sectionColon'), type: 'select', optionLabel: 'label', optionValue: 'value', options: this.regionList, isHidden: !this.sectionColonShow },
{ prop: 'kmRangeLeft', label: this.$t('map.leftKilometerMark'), type: 'number', min: 0, placeholder: this.$t('map.meter') },
{ prop: 'kmRangeRight', label: this.$t('map.rightKilometerMark'), type: 'number', min: 0, placeholder: this.$t('map.meter') },
{ prop: 'trainPosType', label: this.$t('map.trainDirection'), type: 'radio', optionLabel: 'name', optionValue: 'code', border: true, radioList: this.TrainPositionTypeList }
{ prop: 'kmRangeRight', label: this.$t('map.rightKilometerMark'), type: 'number', min: 0, placeholder: this.$t('map.meter') }
// { prop: 'trainPosType', label: this.$t('map.trainDirection'), type: 'radio', optionLabel: 'name', optionValue: 'code', border: true, radioList: this.TrainPositionTypeList }
]
}
}
@ -783,7 +783,7 @@ export default {
sepTypeLeft: '01', //
offsetLeft: 0,
sepTypeRight: '01',
trainPosType: '', //
// trainPosType: '', //
lengthFact: 0,
parentCode: '',
relStandCode: '',
@ -932,7 +932,7 @@ export default {
if (section.parentCode === model.code) {
const copySection = deepAssign({}, section);
copySection.logicSectionShow = model.logicSectionShow;
copySection.trainPosType = model.trainPosType;
// copySection.trainPosType = model.trainPosType;
models.push(copySection);
}
if (model.code !== section.code && (section.type === '01' || section.typel === '03')) {
@ -1051,7 +1051,7 @@ export default {
offsetLeft: selected.offsetLeft,
sepTypeRight: index == this.addModel.splitNumber ? selected.sepTypeRight : '01', // ( 01)
offsetRight: selected.offsetRight,
trainPosType: this.addModel.trainPosType,
// trainPosType: this.addModel.trainPosType,
isCurve: selected.isCurve,
lengthFact: 0,
points: [
@ -1154,7 +1154,7 @@ export default {
model.axleShow = lsection.axleShow;
model.logicSectionNum = lsection.logicSectionNum;
model.logicSectionShow = lsection.logicSectionShow;
model.trainPosType = lsection.trainPosType;
// model.trainPosType = lsection.trainPosType;
model.sepTypeLeft = lsection.sepTypeLeft;
model.offsetLeft = lsection.offsetLeft;
model.sepTypeRight = rsection.sepTypeRight;
@ -1186,7 +1186,7 @@ export default {
model.axleShow = rsection.axleShow;
model.logicSectionNum = rsection.logicSectionNum;
model.logicSectionShow = rsection.logicSectionShow;
model.trainPosType = rsection.trainPosType;
// model.trainPosType = rsection.trainPosType;
model.sepTypeLeft = rsection.sepTypeLeft;
model.offsetLeft = rsection.offsetLeft;
model.sepTypeRight = lsection.sepTypeRight;

View File

@ -99,7 +99,7 @@ export default {
sectionCode: '',
name: '',
directionShowType: '01',
leftOrRight: '0',
leftOrRight: 'L', //
positionType: '01',
stationCode: ''
},
@ -175,6 +175,7 @@ export default {
sectionCode: this.addModel.sectionCode,
positionType: this.addModel.positionType,
directionShowType: this.addModel.directionShowType,
// leftOrRight: this.addModel.leftOrRight,
nameShow: true,
namePosition: { x: 0, y: 0 },
buttonShow: true,
@ -188,7 +189,7 @@ export default {
this.sectionList.forEach(elem => {
if (elem.code === this.addModel.sectionCode) {
if (this.addModel.leftOrRight === '0') {
if (this.addModel.leftOrRight === 'L') {
const beg = elem.points[0];
const end = elem.points[0 + 1];
const traingle = new JTriangle(beg, end);

View File

@ -16,6 +16,19 @@
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second">
<create-signal ref="createSignal" :field="field" @signalSectionCode="signalSectionCode" @updateMapModel="updateMapModel" />
</el-tab-pane>
<el-tab-pane class="view-control" label="批量操作" name="three">
<div class="flex_box">
<el-button type="primary" style="margin-right: 10px;" @click="editAll">构建信号机偏移量</el-button>
<el-button type="" style="margin: 0;" @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>
</el-tab-pane>
</el-tabs>
</template>
@ -56,6 +69,7 @@ export default {
{ code: '00', name: this.$t('map.normal') },
{ code: '01', name: this.$t('map.signalFilamentAlarm') }
],
questionList: [],
field:'',
editModel: {
code: '',
@ -65,6 +79,7 @@ export default {
lampPostType: '',
lampPositionType: '',
potLampType: '01',
leftOrRight: 'L',
directionShowType: '',
positionType: '',
namePosition: { x: 0, y: 0 },
@ -157,7 +172,7 @@ export default {
{ prop: 'uniqueName', label: this.$t('map.signalUniqueName'), type: 'input' },
{ prop: 'useType', label: this.$t('map.signalUseType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SignalUseTypeList },
{ prop: 'potLampType', label: this.$t('map.potLampType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SignalPotLampTypeList },
{ prop: 'sectionCode', label: this.$t('map.belongsSection'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.signalSectionList, disabled: true },
{ prop: 'sectionCode', label: this.$t('map.belongsSection'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.signalSectionList },
{ prop: 'offset', label: this.$t('map.signalOffset'), type: 'number', min: 0, placeholder: this.$t('tip.meter') }
]
@ -234,7 +249,6 @@ export default {
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
},
deviceSelect(selected) {
// this.$refs.make.resetFields();
if (selected && selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() != 'selectSingalCode'.toUpperCase()) {
this.$refs.dataform.resetFields();
this.activeName = 'first';
@ -285,6 +299,46 @@ export default {
_that.$message.info(this.$t('tip.cancelledDelete'));
});
}
},
//
editAll() {
const models = [];
this.questionList = [];
this.signalList.forEach(item => {
const signalModel = deepAssign({}, item);
const section = this.findSection(signalModel);
if (section.code && item.sectionCode != section.code) {
item.sectionCode = section.code;
}
if (!section.code) {
this.questionList.push(`${item.name} 信号机位置可能不正确,请手动调试归属区段及偏移量.`);
}
signalModel.offset = 2;
if (signalModel.directionShowType == '02') {
if (section.lengthFact) {
signalModel.offset = Math.abs(Number(section.lengthFact) - 2);
}
}
models.push(signalModel);
});
this.$emit('updateMapModel', models);
},
//
findSection(signal) {
// 01 02
let model = {};
this.sectionList.forEach(section => {
if (signal.directionShowType == '01' && section.type != '02') {
if (section.points[0].x == signal.position.x && Math.abs(section.points[0].y - signal.position.y) <= 20) {
model = section;
}
} else if (signal.directionShowType == '02' && section.type != '02') {
if (section.points[section.points.length - 1].x == signal.position.x && Math.abs(section.points[section.points.length - 1].y - signal.position.y) <= 20) {
model = section;
}
}
});
return model;
}
}
};
@ -295,6 +349,24 @@ export default {
height: 100%;
}
.flex_box{
display: flex;
justify-content: center;
}
.box-card {
width: calc(100% - 80px);
margin: 20px auto 0;
padding: 0 20px;
.text {
font-size: 14px;
}
.item {
padding: 6px 0;
}
}
.card {
height: 100%;
}

View File

@ -13,7 +13,7 @@
</el-button-group>
</div>
</el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.batchOperation')" name="three">
<el-tab-pane class="view-control" :label="$t('map.batchOperation')" name="second">
<div style="height: 100%">
<el-scrollbar wrap-class="scrollbar-wrapper">
<div style="text-align:center;">
@ -23,6 +23,43 @@
</el-scrollbar>
</div>
</el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.batchOperation')" name="three">
<div style="height: calc(100% - 46px);">
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-form ref="addForm" label-width="130px" :model="addModel" size="mini" :rules="mergeRules">
<el-form-item label="车次窗编码:" prop="modelList">
<el-select v-model="addModel.modelList" filterable multiple>
<el-option
v-for="item in trainWindowList"
:key="item.code"
:label="item.code"
:value="item.code"
/>
</el-select>
<el-button
:type="field === 'trainWindowCode' ? 'danger' : 'primary'"
size="small"
@click="hover('trainWindowCode')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="Y轴坐标:" prop="pointY">
<el-input-number v-model="addModel.pointY" style="width: 178px;" @change="handleChange" />
</el-form-item>
<el-form-item label="车次窗宽度:" prop="width">
<el-input-number v-model="addModel.width" style="width: 178px;" @change="handleChange" />
</el-form-item>
<el-form-item label="车次窗高度:" prop="height">
<el-input-number v-model="addModel.height" style="width: 178px;" @change="handleChange" />
</el-form-item>
</el-form>
</el-scrollbar>
</div>
<div class="button_box">
<el-button-group class="map-draft-group">
<el-button type="primary" size="small" @click="editTrainWindow">{{ $t('map.updateObj') }}</el-button>
</el-button-group>
</div>
</el-tab-pane>
</el-tabs>
</template>
@ -77,6 +114,27 @@ export default {
height: [
{ required: true, message: this.$t('rules.trainWindowHeight'), trigger: 'blur' }
]
},
field: '',
addModel: {
pointY: '',
width: '',
height: '',
modelList: []
},
mergeRules: {
pointY: [
{ required: true, message: '请输入', trigger: 'blur' }
],
modelList: [
{ required: true, message: '请选择', trigger: 'change' }
],
width: [
{ required: true, message: this.$t('rules.trainWindowWidth'), trigger: 'blur' }
],
height: [
{ required: true, message: this.$t('rules.trainWindowHeight'), trigger: 'blur' }
]
}
};
},
@ -140,11 +198,20 @@ export default {
this.$emit('setCenter', code);
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
},
hover(field) {
this.field = field == this.field ? '' : field;
},
deviceSelect(selected) {
this.$refs.form.resetFields();
if (selected && selected._type.toUpperCase() === 'TrainWindow'.toUpperCase()) {
this.activeName = 'first';
this.editModel = deepAssign(this.editModel, selected);
if (this.field == 'trainWindowCode') {
if (this.addModel.modelList.indexOf(selected.code) == -1) {
this.addModel.modelList.push(selected.code);
}
this.activeName = 'three';
}
}
},
createModel(opts) {
@ -314,6 +381,22 @@ export default {
_that.$message.info(this.$t('tip.cancelledDelete'));
});
}
},
editTrainWindow() {
this.$refs['addForm'].validate((valid) => {
if (valid) {
const models = [];
this.addModel.modelList.forEach(item => {
const model = this.$store.getters['map/getDeviceByCode'](item);
model.point.y = this.addModel.pointY;
model.height = this.addModel.height;
model.width = this.addModel.width;
models.push(model);
});
this.$emit('updateMapModel', models);
this.addModel.modelList = [];
}
});
}
}
};