This commit is contained in:
zyy 2019-12-03 17:51:45 +08:00
commit e4aeb547f0
6 changed files with 55 additions and 45 deletions

View File

@ -553,7 +553,9 @@ export default {
belongsSection: 'Belongs section:',
coordinateMode: 'Coordinate mode',
sectionAssociationMode: 'Section association mode',
leftAssociatedSection: 'Left associated section',
rightAssociatedSection: 'Right associated section',
chargeStationList:'Managed station list'
leftAssociatedSection: 'Left associated section:',
rightAssociatedSection: 'Right associated section:',
chargeStationList:'Managed station list',
createModel: 'Create model:',
startingPoint: 'Starting point:',
};

View File

@ -547,7 +547,9 @@ export default {
belongsSection: '所属区段:',
coordinateMode: '坐标方式',
sectionAssociationMode: '区段关联方式',
leftAssociatedSection: '左关联区段',
rightAssociatedSection: '右关联区段',
chargeStationList:'管理车站列表'
leftAssociatedSection: '左关联区段:',
rightAssociatedSection: '右关联区段:',
chargeStationList:'管理车站列表',
createModel: '创建方式:',
startingPoint: '起点:'
};

View File

@ -13,11 +13,11 @@
</el-button-group>
</div>
</el-tab-pane>
<el-tab-pane class="view-control" label="新建" name="second">
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second">
<div style="height: calc(100% - 46px)">
<el-scrollbar>
<el-form ref="oprt" :model="createModel" label-width="130px" size="mini" :rules="createRules">
<el-form-item label="创建方式">
<el-form-item :label="$t('map.createModel')">
<el-radio-group v-model="createModel.type">
<el-radio
v-for="item in typeOptions"
@ -457,21 +457,17 @@ export default {
},
rules() {
var validateLeftSection = (rule, value, callback) => {
const leftSection = this.$store.getters['map/getDeviceByCode'](value);
const leftSection = value ? this.$store.getters['map/getDeviceByCode'](value) : '';
if (leftSection && (leftSection.points[1].x !== this.selected.points[0].x || leftSection.points[1].y !== this.selected.points[0].y )) {
callback(new Error(this.$t('rules.theLeftEndOfTheSelectedAssociatedSectionIsNotAdjacent')));
// } else if (this.editModel.type === '03' && !this.editModel.rightSection && !value) {
// callback(new Error(''));
} else {
callback();
}
};
var validateRightSection = (rule, value, callback) => {
const rightSection = this.$store.getters['map/getDeviceByCode'](value);
const rightSection = value ? this.$store.getters['map/getDeviceByCode'](value) : '';
if (rightSection && (rightSection.points[0].x !== this.selected.points[1].x || rightSection.points[0].y !== this.selected.points[1].y )) {
callback(new Error(this.$t('rules.theRightEndOfTheSelectedAssociatedSectionIsNotAdjacent')));
// } else if (this.editModel.type === '03' && !this.editModel.leftSection && !value) {
// callback(new Error(''));
} else {
callback();
}
@ -665,7 +661,6 @@ export default {
this.$refs.dataform.resetFields();
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) {
this.editModel.points = [];
console.log(selected);
this.activeName = 'first';
this.editModel = deepAssign(this.editModel, selected);
this.editModel.logicSectionNum = selected.type === '01' ? selected.logicSectionNum : [0];
@ -705,6 +700,11 @@ export default {
this.field = '';
}
}
} else {
this.editModel.relStandCode = selected.code;
this.selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code);
this.fieldS = '';
this.$emit('fieldSelect', '');
}
},
handleClick(tab, event) {
@ -716,6 +716,7 @@ export default {
hover(field) {
if (field == 'relStandCode') {
this.fieldS = field == this.fieldS ? '' : field;
this.$emit('fieldSelect', this.fieldS);
} else {
this.field = field == this.field ? '' : field;
this.$emit('fieldSelect', this.field);
@ -1014,8 +1015,8 @@ export default {
};
models.push(model);
}
const leftAssociatedSection = deepAssign({}, this.$store.getters['map/getDeviceByCode'](selected.leftSectionCode) || {});
const rightAssociatedSection = deepAssign({}, this.$store.getters['map/getDeviceByCode'](selected.rightSectionCode) || {});
const leftAssociatedSection = selected.leftSectionCode ? deepAssign({}, this.$store.getters['map/getDeviceByCode'](selected.leftSectionCode) || {}) : '';
const rightAssociatedSection = selected.rightSectionCode ? deepAssign({}, this.$store.getters['map/getDeviceByCode'](selected.rightSectionCode) || {}) : '';
models.forEach((elem, index) => {
if (index === 0) {
elem.leftSectionCode = selected.leftSectionCode;
@ -1035,8 +1036,8 @@ export default {
}
});
models.push(deepAssign(selected, { _dispose: true }));
leftAssociatedSection && models.push(leftAssociatedSection);
rightAssociatedSection && models.push(rightAssociatedSection);
leftAssociatedSection && JSON.stringify(leftAssociatedSection) !== '{}' && models.push(leftAssociatedSection);
rightAssociatedSection && JSON.stringify(rightAssociatedSection) !== '{}' && models.push(rightAssociatedSection);
this.$emit('updateMapModel', models); //
}
}
@ -1114,13 +1115,13 @@ export default {
model.leftSectionCode = lsection.leftSectionCode;
model.rightSectionCode = rsection.rightSectionCode;
models.push(model);
const leftAssociatedSection = deepAssign({}, this.$store.getters['map/getDeviceByCode'](model.leftSectionCode) || {});
const rightAssociatedSection = deepAssign({}, this.$store.getters['map/getDeviceByCode'](model.rightSectionCode) || {});
if (leftAssociatedSection) {
const leftAssociatedSection = model.leftSectionCode ? deepAssign({}, this.$store.getters['map/getDeviceByCode'](model.leftSectionCode) || {}) : '';
const rightAssociatedSection = model.rightSectionCode ? deepAssign({}, this.$store.getters['map/getDeviceByCode'](model.rightSectionCode) || {}) : '';
if (leftAssociatedSection && JSON.stringify(leftAssociatedSection) !== '{}') {
leftAssociatedSection.rightSectionCode = model.code;
models.push(leftAssociatedSection);
}
if (rightAssociatedSection) {
if (rightAssociatedSection && JSON.stringify(rightAssociatedSection) !== '{}') {
rightAssociatedSection.leftSectionCode = model.code;
models.push(rightAssociatedSection);
}
@ -1146,8 +1147,8 @@ export default {
model.leftSectionCode = rsection.leftSectionCode;
model.rightSectionCode = lsection.rightSectionCode;
models.push(model);
const leftAssociatedSection = deepAssign({}, this.$store.getters['map/getDeviceByCode'](model.leftSectionCode));
const rightAssociatedSection = deepAssign({}, this.$store.getters['map/getDeviceByCode'](model.rightSectionCode));
const leftAssociatedSection = model.leftSectionCode ? deepAssign({}, this.$store.getters['map/getDeviceByCode'](model.leftSectionCode) || {}) : '';
const rightAssociatedSection = model.rightSectionCode ? deepAssign({}, this.$store.getters['map/getDeviceByCode'](model.rightSectionCode) || {}) : '';
if (leftAssociatedSection) {
leftAssociatedSection.rightSectionCode = model.code;
models.push(leftAssociatedSection);

View File

@ -218,7 +218,7 @@ export default {
const newModal = Object.assign({}, station);
newModal.controlled = false;
newModal.concentrateStationCode = '';
this.setStationStand(station,"");
this.setStationStand(station,'');
data.forEach(each=>{
switch (each) {
case station.code: {
@ -255,7 +255,7 @@ export default {
newModal.concentrateStationCode = '';
// {}
this.setStationStand(station,"");
this.setStationStand(station, '');
this.$emit('updateMapModel', newModal);
});

View File

@ -8,7 +8,7 @@
</div>
<div class="button_box">
<el-button-group class="map-draft-group">
<!-- <el-button type="primary" size="small" @click="edit">{{ $t('map.updateObj') }}</el-button> -->
<el-button type="primary" size="small" @click="edit">{{ $t('map.updateObj') }}</el-button>
<el-button type="danger" size="small" @click="deleteObj">{{ $t('map.deleteObj') }}</el-button>
</el-button-group>
</div>

View File

@ -8,7 +8,7 @@
</div>
<div class="button_box">
<el-button-group class="map-draft-group">
<!-- <el-button type="primary" size="small" @click="edit">{{ $t('map.updateObj') }}</el-button> -->
<el-button type="primary" size="small" @click="edit">{{ $t('map.updateObj') }}</el-button>
<el-button type="danger" size="small" @click="deleteObj">{{ $t('map.deleteObj') }}</el-button>
</el-button-group>
</div>
@ -18,7 +18,7 @@
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-form ref="make" label-width="140px" :model="addModel" :rules="createRules" size="mini">
<el-form-item :label="$t('map.stationstandName')" prop="stationCode">
<el-select v-model="addModel.stationCode" filterable>
<el-select v-model="addModel.stationCode" filterable @change="changeStation">
<el-option
v-for="item in stationList"
:key="item.code"
@ -171,9 +171,6 @@ export default {
doorLocationType: [
{ required: true, message: this.$t('rules.doorLocationType'), trigger: 'change' }
],
deviceStationCode: [
{ required: true, message: this.$t('rules.deviceStationCode'), trigger: 'change' }
],
direction: [
{ required: true, message: this.$t('rules.stationstandDirection'), trigger: 'change' }
],
@ -206,9 +203,6 @@ export default {
doorLocationType: [
{ required: true, message: this.$t('rules.doorLocationType'), trigger: 'change' }
],
deviceStationCode: [
{ required: true, message: this.$t('rules.deviceStationCode'), trigger: 'change' }
]
};
}
},
@ -234,6 +228,17 @@ export default {
updateView() {
this.edit();
},
changeStation(data){
let station=this.stationList.find(elem => {return elem.code==data});
if(station){
if(station.centralized){
this.addModel.deviceStationCode=station.code;
}
else{
this.addModel.deviceStationCode=station.concentrateStationCode;
}
}
},
deviceSelect(selected) {
this.$refs.dataform.resetFields();
this.$refs.make.resetFields();