--fix bug 概览

This commit is contained in:
yuping
2023-03-26 19:09:59 +08:00
parent 7b98178e34
commit 8307259dcb
3 changed files with 52 additions and 68 deletions

View File

@@ -31,20 +31,20 @@ export function traverseArr(arr, traverseObj, saveOld = false) {
const admin = [5, 6, 8, 9, 11, 12]; const admin = [5, 6, 8, 9, 11, 12];
//检查 管理权和归属权 //检查 管理权和归属权
export function checkPer(per,createId) { export function checkPer(per, createId) {
if(createId && store?.state?.userInfo?.id === createId){ if (createId && store?.state?.userInfo?.id === createId) {
return true; return true;
} }
if (store?.state?.userInfo?.roleList.some(t => t.code === "system-admin")) { if (store?.state?.userInfo?.roleList.some(t => t.code === "system-admin")) {
return true; return true;
} }
if(per){ if (per) {
return (per + "").split(",").some(t => admin.some(s => s == t)); return (per + "").split(",").some(t => admin.some(s => s == t));
} }
if (store?.state?.userInfo?.isHrbp) { if (store?.state?.userInfo?.isHrbp) {
return true; return true;
} }
return false return false;
} }
const adminOwner = [6, 9, 12]; const adminOwner = [6, 9, 12];
@@ -201,3 +201,20 @@ export function newFile(code) {
URL.revokeObjectURL(linkNode.href); // 释放URL 对象 URL.revokeObjectURL(linkNode.href); // 释放URL 对象
document.body.removeChild(linkNode); document.body.removeChild(linkNode);
} }
//保留两位小数
export function fixDouble(v) {
const f = parseFloat(v);
if (isNaN(f)) {
return 0;
}
return Math.round(f * 100) / 100;
}
//输出两位百分小数
export function fixDoublePer(v) {
const f = parseFloat(v);
if (isNaN(f)) {
return 0;
}
return Math.round(f * 10000) / 100;
}

View File

@@ -160,9 +160,7 @@
</div> </div>
<div class="nubbox"> <div class="nubbox">
<div> <div>
<span class="nub1" style="color: #a497ff">{{ <span class="nub1" style="color: #a497ff">{{(routerInfoOverview.completeRatio * 100).toFixed(2)}}</span
routerInfoOverview.completeRatio
}}</span
><span style="color: #a497ff; font-size: 14px">%</span> ><span style="color: #a497ff; font-size: 14px">%</span>
</div> </div>
<div class="nub2">总完成率</div> <div class="nub2">总完成率</div>
@@ -195,9 +193,7 @@
<a-progress <a-progress
type="dashboard" type="dashboard"
gapDegree="0" gapDegree="0"
:percent=" :percent=" chapterOverviewList[choosedStageIndex]?.completeCourseRatio || 0 "
chapterOverviewList[choosedStageIndex]?.completeCourseRatio
"
:width="140" :width="140"
/> />
<div class="protext">课程完成率</div> <div class="protext">课程完成率</div>
@@ -206,9 +202,7 @@
<a-progress <a-progress
type="dashboard" type="dashboard"
gapDegree="0" gapDegree="0"
:percent=" :percent="chapterOverviewList[choosedStageIndex]?.completeExamRatio || 0"
chapterOverviewList[choosedStageIndex]?.completeExamRatio
"
:width="140" :width="140"
/> />
<div class="protext">考试通过率</div> <div class="protext">考试通过率</div>
@@ -217,65 +211,47 @@
<a-progress <a-progress
type="dashboard" type="dashboard"
gapDegree="0" gapDegree="0"
:percent=" :percent="chapterOverviewList[choosedStageIndex]?.completeRatio || 0"
chapterOverviewList[choosedStageIndex]?.completeRatio
"
:width="140" :width="140"
/> />
<div class="protext">作业完成率</div> <div class="protext">作业完成率</div>
</div> </div>
<div class="proright"> <div class="proright">
<div class="pronub" style="margin-left: 142px"> <div class="pronub" style="margin-left: 142px">
{{ {{ chapterOverviewList[choosedStageIndex].completeTaskCnt || 0}}
chapterOverviewList[choosedStageIndex]
? chapterOverviewList[choosedStageIndex].totalTaskCnt
: 0
}}
</div> </div>
<div class="proright1"> <div class="proright1">
<span class="textpro">关卡任务总数</span> <span class="textpro">关卡任务总数</span>
<a-progress <a-progress
:percent=" :percent="fixDoublePer(chapterOverviewList[choosedStageIndex].completeTaskCnt / (chapterOverviewList[choosedStageIndex].totalTaskCnt || 0))"
chapterOverviewList[choosedStageIndex]
? chapterOverviewList[choosedStageIndex].totalTaskCnt
: 0
"
style="width: 369px" style="width: 369px"
/> />
</div> </div>
<div class="pronub" style="margin-left: 142px"> <div class="pronub" style="margin-left: 142px">
{{ {{
chapterOverviewList[choosedStageIndex] chapterOverviewList[choosedStageIndex]
? chapterOverviewList[choosedStageIndex].totalReqCnt ? chapterOverviewList[choosedStageIndex].completeReqCnt
: 0 : 0
}} }}
</div> </div>
<div class="proright1"> <div class="proright1">
<span class="textpro">必修课</span> <span class="textpro">必修课</span>
<a-progress <a-progress
:percent=" :percent="fixDoublePer(chapterOverviewList[choosedStageIndex].completeReqCnt / (chapterOverviewList[choosedStageIndex].totalReqCnt || 0))"
chapterOverviewList[choosedStageIndex]
? chapterOverviewList[choosedStageIndex].totalReqCnt
: 0
"
style="width: 369px" style="width: 369px"
/> />
</div> </div>
<div class="pronub" style="margin-left: 142px"> <div class="pronub" style="margin-left: 142px">
{{ {{
chapterOverviewList[choosedStageIndex] chapterOverviewList[choosedStageIndex]
? chapterOverviewList[choosedStageIndex].totalOptCnt ? chapterOverviewList[choosedStageIndex].completeOptCnt
: 0 : 0
}} }}
</div> </div>
<div class="proright1"> <div class="proright1">
<span class="textpro">选修课</span> <span class="textpro">选修课</span>
<a-progress <a-progress
:percent=" :percent="fixDoublePer(chapterOverviewList[choosedStageIndex].completeOptCnt / (chapterOverviewList[choosedStageIndex].totalOptCnt || 0))"
chapterOverviewList[choosedStageIndex]
? chapterOverviewList[choosedStageIndex].totalOptCnt
: 0
"
style="width: 369px" style="width: 369px"
/> />
</div> </div>
@@ -468,20 +444,12 @@
<div style="display: flex"> <div style="display: flex">
<a-progress <a-progress
:showInfo="false" :showInfo="false"
:percent=" :percent=" parseInt((item.finishStuNum / item.totalStuNum) * 100)"
parseInt(
(item.finishStuNum / item.totalStuNum) * 100
)
"
strokeColor="#FFC067" strokeColor="#FFC067"
trailColor="rgba(253, 209, 98, 0.2)" trailColor="rgba(253, 209, 98, 0.2)"
/> />
<span class="progresstext" style="margin-left: 10px" <span class="progresstext" style="margin-left: 10px"
>{{ >{{parseInt((item.finishStuNum / item.totalStuNum) * 100) || 0}}%</span
parseInt(
(item.finishStuNum / item.totalStuNum) * 100
) || 0
}}%</span
> >
</div> </div>
</div> </div>
@@ -1446,7 +1414,7 @@ import RouterProjectManage from "../../components/drawers/router/RouterProjectMa
import ImpoterGroupLeader from "@/components/drawers/project/ImpoterGroupLeader.vue"; import ImpoterGroupLeader from "@/components/drawers/project/ImpoterGroupLeader.vue";
import TaskImpStu from "../../components/drawers/TaskFaceIn"; import TaskImpStu from "../../components/drawers/TaskFaceIn";
import { checkPer } from "@/utils/utils"; import { checkPer,fixDoublePer } from "@/utils/utils";
export default { export default {
name: "LevelAdd", name: "LevelAdd",
@@ -3012,7 +2980,7 @@ export default {
showCodeModel2, showCodeModel2,
editLearnInfo, editLearnInfo,
pubIcon, pubIcon,
fixDoublePer,
faceTeachModel, faceTeachModel,
examinationModel, examinationModel,
evaluationModel, evaluationModel,

View File

@@ -313,26 +313,26 @@
<div class="second" style="margin-top: 0"> <div class="second" style="margin-top: 0">
<div class="nubbox"> <div class="nubbox">
<span class="nub1">{{ <span class="nub1">{{
projectInfoOverview.totalStudentCnt projectInfoOverview.totalStudentCnt || 0
}}</span> }}</span>
<div class="nub2">总人数</div> <div class="nub2">总人数</div>
</div> </div>
<div class="nubbox"> <div class="nubbox">
<span class="nub1" style="color: #ff90ae">{{ <span class="nub1" style="color: #ff90ae">{{
projectInfoOverview.studyStudentCnt projectInfoOverview.studyStudentCnt || 0
}}</span> }}</span>
<div class="nub2">学习人数</div> <div class="nub2">学习人数</div>
</div> </div>
<div class="nubbox"> <div class="nubbox">
<span class="nub1" style="color: #a497ff">{{ <span class="nub1" style="color: #a497ff">{{
projectInfoOverview.completeStudentCnt projectInfoOverview.completeStudentCnt || 0
}}</span> }}</span>
<div class="nub2">完成人数</div> <div class="nub2">完成人数</div>
</div> </div>
<div class="nubbox"> <div class="nubbox">
<div> <div>
<span class="nub1" style="color: #5dc988">{{ <span class="nub1" style="color: #5dc988">{{
projectInfoOverview.onlineCourseCnt projectInfoOverview.onlineCourseCnt || 0
}}</span> }}</span>
<!-- <span style="color: #5dc988; font-size: 14px">%</span> --> <!-- <span style="color: #5dc988; font-size: 14px">%</span> -->
</div> </div>
@@ -341,7 +341,7 @@
<div class="nubbox"> <div class="nubbox">
<div> <div>
<span class="nub1" style="color: #ff90ae">{{ <span class="nub1" style="color: #ff90ae">{{
projectInfoOverview.offLineCourseCnt projectInfoOverview.offLineCourseCnt || 0
}}</span> }}</span>
<!-- <span style="color: #ff90ae; font-size: 14px">%</span> --> <!-- <span style="color: #ff90ae; font-size: 14px">%</span> -->
</div> </div>
@@ -350,7 +350,7 @@
<div class="nubbox"> <div class="nubbox">
<div> <div>
<span class="nub1" style="color: #a497ff">{{ <span class="nub1" style="color: #a497ff">{{
projectInfoOverview.completeRatio (projectInfoOverview.completeRatio || 0).toFixed(2)
}}</span }}</span
><span style="color: #a497ff; font-size: 14px">%</span> ><span style="color: #a497ff; font-size: 14px">%</span>
</div> </div>
@@ -390,7 +390,7 @@
type="dashboard" type="dashboard"
gapDegree="0" gapDegree="0"
:percent=" :percent="
stageOverviewList[choosedStageIndex]?.completeCourseRatio stageOverviewList[choosedStageIndex]?.completeCourseRatio || 0
" "
:width="140" :width="140"
/> />
@@ -401,7 +401,7 @@
type="dashboard" type="dashboard"
gapDegree="0" gapDegree="0"
:percent=" :percent="
stageOverviewList[choosedStageIndex]?.completeExamRatio stageOverviewList[choosedStageIndex]?.completeExamRatio || 0
" "
:width="140" :width="140"
/> />
@@ -411,41 +411,39 @@
<a-progress <a-progress
type="dashboard" type="dashboard"
gapDegree="0" gapDegree="0"
:percent="stageOverviewList[choosedStageIndex]?.completeRatio" :percent="stageOverviewList[choosedStageIndex]?.completeRatio || 0"
:width="140" :width="140"
/> />
<div class="protext">作业完成率</div> <div class="protext">作业完成率</div>
</div> </div>
<div class="proright"> <div class="proright">
<div class="pronub" style="margin-left: 142px"> <div class="pronub" style="margin-left: 142px">
{{ stageOverviewList[choosedStageIndex]?.completeTaskCnt }} {{ stageOverviewList[choosedStageIndex]?.completeTaskCnt || 0}}
</div> </div>
<div class="proright1"> <div class="proright1">
<span class="textpro">阶段任务总数</span> <span class="textpro">阶段任务总数</span>
<a-progress <a-progress
:percent=" :percent="fixDoublePer(stageOverviewList[choosedStageIndex]?.completeTaskCnt/(stageOverviewList[choosedStageIndex]?.totalTaskCnt || 0))"
stageOverviewList[choosedStageIndex]?.totalTaskCnt
"
style="width: 369px" style="width: 369px"
/> />
</div> </div>
<div class="pronub" style="margin-left: 142px"> <div class="pronub" style="margin-left: 142px">
{{ stageOverviewList[choosedStageIndex]?.totalReqCnt }} {{ stageOverviewList[choosedStageIndex]?.completeReqCnt || 0}}
</div> </div>
<div class="proright1"> <div class="proright1">
<span class="textpro">必修课</span> <span class="textpro">必修课</span>
<a-progress <a-progress
:percent="stageOverviewList[choosedStageIndex]?.totalReqCnt" :percent="fixDoublePer(stageOverviewList[choosedStageIndex]?.completeReqCnt/(stageOverviewList[choosedStageIndex]?.totalReqCnt || 0))"
style="width: 369px" style="width: 369px"
/> />
</div> </div>
<div class="pronub" style="margin-left: 142px"> <div class="pronub" style="margin-left: 142px">
{{ stageOverviewList[choosedStageIndex]?.totalOptCnt }} {{ stageOverviewList[choosedStageIndex]?.completeOptCnt || 0}}
</div> </div>
<div class="proright1"> <div class="proright1">
<span class="textpro">选修课</span> <span class="textpro">选修课</span>
<a-progress <a-progress
:percent="stageOverviewList[choosedStageIndex]?.totalOptCnt" :percent="fixDoublePer(stageOverviewList[choosedStageIndex]?.completeOptCnt/(stageOverviewList[choosedStageIndex]?.totalOptCnt || 0))"
style="width: 369px" style="width: 369px"
/> />
</div> </div>
@@ -2310,7 +2308,7 @@ import TableStudent from "@/components/student/TableStudent";
import TableCertificateStudent from "@/components/student/TableCertificateStudent"; import TableCertificateStudent from "@/components/student/TableCertificateStudent";
import { getStuPage } from "@/api/index1"; import { getStuPage } from "@/api/index1";
import ChangeGroupModal from "@/components/student/ChangeGroupModal.vue"; import ChangeGroupModal from "@/components/student/ChangeGroupModal.vue";
import { checkPer } from "@/utils/utils"; import { checkPer,fixDoublePer } from "@/utils/utils";
import ImpoterGroupLeader from "@/components/drawers/project/ImpoterGroupLeader.vue"; import ImpoterGroupLeader from "@/components/drawers/project/ImpoterGroupLeader.vue";
export default { export default {
name: "taskPage", name: "taskPage",
@@ -4996,6 +4994,7 @@ export default {
checkType, checkType,
downloadFile, downloadFile,
checkPer, checkPer,
fixDoublePer,
addCertificate, addCertificate,
editCertificate, editCertificate,
deleteCertificate, deleteCertificate,