|
@@ -1,29 +1,5 @@
|
|
|
-<style lang="less" scoped>
|
|
|
- @import './SystemSetting.less';
|
|
|
-</style>
|
|
|
-<style>
|
|
|
- .second-arrow {
|
|
|
- margin-left: -16px;
|
|
|
- }
|
|
|
-
|
|
|
- .color-check {
|
|
|
- color: #08d0c8;
|
|
|
- }
|
|
|
-
|
|
|
- .color-uncheck {
|
|
|
- color: #FF6C6B;
|
|
|
- }
|
|
|
-
|
|
|
- .bg-color-check {
|
|
|
- background-color: #08d0c8 !important;
|
|
|
- }
|
|
|
-
|
|
|
- .bg-color-uncheck {
|
|
|
- background-color: #FF6C6B !important;
|
|
|
- }
|
|
|
-</style>
|
|
|
<template>
|
|
|
- <div class="sm-system">
|
|
|
+ <div class="sm-system" @click="editSubStatus = false">
|
|
|
<div class="sm-school-name">
|
|
|
<div>
|
|
|
<span class="setting-title">{{$t('schoolBaseInfo.schoolNameLabel')}}</span>
|
|
@@ -54,15 +30,13 @@
|
|
|
<span class="campus-label" @click="setCampus">
|
|
|
{{item.campusCode === null ? '请设置校区': $JSONPath.query(schoolSetting, "$..campuses[?(@.campusCode=='" + item.campusCode + "')]").length > 0 ? $JSONPath.query(schoolSetting, "$..campuses[?(@.campusCode=='" + item.campusCode + "')]")[0].campusName : '请设置校区' }}
|
|
|
</span>
|
|
|
- <!--<Icon type="md-create" class="period-btn-edit" title="编辑" @click="changePeriodEditStatus(index)" />-->
|
|
|
</p>
|
|
|
-
|
|
|
<p class="period-item-num"><span></span>{{ $t('schoolBaseInfo.semesterNum') + item.semesters.length}}</p>
|
|
|
<p class="period-item-num"><span></span>{{ $t('schoolBaseInfo.gradeNum') + item.grades.length}}</p>
|
|
|
<p class="period-item-num"><span></span>{{ $t('schoolBaseInfo.periodNum') + item.subjects.length}}</p>
|
|
|
|
|
|
</div>
|
|
|
-
|
|
|
+
|
|
|
</div>
|
|
|
</div>
|
|
|
<!--学期列表-->
|
|
@@ -84,17 +58,14 @@
|
|
|
</p>
|
|
|
<div class="term-item-start">
|
|
|
<span>{{$t('schoolBaseInfo.startDate')}}</span>
|
|
|
- <!--<Select v-model="item.month" :disabled="editSemIndex !== index" :placeholder="$t('schoolBaseInfo.monthHolder')">
|
|
|
- <Option v-for="(item,index) in monthList" :value="item" :key="index">{{ item }}</Option>
|
|
|
- </Select>-->
|
|
|
- <InputNumber v-model="item.month" size="small" style="width:50px;" :disabled="editSemIndex !== index" :max="12" :min="1"></InputNumber>
|
|
|
+ <InputNumber @on-change="countSemDays" v-model="item.month" size="small" style="width:50px;" :disabled="editSemIndex !== index" :max="12" :min="1"></InputNumber>
|
|
|
<span> / </span>
|
|
|
- <InputNumber v-model="item.day" size="small" style="width:50px;" :disabled="editSemIndex !== index" :max="31" :min="1"></InputNumber>
|
|
|
+ <InputNumber @on-change="countSemDays" v-model="item.day" size="small" style="width:50px;" :disabled="editSemIndex !== index" :max="31" :min="1"></InputNumber>
|
|
|
</div>
|
|
|
<p class="term-item-students-num">{{$t('schoolBaseInfo.semesterDuration')+ item.days + $t('schoolBaseInfo.dayUnit') }}</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
+
|
|
|
<div class="term-item-time-line" v-if="schoolSetting.period[currentSchoolSysIndex].semesters.length">
|
|
|
<ul>
|
|
|
<li v-for="(item,index) in monthEnList" :key="index">
|
|
@@ -134,17 +105,22 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<!--学科显示区域-->
|
|
|
- <div class="col-title">
|
|
|
+ <div class="col-title" @click.stop>
|
|
|
<span>{{$t('schoolBaseInfo.subjectSetting')}}</span>
|
|
|
- <Icon type="md-add" @click="addSubject()" class="action-btn-icon" v-if="$access.ability('admin','schoolSetting-upd').validateAll"/>
|
|
|
+ <Icon type="md-add" @click="addSubject()" class="action-btn-icon" v-if="$access.ability('admin','schoolSetting-upd').validateAll" />
|
|
|
+ <Icon type="md-trash" @click="delSubStatus = true" class="action-btn-icon" v-if="$access.ability('admin','schoolSetting-upd').validateAll" />
|
|
|
+ <Icon type="md-create" @click.stop="editSubStatus = true" class="action-btn-icon" v-if="$access.ability('admin','schoolSetting-upd').validateAll" />
|
|
|
</div>
|
|
|
- <div class="grade-body">
|
|
|
+ <div class="grade-body dark-iview-input disabled-iview-input" @click.stop>
|
|
|
<div class="grade-item item-active" v-for="(item,index) in schoolSetting.period[currentSchoolSysIndex].subjects" :key="index">
|
|
|
<span class="grade-item-icon"></span>
|
|
|
- <EditableLabel ref="subjectName" class="grade-item-name" :content="item.subjectName" @editComplete="handleEditSubject($event,index)">
|
|
|
- </EditableLabel>
|
|
|
- <Icon type="md-create" class="period-btn-edit" :title="$t('schoolBaseInfo.editLabel')" @click="changeSubjectEditStatus(index)" v-if="$access.ability('admin','schoolSetting-upd').validateAll" />
|
|
|
- <Icon type="md-close" @click="delSubject(index)" v-if="$access.ability('admin','schoolSetting-upd').validateAll" />
|
|
|
+ <!--<EditableLabel ref="subjectName" class="grade-item-name" :content="item.subjectName" @editComplete="handleEditSubject($event,index)">
|
|
|
+ </EditableLabel>-->
|
|
|
+ <p :class="'get-width'+index" id="get-width">{{item.subjectName}}</p>
|
|
|
+
|
|
|
+ <Input v-model="item.subjectName" :disabled="!editSubStatus" placeholder="设置学科..." :style="{width: getWidth(index)+'px'}" />
|
|
|
+ <!--<Icon type="md-create" class="period-btn-edit" :title="$t('schoolBaseInfo.editLabel')" @click="changeSubjectEditStatus(index)" v-if="$access.ability('admin','schoolSetting-upd').validateAll" />-->
|
|
|
+ <Icon type="md-close" @click="delSubject(index)" v-show="delSubStatus" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -190,6 +166,8 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ editSubStatus: false,
|
|
|
+ delSubStatus: false,
|
|
|
updateDays: false,
|
|
|
isSaveLoading: false,
|
|
|
delSemesterStatus: false,
|
|
@@ -215,25 +193,71 @@
|
|
|
subjectSelectList: [],
|
|
|
TERM_MAX_LENGTH: 3, // 学期数上限
|
|
|
campusStatus: false,
|
|
|
- selectedCampusIndex: -1
|
|
|
+ selectedCampusIndex: -1,
|
|
|
+ width:[]
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ /**
|
|
|
+ * 动态设置input宽度
|
|
|
+ * */
|
|
|
+ getWidth(index) {
|
|
|
+ let width = 100
|
|
|
+ this.$nextTick(() => {
|
|
|
+ let dom = document.getElementsByClassName('get-width' + index)
|
|
|
+ console.log(dom)
|
|
|
+ if (dom.length > 0) {
|
|
|
+ width = dom[0].clientWidth + 25
|
|
|
+ console.log(width)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ return width
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 计算学期天数
|
|
|
+ * @param date1
|
|
|
+ * @param date2
|
|
|
+ */
|
|
|
+ countSemDays() {
|
|
|
+ if (this.schoolSetting.period[this.currentSchoolSysIndex].semesters.length > 0) {
|
|
|
+ let count = 365
|
|
|
+ let index = 0
|
|
|
+ let year = new Date().getFullYear()
|
|
|
+ for (let i = 0; i < this.schoolSetting.period[this.currentSchoolSysIndex].semesters.length; i++) {
|
|
|
+ if (i == (this.schoolSetting.period[this.currentSchoolSysIndex].semesters.length - 1)) {
|
|
|
+ index = i
|
|
|
+ break
|
|
|
+ } else {
|
|
|
+ let sDate = year + '-' + this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i].month + '-' + this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i].day
|
|
|
+ let eDate = year + '-' + this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i + 1].month + '-' + this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i + 1].day
|
|
|
+ let d = this.getDays(sDate, eDate)
|
|
|
+ count -= d
|
|
|
+ this.$set(this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i], 'days', d)
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$set(this.schoolSetting.period[this.currentSchoolSysIndex].semesters[index], 'days', count)
|
|
|
+
|
|
|
+ this.updated = false
|
|
|
+ }
|
|
|
+ },
|
|
|
/**
|
|
|
* 计算两个日期的天数
|
|
|
* @param date1
|
|
|
* @param date2
|
|
|
*/
|
|
|
- getDays(date1 , date2){
|
|
|
+ getDays(date1, date2) {
|
|
|
var date1Str = date1.split("-");//将日期字符串分隔为数组,数组元素分别为年.月.日
|
|
|
//根据年 . 月 . 日的值创建Date对象
|
|
|
- var date1Obj = new Date(date1Str[0],(date1Str[1]-1),date1Str[2]);
|
|
|
+ var date1Obj = new Date(date1Str[0], (date1Str[1] - 1), date1Str[2]);
|
|
|
var date2Str = date2.split("-");
|
|
|
- var date2Obj = new Date(date2Str[0],(date2Str[1]-1),date2Str[2]);
|
|
|
+ var date2Obj = new Date(date2Str[0], (date2Str[1] - 1), date2Str[2]);
|
|
|
var t1 = date1Obj.getTime();
|
|
|
var t2 = date2Obj.getTime();
|
|
|
- var dateTime = 1000*60*60*24; //每一天的毫秒数
|
|
|
- var minusDays = Math.floor(((t2-t1)/dateTime));//计算出两个日期的天数差
|
|
|
+ var dateTime = 1000 * 60 * 60 * 24; //每一天的毫秒数
|
|
|
+ var minusDays = Math.floor(((t2 - t1) / dateTime));//计算出两个日期的天数差
|
|
|
var days = Math.abs(minusDays);//取绝对值
|
|
|
return days;
|
|
|
},
|
|
@@ -281,7 +305,7 @@
|
|
|
if (this.$access.ability('admin', 'schoolSetting-upd').validateAll) {
|
|
|
this.campusStatus = true
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
// 删除节点
|
|
|
delGrade(index) {
|
|
@@ -314,6 +338,7 @@
|
|
|
this.currentSchoolSysIndex = 0
|
|
|
this.curSemIndex = 0
|
|
|
this.schoolSetting.period[this.currentSchoolSysIndex].semesters.splice(index, 1)
|
|
|
+ this.countSemDays()
|
|
|
} else {
|
|
|
this.$Message.warning(this.$t('schoolBaseInfo.ssTips2'))
|
|
|
}
|
|
@@ -401,21 +426,21 @@
|
|
|
break
|
|
|
} else {
|
|
|
let sDate = year + '-' + this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i].month + '-' + this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i].day
|
|
|
- let eDate = year + '-' + this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i+1].month + '-' + this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i+1].day
|
|
|
+ let eDate = year + '-' + this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i + 1].month + '-' + this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i + 1].day
|
|
|
let d = this.getDays(sDate, eDate)
|
|
|
console.log(d)
|
|
|
count -= d
|
|
|
this.updateDays = true
|
|
|
- this.$set(this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i],'days',d)
|
|
|
-
|
|
|
+ this.$set(this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i], 'days', d)
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
this.updateDays = true
|
|
|
this.$set(this.schoolSetting.period[this.currentSchoolSysIndex].semesters[index], 'days', count)
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
//保存数据
|
|
|
saveData() {
|
|
@@ -427,6 +452,7 @@
|
|
|
this.$Message.success(this.$t('schoolBaseInfo.ssTips3'))
|
|
|
this.updated = false
|
|
|
this.isSaveLoading = false
|
|
|
+ this.editSemIndex = -1
|
|
|
}
|
|
|
},
|
|
|
(err) => {
|
|
@@ -627,6 +653,7 @@
|
|
|
day: 26,
|
|
|
semesterCode: this.guid()
|
|
|
})
|
|
|
+ this.countSemDays()
|
|
|
} else {
|
|
|
this.$Message.info(this.$t('schoolBaseInfo.ssTips7'))
|
|
|
}
|
|
@@ -756,17 +783,40 @@
|
|
|
} else {
|
|
|
return false
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<!-- 覆盖iview样式 -->
|
|
|
+<style lang="less" scoped>
|
|
|
+ @import './SystemSetting.less';
|
|
|
+</style>
|
|
|
<style>
|
|
|
+ .second-arrow {
|
|
|
+ margin-left: -16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .color-check {
|
|
|
+ color: #08d0c8;
|
|
|
+ }
|
|
|
+
|
|
|
+ .color-uncheck {
|
|
|
+ color: #FF6C6B;
|
|
|
+ }
|
|
|
+
|
|
|
+ .bg-color-check {
|
|
|
+ background-color: #08d0c8 !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ .bg-color-uncheck {
|
|
|
+ background-color: #FF6C6B !important;
|
|
|
+ }
|
|
|
+
|
|
|
.semester-name-label .ivu-input[disabled] {
|
|
|
font-size: 20px !important;
|
|
|
font-weight: bold;
|
|
|
color: white;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|