|
@@ -8,15 +8,17 @@
|
|
|
width="200"
|
|
|
fixed="left"
|
|
|
></el-table-column>
|
|
|
- <el-table-column label="考核项目及比例(%)">
|
|
|
+ <el-table-column label="考核项目及比例(%)" align="center">
|
|
|
<el-table-column
|
|
|
v-for="(column, cindex) in columns"
|
|
|
:key="cindex"
|
|
|
:label="column"
|
|
|
+ align="center"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<el-input-number
|
|
|
v-model="scope.row.evaluationList[cindex].weight"
|
|
|
+ :disabled="scope.row.evaluationList[cindex].disabled"
|
|
|
class="width-50"
|
|
|
size="small"
|
|
|
:min="0"
|
|
@@ -24,22 +26,26 @@
|
|
|
:step="1"
|
|
|
step-strictly
|
|
|
:controls="false"
|
|
|
- @change="weightChange"
|
|
|
+ @change="weightChange(scope.$index, cindex)"
|
|
|
>
|
|
|
</el-input-number>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="权重(%)" prop="totalWeight">
|
|
|
+ <el-table-column label="权重(%)" prop="totalWeight" align="center">
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
- <div class="text-center">
|
|
|
- <el-button type="primary" :loading="loading" @click="submit"
|
|
|
+ <div class="text-center mt-2">
|
|
|
+ <el-button
|
|
|
+ class="width-200"
|
|
|
+ type="primary"
|
|
|
+ :loading="loading"
|
|
|
+ @click="submit"
|
|
|
>保存</el-button
|
|
|
>
|
|
|
</div>
|
|
|
|
|
|
- <div class="part-box part-box-pad">
|
|
|
+ <div>
|
|
|
<p>说明:</p>
|
|
|
<p>
|
|
|
1.课程目标评价依据来源于平时成绩和期末考试成绩二部分,请录入平时成绩,期末成绩整体权重及各目标的权重;
|
|
@@ -53,10 +59,9 @@
|
|
|
<script>
|
|
|
import { courseExamineWeightDetail, courseExamineWeightSave } from "../../api";
|
|
|
import { calcSum } from "@/plugins/utils";
|
|
|
-import { mapState, mapActions } from "vuex";
|
|
|
|
|
|
export default {
|
|
|
- name: "course-weight-manage",
|
|
|
+ name: "course-examine-weight",
|
|
|
props: {
|
|
|
rowData: {
|
|
|
type: Object,
|
|
@@ -72,43 +77,90 @@ export default {
|
|
|
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 || [];
|
|
|
+ const dataList = res.submitForm || [];
|
|
|
|
|
|
- this.columns = this.dataList[0].evaluationList.map(
|
|
|
+ this.columns = dataList[0].evaluationList.map(
|
|
|
(item) => item.evaluationName
|
|
|
);
|
|
|
+
|
|
|
+ this.columns.forEach((column, cindex) => {
|
|
|
+ if (cindex === 0) {
|
|
|
+ dataList.forEach((item, eindex) => {
|
|
|
+ const node = item.evaluationList[cindex];
|
|
|
+ node.disabled = false;
|
|
|
+ node.enable = !!node.weight;
|
|
|
+ node.weight = node.weight || undefined;
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const rowIndex = dataList.findIndex((item, eindex) => {
|
|
|
+ return !!item.evaluationList[cindex].weight;
|
|
|
+ });
|
|
|
+ if (rowIndex !== -1) {
|
|
|
+ dataList.forEach((item, eindex) => {
|
|
|
+ const node = item.evaluationList[cindex];
|
|
|
+ node.disabled = eindex !== rowIndex;
|
|
|
+ node.weight = node.weight || undefined;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ dataList.forEach((item, eindex) => {
|
|
|
+ const node = item.evaluationList[cindex];
|
|
|
+ node.disabled = false;
|
|
|
+ node.weight = node.weight || undefined;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ this.dataList = dataList;
|
|
|
},
|
|
|
- weightChange() {
|
|
|
+ weightChange(rowIndex, cindex) {
|
|
|
this.dataList.forEach((item, tindex) => {
|
|
|
item.totalWeight = calcSum(
|
|
|
- item.evaluationList.map((item) => item.weight || 0)
|
|
|
+ item.evaluationList.map((elem) => elem.weight || 0)
|
|
|
);
|
|
|
});
|
|
|
+
|
|
|
+ if (cindex === 0) {
|
|
|
+ this.dataList.forEach((item, eindex) => {
|
|
|
+ const node = item.evaluationList[cindex];
|
|
|
+ node.enable = !!node.weight;
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const val = this.dataList[rowIndex].evaluationList[cindex].weight;
|
|
|
+ if (val) {
|
|
|
+ this.dataList.forEach((item, eindex) => {
|
|
|
+ const node = item.evaluationList[cindex];
|
|
|
+ node.disabled = eindex !== rowIndex;
|
|
|
+ node.enable = eindex === rowIndex;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.dataList.forEach((item, eindex) => {
|
|
|
+ const node = item.evaluationList[cindex];
|
|
|
+ node.disabled = false;
|
|
|
+ node.enable = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
checkDataList() {
|
|
|
if (!this.dataList.length) return;
|
|
|
|
|
|
// 目标整体权重
|
|
|
const totalWeight = calcSum(
|
|
|
- this.dataList.some((item) => item.totalWeight || 0)
|
|
|
+ this.dataList.map((item) => item.totalWeight || 0)
|
|
|
);
|
|
|
if (totalWeight !== 100) {
|
|
|
this.$message.error("目标整体权重合计不等于100%");
|