Jelajahi Sumber

學生管理-新建學生的教室選項新增篩選

close #323
osbert 4 tahun lalu
induk
melakukan
4385e85398

+ 43 - 2
TEAMModelOS/ClientApp/src/view/student-account/AddStudent.vue

@@ -87,10 +87,25 @@
             <FormItem :label="$t('stuAccount.stuName')" prop="name">
                 <Input v-model="studentInfo.name" :placeholder="$t('stuAccount.stuNameHolder')"></Input>
             </FormItem>
+            <!-- 學制、學級 -->
+            <div style="display:flex;justify-content: space-between;">
+                <!-- 學制 -->
+                <FormItem :label="$t('學制')" style="width:45%">
+                    <Select v-model="searchPeriod" style="width: 100%;" :placeholder="$t('stuAccount.periodHolder')" clearable >
+                        <Option v-for="(item, index) in periods" :value="item.id" :key="index">{{ item.name }}</Option>
+                    </Select>
+                </FormItem>
+                <!-- 學級 -->
+                <FormItem :label="$t('學級')" style="width:45%">
+                    <Select v-model="searchGrade" style="width: 100%; margin-left: 5px" :placeholder="$t('stuAccount.gradeHolder')" not-found-text="请先选择学段" clearable>
+                        <Option v-for="(item, index) in filterGrades" :value="item.id" :key="index">{{ item.name }}</Option>
+                    </Select>
+                </FormItem>
+            </div>
             <!-- 教室資訊 -->
             <FormItem :label="$t('stuAccount.classroomInfo')" prop="classId">
                 <Select filterable style="width:100%" :placeholder="$t('stuAccount.classroomInfoHolder')" v-model="studentInfo.classId" clearable>
-                    <Option v-for="(item,index) in classes.filter((item)=>{ return item.openType == '1'})" :value="item.id" :key="index" @click.native="setCurrentClassDetail(item)">{{ item.name }}</Option>
+                    <Option v-for="(item,index) in filterClasses" :value="item.id" :key="index" @click.native="setCurrentClassDetail(item)">{{ item.name }}</Option>
                 </Select>
                 <span style="float:right;color:#6DE2C4;cursor:pointer;text-decoration:underline;font-size:12px;" @click="createClassroom">{{$t('stuAccount.newClassroom')}}</span>
             </FormItem>
@@ -246,7 +261,9 @@
                         { validator: validateclassId, trigger: 'blur' },
                     ]
                 },
-                modal_loading: false
+                modal_loading: false,
+                searchPeriod: '',
+                searchGrade: ''
             }
         },
         computed: {
@@ -256,6 +273,30 @@
                 classes: 'user/getClasses', // 教室ID,
                 students: 'schoolBaseInfo/getStudent', // 學生List
             }),
+            filterGrades: function() {
+                var data = this.grades
+                if (this.searchPeriod) {
+                    let periodId = this.searchPeriod
+                    data = data.filter(function(item) {
+                        return item.periodId == periodId
+                    })
+                    return data
+                } else {
+                    return []
+                }
+            },
+            filterClasses: function() {
+                var data = this.classes
+                if (this.searchGrade) {
+                    let gradeId = this.searchGrade
+                    data = data.filter(function(item) {
+                        return item.gradeId == gradeId && item.openType == '1'
+                    })
+                    return data
+                } else {
+                    return []
+                }
+            },
             show: {
                 get() {
                     // if (this.bizType == 2 && this.isShow == true) {