|
@@ -11,12 +11,14 @@
|
|
</el-row>
|
|
</el-row>
|
|
<el-row>
|
|
<el-row>
|
|
<el-table :data="list" border :span-method="objectSpanMethod">
|
|
<el-table :data="list" border :span-method="objectSpanMethod">
|
|
- <el-table-column label="期数" prop="term1" align="center"> </el-table-column>
|
|
|
|
- <el-table-column label="班级数" prop="class" align="center"> </el-table-column>
|
|
|
|
- <el-table-column label="时间" prop="date" align="center"> </el-table-column>
|
|
|
|
|
|
+ <el-table-column label="期数" prop="term" align="center"> </el-table-column>
|
|
|
|
+ <el-table-column label="班级名称" prop="name" align="center"> </el-table-column>
|
|
|
|
+ <el-table-column label="时间" prop="date" align="center">
|
|
|
|
+ <template slot-scope="scope"> {{ scope.row.startdate }}-{{ scope.row.enddate }} </template>
|
|
|
|
+ </el-table-column>
|
|
<el-table-column v-for="info in rightHeader" :prop="info.id" :key="info.id" :label="info.name" align="center">
|
|
<el-table-column v-for="info in rightHeader" :prop="info.id" :key="info.id" :label="info.name" align="center">
|
|
- <template slot-scope="scope">
|
|
|
|
- {{ scope.row[scope.row.id] }}
|
|
|
|
|
|
+ <template v-slot="{ row }">
|
|
|
|
+ {{ dirData(info.id, row) }}
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column label="督导值班" prop="term7" align="center">
|
|
<el-table-column label="督导值班" prop="term7" align="center">
|
|
@@ -26,7 +28,7 @@
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column label="月份" prop="month" align="center"> </el-table-column>
|
|
<el-table-column label="月份" prop="month" align="center"> </el-table-column>
|
|
<el-table-column label="班级总数" prop="num" align="center">
|
|
<el-table-column label="班级总数" prop="num" align="center">
|
|
- <template v-slot="{ row }">{{ classNum(row.date) }}</template>
|
|
|
|
|
|
+ <template v-slot="{ row }">{{ classNum(row.startdate) }}</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
</el-row>
|
|
</el-row>
|
|
@@ -54,198 +56,12 @@ export default {
|
|
data: function() {
|
|
data: function() {
|
|
return {
|
|
return {
|
|
loading: true,
|
|
loading: true,
|
|
|
|
+ // 动态部门列表
|
|
rightHeader: [],
|
|
rightHeader: [],
|
|
- list: [
|
|
|
|
- {
|
|
|
|
- term1: '310',
|
|
|
|
- class: '2',
|
|
|
|
- date: '3.11-3.16',
|
|
|
|
- metting: '',
|
|
|
|
- term2: '',
|
|
|
|
- term3: '',
|
|
|
|
- term4: '',
|
|
|
|
- term5: '',
|
|
|
|
- term6: '',
|
|
|
|
- term7: '',
|
|
|
|
- month: '3',
|
|
|
|
- num: '',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- term1: '310',
|
|
|
|
- class: '2',
|
|
|
|
- date: '3.12-3.17',
|
|
|
|
- metting: '',
|
|
|
|
- term2: '',
|
|
|
|
- term3: '',
|
|
|
|
- term4: '',
|
|
|
|
- term5: '',
|
|
|
|
- term6: '',
|
|
|
|
- term7: '',
|
|
|
|
- month: '3',
|
|
|
|
- num: '',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- term1: '310',
|
|
|
|
- class: '3',
|
|
|
|
- date: '3.13-3.18',
|
|
|
|
- metting: '',
|
|
|
|
- term2: '',
|
|
|
|
- term3: '',
|
|
|
|
- term4: '',
|
|
|
|
- term5: '',
|
|
|
|
- term6: '',
|
|
|
|
- term7: '',
|
|
|
|
- month: '3',
|
|
|
|
- num: '',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- term1: '311',
|
|
|
|
- class: '2',
|
|
|
|
- date: '3.17-3.22',
|
|
|
|
- metting: '',
|
|
|
|
- term2: '',
|
|
|
|
- term3: '',
|
|
|
|
- term4: '',
|
|
|
|
- term5: '',
|
|
|
|
- term6: '',
|
|
|
|
- term7: '',
|
|
|
|
- month: '3',
|
|
|
|
- num: '',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- term1: '311',
|
|
|
|
- class: '2',
|
|
|
|
- date: '3.18-3.23',
|
|
|
|
- metting: '',
|
|
|
|
- term2: '',
|
|
|
|
- term3: '',
|
|
|
|
- term4: '',
|
|
|
|
- term5: '',
|
|
|
|
- term6: '',
|
|
|
|
- term7: '',
|
|
|
|
- month: '3',
|
|
|
|
- num: '',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- term1: '311',
|
|
|
|
- class: '3',
|
|
|
|
- date: '3.19-3.24',
|
|
|
|
- metting: '',
|
|
|
|
- term2: '',
|
|
|
|
- term3: '',
|
|
|
|
- term4: '',
|
|
|
|
- term5: '',
|
|
|
|
- term6: '',
|
|
|
|
- term7: '',
|
|
|
|
- month: '3',
|
|
|
|
- num: '',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- term: '3',
|
|
|
|
- term1: '312',
|
|
|
|
- class: '2',
|
|
|
|
- date: '3.23-3.28',
|
|
|
|
- metting: '',
|
|
|
|
- term2: '',
|
|
|
|
- term3: '',
|
|
|
|
- term4: '',
|
|
|
|
- term5: '',
|
|
|
|
- term6: '',
|
|
|
|
- term7: '',
|
|
|
|
- month: '3',
|
|
|
|
- num: '',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- term: '3',
|
|
|
|
- term1: '312',
|
|
|
|
- class: '2',
|
|
|
|
- date: '3.24-3.29',
|
|
|
|
- metting: '',
|
|
|
|
- term2: '',
|
|
|
|
- term3: '',
|
|
|
|
- term4: '',
|
|
|
|
- term5: '',
|
|
|
|
- term6: '',
|
|
|
|
- term7: '',
|
|
|
|
- month: '3',
|
|
|
|
- num: '',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- term: '3',
|
|
|
|
- term1: '312',
|
|
|
|
- class: '3',
|
|
|
|
- date: '3.25-3.30',
|
|
|
|
- metting: '',
|
|
|
|
- term2: '',
|
|
|
|
- term3: '',
|
|
|
|
- term4: '',
|
|
|
|
- term5: '',
|
|
|
|
- term6: '',
|
|
|
|
- term7: '',
|
|
|
|
- month: '3',
|
|
|
|
- num: '',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- term: '4',
|
|
|
|
- term1: '313',
|
|
|
|
- class: '2',
|
|
|
|
- date: '3.29-4.3',
|
|
|
|
- metting: '',
|
|
|
|
- term2: '',
|
|
|
|
- term3: '',
|
|
|
|
- term4: '',
|
|
|
|
- term5: '',
|
|
|
|
- term6: '',
|
|
|
|
- term7: '',
|
|
|
|
- month: '3',
|
|
|
|
- num: '',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- term: '4',
|
|
|
|
- term1: '313',
|
|
|
|
- class: '2',
|
|
|
|
- date: '3.30-4.4',
|
|
|
|
- metting: '',
|
|
|
|
- term2: '',
|
|
|
|
- term3: '',
|
|
|
|
- term4: '',
|
|
|
|
- term5: '',
|
|
|
|
- term6: '',
|
|
|
|
- term7: '',
|
|
|
|
- month: '3',
|
|
|
|
- num: '',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- term: '5',
|
|
|
|
- term1: '314',
|
|
|
|
- class: '2',
|
|
|
|
- date: '4.1-4.6',
|
|
|
|
- metting: '',
|
|
|
|
- term2: '',
|
|
|
|
- term3: '',
|
|
|
|
- term4: '',
|
|
|
|
- term5: '',
|
|
|
|
- term6: '',
|
|
|
|
- term7: '',
|
|
|
|
- month: '4',
|
|
|
|
- num: '',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- term: '5',
|
|
|
|
- term1: '314',
|
|
|
|
- class: '2',
|
|
|
|
- date: '4.2-4.7',
|
|
|
|
- metting: '',
|
|
|
|
- term2: '',
|
|
|
|
- term3: '',
|
|
|
|
- term4: '',
|
|
|
|
- term5: '',
|
|
|
|
- term6: '',
|
|
|
|
- term7: '',
|
|
|
|
- month: '4',
|
|
|
|
- num: '',
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
|
|
+ // 教师列表
|
|
|
|
+ dirList: [],
|
|
|
|
+ // 全年计划列表
|
|
|
|
+ list: [],
|
|
};
|
|
};
|
|
},
|
|
},
|
|
async created() {
|
|
async created() {
|
|
@@ -254,61 +70,48 @@ export default {
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
...director({ getDirList: 'query' }),
|
|
...director({ getDirList: 'query' }),
|
|
- ...mapDept({ getDept: 'query' }),
|
|
|
|
|
|
+ ...mapDept({ getDept: 'query', getDeptFetch: 'fetch' }),
|
|
...mapActions(['divide', 'findTeacher']),
|
|
...mapActions(['divide', 'findTeacher']),
|
|
...classes(['query', 'upHeadTea']),
|
|
...classes(['query', 'upHeadTea']),
|
|
// 查询部门加班主任
|
|
// 查询部门加班主任
|
|
async getOtherList() {
|
|
async getOtherList() {
|
|
let res = await this.getDept();
|
|
let res = await this.getDept();
|
|
if (this.$checkRes(res)) this.$set(this, `rightHeader`, res.data);
|
|
if (this.$checkRes(res)) this.$set(this, `rightHeader`, res.data);
|
|
- // res = await this.getDirList();
|
|
|
|
- // if (this.$checkRes(res)) this.$set(this, `dirList`, res.data);
|
|
|
|
|
|
+ res = await this.getDirList();
|
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `dirList`, res.data);
|
|
},
|
|
},
|
|
async search() {
|
|
async search() {
|
|
let planid = _.get(this.defaultOption, 'planid');
|
|
let planid = _.get(this.defaultOption, 'planid');
|
|
if (!planid) return;
|
|
if (!planid) return;
|
|
let res = await this.query({ planid });
|
|
let res = await this.query({ planid });
|
|
- console.log(res);
|
|
|
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `list`, res.data);
|
|
},
|
|
},
|
|
- // 转换
|
|
|
|
- ptc(date) {
|
|
|
|
- return moment(date).format('YYYY-MM-DD');
|
|
|
|
|
|
+ // 筛选教师
|
|
|
|
+ dirData(id, row) {
|
|
|
|
+ var dir = this.dirList.filter(item => item.id == row.headteacherid);
|
|
|
|
+ let data = dir.find(i => i.department == id);
|
|
|
|
+ if (data) return data.name;
|
|
},
|
|
},
|
|
// 计算班级数
|
|
// 计算班级数
|
|
classNum(month) {
|
|
classNum(month) {
|
|
- month = moment(this.ptc(month.split('-')[0])).month() + 1;
|
|
|
|
|
|
+ month = moment(month).month() + 1;
|
|
let newMonth = this.list.map(i => {
|
|
let newMonth = this.list.map(i => {
|
|
- i.month = moment(this.ptc(i.date.split('-')[0])).month() + 1;
|
|
|
|
|
|
+ i.month = moment(i.startdate).month() + 1;
|
|
return i;
|
|
return i;
|
|
});
|
|
});
|
|
let data = _.groupBy(newMonth, 'month');
|
|
let data = _.groupBy(newMonth, 'month');
|
|
let newData = data[month];
|
|
let newData = data[month];
|
|
- let num = newData.reduce((p, n) => p + n.class * 1, 0);
|
|
|
|
|
|
+ let num = newData.length;
|
|
return num;
|
|
return num;
|
|
},
|
|
},
|
|
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
- // loadsh
|
|
|
|
- // flatten:减维
|
|
|
|
- // toPairs:把object转换成数组
|
|
|
|
- // groupBy:创建对象,根据条件,Math.floor,length,字段
|
|
|
|
- // filter:过滤数组
|
|
|
|
- // find:查找
|
|
|
|
- // every:每一项
|
|
|
|
|
|
+ // console.log(row, column, rowIndex, columnIndex);
|
|
let prop = _.get(column, 'property');
|
|
let prop = _.get(column, 'property');
|
|
- if (prop === 'term1' || prop === 'term7') {
|
|
|
|
- // groupBy创建对象并根据条件过滤出来object,并用toPairs转换成数组,并降维,filter过滤出是数组的数据
|
|
|
|
- let data = _.flatten(_.toPairs(_.groupBy(this.list, 'term1'))).filter(_.isArray);
|
|
|
|
- // 根据数组找出跟当前数组一致的数组
|
|
|
|
- let num = data.find(i => i.every(e => e.term1 === row.term1));
|
|
|
|
- // 时间转换
|
|
|
|
- let newNum = num.map(i => {
|
|
|
|
- i.newDate = this.ptc(i.date.split('-')[0]);
|
|
|
|
- return i;
|
|
|
|
- });
|
|
|
|
- // 根据标准时间进行正序排序
|
|
|
|
- let newOder = _.orderBy(newNum, ['newDate'], ['asc']);
|
|
|
|
- // 找到数组里面的下标,根据时间
|
|
|
|
- let rowi = newOder.findIndex(i => i.newDate == this.ptc(row.date.split('-')[0]));
|
|
|
|
|
|
+ if (prop === 'term' || prop === 'term7') {
|
|
|
|
+ let data = _.flatten(_.toPairs(_.groupBy(this.list, 'term'))).filter(_.isArray);
|
|
|
|
+ let num = data.find(i => i.every(e => e.term === row.term));
|
|
|
|
+ let newOder = _.orderBy(num, ['startdate'], ['asc']);
|
|
|
|
+ let rowi = newOder.findIndex(i => i.startdate == row.startdate);
|
|
if (rowi === 0) {
|
|
if (rowi === 0) {
|
|
return {
|
|
return {
|
|
rowspan: num.length,
|
|
rowspan: num.length,
|
|
@@ -322,7 +125,7 @@ export default {
|
|
}
|
|
}
|
|
} else if (prop === 'month' || prop === 'num') {
|
|
} else if (prop === 'month' || prop === 'num') {
|
|
let newMonth = this.list.map(i => {
|
|
let newMonth = this.list.map(i => {
|
|
- i.month = moment(this.ptc(i.date.split('-')[0])).month() + 1;
|
|
|
|
|
|
+ i.month = moment(i.startdate).month() + 1;
|
|
return i;
|
|
return i;
|
|
});
|
|
});
|
|
let data = _.flatten(_.toPairs(_.groupBy(newMonth, 'month'))).filter(_.isArray);
|
|
let data = _.flatten(_.toPairs(_.groupBy(newMonth, 'month'))).filter(_.isArray);
|