This commit is contained in:
zyy 2019-12-03 15:21:59 +08:00
commit 193f9267a1
2 changed files with 60 additions and 35 deletions

View File

@ -107,7 +107,8 @@ export default {
'stationList',
'sectionList',
'zcList',
'lineCode'
'lineCode',
'stationStandList'
]),
form() {
return {
@ -198,6 +199,7 @@ export default {
this.activeName = 'first';
this.editModel = deepAssign(this.editModel, selected);
this.editModel.runPlanName = selected.runPlanName || '';
//
this.chargeStation = this.stationList.filter(data=>{
return !data.centralized && data.code != this.editModel.code && !(data.controlled && data.concentrateStationCode != this.editModel.code);
});
@ -209,17 +211,20 @@ export default {
this.$emit('stationSectionCode', '');
}
},
//
changeChargeStation(data) {
if (data.length > 0) {
this.chargeStation.forEach(station=>{
const newModal = Object.assign({}, station);
newModal.controlled = false;
newModal.concentrateStationCode = '';
this.setStationStand(station,"");
data.forEach(each=>{
switch (each) {
case station.code: {
newModal.controlled = true;
newModal.concentrateStationCode = this.editModel.code;
this.setStationStand(station,this.editModel.code);
break;
}
}
@ -227,27 +232,44 @@ export default {
this.$emit('updateMapModel', newModal);
});
} else {
this.chargeStation.forEach(station=>{
const newModal = Object.assign({}, station);
newModal.controlled = false;
newModal.concentrateStationCode = '';
this.$emit('updateMapModel', newModal);
});
//
this.modifyChargeStation();
}
this.edit();
},
changeCentralized(data) {
if (!data) {
//
this.editModel.chargeStationCodeList = [];
this.edit();
this.chargeStation.forEach(station=>{
const newModal = Object.assign({}, station);
newModal.controlled = false;
newModal.concentrateStationCode = '';
this.$emit('updateMapModel', newModal);
});
this.modifyChargeStation();
this.setStationStand(this.editModel,'');
}else{
this.setStationStand(this.editModel,this.editModel.code);
}
},
modifyChargeStation(){
this.chargeStation.forEach(station=>{
const newModal = Object.assign({}, station);
newModal.controlled = false;
newModal.concentrateStationCode = '';
// {}
this.setStationStand(station,"");
this.$emit('updateMapModel', newModal);
});
},
// {}
setStationStand(station,code){
this.stationStandList.forEach(elem=>{
if(elem.stationCode==station.code){
const stationStand = Object.assign({}, elem);
stationStand.deviceStationCode=code;
this.$emit('updateMapModel', stationStand);
}
});
},
hover(field) {
this.field = field === this.field ? '' : field;
this.$emit('stationSectionCode', this.field);

View File

@ -18,7 +18,7 @@
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-form ref="make" :model="addModel" label-width="120px" size="mini" :rules="makeRules">
<el-form-item :label="$t('map.stationstandName')" prop="stationCode">
<el-select v-model="addModel.stationCode" filterable>
<el-select v-model="addModel.stationCode" filterable multiple style="width: 350px;">
<el-option
v-for="item in stationList"
:key="item.code"
@ -77,7 +77,7 @@ export default {
// lskContent: ''
},
addModel: {
stationCode: ''
stationCode: []
},
makeRules: {
stationCode: [
@ -190,27 +190,30 @@ export default {
create() {
this.$refs['make'].validate((valid) => {
if (valid) {
if (this.addModel.stationCode) {
const uid = getUID('StationControl');
const model = {
_type: 'StationControl',
code: uid
// zokContent: '',
// zbjkContent: '',
// zakContent: '',
// jjzkContent: '',
// zzkContent: '',
// lskContent: ''
};
this.stationList.forEach(elem => {
if (elem.code === this.addModel.stationCode) {
model.name = 'StationControl_' + elem.name.replace('Station_', '');
model.position = { x: elem.position.x, y: elem.position.y };
model.stationCode = elem.code;
}
if (this.addModel.stationCode.length) {
const models = [];
this.addModel.stationCode.forEach(item => {
const uid = getUID('StationControl');
const model = {
_type: 'StationControl',
code: uid
// zokContent: '',
// zbjkContent: '',
// zakContent: '',
// jjzkContent: '',
// zzkContent: '',
// lskContent: ''
};
this.stationList.forEach(elem => {
if (elem.code === item) {
model.name = 'StationControl_' + elem.name.replace('Station_', '');
model.position = { x: elem.position.x, y: elem.position.y + 30 };
model.stationCode = elem.code;
}
});
models.push(model);
});
this.$emit('updateMapModel', model);
this.$emit('updateMapModel', models);
} else {
this.$messageBox(this.$t('tip.selectedStationEmpty'));
}