From 6459f8bff3e568e65e6dc617f22c686cf5a8db44 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: Mon, 15 Jul 2024 16:35:06 +0800
Subject: [PATCH] 组卷
---
src/views/onlineEducation/count/index.vue | 90 ++++++++++++++++++++++++++++++++++++---------
1 files changed, 72 insertions(+), 18 deletions(-)
diff --git a/src/views/onlineEducation/count/index.vue b/src/views/onlineEducation/count/index.vue
index 3146e79..31bc89f 100644
--- a/src/views/onlineEducation/count/index.vue
+++ b/src/views/onlineEducation/count/index.vue
@@ -1,8 +1,8 @@
<template>
<div class="app-container">
<div style="margin-bottom: 10px">
- <el-form style="display: flex">
- <el-form-item label="企业:">
+ <el-form style="display: flex;flex-wrap: wrap">
+ <el-form-item label="企业:" v-if="state.isAdmin">
<el-select
v-model="state.queryParams.companyId"
style="width: 100%"
@@ -27,7 +27,7 @@
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
- value-format="YYYY-MM-DD 00:00:00"
+ format="YYYY-MM-DD"
/>
</el-form-item>
<el-form-item style="margin-left: 50px">
@@ -47,15 +47,31 @@
<!-- 表格数据 -->
<el-table v-loading="loading" :data="state.dataList" :border="true" row-key="id">
<el-table-column label="序号" type="index" align="center" width="80" />
- <el-table-column label="企业名称" prop="sort" align="center" />
- <el-table-column label="企业编号" prop="sort" align="center" width="80" />
- <el-table-column label="总批次/人数" prop="sort" align="center" width="80" />
- <el-table-column label="三级" prop="sort" align="center" width="80" />
- <el-table-column label="二级" prop="sort" align="center" width="80" />
- <el-table-column label="一级" prop="sort" align="center" width="80" />
- <el-table-column label="考试人次" prop="sort" align="center" width="80" />
- <el-table-column label="合格人次" prop="sort" align="center" width="80" />
- <el-table-column label="考试合格率" prop="sort" align="center" width="80" />
+ <el-table-column label="企业名称" prop="companyName" align="center" />
+ <el-table-column label="企业编号" prop="companyCode" align="center" />
+ <el-table-column label="总批次/人数" prop="sort" align="center" >
+ <template #default="scope">
+ <span>{{scope.row.phaseStudentCount && scope.row.phaseCount ? scope.row.phaseCount + '/' +scope.row.phaseStudentCount:''}}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="三级" prop="sort" align="center" >
+ <template #default="scope">
+ <span>{{scope.row.level3StudentCount && scope.row.level3PhaseCount ? scope.row.level3PhaseCount+ '/' +scope.row.level3StudentCount:''}}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="二级" prop="sort" align="center" >
+ <template #default="scope">
+ <span>{{scope.row.level2StudentCount && scope.row.level2PhaseCount ? scope.row.level2PhaseCount+ '/' +scope.row.level2StudentCount:''}}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="一级" prop="sort" align="center" >
+ <template #default="scope">
+ <span>{{scope.row.level1StudentCount && scope.row.level1PhaseCount ? scope.row.level1PhaseCount+ '/' +scope.row.level1StudentCount:''}}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="考试人次" prop="paperStudentCount" align="center" />
+ <el-table-column label="合格人次" prop="passStudentCount" align="center" />
+ <el-table-column label="合格率" prop="passRate" align="center" />
</el-table>
<pagination
v-show="state.total > 0"
@@ -71,10 +87,12 @@
<script setup>
import {getCurrentInstance, onMounted, reactive, ref, toRefs} from "vue";
import {ElMessage, ElMessageBox} from "element-plus";
+import moment from "moment";
import {delClassification, getClassification} from "@/api/onlineEducation/courseClass";
import {getCompany} from "@/api/onlineEducation/company";
import {getCompanyCount} from "@/api/onlineEducation/count";
+import Cookies from "js-cookie";
const { proxy } = getCurrentInstance();
const loading = ref(false);
const areaRef = ref();
@@ -94,11 +112,19 @@
companyList: [],
pageNum: 1,
pageSize: 10,
+ isAdmin: false
});
//页面加载
onMounted(() => {
- getCompanyList();
+ setDate();
+ const userInfo = JSON.parse(Cookies.get('userInfo'))
+ console.log("userInfo",userInfo)
+ state.isAdmin = userInfo.userType === 0;
+ if(state.isAdmin){
+ getCompanyList();
+ }
+
getList();
});
@@ -106,7 +132,14 @@
loading.value = true;
const res = await getCompanyCount(state.queryParams);
if(res.code === 200){
- state.dataList = res.data
+ state.dataList = res.data.list.map(item => {
+ return {
+ ...item,
+ passRate: item.passStudentCount!=null && item.paperStudentCount!=null ? (item.passStudentCount / item.paperStudentCount).toFixed(2) *100 + '%': ''
+
+ }
+ })
+ state.total = res.data.total
}else{
ElMessage.warning(res.message)
}
@@ -150,23 +183,44 @@
getCompanyList('')
}, 500)
}
+const setDate = () => {
+ let isDate = new Date()
+ let sTime = `${isDate.getFullYear()}-${isDate.getMonth() + 1}-${isDate.getDate()-7}`
+ let eTime = `${isDate.getFullYear()}-${isDate.getMonth() + 1}-${isDate.getDate()}`
+ sTime = `${sTime}`
+ eTime = `${eTime}`
+ searchTime.value = [sTime,eTime];
+ state.queryParams.startTime = searchTime.value[0]+' 00:00:00'
+ state.queryParams.endTime = searchTime.value[1]+' 00:00:00'
+}
const changeTime=(value)=>{
+ console.log('11',searchTime.value)
if(!value){
state.queryParams.endTime = ""
state.queryParams.startTime = ""
}
+ searchTime.value[0]=moment(searchTime.value[0]).format('YYYY-MM-DD')
+ searchTime.value[1]=moment(searchTime.value[1]).format('YYYY-MM-DD')
}
const searchClick = () => {
if(searchTime.value && searchTime.value.length>0){
- state.queryParams.startTime = searchTime.value[0]
- state.queryParams.endTime = searchTime.value[1]
+ state.queryParams.startTime = searchTime.value[0] + ' 00:00:00'
+ state.queryParams.endTime = searchTime.value[1] + ' 00:00:00'
}
getList();
}
+
/** 重置新增的表单以及其他数据 */
function reset() {
- data.queryParams.name = '';
- data.queryParams.pageNum = 1;
+ state.queryParams = {
+ companyId: '',
+ type: null,
+ endTime: '',
+ startTime: '',
+ pageNum: 1,
+ pageSize: 10,
+ }
+ searchTime.value = [];
getList();
}
--
Gitblit v1.9.2