818 lines
24 KiB
Vue

<template>
<div class="political-outlook">
<div class="tabBox">
<div :class="{ danger: true, active: currentTab == 'safeEdu' ? true : false }">
<span @click="handleChangeTab('safeEdu')">入场前安全教育</span>
</div>
<div :class="{ danger: true, active: currentTab == 'eduPlan' ? true : false }">
<span @click="handleChangeTab('eduPlan')">入场后培训计划</span>
</div>
</div>
<div class="content" v-if="currentTab == 'safeEdu'">
<div class="table-one">
<div class="tabList">
<div>序号</div>
<div>姓名</div>
<div>性别</div>
<div>民族</div>
<div>照片</div>
<div>所属企业</div>
<div>所属班组</div>
<div style="width: 180px">身份证号</div>
<div>联系电话</div>
<div style="width: 160px">考试时间</div>
<div>培训状态</div>
</div>
<el-scrollbar class="listBox" ref="refScrollbar">
<div v-for="(item, index) in partyMemberList" class="listStyle" :key="item.id">
<div>{{ index + 1 }}</div>
<div>{{ item.workerName }}</div>
<div>{{ item.sex == 1 ? "男" : "女" }}</div>
<div>{{ item.nation }}</div>
<div class="list-img">
<el-image
fit="contain"
class="el-img"
:src="BASEURL + '/image/' + item.fieldAcquisitionUrl"
:preview-src-list="[BASEURL + '/image/' + item.fieldAcquisitionUrl]"
>
<template #error>
<el-image :src="noDataImage" :preview-src-list="[noDataImage]" fit="contain" class="el-no-img" alt="" />
</template>
</el-image>
<!-- <img :src="item.fieldAcquisitionUrl" alt="" srcset=""> -->
</div>
<div>
<el-tooltip class="box-item" effect="dark" :content="item.enterpriseName" placement="top-start">
<span>{{ item.enterpriseName }}</span>
</el-tooltip>
</div>
<div>
<el-tooltip
class="box-item"
effect="dark"
:content="item.personType == 1 ? item.teamName : item.departmentName"
placement="top-start"
>
<span>{{ item.personType == 1 ? item.teamName : item.departmentName }}</span>
</el-tooltip>
</div>
<div style="width: 180px">
<el-tooltip class="box-item" effect="dark" :content="item.idCard" placement="top-start">
<span>{{ item.idCard }}</span>
</el-tooltip>
</div>
<div>{{ item.phoneNumber }}</div>
<div style="width: 160px">
<el-tooltip class="box-item" effect="dark" :content="item.educationTime" placement="top-start">
<span>{{ item.educationTime }}</span>
</el-tooltip>
</div>
<div>
{{ item.isExamPass == -1 ? "未培训" : item.isExamPass == 1 ? "合格" : "不合格" }}
</div>
</div>
<div class="notoDta" v-if="partyMemberList.length == 0">
<img src="@/assets/images/noData.png" alt="" />
<p>暂无数据</p>
</div>
</el-scrollbar>
</div>
<el-pagination
v-if="partyMemberList.length != 0"
background
:page-size="10"
style="justify-content: center"
@current-change="onCurrentChange"
layout="prev, pager, next"
:total="total"
/>
</div>
<div class="content" v-if="currentTab == 'eduPlan'">
<div style="height: 100%" v-if="!isDetail">
<div class="searchLine">
<span style="margin-right: 5px">培训计划名称</span>
<el-input
v-model="eduPlanName"
clearable
size="small"
style="width: 150px"
@input="handleInput"
placeholder="请输入培训计划名称"
/>
</div>
<div class="table-one">
<div class="tabList">
<div>序号</div>
<div>培训计划名称</div>
<div>科目名称</div>
<div style="width: 180px">教育主题</div>
<div style="width: 350px">培训有效时限</div>
<div>教育人员</div>
<div>创建人</div>
<div>培训完成率</div>
<div>培训通过率</div>
<div>操作</div>
</div>
<el-scrollbar class="listBox" ref="refScrollbar">
<div v-for="(item, index) in partyMemberList" class="listStyle" :key="item.id">
<div>{{ index + 1 }}</div>
<div>
<el-tooltip class="box-item" style="text-align: center" effect="dark" :content="item.name" placement="top-start">
<span>{{ item.name || "--" }}</span>
</el-tooltip>
</div>
<div>
<el-tooltip class="box-item" style="text-align:center" effect="dark" :content="item.subjectName" placement="top-start">
<span>{{ item.subjectName || '--' }}</span>
</el-tooltip>
</div>
<div style="width:180px">
<el-tooltip class="box-item" style="text-align:center" effect="dark" :content="item.title" placement="top-start">
<span>{{ item.title || '--' }}</span>
</el-tooltip>
</div>
<div style="width: 350px">{{ item.trainBeginTime || "--" }} - {{ item.trainEndTime || "--" }}</div>
<div>{{ item.workerNum || "--" }}</div>
<div>{{ item.createByName || "--" }}</div>
<div>
{{ item.completeRadio != null ? item.completeRadio + "%" : "--" }}
</div>
<div>{{ item.passRadio != null ? item.passRadio + "%" : "--" }}</div>
<div style="color: #5382f6; cursor: pointer" @click="handleOpenDetail(item)">查看培训详情</div>
</div>
<div class="notoDta" v-if="partyMemberList.length == 0">
<img src="@/assets/images/noData.png" alt="" />
<p>暂无数据</p>
</div>
</el-scrollbar>
</div>
<el-pagination
v-if="partyMemberList.length != 0"
background
:page-size="10"
style="justify-content: center"
@current-change="onCurrentChange"
layout="prev, pager, next"
:total="total"
/>
</div>
<div style="height: 100%" v-else>
<div
class="searchLine"
style="font-size: 14px; left: 91.6%; top: 18%; z-index: 99; cursor: pointer"
@click="handleCloseDetail"
>
{{ "<<" }}返回
</div>
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleDetailTab">
<el-tab-pane :label="'学习记录'" name="first">
<div class="searchInner">
<span style="margin-right:5px">姓名</span>
<el-input v-model="workerName" clearable size="small" style="width: 150px" @input="handleInput2" placeholder="请输入姓名" />
</div>
<div class="table-one" style="transform:translateY(10px)">
<div class="tabList" style="justify-content:space-around">
<div>序号</div>
<div>姓名</div>
<div>课程名称</div>
<div style="width: 150px">身份证号</div>
<div>培训计划名称</div>
<div>开始学习时间</div>
<div>结束学习时间</div>
</div>
<el-scrollbar class="listBox" ref="refScrollbar" style="height:370px;">
<div v-for="(item, index) in studyExamRecord" class="listStyle" :key="item" style="justify-content:space-around">
<div>{{ index + 1 }}</div>
<div>{{ item.workerName || "--" }}</div>
<div>
<el-tooltip
class="box-item"
style="text-align: center"
effect="dark"
:content="eduPlanItem.courseName"
placement="top-start"
>
<span>{{ eduPlanItem.courseName || "--" }}</span>
</el-tooltip>
</div>
<div style="width: 150px">{{ item.workerCard || "--" }}</div>
<div>
<el-tooltip
class="box-item"
style="text-align: center"
effect="dark"
:content="eduPlanItem.name"
placement="top-start"
>
<span>{{ eduPlanItem.name || "--" }}</span>
</el-tooltip>
</div>
<div>{{ item.beginTime || "--" }}</div>
<div>{{ item.endTime || "--" }}</div>
</div>
<div class="notoDta" v-if="studyExamRecord.length == 0">
<img src="@/assets/images/noData.png" alt="" />
<p>暂无数据</p>
</div>
</el-scrollbar>
</div>
</el-tab-pane>
<el-tab-pane :label="'考试记录'" name="second">
<div class="searchInner">
<span style="margin-right:5px">姓名</span>
<el-input v-model="workerName" clearable size="small" style="width: 150px" @input="handleInput2" placeholder="请输入姓名" />
</div>
<div class="table-one" style="transform:translateY(10px)">
<div class="tabList" style="justify-content:space-around">
<div>序号</div>
<div>姓名</div>
<div>科目名称</div>
<div>考试名称</div>
<div style="width: 140px">培训计划名称</div>
<div style="width: 200px">身份证号</div>
<div style="width: 180px">开始考试时间</div>
<div>作答时长</div>
<div>考试结果</div>
<div>考试总分</div>
<div>考得分</div>
<div style="width: 140px">剩余重考次数</div>
</div>
<el-scrollbar class="listBox" ref="refScrollbar" style="height:370px">
<div v-for="(item, index) in studyExamRecord" class="listStyle" :key="item" style="justify-content:space-around">
<div>{{ index + 1 }}</div>
<div>{{ item.workerName || '--' }}</div>
<div>
<el-tooltip class="box-item" style="text-align:center" effect="dark" :content="eduPlanItem.subjectName" placement="top-start">
<span>{{ eduPlanItem.subjectName || '--' }}</span>
</el-tooltip>
</div>
<div>
<el-tooltip class="box-item" style="text-align:center" effect="dark" :content="eduPlanItem.paperName" placement="top-start">
<span>{{ eduPlanItem.paperName || '--' }}</span>
</el-tooltip>
</div>
<div style="width: 140px">
<el-tooltip
class="box-item"
style="text-align: center"
effect="dark"
:content="eduPlanItem.name"
placement="top-start"
>
<span>{{ eduPlanItem.name || "--" }}</span>
</el-tooltip>
</div>
<div style="width: 200px">{{ item.workerCard || "--" }}</div>
<div style="width: 180px">{{ item.startExamTime || "--" }}</div>
<div>{{ item.duration || "--" }}</div>
<div>{{ item.isPass == 1 ? "合格" : "不合格" }}</div>
<div>{{ item.totalScore != null ? item.totalScore : 0 }}</div>
<div>{{ item.score != null ? item.score : 0 }}</div>
<div style="width: 140px">
{{ item.examCount != null ? item.examCount : 0 }}
</div>
</div>
<div class="notoDta" v-if="studyExamRecord.length == 0">
<img src="@/assets/images/noData.png" alt="" />
<p>暂无数据</p>
</div>
</el-scrollbar>
</div>
</el-tab-pane>
<el-tab-pane :label="'未学习记录'" name="third">
<div class="searchInner">
<span style="margin-right:5px">姓名</span>
<el-input v-model="workerName" clearable size="small" style="width: 150px" @input="handleInput2" placeholder="请输入姓名" />
</div>
<div class="table-one" style="transform:translateY(10px);">
<div class="tabList" style="justify-content:space-around">
<div>序号</div>
<div>姓名</div>
<div style="width: 150px">身份证号</div>
<div>培训计划名称</div>
<div>科目类型</div>
<div>课程名称</div>
</div>
<el-scrollbar class="listBox" ref="refScrollbar" style="height:370px">
<div v-for="(item, index) in studyExamRecord" class="listStyle" :key="item" style="justify-content:space-around">
<div>{{ index + 1 }}</div>
<div>{{ item.workerName || "--" }}</div>
<div style="width: 150px">{{ item.workerCard || "--" }}</div>
<div>
<el-tooltip
class="box-item"
style="text-align: center"
effect="dark"
:content="eduPlanItem.paperName"
placement="top-start"
>
<span>{{ eduPlanItem.name || "--" }}</span>
</el-tooltip>
</div>
<div>{{ eduPlanItem.subjectName || "--" }}</div>
<div>
<el-tooltip
class="box-item"
style="text-align: center"
effect="dark"
:content="eduPlanItem.paperName"
placement="top-start"
>
<span>{{ eduPlanItem.courseName || "--" }}</span>
</el-tooltip>
</div>
</div>
<div class="notoDta" v-if="studyExamRecord.length == 0">
<img src="@/assets/images/noData.png" alt="" />
<p>暂无数据</p>
</div>
</el-scrollbar>
</div>
</el-tab-pane>
<el-tab-pane :label="'未考试记录'" name="four">
<div class="searchInner">
<span style="margin-right:5px">姓名</span>
<el-input v-model="workerName" clearable size="small" style="width: 150px" @input="handleInput2" placeholder="请输入姓名" />
</div>
<div class="table-one" style="transform:translateY(10px)">
<div class="tabList" style="justify-content:space-around">
<div>序号</div>
<div>姓名</div>
<div style="width: 150px">身份证号</div>
<div>培训计划名称</div>
<div>科目类型</div>
<div>考试名称</div>
</div>
<el-scrollbar class="listBox" ref="refScrollbar" style="height:370px;">
<div v-for="(item, index) in studyExamRecord" class="listStyle" :key="item" style="justify-content:space-around">
<div>{{ index + 1 }}</div>
<div>{{ item.workerName || "--" }}</div>
<div style="width: 150px">{{ item.workerCard || "--" }}</div>
<div>
<el-tooltip
class="box-item"
style="text-align: center"
effect="dark"
:content="eduPlanItem.name"
placement="top-start"
>
<span>{{ eduPlanItem.name || "--" }}</span>
</el-tooltip>
</div>
<div>{{ eduPlanItem.subjectName || "--" }}</div>
<div>
<el-tooltip
class="box-item"
style="text-align: center"
effect="dark"
:content="eduPlanItem.paperName"
placement="top-start"
>
<span>{{ eduPlanItem.paperName || "--" }}</span>
</el-tooltip>
</div>
</div>
<div class="notoDta" v-if="studyExamRecord.length == 0">
<img src="@/assets/images/noData.png" alt="" />
<p>暂无数据</p>
</div>
</el-scrollbar>
</div>
</el-tab-pane>
<el-pagination
v-if="studyExamRecord.length != 0"
background
:page-size="10"
style="justify-content: center"
@current-change="onCurrentChange1"
layout="prev, pager, next"
:total="total1"
/>
</el-tabs>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref, onMounted } from "vue";
import { GlobalStore } from "@/stores";
import type { TabsPaneContext } from "element-plus";
import noDataImage from "@/assets/images/vehicleManagement/car.png";
import { getSafeEducationDataApi, getEduPlanDataApi, getStudyDataApi, getExamDataApi } from "@/api/modules/agjtCommandApi";
const store = GlobalStore();
const props = defineProps(["tip"]);
const BASEURL = import.meta.env.VITE_API_URL;
let pageNo = ref(1 as any);
let moreScroll = ref(true as any);
const refScrollbar = ref(null as any); // 绑定到滚动的盒子上
//tab控制属性
const currentTab = ref("safeEdu" as any);
function handleChangeTab(val: any) {
//教育培训相关属性
isDetail.value = false;
activeIndex.value = 0;
activeName.value = "first";
//切换安全教育和教育培训相关属性
currentTab.value = val;
partyMemberList.value = [];
pageNo.value = 1;
getMemberCountList("search");
}
//进入详情页面
const eduPlanItem = ref("" as any);
const isDetail = ref(false as any);
//详情tab
const activeIndex = ref(0 as any);
const activeName = ref("first" as any);
const studyExamRecord = ref("" as any);
//进入详情页面
const handleOpenDetail = async (item: any) => {
activeIndex.value = 0
activeName.value = 'first'
isDetail.value = true;
workerName.value = ''
eduPlanItem.value = item;
getStudyExamData();
};
const handleCloseDetail = async () => {
activeIndex.value = 0
activeName.value = 'first'
workerName.value = ''
isDetail.value = false;
};
//详情tab
const handleDetailTab = async (tab: TabsPaneContext, event: Event) => {
if (tab.index == activeIndex.value) return;
activeIndex.value = tab.index;
workerName.value = ''
getStudyExamData();
};
let total = ref(0 as any);
const onCurrentChange = (event: number) => {
pageNo.value = event;
getMemberCountList(true);
};
const pageNo1 = ref(1 as any);
let total1 = ref(0 as any);
const onCurrentChange1 = (event: number) => {
pageNo1.value = event;
getStudyExamData();
};
const getStudyExamData = async () => {
let data: any = {
projectSn: store.sn,
trainId: eduPlanItem.value.id,
workerName: workerName.value,
pageNo: pageNo1.value,
pageSize: 10
};
if (activeIndex.value == 0) {
data.number = 1;
await getStudyDataApi(data).then((res: any) => {
if (res.success) {
studyExamRecord.value = res.result.records;
total1.value = Number(res.result.total);
}
});
}
if (activeIndex.value == 1) {
data.examNum = 1;
await getExamDataApi(data).then((res: any) => {
if (res.success) {
studyExamRecord.value = res.result.records;
total1.value = Number(res.result.total);
}
});
}
if (activeIndex.value == 2) {
data.number = 0;
await getStudyDataApi(data).then((res: any) => {
if (res.success) {
studyExamRecord.value = res.result.records;
total1.value = Number(res.result.total);
}
});
}
if (activeIndex.value == 3) {
data.examNum = 0;
await getExamDataApi(data).then((res: any) => {
if (res.success) {
studyExamRecord.value = res.result.records;
total1.value = Number(res.result.total);
}
});
}
};
const eduPlanName = ref(''as any)
const workerName = ref(''as any)
const partyMemberList = ref({} as any);
//获取数据
const getMemberCountList = async (tip: any) => {
let requestData: any = {
projectSn: store.sn,
pageNo: tip == "search" ? 1 : pageNo.value,
pageSize: 10
};
if (props.tip == "实时") {
requestData.presence = 1;
} else if (props.tip == "日累积") {
requestData.attendance = 1;
} else {
requestData.inserviceType = 1;
}
// const res: any = await getSafeEducationDataApi(requestData);
let res: any = null;
if (currentTab.value == "safeEdu") {
res = await getSafeEducationDataApi(requestData);
} else {
requestData.name = eduPlanName.value;
res = await getEduPlanDataApi(requestData);
}
// if (tip == "more") {
// partyMemberList.value = partyMemberList.value.concat(res.result.records);
// } else {
// partyMemberList.value = res.result.records;
// }
partyMemberList.value = res.result.records;
total.value = Number(res.result.total);
// 为图片拼接IP
// partyMemberList.value.map((item:any) => {
// item.fieldAcquisitionUrl = BASEURL + '/image/' + item.fieldAcquisitionUrl
// })
// if (res.result.pages == pageNo.value) {
// moreScroll.value = false;
// } else {
// pageNo.value = pageNo.value + 1;
// }
};
//培训计划搜索
const handleInput = async () => {
partyMemberList.value = []
pageNo.value = 1
getMemberCountList('search')
}
//培训计划详情记录搜索
const handleInput2 = async () => {
partyMemberList.value = []
pageNo.value = 1
getStudyExamData()
}
onMounted(async () => {
await getMemberCountList("search");
// refScrollbar.value.wrapRef.addEventListener("scroll", (e: any) => {
// const scrollTop = e.target.scrollTop;
// const scrollHeight = e.target.scrollHeight;
// const clientHeight = e.target.clientHeight;
// // 向上加载更多
// if (scrollTop >= scrollHeight - clientHeight - 1) {
// if (moreScroll.value) {
// getMemberCountList("more");
// }
// }
// });
});
</script>
<style lang="scss" scoped>
@mixin flex {
display: flex;
align-items: center;
}
.searchInner{
color:#fff;
position: absolute;
top:0%;
left:0%;
}
.political-outlook {
height: 97%;
margin: 0 60px;
.tabBox {
position: absolute;
top: 6%;
left: 3.5%;
width: 360px;
height: 50px;
// background-color: #fff;
color: gray;
font-weight: bold;
font-size: 20px;
font-style: italic;
display: flex;
justify-content: space-around;
align-items: center;
.danger {
width: 50%;
height: 100%;
display: flex;
justify-content: space-around;
align-items: center;
cursor: pointer;
}
.special {
width: 50%;
height: 100%;
display: flex;
justify-content: space-around;
align-items: center;
cursor: pointer;
}
.active {
color: #fff;
}
}
.content {
height: 95%;
width: 100%;
margin-top: 10px;
// background: url("@/assets/images/cardImg.png") no-repeat;
background-size: 100% 100%;
padding: 20px 15px;
.searchLine {
color: #fff;
position: absolute;
top: 15.65%;
left: 5%;
}
.top-statistics {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-gap: 20px;
color: white;
margin: 0 5%;
.statistics-item {
width: 240px;
height: 95px;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
position: relative;
.title {
position: absolute;
top: 4%;
left: 4%;
}
&-content {
display: inline-block;
width: 50%;
height: auto;
text-indent: 1.5em;
}
&-content:nth-child(2) {
margin-top: 8%;
}
&-content:nth-child(3) {
margin-top: 8%;
}
}
.statistics-item:nth-child(1) {
background: url("@/assets/images/commandScreen/bg6.png") no-repeat;
background-size: 100% 100%;
}
.statistics-item:nth-child(2) {
background: url("@/assets/images/commandScreen/bg2.png") no-repeat;
background-size: 100% 100%;
}
.statistics-item:nth-child(3) {
background: url("@/assets/images/commandScreen/bg4.png") no-repeat;
background-size: 100% 100%;
}
.statistics-item:nth-child(4) {
background: url("@/assets/images/commandScreen/bg1.png") no-repeat;
background-size: 100% 100%;
}
.statistics-item:nth-child(5) {
background: url("@/assets/images/commandScreen/bg3.png") no-repeat;
background-size: 100% 100%;
}
.statistics-item:nth-child(6) {
background: url("@/assets/images/commandScreen/bg5.png") no-repeat;
background-size: 100% 100%;
}
}
.table-one {
height: 80%;
.tabList {
display: flex;
// width: 100%;
height: 5%;
background: url("@/assets/images/vehicleManagement/ListTitleImg.png") no-repeat;
background-size: 100% 100%;
// position: absolute;
left: 75.5%;
top: 75%;
color: #ccc;
font-size: calc(100vw * 14 / 1920);
line-height: 30px;
align-items: center;
margin-top: 2%;
div {
text-align: center;
width: 10%;
padding: 0 5px;
}
}
.listBox {
height: 92%;
.listStyle {
display: flex;
align-items: center;
text-align: center;
height: 30px;
color: #fff;
font-size: 12px;
margin-bottom: 5px;
.list-img {
.el-img {
width: 30px;
height: 30px;
img {
display: flex;
align-items: center;
width: 100%;
height: 100%;
}
}
.el-no-img {
transform: translateX(-6px);
width: 30px;
height: 30px;
}
}
div {
width: 10%;
white-space: nowrap; //单行
overflow: hidden;
text-overflow: ellipsis;
padding: 0 5px;
}
}
.listStyle:hover {
background: #091f3f;
}
}
}
// .demo-tabs {
// .table-one {
// height: 60% !important;
// }
// }
:deep() {
.el-tabs__item {
color: white;
}
.el-tabs__item.is-active {
color: var(--el-color-primary);
}
}
}
}
.notoDta {
top: 35%;
width: 20%;
left: 40%;
position: absolute;
text-align: center;
img {
width: 40%;
margin: 5% 30%;
}
p {
color: #fff;
font-size: calc(100vw * 14 / 1920);
margin: -6% 37%;
}
}
// element 组件样式
:deep() {
.el-date-editor .el-range-input,
.el-range-separator {
color: #fff;
}
.el-input__wrapper {
background: #112d59;
}
.el-input__inner {
color: #fff;
}
.el-button {
background-color: #2758c0;
color: white;
border-color: transparent;
}
}
// ::v-deep .el-select .el-input .el-select__caret {
// color: #fff;
// }
</style>