panhui 4 лет назад
Родитель
Сommit
6467569c69

+ 63 - 11
src/main/vue/src/views/performance/ArrangeJudgeList.vue

@@ -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
+                    };
+                }
+            }
         }
         }
     }
     }
 };
 };

+ 25 - 2
src/main/vue/src/views/performance/PerformanceEdit.vue

@@ -7,7 +7,7 @@
             label-width="100px"
             label-width="100px"
             label-position="right"
             label-position="right"
             size="small"
             size="small"
-            style="max-width: 700px;"
+            style="max-width: 700px"
         >
         >
             <el-form-item prop="year" label="年度">
             <el-form-item prop="year" label="年度">
                 <el-select v-model="formData.year" style="width: 300px" @change="getName" :disabled="edit">
                 <el-select v-model="formData.year" style="width: 300px" @change="getName" :disabled="edit">
@@ -159,8 +159,31 @@ export default {
                     console.log(e);
                     console.log(e);
                     this.$message.error(e.error);
                     this.$message.error(e.error);
                 });
                 });
+        } else {
+            this.$http.post('/performance/lastYear').then(res => {
+                if (res.programmeNum > 0) {
+                    this.edit = true;
+                }
+                if (typeof res.performanceEnquiries != 'undefined') {
+                    this.phones = res.performanceEnquiries;
+                }
+                this.dateRange = [res.startDate, res.endDate];
+
+                this.$http
+                    .post('/performanceSchedule/all', { size: 100, query: { performanceId: res.id } }, { body: 'json' })
+                    .then(res => {
+                        this.schedules = res.content.map(item => {
+                            delete item.id;
+                            return item;
+                        });
+                    });
+
+                delete res.id;
+                delete res.del;
+                this.formData = res;
+            });
         }
         }
-        this.getAdmin();
+        // this.getAdmin();
     },
     },
     data() {
     data() {
         return {
         return {