You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
269 lines
11 KiB
Vue
269 lines
11 KiB
Vue
<!--
|
|
* @Author: qinzhenpen qzp1807@126.com
|
|
* @Date: 2024-10-31 14:59:14
|
|
* @LastEditors: qinzhenpen qzp1807@126.com
|
|
* @LastEditTime: 2025-05-16 18:25:56
|
|
* @FilePath: \corporate-finance\src\views\teacher\working-capital.vue
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
-->
|
|
<template>
|
|
<div class="app-container score" v-loading="loading">
|
|
<el-form :inline="true" class="demo-form-inline">
|
|
<el-form-item label="用户名:">
|
|
<el-input v-model="scoreParams.name" placeholder="" clearable>
|
|
<template #suffix>
|
|
<el-button type="primary" link color="#51bcb5" @click="getList">
|
|
<!-- <img src="@/assets/images/tea搜索.png" alt="" /> -->
|
|
</el-button>
|
|
</template>
|
|
</el-input>
|
|
</el-form-item>
|
|
<el-form-item label="学号:">
|
|
<el-input v-model="scoreParams.studentId" placeholder="" clearable>
|
|
<template #suffix>
|
|
<el-button type="primary" link color="#51bcb5" @click="getList">
|
|
<!-- <img src="@/assets/images/tea搜索.png" alt="" /> -->
|
|
</el-button>
|
|
</template>
|
|
</el-input>
|
|
</el-form-item>
|
|
<el-form-item label="班级:">
|
|
<el-select v-model="scoreParams.classId" placeholder="" clearable @change="getList">
|
|
<el-option v-for="school in teachingClassList" :key="school.schoolClassId" :label="school.className" :value="school.schoolClassId" />
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" @click="exportExcel">导出</el-button>
|
|
<el-button type="success" @click="scoreweight">权重设置</el-button>
|
|
<el-button type="success" @click="updateScore">成绩更新</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
<div class="table-info1">
|
|
<div class="table-hide">
|
|
<el-table :data="workingCapitalList" stripe border style="width: 100%">
|
|
<el-table-column prop="stuRank" label="排名" align="center" width="120" />
|
|
<el-table-column prop="name" label="用户名" align="center" />
|
|
<el-table-column prop="username" label="学号" align="center" />
|
|
<el-table-column prop="className" label="班级" align="center" />
|
|
<el-table-column prop="score" label="参考成绩" align="center" />
|
|
<el-table-column label="实训进度" align="center">
|
|
<template #default="{ row }">
|
|
<span :title="trainingProgressTitle(row)">{{ formatTrainingProgress(row) }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="成绩详情" align="center">
|
|
<template #default="{ row }">
|
|
<el-button link type="success" @click="getClassScoreDetail(row)">查看详情</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</div>
|
|
</div>
|
|
<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="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="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="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="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="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>
|
|
</el-form>
|
|
<template #footer>
|
|
<div class="dialog-footer" style="text-align: center">
|
|
<el-button type="primary" @click="workingCapitalWeightHandle">确定</el-button>
|
|
<el-button @click="WeightStart = false">取消</el-button>
|
|
</div>
|
|
</template>
|
|
</el-dialog>
|
|
<el-dialog v-model="scoreDetailsStart" title="成绩详情" width="50%" class="F_dialog teacher-dialog">
|
|
<el-table
|
|
:data="tableData"
|
|
border
|
|
style="width: 100%"
|
|
height="400"
|
|
:header-cell-style="{
|
|
color: '#fff',
|
|
fontSize: '14px',
|
|
backgroundColor: '#02a7f0!important',
|
|
}"
|
|
>
|
|
<el-table-column prop="taskName" label="实训任务" align="center" />
|
|
<el-table-column prop="progressStatus" label="任务状态" align="center">
|
|
<template #default="{ row }">
|
|
<span>{{ row.progressStatus === "COMPLETED" ? "已完成" : row.progressStatus === "IN_PROGRESS" ? "进行中" : "未开始" }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="aiAssessmentScore" label="AI评测成绩" align="center" />
|
|
</el-table>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
<script setup>
|
|
import * as indexApi from "@/api/teacher";
|
|
const { proxy } = getCurrentInstance();
|
|
import useUserStore from "@/store/modules/user";
|
|
const userStore = useUserStore();
|
|
const workingCapitalList = ref([]);
|
|
const loading = ref(false);
|
|
const scoreParams = ref({
|
|
classId: "",
|
|
index: 1,
|
|
size: 10,
|
|
schoolId: userStore.userInfo.schoolId,
|
|
});
|
|
const scoreDetailsStart = ref(false);
|
|
const tableData = ref([]);
|
|
const WeightStart = ref(false);
|
|
// 权重
|
|
const workingCapitalTotal = ref(0);
|
|
const scoreWeightObj = ref({});
|
|
const formatTrainingProgress = (row) => {
|
|
if (row.trainingProgress === null || row.trainingProgress === undefined) return "--";
|
|
const percentage = Number(row.trainingProgress);
|
|
if (!Number.isFinite(percentage)) return "--";
|
|
return `${percentage.toFixed(2).replace(/\.00$/, "")}%`;
|
|
};
|
|
const trainingProgressTitle = (row) => {
|
|
if (row.trainingProgress === null || row.trainingProgress === undefined) return "";
|
|
return `已完成 ${row.completedTaskCount || 0}/${row.totalTaskCount || 0} 项`;
|
|
};
|
|
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 {
|
|
...query,
|
|
userName: studentId,
|
|
};
|
|
};
|
|
const getList = () => {
|
|
loading.value = true;
|
|
indexApi.getScoreList(buildScoreQuery()).then((res) => {
|
|
workingCapitalList.value = res.data.list;
|
|
workingCapitalTotal.value = res.data.total;
|
|
loading.value = false;
|
|
});
|
|
};
|
|
const scoreweight = () => {
|
|
if (!scoreParams.value.classId) {
|
|
proxy.$modal.msgWarning("请选择自己的教学班后再设置权重");
|
|
return;
|
|
}
|
|
WeightStart.value = true;
|
|
indexApi.getTeachingClassWeight(scoreParams.value.classId).then((res) => {
|
|
scoreWeightObj.value = res.data;
|
|
weightFields.forEach((key) => (scoreWeightObj.value[key] = Number(scoreWeightObj.value[key]) * 100));
|
|
});
|
|
};
|
|
const workingCapitalWeightHandle = () => {
|
|
proxy.$refs.ruleFormRef.validate((valid) => {
|
|
if (valid) {
|
|
let params = {};
|
|
let sum = 0;
|
|
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;
|
|
}
|
|
indexApi.updateTeachingClassWeight(scoreParams.value.classId, params).then((res) => {
|
|
proxy.$message.success("权重设置成功");
|
|
WeightStart.value = false;
|
|
});
|
|
}
|
|
});
|
|
};
|
|
const classList = ref([]);
|
|
const teachingClassList = computed(() => classList.value.filter((item) => item.classType === "TEACHING"));
|
|
const getClassList = () => {
|
|
indexApi.getOwnedTeachingClasses().then((res) => {
|
|
classList.value = res.data;
|
|
if (scoreParams.value.classId && !teachingClassList.value.some((item) => item.schoolClassId === scoreParams.value.classId)) {
|
|
scoreParams.value.classId = "";
|
|
}
|
|
});
|
|
};
|
|
const exportExcel = () => {
|
|
const { index, size, ...query } = buildScoreQuery();
|
|
indexApi.exportScoreList(query).then((res) => {
|
|
// 打开怎么是空的
|
|
const blob = new Blob([res], { type: "application/vnd.ms-excel" });
|
|
const url = URL.createObjectURL(blob);
|
|
const link = document.createElement("a");
|
|
link.href = url;
|
|
link.download = "成绩表.xlsx";
|
|
link.click();
|
|
URL.revokeObjectURL(url);
|
|
});
|
|
};
|
|
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;
|
|
});
|
|
};
|
|
// 更新成绩
|
|
const updateScore = () => {
|
|
if (!scoreParams.value.classId) {
|
|
proxy.$modal.msgWarning("请选择自己的教学班后再更新成绩");
|
|
return;
|
|
}
|
|
loading.value = true;
|
|
|
|
const params = { schoolId: userStore.userInfo.schoolId };
|
|
if (scoreParams.value.classId) {
|
|
params.teachingClassId = scoreParams.value.classId;
|
|
}
|
|
indexApi.doRankOne(params).then((res) => {
|
|
proxy.$message.success("成绩更新成功");
|
|
loading.value = false;
|
|
getList();
|
|
});
|
|
};
|
|
// 拿到当前路由信息
|
|
onMounted(() => {
|
|
getList();
|
|
getClassList();
|
|
});
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
.score {
|
|
background: #ffffff;
|
|
height: calc(100vh - 70px);
|
|
}
|
|
</style>
|