|
@@ -0,0 +1,189 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="course-weight-manage">
|
|
|
|
+ <div class="part-box part-box-pad">
|
|
|
|
+ <el-table :data="dataList" :summary-method="getSummaries" show-summary>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="courseTargetName"
|
|
|
|
+ label="课程目标"
|
|
|
|
+ width="200"
|
|
|
|
+ fixed="left"
|
|
|
|
+ ></el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ v-for="(column, cindex) in columns"
|
|
|
|
+ :key="cindex"
|
|
|
|
+ :label="column"
|
|
|
|
+ >
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-input-number
|
|
|
|
+ v-model="scope.row.evaluationList[cindex].weight"
|
|
|
|
+ class="width-50"
|
|
|
|
+ size="small"
|
|
|
|
+ :min="0"
|
|
|
|
+ :max="100"
|
|
|
|
+ :step="1"
|
|
|
|
+ step-strictly
|
|
|
|
+ :controls="false"
|
|
|
|
+ >
|
|
|
|
+ </el-input-number>
|
|
|
|
+ <span style="margin-left: 5px">%</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="目标整体权重" prop="totalWeight">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-input-number
|
|
|
|
+ v-model="scope.row.totalWeight"
|
|
|
|
+ class="width-50"
|
|
|
|
+ size="small"
|
|
|
|
+ :min="0"
|
|
|
|
+ :max="100"
|
|
|
|
+ :step="1"
|
|
|
|
+ step-strictly
|
|
|
|
+ :controls="false"
|
|
|
|
+ >
|
|
|
|
+ </el-input-number>
|
|
|
|
+ <span style="margin-left: 5px">%</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ <div class="text-center">
|
|
|
|
+ <el-button type="primary" :loading="loading" @click="submit"
|
|
|
|
+ >保存</el-button
|
|
|
|
+ >
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div class="part-box part-box-pad">
|
|
|
|
+ <p>说明:</p>
|
|
|
|
+ <p>
|
|
|
|
+ 1.课程目标评价依据来源于平时成绩和期末考试成绩二部分,请录入平时成绩,期末成绩整体权重及各目标的权重;
|
|
|
|
+ </p>
|
|
|
|
+ <p>2.各课程目标下选择评价方式总权重应等于100%;</p>
|
|
|
|
+ <p>3.目标整体权重应等于100%,用于计算课程整体达成度。</p>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import { courseExamineWeightDetail, courseExamineWeightSave } from "../../api";
|
|
|
|
+import { calcSum } from "@/plugins/utils";
|
|
|
|
+import { mapState, mapActions } from "vuex";
|
|
|
|
+
|
|
|
|
+export default {
|
|
|
|
+ name: "course-weight-manage",
|
|
|
|
+ props: {
|
|
|
|
+ rowData: {
|
|
|
|
+ type: Object,
|
|
|
|
+ default() {
|
|
|
|
+ return {};
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ dataList: [],
|
|
|
|
+ columns: [],
|
|
|
|
+ loading: false,
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ computed: {
|
|
|
|
+ ...mapState("base", ["cwStatus"]),
|
|
|
|
+ },
|
|
|
|
+ mounted() {
|
|
|
|
+ this.initData();
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ ...mapActions("base", ["updateCwStatus"]),
|
|
|
|
+ async initData() {
|
|
|
|
+ await this.updateCwStatus({
|
|
|
|
+ obeCourseOutlineId: this.rowData.id,
|
|
|
|
+ });
|
|
|
|
+ await this.getList();
|
|
|
|
+ },
|
|
|
|
+ async getList() {
|
|
|
|
+ const res = await courseExamineWeightDetail({
|
|
|
|
+ obeCourseOutlineId: this.rowData.id,
|
|
|
|
+ });
|
|
|
|
+ this.dataList = res || [];
|
|
|
|
+
|
|
|
|
+ this.columns = this.dataList[0].evaluationList.map(
|
|
|
|
+ (item) => item.evaluationName
|
|
|
|
+ );
|
|
|
|
+ },
|
|
|
|
+ checkDataList() {
|
|
|
|
+ if (!this.dataList.length) return;
|
|
|
|
+
|
|
|
|
+ // 目标整体权重
|
|
|
|
+ if (this.dataList.some((item) => !item.totalWeight)) {
|
|
|
|
+ this.$message.error("请设置所有目标的目标整体权重");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ const totalWeight = calcSum(
|
|
|
|
+ this.dataList.some((item) => item.totalWeight || 0)
|
|
|
|
+ );
|
|
|
|
+ if (totalWeight !== 100) {
|
|
|
|
+ this.$message.error("目标整体权重合计不等于100%");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 目标权重统计
|
|
|
|
+ const unvalidTargets = [];
|
|
|
|
+ this.dataList.forEach((item, tindex) => {
|
|
|
|
+ const totalWeight = calcSum(
|
|
|
|
+ item.evaluationList.map((item) => item.weight || 0)
|
|
|
|
+ );
|
|
|
|
+ if (totalWeight !== 100) {
|
|
|
|
+ unvalidTargets.push(item.courseTargetName);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ if (unvalidTargets.length) {
|
|
|
|
+ this.$message.error(
|
|
|
|
+ `${unvalidTargets.join()}评价方式权重合计不等于100%`
|
|
|
|
+ );
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return true;
|
|
|
|
+ },
|
|
|
|
+ async submit() {
|
|
|
|
+ if (this.loading) return;
|
|
|
|
+ if (!this.checkDataList()) return;
|
|
|
|
+
|
|
|
|
+ this.loading = true;
|
|
|
|
+ const res = await courseExamineWeightSave({
|
|
|
|
+ obeCourseOutlineId: this.rowData.id,
|
|
|
|
+ submitForm: this.dataList,
|
|
|
|
+ }).catch(() => {});
|
|
|
|
+ this.loading = false;
|
|
|
|
+ if (!res) return;
|
|
|
|
+
|
|
|
|
+ this.initData();
|
|
|
|
+ this.$message.success("保存成功!");
|
|
|
|
+ },
|
|
|
|
+ getSummaries(param) {
|
|
|
|
+ const { columns } = param;
|
|
|
|
+ const sums = [];
|
|
|
|
+ const lastNo = columns.length - 1;
|
|
|
|
+ columns.forEach((column, index) => {
|
|
|
|
+ if (index === 0) {
|
|
|
|
+ sums[index] = "合计";
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (index === lastNo) {
|
|
|
|
+ sums[index] =
|
|
|
|
+ calcSum(this.dataList.map((item) => item.totalWeight || 0)) + "%";
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ sums[index] =
|
|
|
|
+ calcSum(
|
|
|
|
+ this.dataList.map(
|
|
|
|
+ (item) => item.evaluationList[index - 1].weight || 0
|
|
|
|
+ )
|
|
|
|
+ ) + "%";
|
|
|
|
+ });
|
|
|
|
+ return sums;
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+</script>
|