Skip to content

Commit

Permalink
feat:表格初始化
Browse files Browse the repository at this point in the history
  • Loading branch information
yangfan909 committed May 18, 2022
1 parent 11b0588 commit 465d91b
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 30 deletions.
44 changes: 23 additions & 21 deletions src/components/CourseForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,24 @@ export default {
}
},
created() {
let temp_term =[];
console.log(this.$store.state.currentTerm.toString())
let temp0 = (this.$store.state.currentTerm.toString()).split('.')[1]-1;
let temp1 = (this.$store.state.currentTerm.toString()).split('.')[0];
for(let i = 0; i < 4;i++){
temp0++;
if( temp0 >= this.$store.state.termsPerY){
temp0 = 0;
temp1 ++;
}
console.log(temp1,temp0,temp_term)
temp_term.push({
label: temp1.toString() +'.'+temp0.toString(),
value: temp1.toString() +'.'+temp0.toString()
})
}
this.term_options = temp_term;
console.log(this.form)
this.$axios.get('/classroom/common/getclassrooms').then((resp)=>{
this.classrooms=resp.data
Expand All @@ -159,9 +177,7 @@ export default {
})
// this.form=this.formdata_prop
this.form.courseTerm=this.format_semester(this.formdata_prop),
this.time_options=this.gen_time_options()
this.format_major()
this.$axios.get("/org/common/getorgs",{})
.then(response => {
Expand Down Expand Up @@ -191,25 +207,11 @@ export default {
}).catch((error) => {
console.log(error)
})
let temp_term =[];
console.log(this.$store.state.currentTerm.toString())
let temp0 = (this.$store.state.currentTerm.toString()).split('.')[1]-1;
let temp1 = (this.$store.state.currentTerm.toString()).split('.')[0];
for(let i = 0; i < 4;i++){
temp0++;
if( temp0 >= this.$store.state.termsPerY){
temp0 = 0;
temp1 ++;
}
console.log(temp1,temp0,temp_term)
temp_term.push({
label: temp1.toString() +'.'+temp0.toString(),
value: temp1.toString() +'.'+temp0.toString()
})
}
this.term_options = temp_term;
this.form.courseTerm=this.format_semester(this.formdata_prop),
this.time_options=this.gen_time_options()
this.format_major()
this.course_select_enabled()
},
data() {
Expand Down
27 changes: 18 additions & 9 deletions src/components/CourseTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,13 @@ import ElQuarterPicker from './ElQuarterPicker.vue'
export default {
components: { CourseForm ,ElQuarterPicker},
name:'CourseTable',
mounted (){
this.$axios.get("/org/common/getorgs").then((resp)=>{
this.department=resp.data
})
created() {
this.$axios.get("/org/common/getorgs").then((resp)=>{
this.department=resp.data
})
},
mounted (){
this.$axios.get('/classroom/common/getclassrooms').then((resp)=>{
this.classrooms=resp.data
console.log(resp.data)
Expand Down Expand Up @@ -302,7 +305,6 @@ data() {
console.log(resp.data)
this.course_sort_f()
})
this.course_sort_f()
},
course_sort_f(){
var that = this;
Expand Down Expand Up @@ -411,7 +413,6 @@ data() {
this.$message("没有删除权限");
}
})
this.get_table()
},
addcourse(){
this.$message({
Expand Down Expand Up @@ -458,9 +459,13 @@ data() {
console.log(this.trigger)
console.log(resp.data)
if (resp.data.submitted) {
this.$message("添加成功");
this.$message("添加成功");
} else {
this.$message("提交失败,请检查表单内容");
if(!resp.data.stage_suitable){
this.$message("提交失败,请注意选课阶段!");
}else {
this.$message("提交失败,请注意表单内容!")
}
}
})
},
Expand All @@ -478,7 +483,11 @@ data() {
this.$message("申请修改成功");
this.dialogVisible = false
} else {
this.$message("提交失败,请检查表单内容");
if(!resp.data.stage_suitable){
this.$message("提交失败,请注意选课阶段!");
}else {
this.$message("提交失败,请注意表单内容!")
}
}
})
Expand Down

0 comments on commit 465d91b

Please sign in to comment.