From c293e8f2c2c8f1eae95b0255a8745456963511d2 Mon Sep 17 00:00:00 2001 From: zhouwx <1175765986@qq.com> Date: 星期五, 05 七月 2024 15:11:44 +0800 Subject: [PATCH] 线下登记、统计 --- src/views/onlineEducation/offlineEducation/index.vue | 133 ++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 126 insertions(+), 7 deletions(-) diff --git a/src/views/onlineEducation/offlineEducation/index.vue b/src/views/onlineEducation/offlineEducation/index.vue index a654d8b..75731b5 100644 --- a/src/views/onlineEducation/offlineEducation/index.vue +++ b/src/views/onlineEducation/offlineEducation/index.vue @@ -1,12 +1,131 @@ <template> -<div>线下教育登记</div> + <div class="app-container"> + <div style="margin-bottom: 10px"> + <el-button + type="primary" + @click="openDialog('add',{})" + >新增登记</el-button> + <el-button + type="primary" + plain + >批量导入</el-button> + </div> + <!-- 表格数据 --> + <el-table v-loading="loading" :data="dataList" :border="true"> + <el-table-column label="序号" type="index" align="center" width="80" /> + <el-table-column label="企业名称" prop="companyName" align="center" /> + <el-table-column label="计划名称" prop="planName" align="center" /> + <el-table-column label="学员姓名" prop="studentName" align="center" /> + <el-table-column label="性别" prop="sex" align="center" > + <template #default="scope"> + <span>{{scope.row.sex == 0 ? '男':'女'}}</span> + </template> + </el-table-column> + <el-table-column label="身份证号" prop="idNo" align="center" width="200" :show-overflow-tooltip="true"/> + <el-table-column label="课程名称" prop="courseName" align="center"/> + <el-table-column label="培训等级" prop="level" align="center"/> + <el-table-column label="要求课时(分)" prop="period" align="center"/> + <el-table-column label="实际课时(分)" prop="actualPeriod" align="center"/> + <el-table-column label="考试成绩" prop="score" align="center"/> + <el-table-column label="是否合格" prop="passed" align="center"> + <template #default="scope"> + <span>{{scope.row.passed == 0 ? '不合格':'合格'}}</span> + </template> + </el-table-column> + </el-table> + + <pagination + v-show="total > 0" + :total="total" + v-model:page="queryParams.pageNum" + v-model:limit="queryParams.pageSize" + @pagination="getList" + /> + + <record-dialog ref="dialogRef" @getList=getList></record-dialog> + </div> </template> + <script setup> +import {getCurrentInstance, onMounted, onUnmounted, reactive, ref, toRefs} from "vue"; +import {ElMessage, ElMessageBox} from "element-plus"; +import {delCompany, getCompany} from "@/api/onlineEducation/company"; +import recordDialog from "./components/recordDialog.vue" +import {delUser, getUser} from "@/api/onlineEducation/user"; +import Cookies from "js-cookie"; +import {delStudent, getStudent} from "@/api/onlineEducation/student"; +import {getRecord} from "@/api/onlineEducation/examRecord"; + + +const { proxy } = getCurrentInstance(); +const loading = ref(false); +const dialogRef = ref(); +const data = reactive({ + queryParams: { + pageNum: 1, + pageSize: 10, + }, + total: 0, + dataList: [], + isAdmin: false + +}); + +const { queryParams, total, dataList } = toRefs(data); + +onMounted(async ()=>{ + const userInfo = JSON.parse(Cookies.get('userInfo')) + console.log("userInfo",userInfo) + if(userInfo.userType === 0){ + data.isAdmin = true; + }else { + data.isAdmin = false; + } + await getList() +}) +onUnmounted(()=>{ + +}) + +const getList = async () => { + loading.value = true + const res = await getRecord(data.queryParams) + if(res.code == 200){ + data.dataList = res.data.list + data.total = res.data.total + }else{ + ElMessage.warning(res.message) + } + loading.value = false +} + +const openDialog = (type, value) => { + dialogRef.value.openDialog(type, value); + +} + +/** 重置新增的表单以及其他数据 */ +function reset() { + proxy.resetForm("roleRef"); +} +const handleDelete = (val) => { + ElMessageBox.confirm( + '确定删除此条数据?', + '提示', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }) + .then( async() => { + const res = await delStudent(val.id) + if(res.code == 200){ + ElMessage.success('数据删除成功') + await getList() + }else{ + ElMessage.warning(res.message) + } + }) +} </script> - - - -<style scoped lang="scss"> - -</style> -- Gitblit v1.9.2