Commit 3d85ecf0 by lizhi

优化

parent 152d0fd0
......@@ -67,11 +67,11 @@
</template>
</el-table-column> -->
<el-table-column label="选课" align="center">
<el-table-column label="选课" align="center" width="100px">
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
</el-table-column>
<el-table-column label="年份" align="center">
<el-table-column label="年份" align="center" width="100px">
<template slot-scope="scope">{{ scope.row.yearTime }}</template>
</el-table-column>
<!-- <el-table-column label="年级" align="center">
......
<template>
<div class="app-container">
<!-- 编辑分数的弹框 -->
<el-dialog
<el-dialog
title="编辑课程分数"
:visible.sync="editNoticeVisible"
@close="cancel('editScoreList')"
>
<el-form :model="editScoreList" ref="editScoreList">
<div class="line">
<el-form-item label="编辑学生课程分数" prop="gpa">
<el-input
autosize
v-model.number="editScoreList.gpa"
>
</el-input>
<el-input autosize v-model.number="editScoreList.gpa"> </el-input>
<!-- {{editRecruitCourse.courseName}} -->
</el-form-item>
</div>
</el-form>
<div slot="footer" class="dialog-footer">
......@@ -27,13 +19,10 @@
<el-button type="primary" @click="submitForm('editScoreList')"
>确 定</el-button
>
</div>
</el-dialog>
<div class="table-container">
<el-table
ref="productTable"
:data="list"
......@@ -41,9 +30,7 @@
@selection-change="handleSelectionChange"
v-loading="listLoading"
border
>
<el-table-column label="上课年份" align="center">
<template slot-scope="scope">{{ scope.row.yearTime }}</template>
</el-table-column>
......@@ -57,14 +44,12 @@
<span v-if="scope.row.userCourseList[0].csoCourseCode">
{{ scope.row.userCourseList[0].csoCourseCode }}</span
>
<span v-if="scope.row.userCourseList[0].auditCourseCode">
<span v-else-if="scope.row.userCourseList[0].auditCourseCode">
{{ scope.row.userCourseList[0].auditCourseCode }}</span
>
<span v-if="scope.row.userCourseList[0].ownCourseCode">
<span v-else-if="scope.row.userCourseList[0].ownCourseCode">
{{ scope.row.userCourseList[0].ownCourseCode }}</span
>
</template>
</el-table-column>
<el-table-column align="center" label="分数">
......@@ -72,12 +57,19 @@
{{ scope.row.userCourseList[0].gpa }}</template
>
</el-table-column>
<el-table-column align="center" label="编辑分数">
<template slot-scope="scope">
<el-button @click="updateScore(scope.row.userCourseList[0].gpa,scope.row.userCourseList[0].id)">编辑</el-button>
<el-table-column align="center" label="编辑分数">
<template slot-scope="scope">
<el-button
@click="
updateScore(
scope.row.userCourseList[0].gpa,
scope.row.userCourseList[0].id
)
"
>编辑</el-button
>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="课程2" align="center">
......@@ -86,14 +78,12 @@
<span v-if="scope.row.userCourseList[1].csoCourseCode">
{{ scope.row.userCourseList[1].csoCourseCode }}</span
>
<span v-if="scope.row.userCourseList[1].auditCourseCode">
<span v-else-if="scope.row.userCourseList[1].auditCourseCode">
{{ scope.row.userCourseList[1].auditCourseCode }}</span
>
<span v-if="scope.row.userCourseList[1].ownCourseCode">
<span v-else-if="scope.row.userCourseList[1].ownCourseCode">
{{ scope.row.userCourseList[1].ownCourseCode }}</span
>
</template>
</el-table-column>
<el-table-column align="center" label="分数">
......@@ -101,9 +91,17 @@
{{ scope.row.userCourseList[1].gpa }}</template
>
</el-table-column>
<el-table-column align="center" label="编辑分数">
<template slot-scope="scope" v-if="scope.row.userCourseList[1]">
<el-button @click="updateScore(scope.row.userCourseList[1].gpa,scope.row.userCourseList[1].id)">编辑</el-button>
<el-table-column align="center" label="编辑分数">
<template slot-scope="scope" v-if="scope.row.userCourseList[1]">
<el-button
@click="
updateScore(
scope.row.userCourseList[1].gpa,
scope.row.userCourseList[1].id
)
"
>编辑</el-button
>
</template>
</el-table-column>
</el-table-column>
......@@ -114,13 +112,12 @@
<span v-if="scope.row.userCourseList[2].csoCourseCode">
{{ scope.row.userCourseList[2].csoCourseCode }}</span
>
<span v-if="scope.row.userCourseList[2].auditCourseCode">
<span v-else-if="scope.row.userCourseList[2].auditCourseCode">
{{ scope.row.userCourseList[2].auditCourseCode }}</span
>
<span v-if="scope.row.userCourseList[2].ownCourseCode">
<span v-else-if="scope.row.userCourseList[2].ownCourseCode">
{{ scope.row.userCourseList[2].ownCourseCode }}</span
>
</template>
</el-table-column>
<el-table-column align="center" label="分数">
......@@ -128,9 +125,17 @@
{{ scope.row.userCourseList[2].gpa }}</template
>
</el-table-column>
<el-table-column align="center" label="编辑分数">
<template slot-scope="scope" v-if="scope.row.userCourseList[2]">
<el-button @click="updateScore(scope.row.userCourseList[2].gpa,scope.row.userCourseList[2].id)">编辑</el-button>
<el-table-column align="center" label="编辑分数">
<template slot-scope="scope" v-if="scope.row.userCourseList[2]">
<el-button
@click="
updateScore(
scope.row.userCourseList[2].gpa,
scope.row.userCourseList[2].id
)
"
>编辑</el-button
>
</template>
</el-table-column>
</el-table-column>
......@@ -141,12 +146,12 @@
<span v-if="scope.row.userCourseList[3].csoCourseCode">
{{ scope.row.userCourseList[3].csoCourseCode }}</span
>
<span v-if="scope.row.userCourseList[3].auditCourseCode">
<span v-else-if="scope.row.userCourseList[3].auditCourseCode">
{{ scope.row.userCourseList[3].auditCourseCode }}</span
>
<span v-if="scope.row.userCourseList[3].ownCourseCode">
<span v-else-if="scope.row.userCourseList[3].ownCourseCode">
{{ scope.row.userCourseList[3].ownCourseCode }}</span
>
>
</template>
</el-table-column>
<el-table-column align="center" label="分数">
......@@ -154,23 +159,26 @@
{{ scope.row.userCourseList[3].gpa }}</template
>
</el-table-column>
<el-table-column align="center" label="编辑分数">
<template slot-scope="scope" v-if="scope.row.userCourseList[3]">
<el-button @click="updateScore(scope.row.userCourseList[3].gpa,scope.row.userCourseList[3].id)">编辑</el-button>
<el-table-column align="center" label="编辑分数">
<template slot-scope="scope" v-if="scope.row.userCourseList[3]">
<el-button
@click="
updateScore(
scope.row.userCourseList[3].gpa,
scope.row.userCourseList[3].id
)
"
>编辑</el-button
>
</template>
</el-table-column>
</el-table-column>
</el-table>
</div>
</div>
</template>
<script>
import {
editScore,
getHaveScoreStu
} from "@/api/cso2";
import { editScore, getHaveScoreStu } from "@/api/cso2";
import { formatDate } from "@/utils/date";
// const defaultListQuery = {
// pageNum: 1,
......@@ -193,9 +201,9 @@ export default {
editNoticeVisible: false,
pickerOptions: {},
haveGpaStu: [],
editScoreList:{
id:0,
gpa:0
editScoreList: {
id: 0,
gpa: 0
}
};
},
......@@ -209,27 +217,24 @@ export default {
return formatDate(date, "yyyy-MM-dd hh:mm:ss");
}
},
watch:{
stuName(newVal,oldVal){
this.oneStu = newVal;
// console.log(typeof(this.oneStu),this.oneStu,'this.oneStu');
// methods的函数在这里调用可以获取到newOrderData的值
this.getList()
},
},
watch: {
stuName(newVal, oldVal) {
this.oneStu = newVal;
// console.log(typeof(this.oneStu),this.oneStu,'this.oneStu');
// methods的函数在这里调用可以获取到newOrderData的值
this.getList();
}
},
methods: {
getList() {
this.listLoading = true;
// console.log(this.oneStu,'getOneStu');
getHaveScoreStu({
getHaveScoreStu({
pageNum: 1,
pageSize: 999,
customerName:this.oneStu
customerName: this.oneStu
}).then(res => {
this.listLoading = false;
......@@ -241,8 +246,7 @@ export default {
this.$forceUpdate();
});
},
handleCurrentChange(val) {
// 翻页
this.listQuery.pageNum = val;
......@@ -254,65 +258,57 @@ export default {
},
//编辑分数
updateScore(gpa,id){
updateScore(gpa, id) {
this.editNoticeVisible = true;
this.editScoreList.gpa = gpa
this.editScoreList.id = id
this.editScoreList.gpa = gpa;
this.editScoreList.id = id;
},
cancel(formName) {
cancel(formName) {
this.editNoticeVisible = false;
this.$refs[formName].resetFields();
},
//提交编辑后的分数
submitForm(editScoreList) {
// if (this.updateId) {
// this.recruitCourseInfo.id = this.updateId;
// }
let arr = [];
if (this.editScoreList.gpa) {
let obj = {};
obj.userCourseId = this.editScoreList.id;
obj.gpa = this.editScoreList.gpa;
arr.push(obj);
}
if (arr.length == 0) {
let arr = [];
if (this.editScoreList.gpa) {
let obj = {};
obj.userCourseId = this.editScoreList.id;
obj.gpa = this.editScoreList.gpa;
arr.push(obj);
}
if (arr.length == 0) {
this.$message({
type: "error",
message: "请先打分再提交",
duration: 1000
});
}
else{
this.$confirm("请认真核对课程名称和分数!", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
editScore(arr).then(response => {
this.$message({
type: "success",
message: "提交成功",
duration: 1000
});
// this.$refs[formName].resetFields();
this.editNoticeVisible = false;
} else {
this.$confirm("请认真核对课程名称和分数!", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
editScore(arr).then(response => {
this.$message({
type: "success",
message: "提交成功",
duration: 1000
});
// this.$refs[formName].resetFields();
this.editNoticeVisible = false;
this.getList();
this.$forceUpdate();
this.getList();
this.$forceUpdate();
});
});
});
}
},
},
}
}
};
</script>
<style lang="scss" scoped>
</style>
<style lang="scss" scoped></style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment