Преглед изворни кода

完善UI学级和年级对应关系,添加入学期

liqk пре 4 година
родитељ
комит
6e726bef73

+ 14 - 0
TEAMModelOS/ClientApp/src/view/schoolmgmt/SystemSetting/NewSystemSetting.less

@@ -597,4 +597,18 @@
 .profession-content{
     width: 100%;
     
+}
+.semester-start-warning{
+    color: #ed4014;
+    margin-left: 15px;
+}
+.year-start-tag{
+    font-size: 12px;
+    color: #1cc0f3;
+    border: 1px solid #1cc0f3;
+    padding: 1px 2px;
+    border-radius: 2px;
+    margin-left: 15px;
+    display: inline-block;
+    transform: scale(0.8);
 }

+ 69 - 26
TEAMModelOS/ClientApp/src/view/schoolmgmt/SystemSetting/NewSystemSetting.vue

@@ -89,6 +89,9 @@
                             <div class="setting-content semester-content">
                                 <p class="block-title bf-color1">
                                     {{$t('schoolBaseInfo.semesterSetting')}}
+                                    <span class="semester-start-warning" v-show="startWarning">
+                                        <Icon type="md-warning" />请设置入学期
+                                    </span>
                                     <span class="block-action-box">
                                         <Icon v-if="$access.ability('admin','schoolSetting-upd').validateAll" type="md-add" @click.stop="addSemester()" class="action-btn-icon" />
                                     </span>
@@ -99,18 +102,20 @@
                                     </span>
                                     <span class="term-item-start" @click.stop>
                                         <span>{{$t('schoolBaseInfo.startDate')}}</span>
-                                        <Select v-model="item.month" style="width:60px" :placeholder="$t('schoolBaseInfo.monthHolder')" :disabled="editSemIndex !== index">
+                                        <Select v-model="item.month" style="width:70px" :placeholder="$t('schoolBaseInfo.monthHolder')" :disabled="editSemIndex !== index">
                                             <Option v-for="(item,index) in monthList" :value="(index + 1)" :key="index" @click.native="countSemDays">{{ item }}</Option>
                                         </Select>
                                         <span> / </span>
-                                        <Select v-model="item.day" style="width:60px" :placeholder="$t('schoolBaseInfo.dayHolder')" :disabled="editSemIndex !== index">
+                                        <Select v-model="item.day" style="width:70px" :placeholder="$t('schoolBaseInfo.dayHolder')" :disabled="editSemIndex !== index">
                                             <Option v-for="(item,index) in dayList" :value="(index + 1)" :key="index" @click.native="countSemDays">{{ item }}</Option>
                                         </Select>
                                     </span>
                                     <span class="term-item-students-num">{{$t('schoolBaseInfo.semesterDuration')+ semDays[index] + $t('schoolBaseInfo.dayUnit')  }}</span>
+                                    <span class="year-start-tag" v-show="item.start == '1'">入学期</span>
                                     <div class="action-btx-box hover-show-icon">
                                         <Icon v-if="$access.ability('admin','schoolSetting-upd').validateAll" type="md-trash" @click.stop="showComfirmDelSemester()" :title="$t('schoolBaseInfo.delete')" class="action-btn-icon" />
-                                        <Icon v-if="$access.ability('admin','schoolSetting-upd').validateAll" type="md-create" @click.stop="editSemIndex = curSemIndex" :title="$t('schoolBaseInfo.editLabel')" class="action-btn-icon" />
+                                        <!-- <Icon v-if="$access.ability('admin','schoolSetting-upd').validateAll" type="md-create" @click.stop="editSemIndex = curSemIndex" :title="$t('schoolBaseInfo.editLabel')" class="action-btn-icon" /> -->
+                                        <Icon v-if="$access.ability('admin','schoolSetting-upd').validateAll" type="md-create" @click.stop="setEditSem(index)" :title="$t('schoolBaseInfo.editLabel')" class="action-btn-icon" />
                                     </div>
                                 </div>
                                 <!-- 时间轴UI -->
@@ -337,21 +342,21 @@
                 </FormItem>
                 <!-- 开始时间 -->
                 <FormItem prop="name" label="开始于">
-                    <Select v-model="semtInfo.month" style="width:80px" :placeholder="$t('schoolBaseInfo.monthHolder')">
+                    <Select v-model="semtInfo.month" style="width:90px" :placeholder="$t('schoolBaseInfo.monthHolder')">
                         <Option v-for="(item,index) in monthList" :value="(index + 1)" :key="index" @click.native="countSemDays">{{ item }}</Option>
                     </Select>
-                    <span> / </span>
-                    <Select v-model="semtInfo.day" style="width:80px" :placeholder="$t('schoolBaseInfo.dayHolder')">
+                    <span style="display:inline-block;width:20px;text-align:center"> / </span>
+                    <Select v-model="semtInfo.day" style="width:90px" :placeholder="$t('schoolBaseInfo.dayHolder')">
                         <Option v-for="(item,index) in dayList" :value="(index + 1)" :key="index" @click.native="countSemDays">{{ item }}</Option>
                     </Select>
                 </FormItem>
                 <!-- 是否为入学期 -->
                 <FormItem prop="name" label="入学期">
                     <RadioGroup v-model="semtInfo.start">
-                        <Radio label="1">
+                        <Radio :label="1">
                             <span>是</span>
                         </Radio>
-                        <Radio label="0" style="margin-left:30px">
+                        <Radio :label="0" style="margin-left:30px">
                             <span>否</span>
                         </Radio>
                     </RadioGroup>
@@ -443,8 +448,41 @@ export default {
         }
     },
     methods: {
+        setEditSem(index) {
+            this.semtInfo.name = this.schoolSetting.period[this.curPriodIndex].semesters[index].name
+            this.semtInfo.month = this.schoolSetting.period[this.curPriodIndex].semesters[index].month
+            this.semtInfo.day = this.schoolSetting.period[this.curPriodIndex].semesters[index].day
+            this.semtInfo.start = this.schoolSetting.period[this.curPriodIndex].semesters[index].start
+            this.semtInfo.id = this.schoolSetting.period[this.curPriodIndex].semesters[index].id
+            this.addSemStatus = true
+            console.log('456',this.semtInfo.name)
+        },
         confirmSemester() {
+            console.log('123',this.semtInfo.id)
+            if (this.semtInfo.id) { //编辑
+                let s = this.schoolSetting.period[this.curPriodIndex].semesters.find(item => {
+                    return item.id == this.semtInfo.id
+                })
+                s.name = this.semtInfo.name
+                s.month = this.semtInfo.month
+                s.day = this.semtInfo.day
+                s.start = this.semtInfo.start
+            } else { //新增
+                this.semtInfo.id = this.guid()
+                this.schoolSetting.period[this.curPriodIndex].semesters.push(this._.cloneDeep(this.semtInfo))
+            }
 
+            //根据时间进行排序
+            if (this.schoolSetting.period[this.curPriodIndex].semesters.length > 1) {
+                this.schoolSetting.period[this.curPriodIndex].semesters.sort((a, b) => {
+                    if (a.month == b.month) {
+                        return a.day - b.day
+                    } else {
+                        return a.month - b.month
+                    }
+                })
+            }
+            this.countSemDays()
         },
         cancelSemester() {
             this.semtInfo = {
@@ -468,22 +506,6 @@ export default {
             }
             return true
             // 公共容器只开放了公共读权限,没有公共写的权限,所以需要将文件通过后端上传
-            //上传文件 头像上传到公共容器 “0-public” , 文件路径“header” 
-            // let blobUrl = JSON.parse(decodeURIComponent(localStorage.school_profile, "utf-8")).blob_uri
-            // let urlString = blobUrl.substring(0, blobUrl.lastIndexOf('/'))
-            // let containerName = '0-public' //公共资源目录,暂未开放上传权限
-            // console.log(blobUrl, urlString, containerName)
-            // let blob = new BlobTool(urlString, containerName, '', 'school')
-            // console.log(blob)
-            // blob.upload(file, 'header').then(
-            //     res => {
-            //         console.log(res)
-            //         this.schoolSetting.picture = res.url
-            //     },
-            //     err => {
-            //         console.log(err)
-            //     }
-            // )
         },
         success(response, file, fileList) {
             this.schoolSetting.picture = response.url
@@ -639,7 +661,7 @@ export default {
         //计算时间轴选中颜色
         timeLineColor(index) {
             let len = this.schoolSetting.period[this.curPriodIndex].semesters.length
-            let curIndex = -1
+            let curIndex = -1 //当前选中学期
             if (this.schoolSetting.period[this.curPriodIndex].semesters[this.curSemIndex].month <= (index + 1)) {
                 if (this.curSemIndex < len - 1) {
                     if (this.schoolSetting.period[this.curPriodIndex].semesters[this.curSemIndex + 1].month > (index + 1)) {
@@ -648,12 +670,19 @@ export default {
                 }
             }
             let curMonth = this.schoolSetting.period[this.curPriodIndex].semesters[this.curSemIndex].month
-            let nextMonth = -1
+            let nextMonth = -1 //下个学期的月份
             if (this.curSemIndex == len - 1) {
                 nextMonth = this.schoolSetting.period[this.curPriodIndex].semesters[0].month
             } else {
                 nextMonth = this.schoolSetting.period[this.curPriodIndex].semesters[this.curSemIndex + 1].month
             }
+            if (curMonth == nextMonth) {
+                return {
+                    color: (index + 1) == curMonth ? this.colorList[this.curSemIndex] : '#606060',
+                    text: this.schoolSetting.period[this.curPriodIndex].semesters[this.curSemIndex].name,
+                    showArrow: (index + 1) == curMonth
+                }
+            }
             if (curIndex != -1) {
                 return {
                     color: this.colorList[curIndex],
@@ -1316,6 +1345,20 @@ export default {
             } else {
                 return []
             }
+        },
+        // 设置入学期提示
+        startWarning() {
+            let flag = true
+            if (this.schoolSetting.period && this.schoolSetting.period[this.curPriodIndex].semesters) {
+                this.schoolSetting.period[this.curPriodIndex].semesters.forEach(item => {
+                    if (item.start == 1) {
+                        flag = false
+                    }
+                })
+            } else {
+                flag = false
+            }
+            return flag
         }
 
     }

+ 15 - 6
TEAMModelOS/ClientApp/src/view/student-account/ClassMgt.vue

@@ -14,10 +14,11 @@
                         <DropdownItem :name="item.id">{{ item.name }}</DropdownItem>
                     </DropdownMenu>
                 </Dropdown>
-                <Dropdown class="sort-dropdown" trigger="click" placement="bottom-start" @on-click="function(e){ filterYear = e.value }" style="margin-left:15px">
+                <Dropdown class="sort-dropdown" trigger="click" placement="bottom-start" @on-click="function(e){ filterYear = e }" style="margin-left:15px">
                     <span style="cursor: pointer;">
                         <!-- {{$t('schoolBaseInfo.pdLabel')}} -->
-                        <b class="title">{{ filterYear + '级' }}</b>
+                        <!-- <b class="title">{{ filterYear + '级' }}</b> -->
+                        <b class="title">{{ filterYear}}</b>
                         <Icon type="ios-arrow-down" style="margin-left:8px;"></Icon>
                     </span>
                     <DropdownMenu slot="list" v-for="(item,index) in years" :value="item.value" :key="index">
@@ -186,8 +187,7 @@ export default {
             }
         }
         return {
-            filterYear:'2021',
-
+            filterYear:'',
             // years:[2021,2020,2019,2018,2017,2016,2015,2014],
             studentColumn: [
                 {
@@ -329,14 +329,23 @@ export default {
                     return item.id == this.filterPeriod
                 })
                 if(pData){
-                    let year = (new Date()).getFullYear()
-                    console.log(pData)
+                    let date = new Date()
+                    let year = date.getFullYear()
+                    let month = date.getMonth() + 1
+                    let start = pData.semesters.find(item => {
+                        return item.start == 1
+                    })
+                    // 根据入学月份确定当前年级和学级的关系
+                    if (start && month < start.month) {
+                        year--
+                    }
                     let res = pData.grades.map(item=>{
                         return {
                             label:`${item.name}(${year}级)`,
                             value:year--
                         }
                     })
+                    this.filterYear = res[0].label
                     return res
                 }else{
                     return []

+ 21 - 13
TEAMModelOS/ClientApp/src/view/student-account/Index.vue

@@ -29,7 +29,7 @@
                         <Option v-for="(item, index) in periods" :value="item.id" :key="index">{{ item.name }}</Option>
                     </Select>
                     <!-- 學級Select -->
-                    <Select v-model="searchGrade" style="width: 120px; margin-left: 5px" :placeholder="$t('stuAccount.gradeHolder')" :not-found-text="$t('stuAccount.sltPdFirst')" clearable @on-change="filterData">
+                    <Select v-model="searchGrade" style="width: 150px; margin-left: 5px" :placeholder="$t('stuAccount.gradeHolder')" :not-found-text="$t('stuAccount.sltPdFirst')" clearable @on-change="filterData">
                         <Option v-for="(item, index) in years" :value="item.value" :key="index">{{ item.label }}</Option>
                     </Select>
                     <!-- 教室Select -->
@@ -165,8 +165,8 @@ export default {
             searchPeriod: '',
             searchGrade: '',
             searchClassroom: '',
-            schoolBase:{
-                period:[]
+            schoolBase: {
+                period: []
             },
             tableLoading: true,
             searchText: '',
@@ -770,22 +770,30 @@ export default {
             }
             return str
         },
-        years(){
-            if(this.schoolBase && this.schoolBase.period.length && this.searchPeriod){
-                let pData = this.schoolBase.period.find(item=>{
+        years() {
+            if (this.schoolBase && this.schoolBase.period.length && this.searchPeriod) {
+                let pData = this.schoolBase.period.find(item => {
                     return item.id == this.searchPeriod
                 })
-                if(pData){
-                    let year = (new Date()).getFullYear()
-                    console.log(pData)
-                    let res = pData.grades.map(item=>{
+                if (pData) {
+                    let date = new Date()
+                    let year = date.getFullYear()
+                    let month = date.getMonth() + 1
+                    let start = pData.semesters.find(item => {
+                        return item.start == 1
+                    })
+                    // 根据入学月份确定当前年级和学级的关系
+                    if (start && month < start.month) {
+                        year--
+                    }
+                    let res = pData.grades.map(item => {
                         return {
-                            label:`${item.name}(${year}级)`,
-                            value:year--
+                            label: `${item.name}(${year}级)`,
+                            value: year--
                         }
                     })
                     return res
-                }else{
+                } else {
                     return []
                 }
             }