瀏覽代碼

Merge branch 'master' of http://git.cc-lotus.info/new_train/train-dirtea

reloaded 4 年之前
父節點
當前提交
d73ef2ae09

+ 202 - 0
src/layout/class/classStuList.vue

@@ -0,0 +1,202 @@
+<template>
+  <div id="classStuList">
+    <el-row>
+      <el-col :span="24" class="style">
+        <el-col :span="24" class="top">
+          <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
+        </el-col>
+        <el-col :span="24" class="main">
+          <headStuList
+            :headStuList="headStuList"
+            :assignShow="assignShow"
+            :assignForm="assignForm"
+            :job_list="job_list"
+            @assign="clickAssign"
+            @outForm="outAssignShow"
+            @onForm="onAssignShow"
+            @handleClose="handleClose"
+            :classid="this.id"
+          ></headStuList>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import NavBar from '@/layout/common/topInfo.vue';
+import headStuList from '@/layout/class/headStuList.vue';
+import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: mapStudent } = createNamespacedHelpers('student');
+export default {
+  name: 'classStuList',
+  props: {},
+  components: {
+    NavBar, //头部导航
+    headStuList, //学生列表
+  },
+  data: () => ({
+    headStuList: [],
+    assignShow: false,
+    assignForm: {},
+    job_list: [],
+
+    job1: [
+      {
+        name: '班长',
+      },
+      {
+        name: '学委',
+      },
+      {
+        name: '普通学生',
+      },
+    ],
+    job2: [
+      {
+        name: '班长',
+      },
+
+      {
+        name: '普通学生',
+      },
+    ],
+
+    job3: [
+      {
+        name: '学委',
+      },
+
+      {
+        name: '普通学生',
+      },
+    ],
+
+    job4: [
+      {
+        name: '普通学生',
+      },
+    ],
+
+    title: '',
+    isleftarrow: '',
+    navShow: true,
+  }),
+  created() {
+    this.searchInfo();
+  },
+  computed: {
+    id() {
+      return this.$route.query.id;
+    },
+    ...mapState(['user']),
+  },
+  mounted() {
+    this.title = this.$route.meta.title;
+    this.isleftarrow = this.$route.meta.isleftarrow;
+  },
+  watch: {
+    $route(to, from) {
+      this.title = to.meta.title;
+      this.isleftarrow = to.meta.isleftarrow;
+    },
+  },
+  methods: {
+    ...mapStudent({ list: 'query', add: 'create', fet: 'fetch', updates: 'update' }),
+    // 查询学生列表-并带有职务
+    async searchInfo() {
+      let classid = this.id;
+      const res = await this.list({ classid });
+      console.log(res.data);
+
+      if (this.$checkRes(res)) {
+        this.$set(this, `headStuList`, res.data);
+      }
+    },
+    //点击派遣
+    async clickAssign({ id, item }) {
+      var banzhang = this.headStuList.filter(item => item.job == '班长');
+      var xuewei = this.headStuList.filter(item => item.job == '学委');
+      console.log(banzhang);
+      console.log(xuewei.length);
+
+      if (xuewei.length == '1') {
+        if (banzhang.length == '2') {
+          if (item.job == '班长') {
+            this.$set(this, `job_list`, this.job2);
+          } else if (item.job == '学委') {
+            this.$set(this, `job_list`, this.job3);
+          } else {
+            this.$set(this, `job_list`, this.job4);
+          }
+        } else if (banzhang.length < '2') {
+          console.log('cc');
+
+          if (item.job == '学委') {
+            this.$set(this, `job_list`, this.job1);
+          } else {
+            this.$set(this, `job_list`, this.job2);
+          }
+        } else if (xuewei.length == '0') {
+        }
+      } else if (xuewei.length == '0') {
+        console.log('a');
+
+        if (banzhang.length == '0') {
+          this.$set(this, `job_list`, this.job1);
+        } else if (banzhang.length == '2') {
+          if (item.job == '班长') {
+            this.$set(this, `job_list`, this.job1);
+          } else {
+            this.$set(this, `job_list`, this.job3);
+          }
+        } else {
+          this.$set(this, `job_list`, this.job1);
+        }
+      }
+
+      this.assignShow = true;
+      const res = await this.fet(id);
+      this.$set(this, `assignForm`, res.data);
+    },
+    //指派职务
+    async onAssignShow(assignForm) {
+      console.log(assignForm);
+
+      let data = this.assignForm;
+
+      let res = await this.updates(data);
+      if (this.$checkRes(res)) {
+        this.$message({
+          message: '成功',
+          type: 'success',
+        });
+      }
+      this.outAssignShow();
+      this.searchInfo();
+    },
+    outAssignShow() {
+      this.assignShow = false;
+    },
+    handleClose() {
+      this.assignShow = false;
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.style {
+  width: 100%;
+  min-height: 667px;
+  position: relative;
+  background-color: #f9fafc;
+}
+.top {
+  height: 46px;
+  overflow: hidden;
+}
+.main {
+  min-height: 570px;
+}
+</style>

+ 56 - 0
src/layout/class/headClassList.vue

@@ -0,0 +1,56 @@
+<template>
+  <div id="headClassList">
+    <el-row>
+      <el-col :span="24">
+        <el-col :span="24" class="list" v-for="(item, index) in headClassList" :key="index">
+          <el-col :span="16" class="mess">
+            <p>班级:{{ item.name }}</p>
+            <p>班级人数:{{ item.number }}</p>
+          </el-col>
+          <el-col :span="8" class="btn">
+            <el-button type="primary" @click="clickStu(item.id)" round>班级信息</el-button>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'headClassList',
+  props: {
+    headClassList: null,
+  },
+  components: {},
+  data: () => ({}),
+  created() {},
+  computed: {},
+  methods: {
+    clickStu(id) {
+      this.$emit('clickStu', id);
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+p {
+  padding: 0;
+  margin: 0;
+}
+.list {
+  background: #fff;
+  margin: 10px;
+  width: 94%;
+  padding: 10px;
+  border-radius: 20px;
+}
+.list .mess p {
+  padding: 5px 0;
+}
+.list .btn {
+  padding: 20px 0;
+  text-align: center;
+}
+</style>

+ 96 - 0
src/layout/class/headStuList.vue

@@ -0,0 +1,96 @@
+<template>
+  <div id="headStuList">
+    <el-row type="flex" justify="center" style="padding:10px 0">
+      <el-col :span="6">
+        <el-button type="primary" plain size="mini" @click.native="$router.push({ path: '/class/achieve', query: { classid: $attrs.classid } })">
+          查看平时成绩
+        </el-button>
+      </el-col>
+    </el-row>
+    <el-row>
+      <el-col :span="24" class="info">
+        <el-col :span="6" class="list" v-for="(item, index) in headStuList" :key="index" @click.native="clickAssign(item)">
+          <p class="name" :style="`font-size:${changeNum(item.name)}px`">{{ item.name }}</p>
+          <p class="job" v-if="item.job">{{ item.job }}<i class="el-icon-circle-check"></i></p>
+        </el-col>
+      </el-col>
+    </el-row>
+    <el-dialog title="指派职务" width="90%" :visible.sync="assignShow" :before-close="handleClose">
+      <el-form :model="assignForm">
+        <el-form-item label="学生姓名">
+          {{ assignForm.name }}
+        </el-form-item>
+        <el-form-item label="学生职务">
+          <el-select v-model="assignForm.job" placeholder="请选择学生职务">
+            <el-option v-for="(item, index) in job_list" :key="index" :label="item.name" :value="item.name"></el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="outAssignShow">取 消</el-button>
+        <el-button type="primary" @click="onAssignShow">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'headStuList',
+  props: {
+    headStuList: null,
+    assignForm: null,
+    assignShow: null,
+    job_list: null,
+  },
+  components: {},
+  data: () => ({}),
+  created() {},
+  computed: {},
+  methods: {
+    clickAssign(item) {
+      let id = item.id;
+
+      this.$emit('assign', { id, item });
+    },
+    outAssignShow() {
+      this.$emit('outForm');
+    },
+    onAssignShow(id) {
+      this.$emit('onForm', { data: this.assignForm });
+    },
+    handleClose() {
+      this.$emit('handleClose');
+    },
+    changeNum(name) {
+      if (name.length >= 5) {
+        return 10;
+      } else {
+        return 15;
+      }
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+p {
+  padding: 0;
+  margin: 0;
+}
+.info {
+  margin: 15px 0 0 0;
+}
+.list {
+  text-align: center;
+  border: 1px solid #2c69fe;
+  width: 70px;
+  margin: 0 11px 10px 12px;
+  padding: 5px 0px;
+  border-radius: 10px;
+}
+.list .job {
+  font-size: 10px;
+  color: #405ffe;
+}
+</style>

+ 15 - 0
src/router/index.js

@@ -53,6 +53,21 @@ const routes = [
     meta: { title: '个人中心', isleftarrow: true },
     component: () => import('../views/user/index.vue'),
   },
+
+  //班主任看班级
+  {
+    path: '/class/classStuList',
+    name: 'class_teacher',
+    meta: { title: '班级信息', isleftarrow: true },
+    component: () => import('../views/class/classStuList.vue'),
+  },
+  // 个人中心-请假&退出管理
+  {
+    path: '/user/teaLeave',
+    name: 'user_teaLeave',
+    meta: { title: '请假&退出管理', isleftarrow: true },
+    component: () => import('../views/user/teaLeave.vue'),
+  },
   {
     path: '/user/personalDetail',
     name: 'user_personalDetail',

+ 203 - 0
src/views/class/classStuList.vue

@@ -0,0 +1,203 @@
+<template>
+  <div id="classStuList">
+    <el-row>
+      <el-col :span="24" class="style">
+        <el-col :span="24" class="top">
+          <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
+        </el-col>
+        <el-col :span="24" class="main">
+          <headStuList
+            :headStuList="headStuList"
+            :assignShow="assignShow"
+            :assignForm="assignForm"
+            :job_list="job_list"
+            @assign="clickAssign"
+            @outForm="outAssignShow"
+            @onForm="onAssignShow"
+            @handleClose="handleClose"
+            :classid="this.id"
+          ></headStuList>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import NavBar from '@/layout/common/topInfo.vue';
+import headStuList from '@/layout/class/headStuList.vue';
+import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: mapStudent } = createNamespacedHelpers('student');
+export default {
+  name: 'classStuList',
+  props: {},
+  components: {
+    NavBar, //头部导航
+    headStuList, //学生列表
+  },
+  data: () => ({
+    headStuList: [],
+    assignShow: false,
+    assignForm: {},
+    job_list: [],
+
+    job1: [
+      {
+        name: '班长',
+      },
+      {
+        name: '学委',
+      },
+      {
+        name: '普通学生',
+      },
+    ],
+    job2: [
+      {
+        name: '班长',
+      },
+
+      {
+        name: '普通学生',
+      },
+    ],
+
+    job3: [
+      {
+        name: '学委',
+      },
+
+      {
+        name: '普通学生',
+      },
+    ],
+
+    job4: [
+      {
+        name: '普通学生',
+      },
+    ],
+
+    title: '',
+    isleftarrow: '',
+    navShow: true,
+  }),
+  created() {
+    this.searchInfo();
+  },
+  computed: {
+    id() {
+      return this.$route.query.id;
+    },
+    ...mapState(['user']),
+  },
+  mounted() {
+    this.title = this.$route.meta.title;
+    this.isleftarrow = this.$route.meta.isleftarrow;
+  },
+  watch: {
+    $route(to, from) {
+      this.title = to.meta.title;
+      this.isleftarrow = to.meta.isleftarrow;
+    },
+  },
+  methods: {
+    ...mapStudent({ list: 'query', add: 'create', fet: 'fetch', updates: 'update' }),
+    // 查询学生列表-并带有职务
+    async searchInfo() {
+      let classid = this.id;
+      console.log(classid);
+      const res = await this.list({ classid });
+      console.log(res.data);
+
+      if (this.$checkRes(res)) {
+        this.$set(this, `headStuList`, res.data);
+      }
+    },
+    //点击派遣
+    async clickAssign({ id, item }) {
+      var banzhang = this.headStuList.filter(item => item.job == '班长');
+      var xuewei = this.headStuList.filter(item => item.job == '学委');
+      console.log(banzhang);
+      console.log(xuewei.length);
+
+      if (xuewei.length == '1') {
+        if (banzhang.length == '2') {
+          if (item.job == '班长') {
+            this.$set(this, `job_list`, this.job2);
+          } else if (item.job == '学委') {
+            this.$set(this, `job_list`, this.job3);
+          } else {
+            this.$set(this, `job_list`, this.job4);
+          }
+        } else if (banzhang.length < '2') {
+          console.log('cc');
+
+          if (item.job == '学委') {
+            this.$set(this, `job_list`, this.job1);
+          } else {
+            this.$set(this, `job_list`, this.job2);
+          }
+        } else if (xuewei.length == '0') {
+        }
+      } else if (xuewei.length == '0') {
+        console.log('a');
+
+        if (banzhang.length == '0') {
+          this.$set(this, `job_list`, this.job1);
+        } else if (banzhang.length == '2') {
+          if (item.job == '班长') {
+            this.$set(this, `job_list`, this.job1);
+          } else {
+            this.$set(this, `job_list`, this.job3);
+          }
+        } else {
+          this.$set(this, `job_list`, this.job1);
+        }
+      }
+
+      this.assignShow = true;
+      const res = await this.fet(id);
+      this.$set(this, `assignForm`, res.data);
+    },
+    //指派职务
+    async onAssignShow(assignForm) {
+      console.log(assignForm);
+
+      let data = this.assignForm;
+
+      let res = await this.updates(data);
+      if (this.$checkRes(res)) {
+        this.$message({
+          message: '成功',
+          type: 'success',
+        });
+      }
+      this.outAssignShow();
+      this.searchInfo();
+    },
+    outAssignShow() {
+      this.assignShow = false;
+    },
+    handleClose() {
+      this.assignShow = false;
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.style {
+  width: 100%;
+  min-height: 667px;
+  position: relative;
+  background-color: #f9fafc;
+}
+.top {
+  height: 46px;
+  overflow: hidden;
+}
+.main {
+  min-height: 570px;
+}
+</style>

+ 40 - 14
src/views/class/index.vue

@@ -6,7 +6,7 @@
           <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         <el-col :span="24" class="main">
-          <stuList></stuList>
+          <headClassList :headClassList="headClassList" @clickStu="clickStu"></headClassList>
         </el-col>
         <el-col :span="24" class="foot">
           <footInfo></footInfo>
@@ -19,25 +19,36 @@
 <script>
 import NavBar from '@/layout/common/topInfo.vue';
 import footInfo from '@/layout/common/footInfo.vue';
-import stuList from '@/layout/class/stuList.vue';
-import { mapState, createNamespacedHelpers } from 'vuex';
+import headClassList from '@/layout/class/headClassList.vue';
+import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: mapGroup } = createNamespacedHelpers('group');
+const { mapActions: mapStudent } = createNamespacedHelpers('student');
+const { mapActions: mapclasses } = createNamespacedHelpers('classes');
+const { mapActions: mapSethead } = createNamespacedHelpers('sethead');
+
 export default {
-  name: 'index',
+  metaInfo: { title: '班级名单' },
+  name: 'class_teacher',
   props: {},
   components: {
-    NavBar,
+    NavBar, //头部导航
+    headClassList, //班主任中管理的学生列表
     footInfo,
-    stuList,
   },
-  data: function() {
-    return {
-      title: '',
-      isleftarrow: '',
-      navShow: true,
-    };
+  data: () => ({
+    form: {},
+    columns: [],
+    show: false,
+    // 班主任看班级名单
+    headClassList: [],
+
+    title: '',
+    isleftarrow: '',
+    navShow: true,
+  }),
+  async created() {
+    await this.searchInfo();
   },
-  created() {},
-  methods: {},
   computed: {
     ...mapState(['user']),
   },
@@ -51,6 +62,21 @@ export default {
       this.isleftarrow = to.meta.isleftarrow;
     },
   },
+  methods: {
+    ...mapclasses({ classList: 'query', classFetch: 'fetch' }),
+
+    // 班主任查询管理班级列表
+    async searchInfo() {
+      const res = await this.classList({ headteacherid: this.user.userid });
+      if (this.$checkRes(res)) {
+        this.$set(this, `headClassList`, res.data);
+      }
+    },
+    // 班主任跳转到班级信息
+    clickStu(id) {
+      this.$router.push({ path: '/class/classStuList', query: { id: id } });
+    },
+  },
 };
 </script>
 

+ 0 - 1
src/views/user/personalDetail.vue

@@ -17,7 +17,6 @@
 <script>
 import NavBar from '@/layout/common/topInfo.vue';
 import headteaInfo from '@/layout/user/headteaInfo.vue';
-
 import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
 const { mapActions: mapDirectors } = createNamespacedHelpers('director');
 const { mapActions: mapStudent } = createNamespacedHelpers('student');

+ 102 - 0
src/views/user/teaLeave.vue

@@ -0,0 +1,102 @@
+<template>
+  <div id="teaLeave">
+    <el-row>
+      <el-col :span="24" class="style">
+        <el-col :span="24" class="top">
+          <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
+        </el-col>
+        <el-col :span="24" class="main">
+          <el-col :span="24" class="list" v-for="(item, index) in leaveList" :key="index">
+            <el-col :span="14" class="time">
+              <p>开始时间:{{ item.starttime }}</p>
+              <p>结束时间:{{ item.endtime }}</p>
+            </el-col>
+            <el-col :span="10" class="status">
+              <p>结果:{{ item.status === '0' ? '审核中' : item.status === '1' ? '通过' : item.status === '2' ? '未通过' : '' }}</p></el-col
+            >
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import NavBar from '@/layout/common/topInfo.vue';
+import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: mapLeave } = createNamespacedHelpers('leave');
+export default {
+  name: 'teaLeave',
+  props: {},
+  components: {
+    NavBar, //头部导航
+  },
+  data: function() {
+    return {
+      title: '',
+      isleftarrow: '',
+      navShow: true,
+      // 班级请假退出列表
+      leaveList: [],
+    };
+  },
+  created() {
+    this.searchInfo();
+  },
+  methods: {
+    ...mapLeave(['query']),
+    async searchInfo({ skip = 0, limit = 10, ...info } = {}) {
+      const res = await this.query({ skip, limit, classid: this.classid, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `leaveList`, res.data);
+      }
+    },
+  },
+  computed: {
+    ...mapState(['user', 'classid']),
+  },
+  mounted() {
+    this.title = this.$route.meta.title;
+    this.isleftarrow = this.$route.meta.isleftarrow;
+  },
+  watch: {
+    $route(to, from) {
+      this.title = to.meta.title;
+      this.isleftarrow = to.meta.isleftarrow;
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.style {
+  width: 100%;
+  min-height: 667px;
+  position: relative;
+  background-color: #f9fafc;
+}
+.top {
+  height: 46px;
+  overflow: hidden;
+}
+.main {
+  min-height: 570px;
+}
+p {
+  padding: 0;
+  margin: 0;
+}
+.list {
+  width: 97%;
+  padding: 15px;
+  background-color: #fff;
+  border-radius: 15px;
+  margin: 0 5px 5px 5px;
+}
+.list .time p {
+  padding: 5px 0;
+}
+.list .status {
+  padding: 20px 0;
+}
+</style>