浏览代码

长跑过滤没录入人脸学生

林旭祥 1 月之前
父节点
当前提交
dd89bd3baf
共有 1 个文件被更改,包括 92 次插入65 次删除
  1. 92 65
      src/components/ChooseStudent/index.vue

+ 92 - 65
src/components/ChooseStudent/index.vue

@@ -11,21 +11,34 @@
         </div>
         <div class="content">
           <div class="searchBox">
-            <el-select class="select" v-model="optionForm.grade" :popper-append-to-body="false" placeholder="年级"
-              @change="changeGrade" clearable>
+            <el-select class="select" v-model="optionForm.grade" :popper-append-to-body="false" placeholder="年级" @change="changeGrade" clearable>
               <el-option v-for="item in gradeLists" :key="item.value" :label="item.label" :value="item.value" />
             </el-select>
-            <el-select class="select" v-model="optionForm.class" :popper-append-to-body="false" placeholder="班级"
-              @change="getSearchStudent" @clear="getSearchStudent" clearable>
+            <el-select
+              class="select"
+              v-model="optionForm.class"
+              :popper-append-to-body="false"
+              placeholder="班级"
+              @change="getSearchStudent"
+              @clear="getSearchStudent"
+              clearable
+            >
               <el-option v-for="item in classData" :key="item.value" :label="item.name" :value="item.id" />
             </el-select>
-            <el-input class="input" v-model="optionForm.name" placeholder="请输入学生姓名" clearable @clear="getSearchStudent"/>
+            <el-input class="input" v-model="optionForm.name" placeholder="请输入学生姓名" clearable @clear="getSearchStudent" />
             <el-button class="button" type="primary" @click="getSearchStudent">搜索</el-button>
           </div>
           <div class="tableBox">
-            <el-table ref="myTable" :data="tableData" class="table" :class="{ 'table2': props.selectType == 'single' }"
-              @cell-click="handleCellClickChange" @row-dblclick="handleDblclick" @select-all="handleSelectAll"
-              highlight-current-row>
+            <el-table
+              ref="myTable"
+              :data="tableData"
+              class="table"
+              :class="{ 'table2': props.selectType == 'single' }"
+              @cell-click="handleCellClickChange"
+              @row-dblclick="handleDblclick"
+              @select-all="handleSelectAll"
+              highlight-current-row
+            >
               <el-table-column type="selection" width="55" v-if="props.selectType == 'multiple'" />
               <el-table-column label="头像" width="120">
                 <template #default="scope">
@@ -39,9 +52,15 @@
             </el-table>
           </div>
           <div class="page">
-            <el-pagination layout="prev, pager, next" :total="page.total" :page-size="page.size"
-              :page-sizes="[20, 60, 120]" :current-page="page.current" @size-change="handleSizeChange"
-              @current-change="handleCurrentChange" />
+            <el-pagination
+              layout="prev, pager, next"
+              :total="page.total"
+              :page-size="page.size"
+              :page-sizes="[20, 60, 120]"
+              :current-page="page.current"
+              @size-change="handleSizeChange"
+              @current-change="handleCurrentChange"
+            />
           </div>
           <div class="multipleList" v-if="props.selectType == 'multiple'">
             <ul ref="scrollContainer">
@@ -64,8 +83,9 @@
 </template>
 <script setup lang="ts">
 import useAppStore from '@/store/modules/app';
-import dataDictionary from "@/utils/dataDictionary"
+import dataDictionary from '@/utils/dataDictionary';
 const { proxy } = getCurrentInstance() as any;
+const route = useRoute();
 const emit = defineEmits(['returnData']);
 const myTable = ref();
 const scrollContainer = ref();
@@ -73,16 +93,16 @@ const scrollContainer = ref();
 const props = defineProps({
   selectType: {
     type: String,
-    default: 'single',//单选single 多选multiple
-  },
+    default: 'single' //单选single 多选multiple
+  }
 });
 
 //筛选班别
 const classData = computed(() => {
-  optionForm.value.class = "";
+  optionForm.value.class = '';
   let list = classList.value.filter((item: any) => {
     return item.grade == optionForm.value.grade;
-  })
+  });
   return list;
 });
 
@@ -90,19 +110,20 @@ const data = reactive<any>({
   optionForm: {},
   optionWindow: {
     show: false,
-    time: "",
+    time: ''
   },
   classList: [],
   tableData: [],
   page: {
     current: 1,
     size: 100,
-    total: 0,
+    total: 0
   },
   selectValue: [],
+  project: ''
 });
 
-const { optionForm, optionWindow, classList, tableData, page, selectValue } = toRefs(data);
+const { optionForm, optionWindow, classList, tableData, page, selectValue, project } = toRefs(data);
 
 //打开
 const open = (data: any) => {
@@ -122,11 +143,11 @@ const getClass = () => {
   const list: any = useAppStore().getClass();
   if (list.length) {
     classList.value = list;
-    console.log("classList.value", classList.value)
+    console.log('classList.value', classList.value);
   } else {
     let params = {
       per_page: 1000,
-      page: 1,
+      page: 1
     };
     proxy?.$http.common.classList(params).then((res: any) => {
       if (res.data.length > 0) {
@@ -140,25 +161,31 @@ const getClass = () => {
 
 //获取学生列表
 const getStudent = () => {
-  let myInfo: any = localStorage.getItem("userInfo");
+  let myInfo: any = localStorage.getItem('userInfo');
   let userInfo = JSON.parse(myInfo);
   let params: any = {
     school_id: userInfo.school_id,
     class_id: optionForm.value.class,
     page: page.value.current,
-    per_page: page.value.size,
+    per_page: page.value.size
   };
   if (optionForm.value.name) {
     params.name = optionForm.value.name;
   }
+
+  //长跑需要已经录入人脸信息的
+  if (project.value && ['run800', 'run1000'].includes(project.value)) {
+    params.faced = 1;
+  }
+
   proxy?.$http.common.studentList(params).then((res: any) => {
     if (res.data.length > 0) {
       let list = res.data.map((item: any) => {
         let classObj = classList.value.find((items: any) => {
           return items.id == item.class_id;
-        })
-        item.className = classObj?.name || "";
-        item.genderName = item.gender == 1 ? "男" : "女";
+        });
+        item.className = classObj?.name || '';
+        item.genderName = item.gender == 1 ? '男' : '女';
         item.student_id = item.id;
         return item;
       });
@@ -166,14 +193,14 @@ const getStudent = () => {
       nextTick(() => {
         //添加点选
         let ids = selectValue.value.map((item: any) => {
-          return item.student_id
-        })
+          return item.student_id;
+        });
         list.forEach((item: any) => {
           if (ids.includes(item.student_id)) {
-            myTable.value.toggleRowSelection(item, true)
+            myTable.value.toggleRowSelection(item, true);
           }
-        })
-      })
+        });
+      });
       page.value.total = res.total;
     }
   });
@@ -212,20 +239,20 @@ const handleCellClickChange = (data: any) => {
   if (props.selectType == 'multiple') {
     let ids = selectValue.value.map((item: any) => {
       return item.student_id;
-    })
+    });
     if (!ids.includes(data.student_id)) {
       //不在内就添加
-      myTable.value.toggleRowSelection(data, true)
+      myTable.value.toggleRowSelection(data, true);
       selectValue.value.push(data);
       nextTick(() => {
         scrollContainer.value.scrollLeft = scrollContainer.value.scrollWidth;
       });
     } else {
       //在内就移除
-      myTable.value.toggleRowSelection(data, false)
+      myTable.value.toggleRowSelection(data, false);
       selectValue.value = selectValue.value.filter((item: any) => {
-        return item.student_id != data.student_id
-      })
+        return item.student_id != data.student_id;
+      });
     }
   }
 };
@@ -245,15 +272,15 @@ const handleDblclick = (data: any) => {
 //删除已选学生
 const delChooseStudent = (data: any) => {
   selectValue.value = selectValue.value.filter((item: any) => {
-    return item.student_id != data.student_id
-  })
+    return item.student_id != data.student_id;
+  });
   //表格勾选也移除
-  myTable.value.toggleRowSelection(data, false)
+  myTable.value.toggleRowSelection(data, false);
 };
 
 //确定
 const confirm = () => {
-  console.log("selectValue.value", selectValue.value)
+  console.log('selectValue.value', selectValue.value);
   if (selectValue.value.length == 0) {
     proxy?.$modal.msgWarning(`请选择!`);
     return false;
@@ -268,23 +295,24 @@ const confirm = () => {
 
 //年级
 const gradeLists = computed(() => {
-  let myInfo: any = localStorage.getItem("userInfo");
+  let myInfo: any = localStorage.getItem('userInfo');
   let userInfo = JSON.parse(myInfo);
   let obj = dataDictionary.gradeLists.find((item) => {
-    return userInfo.category == item.value
-  })
+    return userInfo.category == item.value;
+  });
   return obj != undefined ? obj.child : [];
 });
 
 onMounted(() => {
-})
+  project.value = route.query.project;
+});
 
 //暴露给父组件用
 defineExpose({
   open,
   close,
   optionWindow
-})
+});
 </script>
 <style lang="scss" scoped>
 .mask {
@@ -306,13 +334,13 @@ defineExpose({
   display: flex;
   justify-content: center;
   align-items: center;
-  color: #FFFFFF;
+  color: #ffffff;
   z-index: 999;
 
   .box {
     width: 50%;
     border-radius: 1.6rem;
-    background: linear-gradient(60deg, #092941 -85%, #2A484B 96%);
+    background: linear-gradient(60deg, #092941 -85%, #2a484b 96%);
     box-shadow: inset 0px 1px 0px 2px rgba(255, 255, 255, 0.3);
     padding: 20px;
 
@@ -325,10 +353,11 @@ defineExpose({
 
       .title {
         font-size: 1.93rem;
-        color: #13ED84;
+        color: #13ed84;
       }
 
-      .close {}
+      .close {
+      }
     }
 
     .content {
@@ -346,8 +375,8 @@ defineExpose({
 
         .el-select__wrapper {
           border-radius: 15px;
-          color: #1A293A;
-          background: radial-gradient(30% 126% at 97% 6%, #35FFC6 0%, #00FFE8 100%) !important;
+          color: #1a293a;
+          background: radial-gradient(30% 126% at 97% 6%, #35ffc6 0%, #00ffe8 100%) !important;
         }
 
         .el-input__wrapper {
@@ -357,12 +386,11 @@ defineExpose({
         }
 
         .button {
-          color: #1A293A;
-          background: radial-gradient(141% 126% at 5% 93%, #8EFFA9 0%, #07FFE7 100%);
+          color: #1a293a;
+          background: radial-gradient(141% 126% at 5% 93%, #8effa9 0%, #07ffe7 100%);
           box-shadow: inset 0px 1px 0px 2px rgba(255, 255, 255, 0.3);
           border: none;
         }
-
       }
 
       .tableBox {
@@ -377,21 +405,20 @@ defineExpose({
           cursor: pointer;
         }
 
-        .el-table__body tr.current-row>td.el-table__cell {
-          color: #1A293A;
-          background: #07FFE7;
+        .el-table__body tr.current-row > td.el-table__cell {
+          color: #1a293a;
+          background: #07ffe7;
         }
       }
 
       .page {
-
         .el-pagination {
           display: flex;
           justify-content: center;
 
           .el-pager {
             margin: 0 10px !important;
-            background: #D8D8D8;
+            background: #d8d8d8;
             box-sizing: border-box;
             border: 1px solid #979797;
             border-radius: 15px;
@@ -401,7 +428,7 @@ defineExpose({
           .btn-prev,
           .btn-next {
             border-radius: 50%;
-            background: radial-gradient(116% 126% at 97% 6%, #35FFC6 0%, #00FFE8 100%);
+            background: radial-gradient(116% 126% at 97% 6%, #35ffc6 0%, #00ffe8 100%);
           }
         }
       }
@@ -444,7 +471,7 @@ defineExpose({
                 top: 0;
                 box-sizing: border-box;
                 border: 1px solid #979797;
-                background-image: url("@/assets/images/common/close.png");
+                background-image: url('@/assets/images/common/close.png');
                 background-position: center;
                 background-repeat: no-repeat;
                 background-size: 30% 30%;
@@ -500,8 +527,8 @@ defineExpose({
         border-radius: 0.83rem;
         font-size: 2rem;
         text-align: center;
-        color: #1A293A;
-        background: radial-gradient(141% 126% at 5% 93%, #8EFFA9 0%, #07FFE7 100%);
+        color: #1a293a;
+        background: radial-gradient(141% 126% at 5% 93%, #8effa9 0%, #07ffe7 100%);
         box-shadow: inset 0px 1px 0px 2px rgba(255, 255, 255, 0.3);
         cursor: pointer;
       }
@@ -509,7 +536,7 @@ defineExpose({
   }
 }
 
-::v-deep(.table .el-table__body tr:hover>td.el-table__cell) {
+::v-deep(.table .el-table__body tr:hover > td.el-table__cell) {
   background: #dddddd;
   cursor: pointer;
   -webkit-user-select: none;
@@ -523,7 +550,7 @@ defineExpose({
 }
 
 ::v-deep(.table2 .el-table__body tr.current-row > td) {
-  background: #13ED84 !important;
+  background: #13ed84 !important;
   color: #ffffff !important;
 }
 </style>