|
@@ -176,7 +176,8 @@ export default {
|
|
|
competitionGroupOptions: [
|
|
competitionGroupOptions: [
|
|
|
{ label: '个人', value: 'SINGLE' },
|
|
{ label: '个人', value: 'SINGLE' },
|
|
|
{ label: '集体', value: 'COLLECTIVE' }
|
|
{ label: '集体', value: 'COLLECTIVE' }
|
|
|
- ]
|
|
|
|
|
|
|
+ ],
|
|
|
|
|
+ columnKeys: ['date', 'morning', 'address']
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
@@ -227,24 +228,56 @@ export default {
|
|
|
computed: {
|
|
computed: {
|
|
|
selection() {
|
|
selection() {
|
|
|
return this.$refs.table.selection.map(i => i.id);
|
|
return this.$refs.table.selection.map(i => i.id);
|
|
|
|
|
+ },
|
|
|
|
|
+ showTable() {
|
|
|
|
|
+ return this.backMap(this.tableData);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- backMap(list, key = 'date') {
|
|
|
|
|
|
|
+ backMap(list, key = 'date', preActive = 0, keys = ['date', 'morning', 'address']) {
|
|
|
let _map = new Map();
|
|
let _map = new Map();
|
|
|
- list.forEach(item => {
|
|
|
|
|
|
|
+ list.forEach((item, index) => {
|
|
|
|
|
+ let info = {
|
|
|
|
|
+ active: index + preActive,
|
|
|
|
|
+ childNum: 1,
|
|
|
|
|
+ list: []
|
|
|
|
|
+ };
|
|
|
let list = [];
|
|
let list = [];
|
|
|
if (_map.has(item[key])) {
|
|
if (_map.has(item[key])) {
|
|
|
- list = _map.get(item[key]);
|
|
|
|
|
- list.push(item);
|
|
|
|
|
|
|
+ info = _map.get(item[key]);
|
|
|
|
|
+ info.list.push(item);
|
|
|
|
|
+ info.childNum = info.list.length;
|
|
|
} else {
|
|
} else {
|
|
|
- list.push(item);
|
|
|
|
|
|
|
+ info.list.push(item);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- _map.set(item[key], list);
|
|
|
|
|
|
|
+ _map.set(item[key], info);
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+ let keyIndex = keys.indexOf(key);
|
|
|
|
|
+ if (keyIndex !== keys.length - 1) {
|
|
|
|
|
+ [..._map.keys()].forEach(item => {
|
|
|
|
|
+ let info = _map.get(item);
|
|
|
|
|
+ let childMap = this.backMap(info.list, keys[keyIndex + 1], info.active);
|
|
|
|
|
+ _map.set(item, {
|
|
|
|
|
+ ...info,
|
|
|
|
|
+ childMap: childMap
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return _map;
|
|
return _map;
|
|
|
},
|
|
},
|
|
|
|
|
+ getInfo(mapInfo = new Map(), keys = ['date']) {
|
|
|
|
|
+ let info = {};
|
|
|
|
|
+ keys.forEach(item => {
|
|
|
|
|
+ if (mapInfo.has(item)) {
|
|
|
|
|
+ info = mapInfo.get(item);
|
|
|
|
|
+ mapInfo = mapInfo.get(item).childMap;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ return info;
|
|
|
|
|
+ },
|
|
|
competitionGroupFormatter(row, column, cellValue, index) {
|
|
competitionGroupFormatter(row, column, cellValue, index) {
|
|
|
let selectedOption = this.competitionGroupOptions.find(i => i.value === cellValue);
|
|
let selectedOption = this.competitionGroupOptions.find(i => i.value === cellValue);
|
|
|
if (selectedOption) {
|
|
if (selectedOption) {
|
|
@@ -340,10 +373,29 @@ export default {
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
|
- // console.log(row);
|
|
|
|
|
- // console.log(column);
|
|
|
|
|
- // console.log(rowIndex);
|
|
|
|
|
- // console.log(columnIndex);
|
|
|
|
|
|
|
+ let keyIndex = columnIndex;
|
|
|
|
|
+ if (column.label === '操作') {
|
|
|
|
|
+ keyIndex = 2;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (keyIndex < this.columnKeys.length) {
|
|
|
|
|
+ let keys = [...this.columnKeys].slice(0, keyIndex + 1).map(item => {
|
|
|
|
|
+ return row[item];
|
|
|
|
|
+ });
|
|
|
|
|
+ console.log(keys);
|
|
|
|
|
+ let info = this.getInfo(this.showTable, keys);
|
|
|
|
|
+ if (rowIndex === info.active) {
|
|
|
|
|
+ return {
|
|
|
|
|
+ rowspan: info.childNum,
|
|
|
|
|
+ colspan: 1
|
|
|
|
|
+ };
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return {
|
|
|
|
|
+ rowspan: 0,
|
|
|
|
|
+ colspan: 0
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|