|
@@ -51,14 +51,14 @@
|
|
<el-row type="flex" align="middle">
|
|
<el-row type="flex" align="middle">
|
|
<el-col :span="2">
|
|
<el-col :span="2">
|
|
<el-checkbox
|
|
<el-checkbox
|
|
- v-model="scope.row.targets[tindex].used"
|
|
|
|
|
|
+ v-model="scope.row.targets[tindex].enable"
|
|
@change="usedChange(scope.$index, tindex)"
|
|
@change="usedChange(scope.$index, tindex)"
|
|
></el-checkbox>
|
|
></el-checkbox>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="10">
|
|
<el-col :span="10">
|
|
<el-input-number
|
|
<el-input-number
|
|
v-model="scope.row.targets[tindex].weight"
|
|
v-model="scope.row.targets[tindex].weight"
|
|
- :disabled="!scope.row.targets[tindex].used"
|
|
|
|
|
|
+ :disabled="!scope.row.targets[tindex].enable"
|
|
class="width-80"
|
|
class="width-80"
|
|
size="small"
|
|
size="small"
|
|
:min="0"
|
|
:min="0"
|
|
@@ -73,7 +73,7 @@
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
<el-input-number
|
|
<el-input-number
|
|
v-model="scope.row.targets[tindex].targetScore"
|
|
v-model="scope.row.targets[tindex].targetScore"
|
|
- :disabled="!scope.row.targets[tindex].used"
|
|
|
|
|
|
+ :disabled="!scope.row.targets[tindex].enable"
|
|
class="width-80"
|
|
class="width-80"
|
|
size="small"
|
|
size="small"
|
|
:min="0"
|
|
:min="0"
|
|
@@ -98,6 +98,7 @@
|
|
:data="dataList"
|
|
:data="dataList"
|
|
:header-cell-style="{ textAlign: 'center' }"
|
|
:header-cell-style="{ textAlign: 'center' }"
|
|
:cell-style="{ textAlign: 'center' }"
|
|
:cell-style="{ textAlign: 'center' }"
|
|
|
|
+ :span-method="spanMethod"
|
|
>
|
|
>
|
|
<el-table-column
|
|
<el-table-column
|
|
prop="courseTargetName"
|
|
prop="courseTargetName"
|
|
@@ -120,7 +121,7 @@
|
|
>
|
|
>
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
{{
|
|
{{
|
|
- scope.row.evaluation[eindex].used
|
|
|
|
|
|
+ scope.row.evaluation[eindex].enable
|
|
? scope.row.evaluation[eindex].targetScore
|
|
? scope.row.evaluation[eindex].targetScore
|
|
: ""
|
|
: ""
|
|
}}
|
|
}}
|
|
@@ -204,7 +205,7 @@ export default {
|
|
}
|
|
}
|
|
evaluationList[index].targets.push({
|
|
evaluationList[index].targets.push({
|
|
...targetData,
|
|
...targetData,
|
|
- used: item.used,
|
|
|
|
|
|
+ enable: item.enable,
|
|
weight: item.weight || undefined,
|
|
weight: item.weight || undefined,
|
|
targetScore: item.targetScore || undefined,
|
|
targetScore: item.targetScore || undefined,
|
|
});
|
|
});
|
|
@@ -216,25 +217,40 @@ export default {
|
|
},
|
|
},
|
|
usedChange(rowIndex, tindex) {
|
|
usedChange(rowIndex, tindex) {
|
|
const target = this.tableSetData[rowIndex].targets[tindex];
|
|
const target = this.tableSetData[rowIndex].targets[tindex];
|
|
- if (!target.used) {
|
|
|
|
|
|
+ if (!target.enable) {
|
|
target.weight = undefined;
|
|
target.weight = undefined;
|
|
target.targetScore = undefined;
|
|
target.targetScore = undefined;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
getEvaluationSumScore(evaluation) {
|
|
getEvaluationSumScore(evaluation) {
|
|
return calcSum(
|
|
return calcSum(
|
|
- evaluation.map((item) => (item.used ? item.targetScore : 0))
|
|
|
|
|
|
+ evaluation.map((item) => (item.enable ? item.targetScore : 0))
|
|
);
|
|
);
|
|
},
|
|
},
|
|
|
|
+ spanMethod({ rowIndex, columnIndex }) {
|
|
|
|
+ const lineCount = this.dataList.length - 1;
|
|
|
|
+ if (rowIndex === lineCount) {
|
|
|
|
+ if (columnIndex === 0) {
|
|
|
|
+ return [1, 2];
|
|
|
|
+ } else if (columnIndex === 1) {
|
|
|
|
+ return [0, 0];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
updateDataList() {
|
|
updateDataList() {
|
|
const evaluationData = {};
|
|
const evaluationData = {};
|
|
this.tableSetData.forEach((item) => {
|
|
this.tableSetData.forEach((item) => {
|
|
item.targets.forEach((elem) => {
|
|
item.targets.forEach((elem) => {
|
|
const key = `${item.evaluationName}_${elem.courseTargetId}`;
|
|
const key = `${item.evaluationName}_${elem.courseTargetId}`;
|
|
- evaluationData[key] = pick(elem, ["used", "weight", "targetScore"]);
|
|
|
|
|
|
+ evaluationData[key] = pick(elem, ["enable", "weight", "targetScore"]);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ const lastData = this.dataList.slice(-1)[0];
|
|
|
|
+ if (lastData && lastData.courseTargetId === "total") {
|
|
|
|
+ this.dataList.pop();
|
|
|
|
+ }
|
|
|
|
+
|
|
this.dataList.forEach((target) => {
|
|
this.dataList.forEach((target) => {
|
|
target.totalWeight = this.targetTotalWeight[target.courseTargetId];
|
|
target.totalWeight = this.targetTotalWeight[target.courseTargetId];
|
|
target.evaluation.forEach((item) => {
|
|
target.evaluation.forEach((item) => {
|
|
@@ -242,10 +258,58 @@ export default {
|
|
Object.assign(item, evaluationData[key]);
|
|
Object.assign(item, evaluationData[key]);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ // 更新合计
|
|
|
|
+ const tatolEvaluation = this.evaluationData.map(
|
|
|
|
+ (evaluationName, eindex) => {
|
|
|
|
+ const targetScore = calcSum(
|
|
|
|
+ this.dataList.map(
|
|
|
|
+ (item) => item.evaluation[eindex].targetScore || 0
|
|
|
|
+ )
|
|
|
|
+ );
|
|
|
|
+ return {
|
|
|
|
+ evaluationName,
|
|
|
|
+ enable: true,
|
|
|
|
+ weight: null,
|
|
|
|
+ targetScore,
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ this.dataList.push({
|
|
|
|
+ courseTargetId: "total",
|
|
|
|
+ courseTargetName: "合计",
|
|
|
|
+ degreeRequirement: "",
|
|
|
|
+ totalWeight: calcSum(
|
|
|
|
+ this.dataList.map((item) => item.totalWeight || 0)
|
|
|
|
+ ),
|
|
|
|
+ evaluation: tatolEvaluation,
|
|
|
|
+ });
|
|
},
|
|
},
|
|
checkDataList() {
|
|
checkDataList() {
|
|
if (!this.dataList.length) return;
|
|
if (!this.dataList.length) return;
|
|
- // TODO:
|
|
|
|
|
|
+
|
|
|
|
+ // 目标整体权重
|
|
|
|
+ const totalWeight = calcSum(
|
|
|
|
+ this.dataList.map((item) => item.totalWeight || 0)
|
|
|
|
+ );
|
|
|
|
+ if (totalWeight !== 100) {
|
|
|
|
+ this.$message.error("目标整体权重合计不等于100%");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 目标分值统计
|
|
|
|
+ const weightList = [];
|
|
|
|
+ this.dataList.forEach((item) => {
|
|
|
|
+ item.evaluation.forEach((ev) => {
|
|
|
|
+ if (ev.enable) {
|
|
|
|
+ weightList.push(ev.weight);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ if (calcSum(weightList) !== 100) {
|
|
|
|
+ this.$message.error("目标分值统计不等于100");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
return true;
|
|
return true;
|
|
},
|
|
},
|
|
@@ -257,6 +321,7 @@ export default {
|
|
|
|
|
|
this.loading = true;
|
|
this.loading = true;
|
|
const res = await courseWeightSave({
|
|
const res = await courseWeightSave({
|
|
|
|
+ examId: this.course.examId,
|
|
courseCode: this.course.courseCode,
|
|
courseCode: this.course.courseCode,
|
|
submitForm: this.dataList,
|
|
submitForm: this.dataList,
|
|
}).catch(() => {});
|
|
}).catch(() => {});
|