Browse Source

班主任首页添加待办事项

zs 9 months ago
parent
commit
8bcaf2469c
3 changed files with 109 additions and 9 deletions
  1. 5 3
      src/views/classes/leave.vue
  2. 102 3
      src/views/home.vue
  3. 2 3
      src/views/new-plan/index.vue

+ 5 - 3
src/views/classes/leave.vue

@@ -50,9 +50,11 @@ export default {
       }
       }
     },
     },
     async searchtermstu() {
     async searchtermstu() {
-      let res = await this.stuquery({ classid: this.id });
-      if (res.errcode == 0) {
-        this.$set(this, `stuList`, res.data);
+      if (this.id) {
+        let res = await this.stuquery({ classid: this.id });
+        if (res.errcode == 0) {
+          this.$set(this, `stuList`, res.data);
+        }
       }
       }
     },
     },
     toreturn() {
     toreturn() {

+ 102 - 3
src/views/home.vue

@@ -2,6 +2,26 @@
   <div id="home">
   <div id="home">
     <el-card v-if="!loading" shadow="hover">
     <el-card v-if="!loading" shadow="hover">
       <el-col :span="24" class="main">
       <el-col :span="24" class="main">
+        <el-row class="one_1">
+          <el-col :span="24" class="one_title">
+            <span>待办事项</span>
+          </el-col>
+          <el-col :span="24" class="info">
+            <el-row class="info_1">
+              <el-col :span="6" class="list" @click.native="toView">
+                <el-row>
+                  <el-col :span="20" class="l">
+                    <el-col :span="24" class="name">学生请假或退出</el-col>
+                    <el-col :span="24" class="num"><span class="dw">未处理</span>{{ leaveNum || 0 }}<span class="dw">个</span></el-col>
+                  </el-col>
+                  <el-col :span="4" class="r">
+                    <i class="el-icon-s-check"></i>
+                  </el-col>
+                </el-row>
+              </el-col>
+            </el-row>
+          </el-col>
+        </el-row>
         <el-col :span="24" class="title">
         <el-col :span="24" class="title">
           班主任全年安排
           班主任全年安排
         </el-col>
         </el-col>
@@ -32,6 +52,7 @@ import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: classes } = createNamespacedHelpers('classes');
 const { mapActions: classes } = createNamespacedHelpers('classes');
 const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
 const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
 const { mapActions: director } = createNamespacedHelpers('director');
 const { mapActions: director } = createNamespacedHelpers('director');
+const { mapActions: leave } = createNamespacedHelpers('leave');
 export default {
 export default {
   name: 'home',
   name: 'home',
   props: {},
   props: {},
@@ -40,18 +61,21 @@ export default {
     return {
     return {
       loading: true,
       loading: true,
       list: [],
       list: [],
+      leaveNum: 0,
       // 班主任
       // 班主任
       dirList: [],
       dirList: [],
     };
     };
   },
   },
   async created() {
   async created() {
     await this.getOtherList();
     await this.getOtherList();
+    await this.getleave();
     this.search();
     this.search();
   },
   },
   methods: {
   methods: {
     ...classes(['query']),
     ...classes(['query']),
     ...director({ getDirList: 'query' }),
     ...director({ getDirList: 'query' }),
     ...trainplan({ trainplanFetch: 'fetch', trainplanUpdate: 'update', updateclass: 'updateclass', updatereteacher: 'updatereteacher' }),
     ...trainplan({ trainplanFetch: 'fetch', trainplanUpdate: 'update', updateclass: 'updateclass', updatereteacher: 'updatereteacher' }),
+    ...leave({ lQuery: 'query' }),
     async search() {
     async search() {
       let planid = _.get(this.defaultOption, 'planid');
       let planid = _.get(this.defaultOption, 'planid');
       const res = await this.trainplanFetch(planid);
       const res = await this.trainplanFetch(planid);
@@ -59,7 +83,7 @@ export default {
       if (res.errcode == 0) {
       if (res.errcode == 0) {
         let data = res.data.termnum;
         let data = res.data.termnum;
         //按期排序
         //按期排序
-        data = data.map(i => {
+        data = data.map((i) => {
           i.term = i.term * 1;
           i.term = i.term * 1;
           return i;
           return i;
         });
         });
@@ -75,13 +99,13 @@ export default {
                 name: classes.name,
                 name: classes.name,
                 headteacherid: classes.headteacherid,
                 headteacherid: classes.headteacherid,
               };
               };
-              let headteacherData = this.dirList.find(i => i.id == classes.headteacherid);
+              let headteacherData = this.dirList.find((i) => i.id == classes.headteacherid);
               if (headteacherData) dirData.headteacher = headteacherData.name;
               if (headteacherData) dirData.headteacher = headteacherData.name;
               newData.push(dirData);
               newData.push(dirData);
             }
             }
           }
           }
         }
         }
-        let dirClass = newData.filter(i => i.headteacherid == this.user.userid);
+        let dirClass = newData.filter((i) => i.headteacherid == this.user.userid);
         if (dirClass) this.$set(this, `list`, dirClass);
         if (dirClass) this.$set(this, `list`, dirClass);
       }
       }
       this.loading = false;
       this.loading = false;
@@ -95,6 +119,19 @@ export default {
       let res = await this.getDirList();
       let res = await this.getDirList();
       if (this.$checkRes(res)) this.$set(this, `dirList`, res.data);
       if (this.$checkRes(res)) this.$set(this, `dirList`, res.data);
     },
     },
+    // 查询请假人数未处理多少
+    async getleave() {
+      let classid = _.get(this.defaultOption, 'classid');
+      let termid = _.get(this.defaultOption, 'termid');
+      if (classid && termid) {
+        let res = await this.lQuery({ status: 0, termid, classid, skip: 0, limit: 1 });
+        if (this.$checkRes(res)) this.$set(this, `leaveNum`, res.total);
+      }
+    },
+    // 查看
+    toView() {
+      this.$router.push({ path: '/train/plan/leave' });
+    },
   },
   },
   computed: {
   computed: {
     ...mapState(['user', 'defaultOption']),
     ...mapState(['user', 'defaultOption']),
@@ -116,5 +153,67 @@ export default {
     font-size: 20px;
     font-size: 20px;
     padding: 15px 0;
     padding: 15px 0;
   }
   }
+  .one_1 {
+    margin: 0 0 20px 0;
+    .one_title {
+      margin: 0 0 20px 0;
+      span {
+        background-color: #439eff;
+        color: #ffffff;
+        padding: 5px 10px;
+        border-radius: 5px;
+        font-weight: bold;
+      }
+    }
+    .info {
+      .info_1 {
+        .list {
+          max-width: 23%;
+          margin: 0 10px;
+          border-radius: 5px;
+          padding: 15px 10px;
+          background: linear-gradient(to bottom, #439eff 90%, #f1f1f1);
+          .l {
+            .name {
+              font-size: 18px;
+              font-weight: bold;
+              color: #ffffff;
+              margin: 0 0 10px 0;
+            }
+            .num {
+              display: flex;
+              align-items: center;
+              color: #ffffff;
+              font-size: 22px;
+              font-weight: bold;
+              .dw {
+                padding: 0 5px;
+                font-size: 12px;
+                color: #f1f1f1;
+              }
+            }
+          }
+          .r {
+            text-align: center;
+            padding: 5px 0;
+            font-size: 40px;
+            color: #ffffff;
+          }
+        }
+        .list:nth-child(2) {
+          background: linear-gradient(to bottom, #ffa500 90%, #f1f1f1);
+        }
+        .list:nth-child(3) {
+          background: linear-gradient(to bottom, #00ff7f 90%, #f1f1f1);
+        }
+        .list:nth-child(4) {
+          background: linear-gradient(to bottom, #ff0000 90%, #f1f1f1);
+        }
+        .list:hover {
+          cursor: pointer;
+        }
+      }
+    }
+  }
 }
 }
 </style>
 </style>

+ 2 - 3
src/views/new-plan/index.vue

@@ -1,11 +1,10 @@
 <template>
 <template>
   <div id="index">
   <div id="index">
     <detail-frame :title="pageTitle">
     <detail-frame :title="pageTitle">
-      <data-form :data="info" :fields="Ffields" :rules="rules" @save="handleSave" :isNew="!info.id" :styles="{ padding: 0 }" labelWidth="120px" :reset="false">
+      <data-form :data="info" :fields="Ffields" :rules="rules" @save="handleSave" :isNew="!info.id" labelWidth="140px" :reset="false">
         <template #custom="{item,form}">
         <template #custom="{item,form}">
           <template v-if="item.model == 'date'">
           <template v-if="item.model == 'date'">
-            <el-date-picker v-model="form[item.model]" type="date" placeholder="请选择" format="yyyy-MM-dd" value-format="yyyy-MM-dd" @change="pushDate">
-            </el-date-picker>
+            <el-date-picker v-model="form[item.model]" type="date" placeholder="请选择" format="yyyy-MM-dd" value-format="yyyy-MM-dd" @change="pushDate"> </el-date-picker>
           </template>
           </template>
           <template v-if="item.model == 'nodate' && form[item.model]">
           <template v-if="item.model == 'nodate' && form[item.model]">
             <data-table :fields="dateFields" :data="form[item.model]" :opera="dateOpera" @delete="toDateDelete" height="400px"></data-table>
             <data-table :fields="dateFields" :data="form[item.model]" :opera="dateOpera" @delete="toDateDelete" height="400px"></data-table>