延续保护区段预览详情合并rowspan

This commit is contained in:
fan 2019-12-25 10:58:58 +08:00
parent 432b268675
commit df7f13d411

View File

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