|
@@ -44,7 +44,7 @@
|
|
|
<span>依建立时间排序</span>
|
|
|
</div>
|
|
|
<div class="period-list">
|
|
|
- <div class="period-item" v-for="(item,index) in schoolSetting.systems" :key="index" @click="choosePeriod(index)" :class="index == currentSchoolSysIndex ? 'item-active-div':''">
|
|
|
+ <div class="period-item" v-for="(item,index) in schoolSetting.period" :key="index" @click="choosePeriod(index)" :class="index == currentSchoolSysIndex ? 'item-active-div':''">
|
|
|
<p class="period-item-name">
|
|
|
<EditableLabel ref="periodName" class="term-item-name" :content="item.name" @editComplete="handleEditPeriod($event,index)">
|
|
|
</EditableLabel>
|
|
@@ -66,9 +66,9 @@
|
|
|
<Icon type="md-add" @click="handleAddTerm" />
|
|
|
</div>
|
|
|
<div class="col-body">
|
|
|
- <div class="no-data-text" v-if="!schoolSetting.systems[currentSchoolSysIndex].semester.length">没有设置学期</div>
|
|
|
- <div class="term-list" v-if="schoolSetting.systems[currentSchoolSysIndex].semester.length">
|
|
|
- <div class="term-item editable" v-for="(item,index) in schoolSetting.systems[currentSchoolSysIndex].semester" :key="index" :class="index == currentSemesterIndex ? 'item-active-div':''" @click="chooseSemester(index)">
|
|
|
+ <div class="no-data-text" v-if="!schoolSetting.period[currentSchoolSysIndex].semester.length">没有设置学期</div>
|
|
|
+ <div class="term-list" v-if="schoolSetting.period[currentSchoolSysIndex].semester.length">
|
|
|
+ <div class="term-item editable" v-for="(item,index) in schoolSetting.period[currentSchoolSysIndex].semester" :key="index" :class="index == currentSemesterIndex ? 'item-active-div':''" @click="chooseSemester(index)">
|
|
|
<span class="term-item-name-line" :style="{backgroundColor: colorList[index]}"></span>
|
|
|
<EditableLabel ref="semesterName" class="term-item-name" :content="item.name" @editComplete="handleEditSemester($event,index)">
|
|
|
</EditableLabel>
|
|
@@ -95,18 +95,18 @@
|
|
|
<li v-for="(item,index) in monthEnList" :key="index">
|
|
|
<span class="time-label">{{item}}.</span>
|
|
|
<span class="time-dot">
|
|
|
- <span v-if="auto" class="time-inner-dot" :class="index + 1 >= schoolSetting.systems[currentSchoolSysIndex].semester[currentSemesterIndex].month && index < endMonth ? 'bg-color-check':'bg-color-uncheck'"></span>
|
|
|
- <span v-else class="time-inner-dot" :class="index + 1 >= schoolSetting.systems[currentSchoolSysIndex].semester[currentSemesterIndex].month || index < endMonth ? 'bg-color-check':'bg-color-uncheck'"></span>
|
|
|
+ <span v-if="auto" class="time-inner-dot" :class="index + 1 >= schoolSetting.period[currentSchoolSysIndex].semester[currentSemesterIndex].month && index < endMonth ? 'bg-color-check':'bg-color-uncheck'"></span>
|
|
|
+ <span v-else class="time-inner-dot" :class="index + 1 >= schoolSetting.period[currentSchoolSysIndex].semester[currentSemesterIndex].month || index < endMonth ? 'bg-color-check':'bg-color-uncheck'"></span>
|
|
|
<span class="time-line-tail"></span>
|
|
|
</span>
|
|
|
<div>
|
|
|
- <Icon class="first-arrow" size="22" type="ios-arrow-back" v-if="index + 1 == schoolSetting.systems[currentSchoolSysIndex].semester[currentSemesterIndex].month || index + 1 == endMonth" />
|
|
|
- <!--<Icon class="second-arrow" size="22" :class="index < endMonth ? 'color-check':'color-uncheck'" type="ios-arrow-back" v-if="index + 1 == schoolSetting.systems[currentSchoolSysIndex].semester[currentSemesterIndex].month || index + 1 == endMonth" />-->
|
|
|
+ <Icon class="first-arrow" size="22" type="ios-arrow-back" v-if="index + 1 == schoolSetting.period[currentSchoolSysIndex].semester[currentSemesterIndex].month || index + 1 == endMonth" />
|
|
|
+ <!--<Icon class="second-arrow" size="22" :class="index < endMonth ? 'color-check':'color-uncheck'" type="ios-arrow-back" v-if="index + 1 == schoolSetting.period[currentSchoolSysIndex].semester[currentSemesterIndex].month || index + 1 == endMonth" />-->
|
|
|
<span v-if="auto">
|
|
|
- <Icon class="second-arrow" size="22" :class="index < endMonth ? 'color-check':'color-uncheck'" type="ios-arrow-back" v-if="index + 1 == schoolSetting.systems[currentSchoolSysIndex].semester[currentSemesterIndex].month || index + 1 == endMonth" />
|
|
|
+ <Icon class="second-arrow" size="22" :class="index < endMonth ? 'color-check':'color-uncheck'" type="ios-arrow-back" v-if="index + 1 == schoolSetting.period[currentSchoolSysIndex].semester[currentSemesterIndex].month || index + 1 == endMonth" />
|
|
|
</span>
|
|
|
<span v-else>
|
|
|
- <Icon class="second-arrow" size="22" :class="index + 1 >= endMonth ? 'color-check':'color-uncheck'" type="ios-arrow-back" v-if="index + 1 == schoolSetting.systems[currentSchoolSysIndex].semester[currentSemesterIndex].month || index + 1 == endMonth" />
|
|
|
+ <Icon class="second-arrow" size="22" :class="index + 1 >= endMonth ? 'color-check':'color-uncheck'" type="ios-arrow-back" v-if="index + 1 == schoolSetting.period[currentSchoolSysIndex].semester[currentSemesterIndex].month || index + 1 == endMonth" />
|
|
|
</span>
|
|
|
</div>
|
|
|
</li>
|
|
@@ -123,7 +123,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="grade-body">
|
|
|
- <div class="grade-item item-active" v-for="(item,index) in schoolSetting.systems[currentSchoolSysIndex].grade" :key="index">
|
|
|
+ <div class="grade-item item-active" v-for="(item,index) in schoolSetting.period[currentSchoolSysIndex].grade" :key="index">
|
|
|
<span class="grade-item-icon"></span>
|
|
|
<EditableLabel ref="gradeName" class="grade-item-name" :content="item.name" @editComplete="handleEditGrade($event,index)">
|
|
|
</EditableLabel>
|
|
@@ -139,7 +139,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="grade-body">
|
|
|
- <div class="grade-item item-active" v-for="(item,index) in schoolSetting.systems[currentSchoolSysIndex].subject" :key="index">
|
|
|
+ <div class="grade-item item-active" v-for="(item,index) in schoolSetting.period[currentSchoolSysIndex].subject" :key="index">
|
|
|
<span class="grade-item-icon"></span>
|
|
|
<EditableLabel ref="subjectName" class="grade-item-name" :content="item.name" @editComplete="handleEditSubject($event,index)">
|
|
|
</EditableLabel>
|
|
@@ -149,9 +149,6 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <!--<Modal v-model="updated">
|
|
|
- <p>您修改信息后还未保存,如果离开数据将会丢失!</p>
|
|
|
- </Modal>-->
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
@@ -186,24 +183,7 @@
|
|
|
schoolSetting: {
|
|
|
code: "",
|
|
|
name: "",
|
|
|
- systems: [
|
|
|
- {
|
|
|
- name: "预设学段1",
|
|
|
- gradeCount: 0,
|
|
|
- semesterCount: 0,
|
|
|
- subjectCount: 0,
|
|
|
- semester: [
|
|
|
- {
|
|
|
- name: "预设学期1",
|
|
|
- studentCount: "学生人数",
|
|
|
- month: 1,
|
|
|
- day:26
|
|
|
- }
|
|
|
- ],
|
|
|
- grade: [],
|
|
|
- subject: []
|
|
|
- }
|
|
|
- ]
|
|
|
+ period: []
|
|
|
},
|
|
|
tabIndex: 0,
|
|
|
periodList: [
|
|
@@ -228,29 +208,29 @@
|
|
|
methods: {
|
|
|
//删除节点
|
|
|
delGrade(index) {
|
|
|
- this.schoolSetting.systems[this.currentSchoolSysIndex].grade.splice(index, 1);
|
|
|
+ this.schoolSetting.period[this.currentSchoolSysIndex].grade.splice(index, 1);
|
|
|
},
|
|
|
delSubject(index) {
|
|
|
- this.schoolSetting.systems[this.currentSchoolSysIndex].subject.splice(index, 1);
|
|
|
+ this.schoolSetting.period[this.currentSchoolSysIndex].subject.splice(index, 1);
|
|
|
},
|
|
|
delPeriod(index) {
|
|
|
if (this.currentSchoolSysIndex >= index && index > 0) {
|
|
|
this.currentSemesterIndex = 0;
|
|
|
this.currentSchoolSysIndex = 0;
|
|
|
}
|
|
|
- if (this.schoolSetting.systems.length > 1) {
|
|
|
+ if (this.schoolSetting.period.length > 1) {
|
|
|
this.currentSchoolSysIndex = 0;
|
|
|
this.currentSemesterIndex = 0;
|
|
|
- this.schoolSetting.systems.splice(index, 1);
|
|
|
+ this.schoolSetting.period.splice(index, 1);
|
|
|
} else {
|
|
|
this.$Message.warning('至少需要保留一项!');
|
|
|
}
|
|
|
},
|
|
|
delSemester(index) {
|
|
|
- if (this.schoolSetting.systems[this.currentSchoolSysIndex].semester.length > 1) {
|
|
|
+ if (this.schoolSetting.period[this.currentSchoolSysIndex].semester.length > 1) {
|
|
|
this.currentSchoolSysIndex = 0;
|
|
|
this.currentSemesterIndex = 0;
|
|
|
- this.schoolSetting.systems[this.currentSchoolSysIndex].semester.splice(index, 1);
|
|
|
+ this.schoolSetting.period[this.currentSchoolSysIndex].semester.splice(index, 1);
|
|
|
} else {
|
|
|
this.$Message.warning('至少需要保留一项!');
|
|
|
}
|
|
@@ -258,30 +238,41 @@
|
|
|
initData() {
|
|
|
this.schoolSetting.code = this.demoLoginInfo.schoolCode;
|
|
|
this.schoolSetting.name = this.demoLoginInfo.school;
|
|
|
- this.schoolSetting.systems[0].grade.push({
|
|
|
+ this.schoolSetting.period.push({
|
|
|
+ name: "预设学段1",
|
|
|
+ code: this.guid(),
|
|
|
+ gradeCount: 0,
|
|
|
+ semesterCount: 0,
|
|
|
+ subjectCount: 0,
|
|
|
+ semester: [],
|
|
|
+ grade: [],
|
|
|
+ subject: []
|
|
|
+ });
|
|
|
+ this.schoolSetting.period[0].grade.push({
|
|
|
name: '一年级',
|
|
|
code: this.guid()
|
|
|
});
|
|
|
- this.schoolSetting.systems[0].grade.push({
|
|
|
+ this.schoolSetting.period[0].grade.push({
|
|
|
name: '二年级',
|
|
|
code: this.guid()
|
|
|
});
|
|
|
- this.schoolSetting.systems[0].grade.push({
|
|
|
+ this.schoolSetting.period[0].grade.push({
|
|
|
name: '三年级',
|
|
|
code: this.guid()
|
|
|
});
|
|
|
- this.schoolSetting.systems[0].subject.push({
|
|
|
+ this.schoolSetting.period[0].subject.push({
|
|
|
name: '语文',
|
|
|
code: this.guid()
|
|
|
});
|
|
|
- this.schoolSetting.systems[0].subject.push({
|
|
|
+ this.schoolSetting.period[0].subject.push({
|
|
|
name: '数学',
|
|
|
code: this.guid()
|
|
|
});
|
|
|
- this.schoolSetting.systems[0].subject.push({
|
|
|
+ this.schoolSetting.period[0].subject.push({
|
|
|
name: '英语',
|
|
|
code: this.guid()
|
|
|
});
|
|
|
+ this.updated = false;
|
|
|
},
|
|
|
changeGradeEditStatus(index) {
|
|
|
this.$refs.gradeName[index].handleEdit();
|
|
@@ -314,21 +305,24 @@
|
|
|
if (res.error == null) {
|
|
|
if (res.result.data.length > 0) {
|
|
|
this.schoolSetting = res.result.data[0];
|
|
|
+ this.updated = false;
|
|
|
+ } else {
|
|
|
+ this.initData();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
},
|
|
|
handleData() {
|
|
|
- for (let i = 0; i < this.schoolSetting.systems.length; i++) {
|
|
|
- this.schoolSetting.systems[i].gradeCount = this.schoolSetting.systems[i].grade.length;
|
|
|
- this.schoolSetting.systems[i].semesterCount = this.schoolSetting.systems[i].semester.length;
|
|
|
- this.schoolSetting.systems[i].subjectCount = this.schoolSetting.systems[i].subject.length;
|
|
|
+ for (let i = 0; i < this.schoolSetting.period.length; i++) {
|
|
|
+ this.schoolSetting.period[i].gradeCount = this.schoolSetting.period[i].grade.length;
|
|
|
+ this.schoolSetting.period[i].semesterCount = this.schoolSetting.period[i].semester.length;
|
|
|
+ this.schoolSetting.period[i].subjectCount = this.schoolSetting.period[i].subject.length;
|
|
|
}
|
|
|
},
|
|
|
handleEditGrade(val, index) {
|
|
|
let flag = false;
|
|
|
- this.schoolSetting.systems[this.currentSchoolSysIndex].grade.forEach((v, i) => {
|
|
|
+ this.schoolSetting.period[this.currentSchoolSysIndex].grade.forEach((v, i) => {
|
|
|
if (v.name == val) {
|
|
|
flag = true;
|
|
|
}
|
|
@@ -336,13 +330,13 @@
|
|
|
if (flag) {
|
|
|
this.$Message.warning('已有相同的名字,请重新设置名字!');
|
|
|
} else {
|
|
|
- this.schoolSetting.systems[this.currentSchoolSysIndex].grade[index].name = val;
|
|
|
+ this.schoolSetting.period[this.currentSchoolSysIndex].grade[index].name = val;
|
|
|
}
|
|
|
|
|
|
},
|
|
|
handleEditSubject(val, index) {
|
|
|
let flag = false;
|
|
|
- this.schoolSetting.systems[this.currentSchoolSysIndex].subject.forEach((v, i) => {
|
|
|
+ this.schoolSetting.period[this.currentSchoolSysIndex].subject.forEach((v, i) => {
|
|
|
if (v.name == val) {
|
|
|
flag = true;
|
|
|
}
|
|
@@ -350,7 +344,7 @@
|
|
|
if (flag) {
|
|
|
this.$Message.warning('已有相同的名字,请重新设置名字!');
|
|
|
} else {
|
|
|
- this.schoolSetting.systems[this.currentSchoolSysIndex].subject[index].name = val;
|
|
|
+ this.schoolSetting.period[this.currentSchoolSysIndex].subject[index].name = val;
|
|
|
}
|
|
|
},
|
|
|
handleEditSchoolName(val) {
|
|
@@ -358,7 +352,7 @@
|
|
|
},
|
|
|
handleEditPeriod(val, index) {
|
|
|
let flag = false;
|
|
|
- this.schoolSetting.systems.forEach((v, i) => {
|
|
|
+ this.schoolSetting.period.forEach((v, i) => {
|
|
|
if (v.name == val) {
|
|
|
flag = true;
|
|
|
}
|
|
@@ -366,12 +360,12 @@
|
|
|
if (flag) {
|
|
|
this.$Message.warning('已有相同的名字,请重新设置名字!');
|
|
|
} else {
|
|
|
- this.schoolSetting.systems[index].name = val;
|
|
|
+ this.schoolSetting.period[index].name = val;
|
|
|
}
|
|
|
},
|
|
|
handleEditSemester(val, index) {
|
|
|
let flag = false;
|
|
|
- this.schoolSetting.systems[this.currentSchoolSysIndex].semester.forEach((v, i) => {
|
|
|
+ this.schoolSetting.period[this.currentSchoolSysIndex].semester.forEach((v, i) => {
|
|
|
if (v.name == val) {
|
|
|
flag = true;
|
|
|
}
|
|
@@ -379,7 +373,7 @@
|
|
|
if (flag) {
|
|
|
this.$Message.warning('已有相同的名字,请重新设置名字!');
|
|
|
} else {
|
|
|
- this.schoolSetting.systems[this.currentSchoolSysIndex].semester[index].name = val;
|
|
|
+ this.schoolSetting.period[this.currentSchoolSysIndex].semester[index].name = val;
|
|
|
}
|
|
|
},
|
|
|
changePeriodEditStatus(index) {
|
|
@@ -394,8 +388,8 @@
|
|
|
addSubject() {
|
|
|
if (this.termList.length < this.TERM_MAX_LENGTH) {
|
|
|
let newTerm = Object.assign({}, defaultTerm);
|
|
|
- this.schoolSetting.systems[this.currentSchoolSysIndex].subject.push({
|
|
|
- name: "预设学科"+(this.schoolSetting.systems[this.currentSchoolSysIndex].subject.length+1),
|
|
|
+ this.schoolSetting.period[this.currentSchoolSysIndex].subject.push({
|
|
|
+ name: "预设学科"+(this.schoolSetting.period[this.currentSchoolSysIndex].subject.length+1),
|
|
|
code:this.guid()
|
|
|
});
|
|
|
} else {
|
|
@@ -411,8 +405,8 @@
|
|
|
addGrade() {
|
|
|
if (this.termList.length < this.TERM_MAX_LENGTH) {
|
|
|
let newTerm = Object.assign({}, defaultTerm);
|
|
|
- this.schoolSetting.systems[this.currentSchoolSysIndex].grade.push({
|
|
|
- name: "预设年级"+(this.schoolSetting.systems[this.currentSchoolSysIndex].grade.length),
|
|
|
+ this.schoolSetting.period[this.currentSchoolSysIndex].grade.push({
|
|
|
+ name: "预设年级"+(this.schoolSetting.period[this.currentSchoolSysIndex].grade.length),
|
|
|
code:this.guid()
|
|
|
});
|
|
|
} else {
|
|
@@ -420,32 +414,33 @@
|
|
|
}
|
|
|
},
|
|
|
addPeriod() {
|
|
|
- this.schoolSetting.systems.push({
|
|
|
- name: "预设学段"+(this.schoolSetting.systems.length+1),
|
|
|
- gradeCount: 0,
|
|
|
- semesterCount: 0,
|
|
|
- subjectCount: 0,
|
|
|
- semester: [
|
|
|
- {
|
|
|
- name: "预设学期1",
|
|
|
- studentCount: "学生人数",
|
|
|
- month: this.schoolSetting.systems[this.currentSchoolSysIndex].semester[this.currentSemesterIndex].month + 1,
|
|
|
- day:26
|
|
|
- }
|
|
|
- ],
|
|
|
- grade: [
|
|
|
- {
|
|
|
- code: "年级编码",
|
|
|
- name: "预设年级1"
|
|
|
- }
|
|
|
- ],
|
|
|
- subject: [
|
|
|
- {
|
|
|
- code: "科目编码",
|
|
|
- name: "预设科目1"
|
|
|
- }
|
|
|
- ]
|
|
|
- });
|
|
|
+ this.schoolSetting.period.push({
|
|
|
+ name: "预设学段" + (this.schoolSetting.period.length + 1),
|
|
|
+ code: this.guid(),
|
|
|
+ gradeCount: 0,
|
|
|
+ semesterCount: 0,
|
|
|
+ subjectCount: 0,
|
|
|
+ semester: [
|
|
|
+ {
|
|
|
+ name: "预设学期1",
|
|
|
+ studentCount: "学生人数",
|
|
|
+ month: this.schoolSetting.period[this.currentSchoolSysIndex].semester[this.currentSemesterIndex].month + 1,
|
|
|
+ day: 26
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ grade: [
|
|
|
+ {
|
|
|
+ code: "年级编码",
|
|
|
+ name: "预设年级1"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ subject: [
|
|
|
+ {
|
|
|
+ code: "科目编码",
|
|
|
+ name: "预设科目1"
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ });
|
|
|
},
|
|
|
//获取随机颜色十六进制
|
|
|
getRandomColor() {
|
|
@@ -455,10 +450,10 @@
|
|
|
handleAddTerm() {
|
|
|
if (this.termList.length < this.TERM_MAX_LENGTH) {
|
|
|
let newTerm = Object.assign({}, defaultTerm);
|
|
|
- this.schoolSetting.systems[this.currentSchoolSysIndex].semester.push({
|
|
|
- name: "预设学期"+(this.schoolSetting.systems[this.currentSchoolSysIndex].semester.length+1),
|
|
|
+ this.schoolSetting.period[this.currentSchoolSysIndex].semester.push({
|
|
|
+ name: "预设学期"+(this.schoolSetting.period[this.currentSchoolSysIndex].semester.length+1),
|
|
|
studentCount: "学生人数",
|
|
|
- month: this.schoolSetting.systems[this.currentSchoolSysIndex].semester[this.currentSemesterIndex].month + 1,
|
|
|
+ month: this.schoolSetting.period[this.currentSchoolSysIndex].semester[this.currentSemesterIndex].month + 1,
|
|
|
day: 26
|
|
|
});
|
|
|
} else {
|
|
@@ -507,10 +502,10 @@
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- this.initData();
|
|
|
+
|
|
|
},
|
|
|
beforeRouteLeave(to, from, next) {
|
|
|
- if (this.updated) {
|
|
|
+ if (this.updated == true) {
|
|
|
let config = {
|
|
|
render: (h) => {
|
|
|
return h("h3", {
|
|
@@ -547,14 +542,14 @@
|
|
|
computed: {
|
|
|
endMonth() {
|
|
|
let end = 1;
|
|
|
- if(this.schoolSetting.systems[this.currentSchoolSysIndex].semester.length == 1){
|
|
|
+ if(this.schoolSetting.period[this.currentSchoolSysIndex].semester.length == 1){
|
|
|
end = 12;
|
|
|
this.auto = true;
|
|
|
- } else if (this.currentSemesterIndex + 1 < this.schoolSetting.systems[this.currentSchoolSysIndex].semester.length) {
|
|
|
- end = this.schoolSetting.systems[this.currentSchoolSysIndex].semester[this.currentSemesterIndex + 1].month;
|
|
|
+ } else if (this.currentSemesterIndex + 1 < this.schoolSetting.period[this.currentSchoolSysIndex].semester.length) {
|
|
|
+ end = this.schoolSetting.period[this.currentSchoolSysIndex].semester[this.currentSemesterIndex + 1].month;
|
|
|
this.auto = true;
|
|
|
- } else if (this.currentSemesterIndex + 1 == this.schoolSetting.systems[this.currentSchoolSysIndex].semester.length){
|
|
|
- end = this.schoolSetting.systems[this.currentSchoolSysIndex].semester[0].month;
|
|
|
+ } else if (this.currentSemesterIndex + 1 == this.schoolSetting.period[this.currentSchoolSysIndex].semester.length){
|
|
|
+ end = this.schoolSetting.period[this.currentSchoolSysIndex].semester[0].month;
|
|
|
this.auto = false;
|
|
|
}
|
|
|
return end;
|