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:', belongsSection: 'Belongs section:',
coordinateMode: 'Coordinate mode', coordinateMode: 'Coordinate mode',
sectionAssociationMode: 'Section association mode', sectionAssociationMode: 'Section association mode',
leftAssociatedSection: 'Left associated section', leftAssociatedSection: 'Left associated section:',
rightAssociatedSection: 'Right associated section', rightAssociatedSection: 'Right associated section:',
chargeStationList:'Managed station list' chargeStationList:'Managed station list',
createModel: 'Create model:',
startingPoint: 'Starting point:',
}; };

View File

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

View File

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

View File

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

View File

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

View File

@ -8,7 +8,7 @@
</div> </div>
<div class="button_box"> <div class="button_box">
<el-button-group class="map-draft-group"> <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 type="danger" size="small" @click="deleteObj">{{ $t('map.deleteObj') }}</el-button>
</el-button-group> </el-button-group>
</div> </div>
@ -18,7 +18,7 @@
<el-scrollbar wrap-class="scrollbar-wrapper"> <el-scrollbar wrap-class="scrollbar-wrapper">
<el-form ref="make" label-width="140px" :model="addModel" :rules="createRules" size="mini"> <el-form ref="make" label-width="140px" :model="addModel" :rules="createRules" size="mini">
<el-form-item :label="$t('map.stationstandName')" prop="stationCode"> <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 <el-option
v-for="item in stationList" v-for="item in stationList"
:key="item.code" :key="item.code"
@ -171,9 +171,6 @@ export default {
doorLocationType: [ doorLocationType: [
{ required: true, message: this.$t('rules.doorLocationType'), trigger: 'change' } { required: true, message: this.$t('rules.doorLocationType'), trigger: 'change' }
], ],
deviceStationCode: [
{ required: true, message: this.$t('rules.deviceStationCode'), trigger: 'change' }
],
direction: [ direction: [
{ required: true, message: this.$t('rules.stationstandDirection'), trigger: 'change' } { required: true, message: this.$t('rules.stationstandDirection'), trigger: 'change' }
], ],
@ -206,9 +203,6 @@ export default {
doorLocationType: [ doorLocationType: [
{ required: true, message: this.$t('rules.doorLocationType'), trigger: 'change' } { 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() { updateView() {
this.edit(); 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) { deviceSelect(selected) {
this.$refs.dataform.resetFields(); this.$refs.dataform.resetFields();
this.$refs.make.resetFields(); this.$refs.make.resetFields();