@@ -54,7 +54,7 @@ export default {
code: '',
name: '',
// visible: '',
- concentrateStationList:[],
+ // concentrateStationList:[],
position: {
x: 0,
y: 0
@@ -64,12 +64,13 @@ export default {
code: '',
name: '',
// visible: '',
- concentrateStationList:[],
+ // concentrateStationList:[],
position: {
x: 0,
y: 0
}
},
+ field:'',
rules: {
code: [
{ required: true, message: this.$t('rules.pleaseSelectEncoding'), trigger: 'change' }
@@ -80,9 +81,9 @@ export default {
// visible: [
// { required: true, message: this.$t('rules.visible'), trigger: 'change' }
// ],
- concentrateStationList:[
- { required: true, message: this.$t('rules.selectConcentrateStation'), trigger: 'change' }
- ],
+ // concentrateStationList:[
+ // { required: true, message: this.$t('rules.selectConcentrateStation'), trigger: 'change' }
+ // ],
'position.x': [
{ required: true, message: this.$t('rules.trainPositionX'), trigger: 'blur' }
],
@@ -94,9 +95,11 @@ export default {
},
computed: {
...mapGetters('map', [
- 'zcList',
- 'stationList'
+ 'zcList'
]),
+ isButtonType() {
+ return this.field == 'checkZcSection';
+ },
form() {
const form = {
labelWidth: '150px',
@@ -114,8 +117,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, deviceChange: this.changeConcentrateStation }
+ ] }
+ // { prop:'concentrateStationList', label:this.$t('map.concentrateStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.concertrateStation, deviceChange: this.changeConcentrateStation }
]
}
}
@@ -134,7 +137,10 @@ export default {
{ 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.changeConcentrateStation }
+
+ { prop:'sectionList', label:'关联区段: ', type: 'checkBoxDevice', getName:this.getName, mouseenter:this.mouseenter, mouseleave:this.mouseleave, buttonShowType:this.isButtonType, hover:this.hover, buttonType:'checkZcSection'}
+ //
+ // { prop:'concentrateStationList', label:this.$t('map.concentrateStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.concertrateStation, deviceChange: this.changeConcentrateStation }
]
}
}
@@ -143,51 +149,28 @@ export default {
}
},
watch: {
- stationList() {
- this.getConcertrateStation();
- }
- },
- mounted() {
- this.getConcertrateStation();
},
+ // mounted() {
+ // this.getConcertrateStation();
+ // },
methods: {
deviceChange(code) {
this.$emit('setCenter', code);
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
},
- changeConcentrateStation() {},
- handleClick() {
- this.getConcertrateStation();
- },
deviceSelect(selected) {
+ // debugger;
+ // 待调整
this.$refs.dataform && this.$refs.dataform.resetFields();
this.$refs.make && 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.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));
- return station.centralized;
- // } else {
- // return station.centralized && !( beConcentrateStation[station.code]);
- // }
- });
- },
create() {
const uid = getUID('ZcControl', this.zcList);
- let models = [];
+ const models = [];
const model = {
_type: 'ZcControl',
code: uid,
@@ -195,16 +178,11 @@ export default {
position: {
x: this.addModel.position.x,
y: this.addModel.position.y
- },
- concentrateStationList:this.addModel.concentrateStationList
+ }
};
models.push(model);
- model.concentrateStationList.forEach(stationCode=>{
- const arr = this.setStationStand(stationCode, model.code);
- models = [...models, ...arr];
- });
+
this.$emit('updateMapModel', models);
- this.getConcertrateStation();
this.$refs.createForm.resetForm();
},
// 修改对象
@@ -212,11 +190,7 @@ export default {
this.$refs['dataform'].validate((valid) => {
if (valid) {
const data = Object.assign({_type: 'ZcControl'}, this.editModel);
- let models = [data];
- data.concentrateStationList.forEach(stationCode=>{
- const arr = this.setStationStand(stationCode, data.code);
- models = [...models, ...arr];
- });
+ const models = [data];
this.$emit('updateMapModel', models);
this.$emit('deviceSelect', '');
}
@@ -231,16 +205,6 @@ export default {
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
- this.concertrateStation.forEach(station=>{
- selected.concentrateStationList.forEach(stationCode=>{
- switch (stationCode) {
- case station.code: {
- this.setStationStand(station.code, '');
- break;
- }
- }
- });
- });
this.$emit('updateMapModel', {...selected, _dispose: true});
this.$refs.dataform && this.$refs.dataform.resetFields();
}).catch(() => {
@@ -248,19 +212,18 @@ export default {
});
}
},
- // 设置车站所属ZC区域
- setStationStand(stationCode, code) {
- const arr = [];
- this.stationList.forEach(elem=>{
- if (elem.code == stationCode) {
- const station = deepAssign({}, elem);
- // const station = Object.assign({}, elem);
- station.zcCode = code;
- arr.push(station);
- // this.$emit('updateMapModel', station);
- }
- });
- return arr; // 返回设置的车站list
+ getName(code) {
+ const section = this.$store.getters['map/getDeviceByCode'](code);
+ return section.name || '';
+ },
+ mouseenter(code) {
+
+ },
+ mouseleave(code) {
+
+ },
+ hover(field) {
+ this.field = field === this.field ? '' : field;
}
// changeConcertrateStation(data) {
// if (data.length > 0) {