This commit is contained in:
zyy 2019-12-25 18:45:53 +08:00
commit 1c04b8d215
5 changed files with 111 additions and 35 deletions

View File

@ -194,6 +194,9 @@ export default {
} else {
return '';
}
},
newRouteOverlapSectionList() {
return JSON.stringify(this.addOverlapModel.routeOverlapSectionList);
}
},
watch: {
@ -213,14 +216,18 @@ export default {
this.editShow = true;
}
},
'addOverlapModel.routeOverlapSectionList': function (val, old) {
if (old && old.length) {
this.changeSectionSelected(old, false, 'continueProtectSection' );
}
if (val && val.length) {
this.changeSectionSelected(val, true, 'continueProtectSection' );
}
newRouteOverlapSectionList:{
handler: function(val, old) {
const obj = JSON.parse(val);
const objOld = JSON.parse(old);
if (objOld && objOld.length) {
this.changeSectionSelected(objOld, false, 'continueProtectSection' );
}
if (obj && obj.length) {
this.changeSectionSelected(obj, true, 'continueProtectSection' );
}
},
deep: true
}
},
mounted() {
@ -257,8 +264,11 @@ export default {
setSelected(selected) {
if (selected) {
if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'routeOverlapSectionList'.toUpperCase()) {
if ((selected.type === '01' || selected.type === '03' || selected.tyoe === '02') && this.addOverlapModel.routeOverlapSectionList.indexOf(selected.code) === -1) {
const sectionIndex = this.addOverlapModel.routeOverlapSectionList.indexOf(selected.code);
if ((selected.type === '01' || selected.type === '03' || selected.type === '02') && sectionIndex === -1) {
this.addOverlapModel.routeOverlapSectionList.push(selected.code);
} else if ( sectionIndex !== -1 ) {
this.addOverlapModel.routeOverlapSectionList.splice(sectionIndex, 1);
}
} else if (selected._type.toUpperCase() === 'Switch'.toUpperCase() && this.field.toUpperCase() === 'routeOverlapSwitchList'.toUpperCase()) {
this.overlapCode = selected.code;

View File

@ -9,7 +9,7 @@
append-to-body
>
<el-table ref="protetTable" border :data="data">
<el-table ref="protetTable" border :data="data" :span-method="objectSpanMethod">
<el-table-column key="1" label="解锁区段" prop="unlockSectionCode" />
<el-table-column key="2" label="解锁时间(s)" prop="unlockTime" />
<el-table-column key="3" label="延时保护线路" prop="">
@ -49,7 +49,8 @@ export default {
return {
show: false,
title: '',
data: []
data: [],
sectionListNumList: []
};
},
computed: {
@ -61,10 +62,13 @@ export default {
methods: {
doShow(data) {
this.data = [];
this.sectionListNumList = [];
data.relSectionSwitchList.forEach(item => {
const unlockSectionName = this.handleRouteOverlapSectionList(item, data.unlockSectionCode);
if (item.routeOverlapSwitchList.length) {
this.sectionListNumList.push(item.routeOverlapSwitchList.length);
item.routeOverlapSwitchList.forEach( ele => {
this.sectionListNumList.push(0);
const column = {
unlockSectionCode: unlockSectionName,
unlockTime: data.unlockTime,
@ -75,7 +79,9 @@ export default {
this.$convertSpecifiedField(column, this.switchList, 'code', 'name', ['switchCode']);
this.data.push(column);
} );
this.sectionListNumList.pop();
} else {
this.sectionListNumList.push(1);
const column = {
unlockSectionCode: unlockSectionName,
unlockTime: data.unlockTime,
@ -102,6 +108,26 @@ export default {
},
doClose(done) {
this.show = false;
},
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if (column.property === 'unlockSectionCode' || column.property === 'unlockTime') {
if (rowIndex === 0) {
return {
rowspan: this.data.length,
colspan: 1
};
} else {
return {
rowspan: 0,
colspan: 0
};
}
} else if (column.property === 'routeOverlapSectionList') {
return {
rowspan: this.sectionListNumList[rowIndex],
colspan: 1
};
}
}
}
};

View File

@ -320,6 +320,9 @@ export default {
]
};
return baseRules;
},
newRouteSectionList() {
return JSON.stringify(this.addModel.routeSectionList);
}
},
watch: {
@ -345,16 +348,21 @@ export default {
this.addModel.name = val;
}
},
'addModel.routeSectionList': function(val, old) {
if (old && old.length) {
this.changeSectionSelected(old, false, 'routePhysicalSection');
}
if (val && val.length) {
if (!this.addModel.code) {
this.$refs.protect.addModel.unlockSectionCode = val[val.length - 1];
newRouteSectionList: {
handler: function (val, old) {
const obj = JSON.parse(val);
const objOld = JSON.parse(old);
if (objOld && objOld.length) {
this.changeSectionSelected(objOld, false, 'routePhysicalSection');
}
this.changeSectionSelected(val, true, 'routePhysicalSection');
}
if (obj && obj.length) {
if (!this.addModel.code) {
this.$refs.protect.addModel.unlockSectionCode = obj[obj.length - 1];
}
this.changeSectionSelected(obj, true, 'routePhysicalSection');
}
},
deep: true
},
'addModel.startSignalCode': function (val, old) {
if (old) {
@ -504,9 +512,12 @@ export default {
changeSectionSelected(list, flag, type) {
list && list.forEach((item) => {
const section = this.$store.getters['map/getDeviceByCode'](item);
if (section.logicSectionCodeList && section.logicSectionCodeList.length) {
if (section.logicSectionCodeList && section.logicSectionCodeList.length > 0) {
section.logicSectionCodeList.forEach( (logicSectionCode) => {
this.$store.getters['map/getDeviceByCode'](logicSectionCode).instance.drawBatchSelected(flag, flag ? type : '');
const logicSection = this.$store.getters['map/getDeviceByCode'](logicSectionCode);
if (logicSection) {
logicSection.instance.drawBatchSelected(flag, flag ? type : '');
}
});
} else {
section.instance.drawBatchSelected(flag, flag ? type : '');
@ -524,10 +535,15 @@ export default {
} else if (selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() === 'endSignalCode'.toUpperCase()) {
this.addModel.endSignalCode = selected.code;
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'routeSectionList'.toUpperCase()) {
if ((selected.type === '01' || selected.type === '03') && this.addModel.routeSectionList.indexOf(selected.code) === -1) {
const sectionIndex = this.addModel.routeSectionList.indexOf(selected.code);
if ((selected.type === '01' || selected.type === '03') && sectionIndex === -1) {
this.addModel.routeSectionList.push(selected.code);
} else if (selected.type === '02' && this.addModel.routeSectionList.indexOf(selected.parentCode) === -1) {
this.addModel.routeSectionList.push(selected.parentCode);
} else if ((selected.type === '01' || selected.type === '03') && sectionIndex !== -1) {
this.addModel.routeSectionList.splice(sectionIndex, 1);
} else if (selected.type === '02' && this.addModel.routeSectionList.indexOf(selected.parentCode) !== -1) {
this.addModel.routeSectionList.splice(this.addModel.routeSectionList.indexOf(selected.parentCode), 1);
}
} else if (selected._type.toUpperCase() === 'Switch'.toUpperCase() && this.field.toUpperCase() === 'routeSwitchList'.toUpperCase()) {
this.routeCode = selected.code;

View File

@ -99,7 +99,10 @@ export default {
...mapGetters('map', [
'signalList',
'sectionList'
])
]),
newRouteSectionList() {
return JSON.stringify(this.addModel.routeSectionList);
}
},
watch: {
mapInfo(val) {
@ -112,12 +115,25 @@ export default {
this.addModel = val;
}
},
'addModel.routeSectionList': function(val, old) {
if (old && old.length) {
this.changeSectionSelected(old, false, 'signalNearSection');
newRouteSectionList: {
handler: function(val, old) {
const obj = JSON.parse(val);
const objOld = JSON.parse(old);
if (objOld && objOld.length) {
this.changeSectionSelected(objOld, false, 'signalNearSection');
}
if (obj && obj.length) {
this.changeSectionSelected(obj, true, 'signalNearSection');
}
},
deep: true
},
'addModel.signalCode': function (val, old) {
if (old) {
this.changeSignalSelected(old, false, 'routeSignal');
}
if (val && val.length) {
this.changeSectionSelected(val, true, 'signalNearSection');
if (val) {
this.changeSignalSelected(val, true, 'routeSignal');
}
}
},
@ -208,6 +224,11 @@ export default {
},
signalNearSectionListFocus(flag) {
this.changeSectionSelected(this.addModel.routeSectionList, flag, 'signalNearSection');
this.changeSignalSelected(this.addModel.signalCode, flag, 'routeSignal');
},
changeSignalSelected(val, flag, type) {
const signal = this.$store.getters['map/getDeviceByCode'](val);
signal && signal.instance.drawBatchSelected(flag, flag ? type : '');
},
changeSectionSelected(list, flag, type) {
list && list.forEach((item) => {

View File

@ -129,7 +129,7 @@ export default {
name: this.$t('map.mapData'),
item: [
{ prop: 'deviceStationCode', label: this.$t('map.equipmentStation'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.stationList, disabled:true},
{ prop: 'stationCode', label: this.$t('map.belongsStation'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList }
{ prop: 'stationCode', label: this.$t('map.belongsStation'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList, change: true, deviceChange: this.changeStation }
]
}
}
@ -258,6 +258,9 @@ export default {
this.field = field === this.field ? '' : field;
this.$emit('standStationCode', this.field);
},
changeStation(station) {
this.editModel.deviceStationCode = this.getDeviceStationCode(station);
},
deviceSelect(selected) {
if (this.field.toUpperCase() != 'standSelectStationCode'.toUpperCase() && selected && selected._type.toUpperCase() === 'StationStand'.toUpperCase()) {
this.$refs.dataform.resetFields();
@ -293,7 +296,7 @@ export default {
name: `PF${this.stationStandList.length + 1}`,
width: this.addModel.width,
height: this.addModel.height,
deviceStationCode: this.getDeviceStationCode(),
deviceStationCode: this.getDeviceStationCode(this.addModel.stationCode),
visible: true,
position: {
x: 0,
@ -343,15 +346,15 @@ export default {
}
});
},
getDeviceStationCode() {
getDeviceStationCode(stationCode) {
//
//
let beCentralizedStation = {};
this.stationList.some(data=>{
if (data.centralized) {
if (data.code == this.addModel.stationCode) {
if (data.code == stationCode) {
beCentralizedStation = {};
beCentralizedStation[this.addModel.stationCode] = data.code;
beCentralizedStation[stationCode] = data.code;
return true;
}
data.chargeStationCodeList.forEach(charge=>{
@ -359,7 +362,7 @@ export default {
});
}
});
return beCentralizedStation[this.addModel.stationCode] || '';
return beCentralizedStation[stationCode] || '';
},
//
edit() {