feat: scope teacher score dashboard

dev-QQq
chenyuan 4 weeks ago
parent 0a794c21e7
commit 194d452978

@ -613,6 +613,27 @@ export function retrySchoolDefaultTaskInitialization() {
});
}
// 成绩中心-查询成绩列表
export function getOwnedTeachingClasses() {
return request({
url: "/api/weight/ownedTeachingClasses",
method: "get",
});
}
export function getTeachingClassWeight(teachingClassId) {
return request({
url: "/api/weight/selectTeachingClassWeight",
method: "post",
params: { teachingClassId },
});
}
export function updateTeachingClassWeight(teachingClassId, data) {
return request({
url: "/api/weight/updateTeachingClassWeight",
method: "post",
params: { teachingClassId },
data,
});
}
export function getScoreList(params) {
return request({
url: "/api/weight/selectStuRankAndScore",

@ -58,7 +58,6 @@ const classList = ref([]);
const classParams = ref({
classId: "",
time: "",
schoolId: userStore.userInfo.schoolId,
});
const initstatus = ref(false);
const circularData = ref([
@ -144,10 +143,11 @@ const getStatisticsData = async () => {
};
//
const getClassGradeTrend = () => {
teacherApi.getAverageScoreTrend({ schoolId: userStore.userInfo.schoolId, userId: userStore.userInfo.userId }).then((res) => {
classTime.value = res.startTime;
className.value = res.map((item) => item.className);
classList.value = res.map((item) => {
teacherApi.getAverageScoreTrend().then((res) => {
const trends = Array.isArray(res) ? res : [];
classTime.value = trends[0]?.startTime || [];
className.value = trends.map((item) => item.className);
classList.value = trends.map((item) => {
return {
name: item.className,
type: "line",
@ -186,10 +186,10 @@ const getClassGradeStatistics = () => {
};
//
const getClassList = () => {
teacherApi.getClasses({ schoolMajorId: userStore.userInfo.schoolId }).then((res) => {
userStore.classList = Object.keys(res).map((key) => ({
class_name: res[key],
class_id: key,
teacherApi.getOwnedTeachingClasses().then((res) => {
userStore.classList = (res.data || []).map((item) => ({
class_name: item.className,
class_id: item.schoolClassId,
}));
});
};
@ -320,4 +320,4 @@ onMounted(() => {
margin-right: 0px !important;
}
}
</style>
</style>

@ -62,28 +62,33 @@
<pagination v-show="workingCapitalTotal > 0" :total="workingCapitalTotal" v-model:page="scoreParams.index" v-model:limit="scoreParams.size" @pagination="getList" />
<el-dialog v-model="WeightStart" title="权重设置" width="500" class="F_dialog teacher-dialog">
<el-form ref="ruleFormRef" :model="scoreWeightObj" class="demo-form" :rules="rules">
<el-form-item label="市场需求挖掘:" prop="marketResearchWeight" label-width="150">
<el-input v-model.number="scoreWeightObj.marketResearchWeight" placeholder="" clearable>
<el-form-item label="互联网产品开发基础认知:" prop="foundationWeight" label-width="200">
<el-input v-model.number="scoreWeightObj.foundationWeight" placeholder="" clearable>
<template #suffix>%</template>
</el-input>
</el-form-item>
<el-form-item label="产品规划:" prop="productPlanningWeight" label-width="150">
<el-input v-model.number="scoreWeightObj.productPlanningWeight" placeholder="" clearable>
<el-form-item label="市场洞察与需求分析:" prop="marketInsightWeight" label-width="200">
<el-input v-model.number="scoreWeightObj.marketInsightWeight" placeholder="" clearable>
<template #suffix>%</template>
</el-input>
</el-form-item>
<el-form-item label="产品投放测试:" prop="productLaunchTestWeight" label-width="150">
<el-input v-model.number="scoreWeightObj.productLaunchTestWeight" placeholder="" clearable>
<el-form-item label="产品规划与设计:" prop="planningDesignWeight" label-width="200">
<el-input v-model.number="scoreWeightObj.planningDesignWeight" placeholder="" clearable>
<template #suffix>%</template>
</el-input>
</el-form-item>
<el-form-item label="供应渠道管理:" prop="supplyChannelWeight" label-width="150">
<el-input v-model.number="scoreWeightObj.supplyChannelWeight" placeholder="" clearable>
<el-form-item label="产品开发与测试验证:" prop="developmentValidationWeight" label-width="200">
<el-input v-model.number="scoreWeightObj.developmentValidationWeight" placeholder="" clearable>
<template #suffix>%</template>
</el-input>
</el-form-item>
<el-form-item label="产品评估与考核:" prop="productEvaluationWeight" label-width="150">
<el-input v-model.number="scoreWeightObj.productEvaluationWeight" placeholder="" clearable>
<el-form-item label="产品上线与运营推广:" prop="launchOperationWeight" label-width="200">
<el-input v-model.number="scoreWeightObj.launchOperationWeight" placeholder="" clearable>
<template #suffix>%</template>
</el-input>
</el-form-item>
<el-form-item label="综合实训:" prop="comprehensiveTrainingWeight" label-width="200">
<el-input v-model.number="scoreWeightObj.comprehensiveTrainingWeight" placeholder="" clearable>
<template #suffix>%</template>
</el-input>
</el-form-item>
@ -147,28 +152,11 @@ const trainingProgressTitle = (row) => {
if (row.trainingProgress === null || row.trainingProgress === undefined) return "";
return `已完成 ${row.completedTaskCount || 0}/${row.totalTaskCount || 0}`;
};
const rules = {
marketResearchWeight: [
{ required: true, message: "请输入市场需求挖掘权重", trigger: "blur" },
{ type: "number", message: "权重必须为数字值" },
],
productEvaluationWeight: [
{ required: true, message: "请输入产品评估与考核权重", trigger: "blur" },
{ type: "number", message: "权重必须为数字值" },
],
productLaunchTestWeight: [
{ required: true, message: "请输入产品投放测试权重", trigger: "blur" },
{ type: "number", message: "权重必须为数字值" },
],
productPlanningWeight: [
{ required: true, message: "请输入产品规划权重", trigger: "blur" },
{ type: "number", message: "权重必须为数字值" },
],
supplyChannelWeight: [
{ required: true, message: "请输入供应渠道管理权重", trigger: "blur" },
{ type: "number", message: "权重必须为数字值" },
],
};
const weightFields = ["foundationWeight", "marketInsightWeight", "planningDesignWeight", "developmentValidationWeight", "launchOperationWeight", "comprehensiveTrainingWeight"];
const rules = Object.fromEntries(weightFields.map((field) => [field, [
{ required: true, message: "请输入权重", trigger: "blur" },
{ type: "number", message: "权重必须为数字值" },
]]));
const buildScoreQuery = () => {
const { studentId, ...query } = scoreParams.value;
return {
@ -185,14 +173,14 @@ const getList = () => {
});
};
const scoreweight = () => {
if (!scoreParams.value.classId) {
proxy.$modal.msgWarning("请选择自己的教学班后再设置权重");
return;
}
WeightStart.value = true;
indexApi.getWeightList({ schoolId: userStore.userInfo.schoolId }).then((res) => {
indexApi.getTeachingClassWeight(scoreParams.value.classId).then((res) => {
scoreWeightObj.value = res.data;
for (const key in scoreWeightObj.value) {
if (key !== "schoolId") {
scoreWeightObj.value[key] = scoreWeightObj.value[key] * 100;
}
}
weightFields.forEach((key) => (scoreWeightObj.value[key] = Number(scoreWeightObj.value[key]) * 100));
});
};
const workingCapitalWeightHandle = () => {
@ -200,18 +188,15 @@ const workingCapitalWeightHandle = () => {
if (valid) {
let params = {};
let sum = 0;
for (const key in scoreWeightObj.value) {
if (key !== "schoolId") {
params[key] = scoreWeightObj.value[key] / 100;
sum += scoreWeightObj.value[key] / 100;
}
}
if (sum !== 1) {
weightFields.forEach((key) => {
params[key] = Number(scoreWeightObj.value[key]) / 100;
sum += params[key];
});
if (Math.abs(sum - 1) > 0.000001) {
proxy.$message.error("权重合计为100%");
return;
}
params.schoolId = userStore.userInfo.schoolId;
indexApi.updateWeight(params).then((res) => {
indexApi.updateTeachingClassWeight(scoreParams.value.classId, params).then((res) => {
proxy.$message.success("权重设置成功");
WeightStart.value = false;
});
@ -221,7 +206,7 @@ const workingCapitalWeightHandle = () => {
const classList = ref([]);
const teachingClassList = computed(() => classList.value.filter((item) => item.classType === "TEACHING"));
const getClassList = () => {
indexApi.getClassListBySchoolId({ schoolId: userStore.userInfo.schoolId }).then((res) => {
indexApi.getOwnedTeachingClasses().then((res) => {
classList.value = res.data;
if (scoreParams.value.classId && !teachingClassList.value.some((item) => item.schoolClassId === scoreParams.value.classId)) {
scoreParams.value.classId = "";
@ -242,6 +227,10 @@ const exportExcel = () => {
});
};
const getClassScoreDetail = (row) => {
if (!scoreParams.value.classId) {
proxy.$modal.msgWarning("请选择自己的教学班后再查看成绩详情");
return;
}
indexApi.getScoreDetail({ userId: row.userId, classId: scoreParams.value.classId }).then((res) => {
tableData.value = res.data;
scoreDetailsStart.value = true;
@ -249,6 +238,10 @@ const getClassScoreDetail = (row) => {
};
//
const updateScore = () => {
if (!scoreParams.value.classId) {
proxy.$modal.msgWarning("请选择自己的教学班后再更新成绩");
return;
}
loading.value = true;
const params = { schoolId: userStore.userInfo.schoolId };

@ -0,0 +1,21 @@
const assert = require('assert');
const fs = require('fs');
const page = fs.readFileSync('src/views/teacherEnd/score/index.vue', 'utf8');
const home = fs.readFileSync('src/views/teacherEnd/index.vue', 'utf8');
const api = fs.readFileSync('src/api/teacher.js', 'utf8');
assert(api.includes('/api/weight/ownedTeachingClasses'));
assert(api.includes('/api/weight/selectTeachingClassWeight'));
assert(api.includes('/api/weight/updateTeachingClassWeight'));
assert(page.includes('getOwnedTeachingClasses'));
assert(page.includes('互联网产品开发基础认知'));
assert(page.includes('市场洞察与需求分析'));
assert(page.includes('产品规划与设计'));
assert(page.includes('产品开发与测试验证'));
assert(page.includes('产品上线与运营推广'));
assert(page.includes('综合实训'));
assert(page.includes('foundationWeight'));
assert(page.includes('comprehensiveTrainingWeight'));
assert(home.includes('getOwnedTeachingClasses'));
console.log('teacher score scope static checks passed');
Loading…
Cancel
Save