|
@@ -10,6 +10,37 @@
|
|
|
<p>4.目标整体权重应等于100%,用于计算课程整体达成度。</p>
|
|
|
</div>
|
|
|
<div class="part-box part-box-pad">
|
|
|
+ <el-form class="mb-2" inline>
|
|
|
+ <el-form-item label="整体权重设置:"></el-form-item>
|
|
|
+ <el-form-item label="平均成绩权重:">
|
|
|
+ <el-input-number
|
|
|
+ v-model="customRate"
|
|
|
+ class="width-50"
|
|
|
+ size="small"
|
|
|
+ :min="0"
|
|
|
+ :max="100"
|
|
|
+ :step="1"
|
|
|
+ step-strictly
|
|
|
+ :controls="false"
|
|
|
+ >
|
|
|
+ </el-input-number>
|
|
|
+ <span style="margin-left: 5px">%</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="期末成绩权重:">
|
|
|
+ <el-input-number
|
|
|
+ v-model="defaultRate"
|
|
|
+ class="width-50"
|
|
|
+ size="small"
|
|
|
+ :min="0"
|
|
|
+ :max="100"
|
|
|
+ :step="1"
|
|
|
+ step-strictly
|
|
|
+ :controls="false"
|
|
|
+ >
|
|
|
+ </el-input-number>
|
|
|
+ <span style="margin-left: 5px">%</span>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
<el-table :data="tableSetData">
|
|
|
<el-table-column
|
|
|
prop="evaluationName"
|
|
@@ -44,19 +75,24 @@
|
|
|
<template slot="header">
|
|
|
<el-row>
|
|
|
<el-col :span="10" :offset="2"> 权重 </el-col>
|
|
|
- <el-col :span="12"> 目标分值 </el-col>
|
|
|
</el-row>
|
|
|
</template>
|
|
|
<template slot-scope="scope">
|
|
|
<el-row type="flex" align="middle">
|
|
|
<el-col :span="2">
|
|
|
<el-checkbox
|
|
|
+ v-if="scope.$index !== endRowNo"
|
|
|
v-model="scope.row.targets[tindex].enable"
|
|
|
- @change="usedChange(scope.$index, tindex)"
|
|
|
+ :disabled="scope.row.targets[tindex].disabled"
|
|
|
+ @change="enableChange(scope.$index, tindex)"
|
|
|
></el-checkbox>
|
|
|
</el-col>
|
|
|
<el-col :span="10">
|
|
|
+ <span v-if="scope.$index === endRowNo">
|
|
|
+ {{ scope.row.targets[tindex].weight }}
|
|
|
+ </span>
|
|
|
<el-input-number
|
|
|
+ v-else
|
|
|
v-model="scope.row.targets[tindex].weight"
|
|
|
:disabled="!scope.row.targets[tindex].enable"
|
|
|
class="width-80"
|
|
@@ -70,20 +106,6 @@
|
|
|
</el-input-number>
|
|
|
<span style="margin-left: 5px">%</span>
|
|
|
</el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-input-number
|
|
|
- v-model="scope.row.targets[tindex].targetScore"
|
|
|
- :disabled="!scope.row.targets[tindex].enable"
|
|
|
- class="width-80"
|
|
|
- size="small"
|
|
|
- :min="0"
|
|
|
- :max="1000"
|
|
|
- :step="1"
|
|
|
- step-strictly
|
|
|
- :controls="false"
|
|
|
- >
|
|
|
- </el-input-number>
|
|
|
- </el-col>
|
|
|
</el-row>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -95,7 +117,7 @@
|
|
|
>
|
|
|
</div>
|
|
|
<el-table
|
|
|
- v-if="resultDataList.length"
|
|
|
+ v-if="resultDataList.length && cwStatus.currentSettingStatus"
|
|
|
:data="resultDataList"
|
|
|
:header-cell-style="{ textAlign: 'center' }"
|
|
|
:cell-style="{ textAlign: 'center' }"
|
|
@@ -158,6 +180,8 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
dataList: [],
|
|
|
+ defaultRate: 0,
|
|
|
+ customRate: 0,
|
|
|
tableSetData: [],
|
|
|
targetTotalWeight: {},
|
|
|
evaluationData: [],
|
|
@@ -167,6 +191,9 @@ export default {
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState("base", ["cwStatus"]),
|
|
|
+ endRowNo() {
|
|
|
+ return this.tableSetData.length - 1;
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
this.initData();
|
|
@@ -174,10 +201,13 @@ export default {
|
|
|
methods: {
|
|
|
...mapActions("base", ["updateCwStatus"]),
|
|
|
async initData() {
|
|
|
- await this.updateCwStatus();
|
|
|
+ await this.updateCwStatus({
|
|
|
+ examId: this.course.examId,
|
|
|
+ courseCode: this.course.courseCode,
|
|
|
+ });
|
|
|
await this.getList();
|
|
|
if (this.cwStatus.currentSettingStatus) {
|
|
|
- this.updateDataList();
|
|
|
+ this.updateResultDataList();
|
|
|
}
|
|
|
},
|
|
|
async getList() {
|
|
@@ -185,7 +215,9 @@ export default {
|
|
|
examId: this.course.examId,
|
|
|
courseCode: this.course.courseCode,
|
|
|
});
|
|
|
- this.dataList = res || [];
|
|
|
+ this.defaultRate = res.defaultRate;
|
|
|
+ this.customRate = res.customRate;
|
|
|
+ this.dataList = res.submitForm || [];
|
|
|
this.transformData(this.dataList);
|
|
|
},
|
|
|
transformData(data) {
|
|
@@ -206,7 +238,7 @@ export default {
|
|
|
targetTotalWeight[target.courseTargetId] = target.totalWeight;
|
|
|
const targetData = {
|
|
|
...omit(target, ["evaluationList"]),
|
|
|
- totalWeight: target.totalWeight || undefined,
|
|
|
+ totalWeight: target.totalWeight || 0,
|
|
|
};
|
|
|
|
|
|
target.evaluationList.forEach((item) => {
|
|
@@ -220,21 +252,40 @@ export default {
|
|
|
tableSetData[index].targets.push({
|
|
|
...targetData,
|
|
|
enable: item.enable,
|
|
|
- weight: item.weight || undefined,
|
|
|
- targetScore: item.targetScore || undefined,
|
|
|
+ disabled: false,
|
|
|
+ weight: item.weight || 0,
|
|
|
+ targetScore: item.targetScore || 0,
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
|
|
|
this.targetTotalWeight = targetTotalWeight;
|
|
|
this.tableSetData = tableSetData;
|
|
|
+ this.updateSetDataDisabled();
|
|
|
},
|
|
|
- usedChange(rowIndex, tindex) {
|
|
|
+ updateSetDataDisabled() {
|
|
|
+ this.tableSetData.forEach((item, tindex) => {
|
|
|
+ const hasTargetWeight = item.targets.some((t) => t.weight);
|
|
|
+ item.targets.forEach((t) => {
|
|
|
+ if (hasTargetWeight) {
|
|
|
+ t.disabled = !t.weight;
|
|
|
+ } else {
|
|
|
+ t.disabled = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ enableChange(rowIndex, tindex) {
|
|
|
const target = this.tableSetData[rowIndex].targets[tindex];
|
|
|
if (!target.enable) {
|
|
|
- target.weight = undefined;
|
|
|
- target.targetScore = undefined;
|
|
|
+ target.weight = 0;
|
|
|
+ target.targetScore = 0;
|
|
|
}
|
|
|
+ this.tableSetData[rowIndex].targets.forEach((item, dindex) => {
|
|
|
+ if (dindex !== tindex) {
|
|
|
+ item.disabled = target.enable;
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
getEvaluationSumScore(evaluationList) {
|
|
|
return calcSum(
|
|
@@ -260,11 +311,6 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- const lastData = this.dataList.slice(-1)[0];
|
|
|
- if (lastData && lastData.courseTargetId === "total") {
|
|
|
- this.dataList.pop();
|
|
|
- }
|
|
|
-
|
|
|
this.dataList.forEach((target) => {
|
|
|
target.totalWeight = this.targetTotalWeight[target.courseTargetId];
|
|
|
target.evaluationList.forEach((item) => {
|
|
@@ -272,7 +318,8 @@ export default {
|
|
|
Object.assign(item, evaluationData[key]);
|
|
|
});
|
|
|
});
|
|
|
-
|
|
|
+ },
|
|
|
+ updateResultDataList() {
|
|
|
// 更新合计
|
|
|
const tatolEvaluation = this.evaluationData.map(
|
|
|
(evaluationName, eindex) => {
|
|
@@ -305,26 +352,44 @@ export default {
|
|
|
checkDataList() {
|
|
|
if (!this.dataList.length) return;
|
|
|
|
|
|
+ // 整体权重设置
|
|
|
+ if (!this.customRate) {
|
|
|
+ this.$message.error("请输入平均成绩权重");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!this.defaultRate) {
|
|
|
+ this.$message.error("请输入期末成绩权重");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.defaultRate + this.customRate !== 100) {
|
|
|
+ this.$message.error("平均成绩权重与期末成绩权重合计不等于100%");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
// 目标整体权重
|
|
|
const totalWeight = calcSum(
|
|
|
- this.dataList.map((item) => item.totalWeight || 0)
|
|
|
+ Object.values(this.targetTotalWeight).map((item) => item || 0)
|
|
|
);
|
|
|
if (totalWeight !== 100) {
|
|
|
this.$message.error("目标整体权重合计不等于100%");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- // 目标分值统计
|
|
|
- const weightList = [];
|
|
|
- this.dataList.forEach((item) => {
|
|
|
- item.evaluationList.forEach((ev) => {
|
|
|
- if (ev.enable) {
|
|
|
- weightList.push(ev.weight);
|
|
|
- }
|
|
|
- });
|
|
|
+ // 目标权重统计
|
|
|
+ const unvalidTargets = [];
|
|
|
+ const tableData = this.tableSetData.slice(0, -1);
|
|
|
+ this.dataList.forEach((target, tindex) => {
|
|
|
+ const totalWeight = calcSum(
|
|
|
+ tableData.map((item) => item.targets[tindex].weight || 0)
|
|
|
+ );
|
|
|
+ if (totalWeight !== 100) {
|
|
|
+ unvalidTargets.push(target.courseTargetName);
|
|
|
+ }
|
|
|
});
|
|
|
- if (calcSum(weightList) !== 100) {
|
|
|
- this.$message.error("目标分值统计不等于100");
|
|
|
+ if (unvalidTargets.length) {
|
|
|
+ this.$message.error(
|
|
|
+ `${unvalidTargets.join()}评价方式权重合计不等于100%`
|
|
|
+ );
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -332,6 +397,7 @@ export default {
|
|
|
},
|
|
|
async submit() {
|
|
|
if (this.loading) return;
|
|
|
+ this.updateDataList();
|
|
|
|
|
|
if (!this.checkDataList()) return;
|
|
|
|
|
@@ -339,6 +405,8 @@ export default {
|
|
|
const res = await courseWeightSave({
|
|
|
examId: this.course.examId,
|
|
|
courseCode: this.course.courseCode,
|
|
|
+ defaultRate: this.defaultRate,
|
|
|
+ customRate: this.customRate,
|
|
|
submitForm: this.dataList,
|
|
|
}).catch(() => {});
|
|
|
this.loading = false;
|