@@ -52,11 +52,13 @@ export default {
data() {
return {
activeName: 'first',
+ concertrateStation:[],
mapData: null,
editModel: {
code: '',
name: '',
- visible: '',
+ // visible: '',
+ concentrateStationList:[],
position: {
x: 0,
y: 0
@@ -65,7 +67,8 @@ export default {
addModel: {
code: '',
name: '',
- visible: '',
+ // visible: '',
+ concentrateStationList:[],
position: {
x: 0,
y: 0
@@ -78,8 +81,11 @@ export default {
name: [
{ required: true, message: this.$t('rules.pleaseEnterStatusSignal'), trigger: 'blur' }
],
- visible: [
- { required: true, message: this.$t('rules.visible'), trigger: 'change' }
+ // visible: [
+ // { required: true, message: this.$t('rules.visible'), trigger: 'change' }
+ // ],
+ concentrateStationList:[
+ { required: true, message: this.$t('rules.selectConcentrateStation'), trigger: 'change' }
],
'position.x': [
{ required: true, message: this.$t('rules.trainPositionX'), trigger: 'blur' }
@@ -95,7 +101,8 @@ export default {
'sectionList',
'trainModelList',
'zcList',
- 'lineCode'
+ 'lineCode',
+ 'stationList'
]),
form() {
const form = {
@@ -110,16 +117,13 @@ export default {
item: [
{ prop: 'code', label: `${this.$t('map.zcZoneControl')}${this.$t('map.code')}`, type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.zcList, change: true, deviceChange: this.deviceChange },
{ prop: 'name', label: this.$t('map.statusSignalName'), type: 'input' },
- { prop: 'visible', label: this.$t('map.showZc'), type: 'checkboxx' },
+ // { prop: 'visible', label: this.$t('map.showZc'), type: 'checkboxx' },
{ prop: 'position', label: this.$t('map.stateSignalsPlotCoordinates'), type: 'coordinate', width: '140px', children: [
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px' },
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px' }
- ] }
+ ] },
+ { prop:'concentrateStationList', label:this.$t('map.concentrateStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.concertrateStation, deviceChange:this.changeConcertrateStation }
]
- },
- map: {
- name: this.$t('map.mapData'),
- item: []
}
}
};
@@ -133,7 +137,8 @@ export default {
{ prop: 'position', label: this.$t('map.stateSignalsPlotCoordinates'), type: 'coordinate', width: '140px', children: [
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px' },
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px' }
- ] }
+ ] },
+ { prop:'concentrateStationList', label:this.$t('map.concentrateStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.concertrateStation }
]
};
return form;
@@ -148,6 +153,9 @@ export default {
],
'position.y': [
{ required: true, message: this.$t('rules.trainPositionY'), trigger: 'blur' }
+ ],
+ concentrateStationList:[
+ { required: true, message: this.$t('rules.selectConcentrateStation'), trigger: 'change' }
]
};
}
@@ -158,20 +166,42 @@ export default {
}
},
mounted() {
+ this.getConcertrateStation();
},
methods: {
deviceChange(code) {
this.$emit('setCenter', code);
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
},
+ handleClick() {
+ this.getConcertrateStation();
+ },
deviceSelect(selected) {
this.$refs.dataform.resetFields();
this.$refs.make.resetFields();
if (selected && selected._type.toUpperCase() === 'ZcControl'.toUpperCase()) {
this.activeName = 'first';
this.editModel = deepAssign(this.editModel, selected);
+ this.getConcertrateStation();
}
},
+ getConcertrateStation() {
+ // 被选中的集中站站数据
+ const beConcentrateStation = {};
+ this.zcList = this.$store.getters['map/zcList'];
+ this.zcList.forEach(data=>{
+ data.concentrateStationList.forEach(concentrate=>{
+ beConcentrateStation[concentrate] = data.code;
+ });
+ });
+ this.concertrateStation = this.stationList.filter(station=>{
+ if (this.activeName == 'first') {
+ return station.centralized && !( beConcentrateStation[station.code] && (beConcentrateStation[station.code] != this.editModel.code));
+ } else {
+ return station.centralized && !( beConcentrateStation[station.code]);
+ }
+ });
+ },
create() {
this.$refs.make.validate((valid) => {
if (valid) {
@@ -179,13 +209,16 @@ export default {
const model = {
_type: 'ZcControl',
code: uid,
- visible: true,
name: this.addModel.name,
position: {
x: this.addModel.position.x,
y: this.addModel.position.y
- }
+ },
+ concentrateStationList:this.addModel.concentrateStationList
};
+ model.concentrateStationList.forEach(stationCode=>{
+ this.setStationStand(stationCode, model.code);
+ });
this.$emit('updateMapModel', model);
}
});
@@ -196,6 +229,19 @@ export default {
if (valid) {
const data = Object.assign({_type: 'ZcControl'}, this.editModel);
this.$emit('updateMapModel', data);
+
+ this.concertrateStation.forEach(station=>{
+ this.setStationStand(station.code, '');
+ data.concentrateStationList.forEach(stationCode=>{
+ switch (stationCode) {
+ case station.code: {
+ this.setStationStand(stationCode, this.editModel.code);
+ break;
+ }
+ }
+ });
+ });
+
}
});
},
@@ -215,7 +261,42 @@ export default {
_that.$message.info(this.$t('tip.cancelledDelete'));
});
}
+ },
+ setStationStand(stationCode, code) {
+ this.stationList.forEach(elem=>{
+ if (elem.code == stationCode) {
+ const station = Object.assign({}, elem);
+ station.zcCode = code;
+ this.$emit('updateMapModel', station);
+ }
+ });
}
+ // changeConcertrateStation(data) {
+ // if (data.length > 0) {
+ // debugger;
+ // this.concertrateStation.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;
+ // }
+ // }
+ // });
+ // this.$emit('updateMapModel', newModal);
+ // });
+ // } else {
+ // // 没有选中数据,直接将其他车站设置
+ // this.modifyChargeStation();
+ // }
+ // this.edit();
+ // }
}
};