From 4f6cdee3d3a9967b6955aacc354bf557430c0643 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期一, 05 八月 2024 17:05:16 +0800
Subject: [PATCH] 批改

---
 src/views/onlineEducation/classHourBatch/index.vue |  101 +++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 86 insertions(+), 15 deletions(-)

diff --git a/src/views/onlineEducation/classHourBatch/index.vue b/src/views/onlineEducation/classHourBatch/index.vue
index 13380d4..d264e80 100644
--- a/src/views/onlineEducation/classHourBatch/index.vue
+++ b/src/views/onlineEducation/classHourBatch/index.vue
@@ -1,12 +1,41 @@
 <template>
   <div class="app-container">
-    <div style="margin-bottom: 10px;display: flex;align-items: center;justify-content: space-between">
-      <el-button
-          type="primary"
-          plain
-          icon="Plus"
-          @click="openDialog('add',{})"
-      >新增批次</el-button>
+    <div style="display: flex;justify-content: space-between">
+      <el-form :inline="true" style="display: flex;align-items: center;flex-wrap: wrap;" >
+        <el-form-item>
+          <el-button
+              type="primary"
+              plain
+              icon="Plus"
+              @click="openDialog('add',{})"
+          >新增批次</el-button>
+        </el-form-item>
+        <el-form-item label="批次名称:" >
+          <el-input v-model="data.queryParams.name" placeholder="请输入批次名称"></el-input>
+        </el-form-item>
+        <el-form-item label="批次级别:" >
+          <el-select
+              v-model="data.queryParams.level"
+              class="w100"
+              style="max-width: 180px"
+              clearable
+              size="default"
+          >
+            <el-option v-for="item in data.levelList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item >
+          <el-button
+              type="primary"
+              @click="getList"
+          >查询</el-button>
+          <el-button
+              type="primary"
+              plain
+              @click="reset"
+          >重置</el-button>
+        </el-form-item>
+      </el-form>
       <span v-if="!data.isAdmin" style="font-size: 19px;font-weight: 600;margin-right: 20px">
         {{data.companyName}},您的企业当前系统可用课时总计
         <span style="font-size: 19px;font-weight: 600;color: #1ab394">{{data.remainPeriod}}</span> 分钟。<span @click="openDetail" style="cursor: pointer; font-size: 19px;font-weight: 600;color: #1890ff">[明细]</span>
@@ -26,8 +55,8 @@
       <el-table-column label="课程" prop="courseName" align="center"  />
       <el-table-column label="学习人数" prop="studentCount" align="center"  />
       <el-table-column label="总课时" prop="coursePeriodNum" align="center"  />
-      <el-table-column label="已完成人数" prop="" align="center"  />
-      <el-table-column label="完成率" prop="" align="center"  />
+      <el-table-column label="已完成人数" prop="finishCount" align="center"  />
+      <el-table-column label="完成率" prop="finishRate" align="center"  />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width"  width="180">
         <template #default="scope">
           <el-button link type="primary" @click="toStuChoose(scope.row)">学生数据</el-button>
@@ -55,11 +84,11 @@
 import batchDialog from './components/batchDialog.vue'
 import classHourChange from './components/classHourChange.vue'
 import Cookies from "js-cookie";
-import {useRouter} from 'vue-router'
+import {useRoute, useRouter} from 'vue-router'
 const router = useRouter()
 import {delQuestionBank, getQuestionBank} from "@/api/onlineEducation/questionBank";
 import {delBatch, getBatch} from "@/api/onlineEducation/batch";
-
+const route = useRoute()
 
 const { proxy } = getCurrentInstance();
 const loading = ref(false);
@@ -67,6 +96,8 @@
 const classHourRef = ref();
 const data = reactive({
   queryParams: {
+    name: '',
+    level: null,
     pageNum: 1,
     pageSize: 10,
   },
@@ -75,13 +106,39 @@
   isAdmin: false,
   companyName: '',
   remainPeriod: null,
-  companyId: null
+  companyId: null,
+  levelList: [
+    {
+      id: 1,
+      name: '公司级 '
+    },
+    {
+      id: 2,
+      name: '部门级'
+    },
+    {
+      id: 3,
+      name: '车间级'
+    },
+    {
+      id: 4,
+      name: '其他'
+    },
+  ],
 
 });
 
 const { queryParams, total, dataList } = toRefs(data);
 
 onMounted(async ()=>{
+  if(route.query.val){
+    const val = JSON.parse(route.query.val)
+    if(val){
+      data.queryParams.pageNum = val.pageNum;
+      data.queryParams.pageSize = val.pageSize;
+    }
+  }
+
   const userInfo = JSON.parse(Cookies.get('userInfo'))
   console.log("userInfo",userInfo)
   if(userInfo.userType === 0){
@@ -105,7 +162,8 @@
     data.dataList = res.data.list.map(item => {
       return {
         ...item,
-        coursePeriodNum: item.coursePeriod ? (item.coursePeriod /60).toFixed(2).replace(/\.00$/, '') + '分钟':''
+        coursePeriodNum: item.coursePeriod ? (item.coursePeriod /60).toFixed(2).replace(/\.00$/, '') + '分钟':'',
+        finishRate: item.finishCount ?  item.finishCount ===0 && item.studentCount ===0  ? '0%': (item.finishCount / item.studentCount).toFixed(2) *100 + '%' : ''
       }
     })
     data.total = res.data.total
@@ -121,7 +179,13 @@
 
 /** 重置新增的表单以及其他数据  */
 function reset() {
-  proxy.resetForm("roleRef");
+  data.queryParams = {
+    name: '',
+    level: null,
+    pageNum: 1,
+    pageSize: 10,
+  }
+  getList()
 }
 const handleDelete = (val) => {
   ElMessageBox.confirm(
@@ -143,7 +207,14 @@
       })
 }
 const toStuChoose = (val) => {
-  const v = JSON.stringify(val)
+  const obj = {
+    pageNum: data.queryParams.pageNum,
+    pageSize: data.queryParams.pageSize,
+    id: val.id
+  }
+  // val.pageNum = data.queryParams.pageNum;
+  // val.pageSize = data.queryParams.pageSize
+  const v = JSON.stringify(obj)
   router.push({ path: "/chooseStu", query: { val: v } });
 }
 

--
Gitblit v1.9.2