|
|
@@ -112,69 +112,92 @@
|
|
|
</div>
|
|
|
</page-body>
|
|
|
<!-- 成绩比例调控模态框 -->
|
|
|
- <b-modal :active.sync="isCardModalActive" width="420px" scroll="keep">
|
|
|
+ <b-modal :active.sync="isCardModalActive" scroll="keep">
|
|
|
<div class="card">
|
|
|
<div class="title">
|
|
|
成绩比例调控<small> 请按百分比填写</small>
|
|
|
</div>
|
|
|
<div class="content">
|
|
|
- <div class="homework-item">
|
|
|
- <label>文档作业</label>
|
|
|
- <div class="homework-percent">
|
|
|
- <b-field position="is-centered">
|
|
|
- <b-input placeholder="第一次作业百分比"> </b-input>
|
|
|
- <p class="control">
|
|
|
- <button class="button is-light">%</button>
|
|
|
- </p>
|
|
|
- </b-field>
|
|
|
- </div>
|
|
|
- <div class="homework-percent">
|
|
|
- <b-field position="is-centered">
|
|
|
- <b-input placeholder="第二次作业百分比"> </b-input>
|
|
|
- <p class="control">
|
|
|
- <button class="button is-light">%</button>
|
|
|
- </p>
|
|
|
- </b-field>
|
|
|
- </div>
|
|
|
- <div class="homework-percent">
|
|
|
- <b-field
|
|
|
- :type="$v.percent.$error ? 'is-danger' : ''"
|
|
|
- :message="$v.percent.$error ? '请填写1-100之间的数字' : ''"
|
|
|
- position="is-centered"
|
|
|
- >
|
|
|
+ <b-table
|
|
|
+ :data="resultPercentList"
|
|
|
+ class="customer-table"
|
|
|
+ :striped="true"
|
|
|
+ :narrowed="true"
|
|
|
+ >
|
|
|
+ <template slot-scope="props">
|
|
|
+ <b-table-column field="id" label="作业ID" width="50" numeric>
|
|
|
+ {{ props.row.id }}
|
|
|
+ </b-table-column>
|
|
|
+ <b-table-column field="name" label="作业名称">
|
|
|
+ {{ props.row.name }}
|
|
|
+ </b-table-column>
|
|
|
+ <b-table-column field="type" label="作业类型" email>
|
|
|
+ {{ props.row.type }}
|
|
|
+ </b-table-column>
|
|
|
+ <b-table-column field="percent" label="当前比例">
|
|
|
<b-input
|
|
|
- v-model="$v.percent.$model"
|
|
|
- placeholder="第三次作业百分比"
|
|
|
- >
|
|
|
- </b-input>
|
|
|
- <p class="control">
|
|
|
- <button class="button is-light">%</button>
|
|
|
- </p>
|
|
|
- </b-field>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="homework-item">
|
|
|
- <label>互评作业</label>
|
|
|
- <div class="homework-percent">
|
|
|
- <b-field position="is-centered">
|
|
|
- <b-input placeholder="第一次作业百分比"> </b-input>
|
|
|
- <p class="control">
|
|
|
- <button class="button is-light">%</button>
|
|
|
- </p>
|
|
|
- </b-field>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="homework-item">
|
|
|
- <label>代码作业</label>
|
|
|
- <div class="homework-percent">
|
|
|
- <b-field position="is-centered">
|
|
|
- <b-input placeholder="第一次作业百分比"> </b-input>
|
|
|
- <p class="control">
|
|
|
- <button class="button is-light">%</button>
|
|
|
- </p>
|
|
|
- </b-field>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ v-model="resultPercentList[props.index].percent"
|
|
|
+ ></b-input>
|
|
|
+ </b-table-column>
|
|
|
+ </template>
|
|
|
+ </b-table>
|
|
|
+ <!--<div class="homework-item">-->
|
|
|
+ <!--<label>文档作业</label>-->
|
|
|
+ <!--<div class="homework-percent">-->
|
|
|
+ <!--<b-field position="is-centered">-->
|
|
|
+ <!--<b-input placeholder="第一次作业百分比"> </b-input>-->
|
|
|
+ <!--<p class="control">-->
|
|
|
+ <!--<button class="button is-light">%</button>-->
|
|
|
+ <!--</p>-->
|
|
|
+ <!--</b-field>-->
|
|
|
+ <!--</div>-->
|
|
|
+ <!--<div class="homework-percent">-->
|
|
|
+ <!--<b-field position="is-centered">-->
|
|
|
+ <!--<b-input placeholder="第二次作业百分比"> </b-input>-->
|
|
|
+ <!--<p class="control">-->
|
|
|
+ <!--<button class="button is-light">%</button>-->
|
|
|
+ <!--</p>-->
|
|
|
+ <!--</b-field>-->
|
|
|
+ <!--</div>-->
|
|
|
+ <!--<div class="homework-percent">-->
|
|
|
+ <!--<b-field-->
|
|
|
+ <!--:type="$v.percent.$error ? 'is-danger' : ''"-->
|
|
|
+ <!--:message="$v.percent.$error ? '请填写1-100之间的数字' : ''"-->
|
|
|
+ <!--position="is-centered"-->
|
|
|
+ <!-->-->
|
|
|
+ <!--<b-input-->
|
|
|
+ <!--v-model="$v.percent.$model"-->
|
|
|
+ <!--placeholder="第三次作业百分比"-->
|
|
|
+ <!-->-->
|
|
|
+ <!--</b-input>-->
|
|
|
+ <!--<p class="control">-->
|
|
|
+ <!--<button class="button is-light">%</button>-->
|
|
|
+ <!--</p>-->
|
|
|
+ <!--</b-field>-->
|
|
|
+ <!--</div>-->
|
|
|
+ <!--</div>-->
|
|
|
+ <!--<div class="homework-item">-->
|
|
|
+ <!--<label>互评作业</label>-->
|
|
|
+ <!--<div class="homework-percent">-->
|
|
|
+ <!--<b-field position="is-centered">-->
|
|
|
+ <!--<b-input placeholder="第一次作业百分比"> </b-input>-->
|
|
|
+ <!--<p class="control">-->
|
|
|
+ <!--<button class="button is-light">%</button>-->
|
|
|
+ <!--</p>-->
|
|
|
+ <!--</b-field>-->
|
|
|
+ <!--</div>-->
|
|
|
+ <!--</div>-->
|
|
|
+ <!--<div class="homework-item">-->
|
|
|
+ <!--<label>代码作业</label>-->
|
|
|
+ <!--<div class="homework-percent">-->
|
|
|
+ <!--<b-field position="is-centered">-->
|
|
|
+ <!--<b-input placeholder="第一次作业百分比"> </b-input>-->
|
|
|
+ <!--<p class="control">-->
|
|
|
+ <!--<button class="button is-light">%</button>-->
|
|
|
+ <!--</p>-->
|
|
|
+ <!--</b-field>-->
|
|
|
+ <!--</div>-->
|
|
|
+ <!--</div>-->
|
|
|
</div>
|
|
|
<a
|
|
|
:class="['button', 'is-link', { 'is-loading': submitting }]"
|
|
|
@@ -192,7 +215,10 @@ import PageBody from "@/components/PageBody/index";
|
|
|
import Chart from "chart.js";
|
|
|
import BInput from "buefy/src/components/input/Input";
|
|
|
import { required, numeric, between } from "vuelidate/lib/validators";
|
|
|
-import { getStudentFinaleResult } from "@/api/resultstatistics";
|
|
|
+import {
|
|
|
+ getStudentFinaleResult,
|
|
|
+ setResultPercentList
|
|
|
+} from "@/api/resultstatistics";
|
|
|
import PageSectionLoading from "@/components/PageBody/PageSectionLoading/index";
|
|
|
|
|
|
const RESULT_SECTION = [
|
|
|
@@ -234,17 +260,38 @@ export default {
|
|
|
data: [],
|
|
|
isCardModalActive: false,
|
|
|
myChart2: {},
|
|
|
- percent: "",
|
|
|
+ percent: [],
|
|
|
finalResultPercentage: [20, 20, 20, 10, 10, 10, 10],
|
|
|
submitting: false,
|
|
|
isServerError: false,
|
|
|
errorMessage: "服务器错误,请稍后重试",
|
|
|
isResultLoading: true,
|
|
|
finalResult: [],
|
|
|
- homeworkNum: 0
|
|
|
+ homeworkNum: 0,
|
|
|
+ resultPercentList: []
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
+ //生成成绩百分比表格
|
|
|
+ createResultPercentList() {
|
|
|
+ let resultPercentList = [];
|
|
|
+ //let percentList = [];
|
|
|
+ let resultData = this.data[0];
|
|
|
+ for (let codesHw of resultData.codes) {
|
|
|
+ codesHw.type = "CODE";
|
|
|
+ resultPercentList.push(codesHw);
|
|
|
+ }
|
|
|
+ for (let documentsHw of resultData.documents) {
|
|
|
+ documentsHw.type = "DOCUMENT";
|
|
|
+ resultPercentList.push(documentsHw);
|
|
|
+ }
|
|
|
+ for (let reviewHw of resultData.reviews) {
|
|
|
+ reviewHw.type = "REVIEW";
|
|
|
+ resultPercentList.push(reviewHw);
|
|
|
+ }
|
|
|
+ this.resultPercentList = resultPercentList;
|
|
|
+ console.log(resultPercentList);
|
|
|
+ },
|
|
|
//初始化成绩比例
|
|
|
initialResultPercent(studentResults) {
|
|
|
if (studentResults.length < 1) return;
|
|
|
@@ -299,33 +346,39 @@ export default {
|
|
|
}
|
|
|
let res = 0;
|
|
|
for (let item of resultList) {
|
|
|
- res += item.score;
|
|
|
+ if (item.score) {
|
|
|
+ res += item.score;
|
|
|
+ }
|
|
|
}
|
|
|
return res / resultList.length;
|
|
|
},
|
|
|
//计算总评
|
|
|
getFinalResult(resultList) {
|
|
|
- console.log(resultList);
|
|
|
let finalResultList = [];
|
|
|
for (let i = 0; i < resultList.length; i++) {
|
|
|
let finalRes = 0;
|
|
|
let result = resultList[i];
|
|
|
- console.log(result);
|
|
|
//let currentIndex = 0;
|
|
|
for (let docRes of result.documents) {
|
|
|
- finalRes += docRes.score;
|
|
|
+ if (docRes.score) {
|
|
|
+ finalRes += docRes.score;
|
|
|
+ }
|
|
|
// finalRes +=
|
|
|
// docRes.score * (this.finalResultPercentage[currentIndex] / 100);
|
|
|
// currentIndex++;
|
|
|
}
|
|
|
for (let codeRes of result.codes) {
|
|
|
- finalRes += codeRes.score;
|
|
|
+ if (codeRes.score) {
|
|
|
+ finalRes += codeRes.score;
|
|
|
+ }
|
|
|
// finalRes +=
|
|
|
// codeRes.score * (this.finalResultPercentage[currentIndex] / 100);
|
|
|
// currentIndex++;
|
|
|
}
|
|
|
for (let reviewRes of result.reviews) {
|
|
|
- finalRes += reviewRes.score;
|
|
|
+ if (reviewRes.score) {
|
|
|
+ finalRes += reviewRes.score;
|
|
|
+ }
|
|
|
// finalRes +=
|
|
|
// reviewRes.score * (this.finalResultPercentage[currentIndex] / 100);
|
|
|
// currentIndex++;
|
|
|
@@ -335,12 +388,55 @@ export default {
|
|
|
}
|
|
|
this.data = finalResultList;
|
|
|
},
|
|
|
+ //调整成绩比例
|
|
|
confirmPercent() {
|
|
|
- this.submitting = true;
|
|
|
- this.$toast.open({
|
|
|
- message: "成绩比例调整成功",
|
|
|
- type: "is-success"
|
|
|
- });
|
|
|
+ //检查是否满足100%
|
|
|
+ let percentSum = 0;
|
|
|
+ let docPercentList = [];
|
|
|
+ let codePercentList = [];
|
|
|
+ let reviewPercentList = [];
|
|
|
+ for (let item of this.resultPercentList) {
|
|
|
+ percentSum += parseInt(item.percent);
|
|
|
+ switch (item.type) {
|
|
|
+ case "DOCUMENT":
|
|
|
+ docPercentList.push({ id: item.id, percent: item.percent });
|
|
|
+ break;
|
|
|
+ case "CODE":
|
|
|
+ codePercentList.push({ id: item.id, percent: item.percent });
|
|
|
+ break;
|
|
|
+ case "REVIEW":
|
|
|
+ reviewPercentList.push({ id: item.id, percent: item.percent });
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (percentSum != 100) {
|
|
|
+ this.$toast.open({
|
|
|
+ message: "请使比例加和为100%",
|
|
|
+ type: "is-warning"
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.submitting = true;
|
|
|
+ setResultPercentList(
|
|
|
+ this.$route.params.courseId,
|
|
|
+ docPercentList,
|
|
|
+ codePercentList,
|
|
|
+ reviewPercentList
|
|
|
+ )
|
|
|
+ .then(res => {
|
|
|
+ console.log(res);
|
|
|
+ this.$toast.open({
|
|
|
+ message: "成绩比例调整成功",
|
|
|
+ type: "is-success"
|
|
|
+ });
|
|
|
+ this.isCardModalActive = false;
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ this.$toast.open({
|
|
|
+ message: e.message || "服务器未知错误",
|
|
|
+ type: "is-danger"
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
async mounted() {
|
|
|
@@ -353,8 +449,9 @@ export default {
|
|
|
console.log(this.data);
|
|
|
//初始化默认成绩比例
|
|
|
this.initialResultPercent(this.data);
|
|
|
+ //初始化各作业比例
|
|
|
+ this.createResultPercentList();
|
|
|
//统计学生总评
|
|
|
- console.log(resultData.data);
|
|
|
this.getFinalResult(resultData.data);
|
|
|
//统计学生分数
|
|
|
let studentResultStatistics = this.studenResultStatistics(this.data);
|