فهرست منبع

更新考勤展示

wuhongyuq 5 سال پیش
والد
کامیت
2a6438f4e0
2فایلهای تغییر یافته به همراه29 افزوده شده و 41 حذف شده
  1. 14 10
      src/layout/user/checkList.vue
  2. 15 31
      src/views/user/checkWork.vue

+ 14 - 10
src/layout/user/checkList.vue

@@ -3,18 +3,21 @@
     <el-row>
       <van-col :span="24">
         <van-collapse v-model="openCollapse">
-          <van-collapse-item :name="index" v-for="(item, index) in checkWorkList" :key="index">
+          <!-- <van-collapse-item :name="index" v-for="(item, index) in checkWorkList" :key="index"> -->
+          <van-collapse-item>
             <div slot="title" class="title">
-              <span class="name">{{ item.studentid }}</span>
+              <span class="name">{{ anames }}</span>
             </div>
-            <van-row class="attend" v-for="(tag, index) in item.attend" :key="index">
-              <van-col :span="20" class="dateTime">
-                <p>{{ tag.date }}</p>
-                <p>{{ tag.time }}</p>
-              </van-col>
-              <van-col :span="4" class="status">
-                {{ tag.status === '0' ? '未签到' : tag.status === '1' ? '签到' : '迟到' }}
-              </van-col>
+            <van-row class="attend" v-for="(tag, index) in checkWorkList" :key="index">
+              <template v-for="(item, indexs) in tag.attend">
+                <van-col :span="20" class="dateTime" :key="'aa' + indexs">
+                  <p>{{ item.date }}</p>
+                  <p>{{ item.time }}</p>
+                </van-col>
+                <van-col :span="4" class="status" :key="'bb' + indexs">
+                  {{ item.status === '0' ? '未签到' : item.status === '1' ? '签到' : '迟到' }}
+                </van-col>
+              </template>
             </van-row>
           </van-collapse-item>
         </van-collapse>
@@ -28,6 +31,7 @@ export default {
   name: 'checkList',
   props: {
     checkWorkList: null,
+    anames: null,
   },
   components: {},
   data: () => ({

+ 15 - 31
src/views/user/checkWork.vue

@@ -12,7 +12,7 @@
             <punchBtn :show="show" :form="form" :dates="dates" @openClick="openClick" @onSubmit="onSubmit"></punchBtn>
           </el-col>
           <el-col :span="24" class="leaveList">
-            <checkList :checkWorkList="checkWorkList"></checkList>
+            <checkList :checkWorkList="checkWorkList" :anames="anames"></checkList>
           </el-col>
         </el-col>
       </el-col>
@@ -36,28 +36,11 @@ export default {
   },
   data: () => ({
     info: {},
-    checkWorkList: [
-      // {
-      //   studentid: '流域',
-      //   attend: [
-      //     {
-      //       date: '2020-02-25',
-      //       time: '80:30',
-      //       status: '0',
-      //     },
-      //     {
-      //       date: '2020-02-25',
-      //       time: '80:30',
-      //       status: '1',
-      //     },
-      //     {
-      //       date: '2020-02-25',
-      //       time: '80:30',
-      //       status: '2',
-      //     },
-      //   ],
-      // },
-    ],
+    anames: '',
+    checkWorkList: {
+      attend: [],
+    },
+
     show: false,
     form: {
       attend: [],
@@ -89,14 +72,18 @@ export default {
   methods: {
     ...mapAttendance(['fetch', 'create', 'query']),
     async search() {
-      const res = await this.fetch();
-      console.log(res);
+      let studentid = this.user.userid;
+      console.log(studentid);
+      const res = await this.query();
+      console.log(res.data);
+      console.log(res.data[0]);
+
       this.$set(this, `checkWorkList`, res.data);
     },
     searchInfo() {
-      let site = JSON.parse(sessionStorage.getItem('site'));
-      this.$set(this.form, `batchid`, site.batchid);
-      this.$set(this.form, `classid`, site.classid);
+      this.$set(this.form, `batchid`, this.user.batchid);
+      this.$set(this.form, `classid`, this.user.classid);
+      this.$set(this, `anames`, this.user.name);
     },
     openClick() {
       this.show = true;
@@ -108,10 +95,7 @@ export default {
       this.form.classid = this.user.classid;
       this.form.studentid = this.user.userid;
       let data = this.form;
-      console.log(this.form.batchid);
       let res = await this.create(data);
-      console.log(res);
-
       this.show = false;
     },
     getDate() {