|
@@ -95,7 +95,8 @@
|
|
>
|
|
>
|
|
</div>
|
|
</div>
|
|
<el-table
|
|
<el-table
|
|
- :data="dataList"
|
|
|
|
|
|
+ v-if="resultDataList.length"
|
|
|
|
+ :data="resultDataList"
|
|
:header-cell-style="{ textAlign: 'center' }"
|
|
:header-cell-style="{ textAlign: 'center' }"
|
|
:cell-style="{ textAlign: 'center' }"
|
|
:cell-style="{ textAlign: 'center' }"
|
|
:span-method="spanMethod"
|
|
:span-method="spanMethod"
|
|
@@ -121,8 +122,8 @@
|
|
>
|
|
>
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
{{
|
|
{{
|
|
- scope.row.evaluation[eindex].enable
|
|
|
|
- ? scope.row.evaluation[eindex].targetScore
|
|
|
|
|
|
+ scope.row.evaluationList[eindex].enable
|
|
|
|
+ ? scope.row.evaluationList[eindex].targetScore
|
|
: ""
|
|
: ""
|
|
}}
|
|
}}
|
|
</template>
|
|
</template>
|
|
@@ -130,7 +131,7 @@
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column label="目标分值统计" width="120">
|
|
<el-table-column label="目标分值统计" width="120">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- {{ getEvaluationSumScore(scope.row.evaluation) }}
|
|
|
|
|
|
+ {{ getEvaluationSumScore(scope.row.evaluationList) }}
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
@@ -140,7 +141,7 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { courseWeightDetail, courseWeightSave } from "../../api";
|
|
import { courseWeightDetail, courseWeightSave } from "../../api";
|
|
-import { weightList } from "./targetData";
|
|
|
|
|
|
+// import { weightList } from "./targetData";
|
|
import { omit, pick } from "lodash";
|
|
import { omit, pick } from "lodash";
|
|
import { calcSum } from "@/plugins/utils";
|
|
import { calcSum } from "@/plugins/utils";
|
|
|
|
|
|
@@ -160,13 +161,14 @@ export default {
|
|
tableSetData: [],
|
|
tableSetData: [],
|
|
targetTotalWeight: {},
|
|
targetTotalWeight: {},
|
|
evaluationData: [],
|
|
evaluationData: [],
|
|
|
|
+ resultDataList: [],
|
|
loading: false,
|
|
loading: false,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
- // this.getList();
|
|
|
|
- this.dataList = weightList;
|
|
|
|
- this.transformData(this.dataList);
|
|
|
|
|
|
+ this.getList();
|
|
|
|
+ // this.dataList = weightList;
|
|
|
|
+ // this.transformData(this.dataList);
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
async getList() {
|
|
async getList() {
|
|
@@ -174,39 +176,39 @@ export default {
|
|
examId: this.course.examId,
|
|
examId: this.course.examId,
|
|
courseCode: this.course.courseCode,
|
|
courseCode: this.course.courseCode,
|
|
});
|
|
});
|
|
- this.dataList = res.submitForm || [];
|
|
|
|
|
|
+ this.dataList = res || [];
|
|
this.transformData(this.dataList);
|
|
this.transformData(this.dataList);
|
|
},
|
|
},
|
|
transformData(data) {
|
|
transformData(data) {
|
|
if (!data || !data.length) return [];
|
|
if (!data || !data.length) return [];
|
|
|
|
|
|
- const evaluationList = [];
|
|
|
|
|
|
+ const tableSetData = [];
|
|
const evaluationMap = {};
|
|
const evaluationMap = {};
|
|
const targetTotalWeight = {};
|
|
const targetTotalWeight = {};
|
|
- data[0].evaluation.forEach((item, index) => {
|
|
|
|
|
|
+ data[0].evaluationList.forEach((item, index) => {
|
|
evaluationMap[item.evaluationName] = index;
|
|
evaluationMap[item.evaluationName] = index;
|
|
});
|
|
});
|
|
|
|
|
|
- this.evaluationData = data[0].evaluation.map(
|
|
|
|
|
|
+ this.evaluationData = data[0].evaluationList.map(
|
|
(item) => item.evaluationName
|
|
(item) => item.evaluationName
|
|
);
|
|
);
|
|
|
|
|
|
data.forEach((target) => {
|
|
data.forEach((target) => {
|
|
targetTotalWeight[target.courseTargetId] = target.totalWeight;
|
|
targetTotalWeight[target.courseTargetId] = target.totalWeight;
|
|
const targetData = {
|
|
const targetData = {
|
|
- ...omit(target, ["evaluation"]),
|
|
|
|
|
|
+ ...omit(target, ["evaluationList"]),
|
|
totalWeight: target.totalWeight || undefined,
|
|
totalWeight: target.totalWeight || undefined,
|
|
};
|
|
};
|
|
|
|
|
|
- target.evaluation.forEach((item) => {
|
|
|
|
|
|
+ target.evaluationList.forEach((item) => {
|
|
const index = evaluationMap[item.evaluationName];
|
|
const index = evaluationMap[item.evaluationName];
|
|
- if (!evaluationList[index]) {
|
|
|
|
- evaluationList[index] = {
|
|
|
|
|
|
+ if (!tableSetData[index]) {
|
|
|
|
+ tableSetData[index] = {
|
|
evaluationName: item.evaluationName,
|
|
evaluationName: item.evaluationName,
|
|
targets: [],
|
|
targets: [],
|
|
};
|
|
};
|
|
}
|
|
}
|
|
- evaluationList[index].targets.push({
|
|
|
|
|
|
+ tableSetData[index].targets.push({
|
|
...targetData,
|
|
...targetData,
|
|
enable: item.enable,
|
|
enable: item.enable,
|
|
weight: item.weight || undefined,
|
|
weight: item.weight || undefined,
|
|
@@ -216,7 +218,7 @@ export default {
|
|
});
|
|
});
|
|
|
|
|
|
this.targetTotalWeight = targetTotalWeight;
|
|
this.targetTotalWeight = targetTotalWeight;
|
|
- this.tableSetData = evaluationList;
|
|
|
|
|
|
+ this.tableSetData = tableSetData;
|
|
},
|
|
},
|
|
usedChange(rowIndex, tindex) {
|
|
usedChange(rowIndex, tindex) {
|
|
const target = this.tableSetData[rowIndex].targets[tindex];
|
|
const target = this.tableSetData[rowIndex].targets[tindex];
|
|
@@ -225,13 +227,13 @@ export default {
|
|
target.targetScore = undefined;
|
|
target.targetScore = undefined;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- getEvaluationSumScore(evaluation) {
|
|
|
|
|
|
+ getEvaluationSumScore(evaluationList) {
|
|
return calcSum(
|
|
return calcSum(
|
|
- evaluation.map((item) => (item.enable ? item.targetScore : 0))
|
|
|
|
|
|
+ evaluationList.map((item) => (item.enable ? item.targetScore : 0))
|
|
);
|
|
);
|
|
},
|
|
},
|
|
spanMethod({ rowIndex, columnIndex }) {
|
|
spanMethod({ rowIndex, columnIndex }) {
|
|
- const lineCount = this.dataList.length - 1;
|
|
|
|
|
|
+ const lineCount = this.resultDataList.length - 1;
|
|
if (rowIndex === lineCount) {
|
|
if (rowIndex === lineCount) {
|
|
if (columnIndex === 0) {
|
|
if (columnIndex === 0) {
|
|
return [1, 2];
|
|
return [1, 2];
|
|
@@ -256,7 +258,7 @@ export default {
|
|
|
|
|
|
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.evaluationList.forEach((item) => {
|
|
const key = `${item.evaluationName}_${target.courseTargetId}`;
|
|
const key = `${item.evaluationName}_${target.courseTargetId}`;
|
|
Object.assign(item, evaluationData[key]);
|
|
Object.assign(item, evaluationData[key]);
|
|
});
|
|
});
|
|
@@ -267,7 +269,7 @@ export default {
|
|
(evaluationName, eindex) => {
|
|
(evaluationName, eindex) => {
|
|
const targetScore = calcSum(
|
|
const targetScore = calcSum(
|
|
this.dataList.map(
|
|
this.dataList.map(
|
|
- (item) => item.evaluation[eindex].targetScore || 0
|
|
|
|
|
|
+ (item) => item.evaluationList[eindex].targetScore || 0
|
|
)
|
|
)
|
|
);
|
|
);
|
|
return {
|
|
return {
|
|
@@ -278,15 +280,18 @@ export default {
|
|
};
|
|
};
|
|
}
|
|
}
|
|
);
|
|
);
|
|
- this.dataList.push({
|
|
|
|
- courseTargetId: "total",
|
|
|
|
- courseTargetName: "合计",
|
|
|
|
- degreeRequirement: "",
|
|
|
|
- totalWeight: calcSum(
|
|
|
|
- this.dataList.map((item) => item.totalWeight || 0)
|
|
|
|
- ),
|
|
|
|
- evaluation: tatolEvaluation,
|
|
|
|
- });
|
|
|
|
|
|
+ this.resultDataList = [
|
|
|
|
+ ...this.dataList,
|
|
|
|
+ {
|
|
|
|
+ courseTargetId: "total",
|
|
|
|
+ courseTargetName: "合计",
|
|
|
|
+ degreeRequirement: "",
|
|
|
|
+ totalWeight: calcSum(
|
|
|
|
+ this.dataList.map((item) => item.totalWeight || 0)
|
|
|
|
+ ),
|
|
|
|
+ evaluationList: tatolEvaluation,
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
},
|
|
},
|
|
checkDataList() {
|
|
checkDataList() {
|
|
if (!this.dataList.length) return;
|
|
if (!this.dataList.length) return;
|
|
@@ -303,7 +308,7 @@ export default {
|
|
// 目标分值统计
|
|
// 目标分值统计
|
|
const weightList = [];
|
|
const weightList = [];
|
|
this.dataList.forEach((item) => {
|
|
this.dataList.forEach((item) => {
|
|
- item.evaluation.forEach((ev) => {
|
|
|
|
|
|
+ item.evaluationList.forEach((ev) => {
|
|
if (ev.enable) {
|
|
if (ev.enable) {
|
|
weightList.push(ev.weight);
|
|
weightList.push(ev.weight);
|
|
}
|
|
}
|