|
@@ -0,0 +1,105 @@
|
|
|
+<template>
|
|
|
+ <div id="index">
|
|
|
+ <list-frame title="教师上报" @query="search" :total="total" :needFilter="false">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="3">
|
|
|
+ <el-select v-model="form.teacherid" placeholder="搜索教师" size="mini" clearable filterable @change="search">
|
|
|
+ <el-option v-for="(i, index) in teacherList" :key="index" :label="i.name" :value="i._id"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="5">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="form.date"
|
|
|
+ type="date"
|
|
|
+ placeholder="选择日期"
|
|
|
+ size="mini"
|
|
|
+ format="yyyy-MM-dd"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ clearable
|
|
|
+ @change="search"
|
|
|
+ >
|
|
|
+ </el-date-picker>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <data-table :fields="fields" :data="list" :opera="opera" @delete="toDelete" :toFormat="toFormat"></data-table>
|
|
|
+ </list-frame>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import listFrame from '@frame/layout/admin/list-frame';
|
|
|
+import dataTable from '@frame/components/data-table';
|
|
|
+import { createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: teaplan } = createNamespacedHelpers('teaPlan');
|
|
|
+const { mapActions: teacher } = createNamespacedHelpers('teacher');
|
|
|
+const { mapActions: subject } = createNamespacedHelpers('subject');
|
|
|
+export default {
|
|
|
+ metaInfo: { title: '寝室管理' },
|
|
|
+ name: 'index',
|
|
|
+ props: {},
|
|
|
+ components: {
|
|
|
+ listFrame,
|
|
|
+ dataTable,
|
|
|
+ },
|
|
|
+ data: () => ({
|
|
|
+ form: {
|
|
|
+ range: [],
|
|
|
+ },
|
|
|
+ opera: [
|
|
|
+ {
|
|
|
+ label: '删除',
|
|
|
+ icon: 'el-icon-delete',
|
|
|
+ method: 'delete',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ fields: [
|
|
|
+ { label: '教师', prop: 'teacherid', format: true },
|
|
|
+ { label: '科目', prop: 'subid', format: true },
|
|
|
+ { label: '日期', prop: 'date' },
|
|
|
+ ],
|
|
|
+ subjectList: [],
|
|
|
+ teacherList: [],
|
|
|
+ list: [],
|
|
|
+ total: 0,
|
|
|
+ }),
|
|
|
+ async created() {
|
|
|
+ await this.getOtherList();
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ computed: {},
|
|
|
+ methods: {
|
|
|
+ ...teaplan({ apply: 'create', applyFetch: 'query', applyDelete: 'delete' }),
|
|
|
+ ...subject({ getSubjectList: 'query' }),
|
|
|
+ ...teacher({ getTeacher: 'query' }),
|
|
|
+ async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
+ const res = await this.applyFetch({ skip, limit, ...info, ...this.form });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `list`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async toDelete({ data, index }) {
|
|
|
+ const res = await this.applyDelete(data.id);
|
|
|
+ this.$checkRes(res, '删除成功', '删除失败');
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ async getOtherList() {
|
|
|
+ let res = await this.getSubjectList();
|
|
|
+ if (res.errcode == '0') this.$set(this, `subjectList`, res.data);
|
|
|
+ res = await this.getTeacher();
|
|
|
+ if (res.errcode == '0') this.$set(this, `teacherList`, res.data);
|
|
|
+ },
|
|
|
+ toFormat({ model, value }) {
|
|
|
+ if (model == 'subid') {
|
|
|
+ const res = this.subjectList.find(f => f.id == value);
|
|
|
+ if (res) return res.name;
|
|
|
+ } else if (model == 'teacherid') {
|
|
|
+ const res = this.teacherList.find(f => f.id == value);
|
|
|
+ if (res) return res.name;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped></style>
|