Commit 3d85ecf0 by lizhi

优化

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