|
@@ -34,32 +34,43 @@
|
|
|
</template>
|
|
|
</list-frame>
|
|
|
<detail-frame title="学生名签" v-if="view == 'nameList'" :returns="toReturns">
|
|
|
- <name-card :list="studList"></name-card>
|
|
|
+ <name-card v-loading="loading" :list="studList"></name-card>
|
|
|
</detail-frame>
|
|
|
<detail-frame title="学生报道表" v-if="view == 'signList'" :returns="toReturns">
|
|
|
- <sign-list :list="studList"></sign-list>
|
|
|
+ <sign-list v-loading="loading" :list="studList"></sign-list>
|
|
|
+ </detail-frame>
|
|
|
+ <detail-frame title="学生报道表" v-if="view == 'lesson'" :returns="toReturns">
|
|
|
+ <lesson-table v-loading="loading" :data="classInfo" :th="lth" :tr="ltr" :lessons="lessons"></lesson-table>
|
|
|
</detail-frame>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import _ from 'lodash';
|
|
|
+import axios from 'axios';
|
|
|
import signList from './parts/print-sign';
|
|
|
import dataTable from '@frame/components/filter-page-table';
|
|
|
import nameCard from '@/views/student/namCard.vue';
|
|
|
+import lessonTable from '@frame/parts/time-table.vue';
|
|
|
import listFrame from '@frame/layout/admin/list-frame';
|
|
|
import detailFrame from '@frame/layout/admin/detail-frame';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
const { mapActions: classes } = createNamespacedHelpers('classes');
|
|
|
const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
|
|
|
const { mapActions: student } = createNamespacedHelpers('student');
|
|
|
+const { mapActions: util } = createNamespacedHelpers('util');
|
|
|
+const { mapActions: location } = createNamespacedHelpers('location'); //地点
|
|
|
+const { mapActions: teacher } = createNamespacedHelpers('teacher'); //教师
|
|
|
+const { mapActions: director } = createNamespacedHelpers('director'); //教师
|
|
|
+
|
|
|
export default {
|
|
|
name: 'print',
|
|
|
props: {},
|
|
|
- components: { listFrame, nameCard, detailFrame, dataTable, signList },
|
|
|
+ components: { listFrame, nameCard, detailFrame, dataTable, signList, lessonTable },
|
|
|
data: function() {
|
|
|
return {
|
|
|
view: 'list',
|
|
|
+ loading: false,
|
|
|
form: {},
|
|
|
termList: [],
|
|
|
batchList: [],
|
|
@@ -88,9 +99,12 @@ export default {
|
|
|
],
|
|
|
total: 0,
|
|
|
classList: [],
|
|
|
-
|
|
|
//打印数据
|
|
|
studList: [],
|
|
|
+ classInfo: {},
|
|
|
+ lth: [], //table表头
|
|
|
+ ltr: [], //table y轴
|
|
|
+ lessons: [], //原始课表,取出来什么样就什么样
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -100,6 +114,10 @@ export default {
|
|
|
...trainplan({ planfetch: 'fetch' }),
|
|
|
...classes({ classesquery: 'query' }),
|
|
|
...student({ getStudentList: 'query' }),
|
|
|
+ ...util({ modelFetch: 'fetch' }),
|
|
|
+ ...location({ getLocation: 'fetch' }),
|
|
|
+ ...teacher({ getTeacher: 'fetch' }),
|
|
|
+ ...director({ getDirector: 'fetch' }),
|
|
|
async searchinfo() {
|
|
|
const res = await this.planfetch(this.defaultOption.planid);
|
|
|
let terms = res.data.termnum;
|
|
@@ -116,8 +134,8 @@ export default {
|
|
|
this.$set(this, `batchList`, batchnum);
|
|
|
}
|
|
|
},
|
|
|
- async search() {
|
|
|
- const res = await this.classesquery({ batchid: this.form.batchid, termid: this.form.termid });
|
|
|
+ async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
+ const res = await this.classesquery({ skip, limit, batchid: this.form.batchid, termid: this.form.termid });
|
|
|
this.$set(this, `tableData`, res.data);
|
|
|
this.$set(this, `total`, res.total);
|
|
|
},
|
|
@@ -125,22 +143,69 @@ export default {
|
|
|
this.classList = val;
|
|
|
},
|
|
|
async nameList({ data }) {
|
|
|
+ this.loading = true;
|
|
|
+ this.view = 'nameList';
|
|
|
let { _id: classid } = data;
|
|
|
let res = await this.getStudentList({ classid });
|
|
|
if (this.$checkRes(res)) this.$set(this, `studList`, res.data);
|
|
|
- this.view = 'nameList';
|
|
|
+ this.loading = false;
|
|
|
},
|
|
|
async signList({ data }) {
|
|
|
+ this.loading = true;
|
|
|
+ this.view = 'signList';
|
|
|
let { _id: classid } = data;
|
|
|
let res = await this.getStudentList({ classid });
|
|
|
if (this.$checkRes(res)) this.$set(this, `studList`, res.data);
|
|
|
- this.view = 'signList';
|
|
|
+ this.loading = false;
|
|
|
+ },
|
|
|
+ certList({ data }) {},
|
|
|
+ async classLesson({ data }) {
|
|
|
+ this.loading = true;
|
|
|
+ this.view = 'lesson';
|
|
|
+ let { _id: classid } = data;
|
|
|
+ let res = await this.modelFetch({ model: 'lesson', classid });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ let { lessons } = res.data;
|
|
|
+ let { x, y } = this.proLesson(lessons);
|
|
|
+ this.$set(this, `lth`, x);
|
|
|
+ this.$set(this, `ltr`, y);
|
|
|
+ this.$set(this, `lessons`, lessons);
|
|
|
+ data = await this.getRemarkParts(data);
|
|
|
+ this.$set(this, `classInfo`, data);
|
|
|
+ }
|
|
|
+ this.loading = false;
|
|
|
},
|
|
|
- certList({ data }) {
|
|
|
- console.log(this.classList);
|
|
|
+ async getRemarkParts(data) {
|
|
|
+ let { headteacherid, jslocationid, lyteacherid } = data;
|
|
|
+ let aArr = [];
|
|
|
+ aArr.push(this.getDirector(headteacherid));
|
|
|
+ aArr.push(this.getLocation(jslocationid));
|
|
|
+ axios.all(aArr).then(
|
|
|
+ axios.spread((r1, r2) => {
|
|
|
+ if (r1 && r1.errcode == 0) data.headteacher = r1.data.name;
|
|
|
+ if (r2 && r2.errcode == 0) data.jslocation = r2.data.name;
|
|
|
+ })
|
|
|
+ );
|
|
|
+ let check = data => {
|
|
|
+ if (!data || data.errcode != 0) return false;
|
|
|
+ let obj = _.get(data, `data`);
|
|
|
+ if (!obj) return false;
|
|
|
+ return obj.name;
|
|
|
+ };
|
|
|
+ //单独处理礼仪教师,因为数据可能从2个表来
|
|
|
+ let res = await this.getDirector(lyteacherid);
|
|
|
+ let name = check(res);
|
|
|
+ if (name) data.lyteacher = name;
|
|
|
+ else res = await this.getTeacher(lyteacherid);
|
|
|
+ name = check(res);
|
|
|
+ if (name) data.lyteacher = name;
|
|
|
+ return data;
|
|
|
},
|
|
|
- classLesson({ data }) {
|
|
|
- console.log(this.classList);
|
|
|
+ proLesson(data) {
|
|
|
+ let duplicate = _.cloneDeep(data);
|
|
|
+ let x = _.uniq(_.orderBy(duplicate, 'date', 'asc').map(i => i.date));
|
|
|
+ let y = _.uniq(_.orderBy(duplicate, 'time', 'asc').map(i => i.time));
|
|
|
+ return { x, y };
|
|
|
},
|
|
|
toReturns() {
|
|
|
this.view = 'list';
|