lex 1 年之前
父节点
当前提交
58654d51b9
共有 2 个文件被更改,包括 116 次插入8 次删除
  1. 1 1
      src/views/home/index.tsx
  2. 115 7
      src/views/studentList/index.tsx

+ 1 - 1
src/views/home/index.tsx

@@ -279,7 +279,7 @@ export default defineComponent({
           v-model:show={forms.subjectSyncVisiable}
           preset="card"
           class={['modalTitle background', styles.subjectSyncModal]}
-          title={'请选择乐器'}>
+          title={'请选择声部'}>
           <SubjectModal
             onClose={() => (forms.subjectSyncVisiable = false)}
             onConfirm={async (item: any) => {

+ 115 - 7
src/views/studentList/index.tsx

@@ -26,6 +26,8 @@ import TheEmpty from '/src/components/TheEmpty';
 import { useUserStore } from '/src/store/modules/users';
 import UpdateStudent from './modals/update-student';
 import { initCache, setCache } from '/src/hooks/use-async';
+import { classArray, getgradeNumList } from '../classList/contants';
+import { getGradeLevelList, getGradeYearList } from '../home/api';
 export default defineComponent({
   name: 'student-studentList',
   setup(props, { emit }) {
@@ -35,8 +37,13 @@ export default defineComponent({
         keyword: '',
         gender: '' as any,
         classGroupId: '' as any,
-        membership: '' as any
+        membership: '' as any,
+        currentClass: '' as any,
+        currentGradeNum: '' as any,
+        gradeYear: '' as any,
+        gradeLevel: ''
       },
+      gradeNumList: [] as any,
       searchWord: '',
       orchestraType: null,
       courseTypeCode: null,
@@ -53,8 +60,11 @@ export default defineComponent({
       classList: [],
       addStudentVisible: false,
       editStatus: false,
-      activeRow: {} as any
+      activeRow: {} as any,
+      popSelectYearList: [] as any,
+      popSelectLevelList: [] as any
     });
+    state.gradeNumList = getgradeNumList();
     const route = useRoute();
     const router = useRouter();
     const showGuide = ref(false);
@@ -93,8 +103,15 @@ export default defineComponent({
         keyword: '',
         gender: '' as any,
         classGroupId: '' as any,
-        membership: '' as any
+        membership: '' as any,
+        currentClass: '' as any,
+        currentGradeNum: '' as any,
+        gradeYear: '' as any,
+        gradeLevel: ''
       };
+      if (state.popSelectYearList.length > 0) {
+        state.searchForm.gradeYear = state.popSelectYearList[1].id;
+      }
       search();
       setCache({ current: state.searchForm, saveKey: route.path });
     };
@@ -124,9 +141,54 @@ export default defineComponent({
       console.log('getList');
     };
 
-    onMounted(() => {
-      getList();
-      getClasslist();
+    // 获取学年
+    const getYearList = async () => {
+      try {
+        const { data } = await getGradeYearList();
+        const temp = data || [];
+        temp.forEach((i: any) => {
+          i.name = i.name + '学年';
+        });
+        temp.unshift({
+          id: '',
+          name: '全部学年'
+        });
+        state.popSelectYearList = temp || [];
+        if (temp.length > 0 && !state.searchForm.gradeYear) {
+          state.searchForm.gradeYear = temp[1].id;
+        }
+      } catch {
+        //
+      }
+    };
+    // 获取学级
+    const getLevelList = async () => {
+      try {
+        const { data } = await getGradeLevelList();
+        const temp = data || [];
+        temp.forEach((i: any) => {
+          i.name = i.name + '级';
+        });
+        temp.unshift({
+          id: '',
+          name: '全部学级'
+        });
+        state.popSelectLevelList = temp || [];
+        if (temp.length > 0 && !state.searchForm.gradeLevel) {
+          state.searchForm.gradeLevel = temp[0].id;
+        }
+      } catch {
+        //
+      }
+    };
+
+    onMounted(async () => {
+      state.loading = true;
+      await getYearList();
+      await getLevelList();
+      await getList();
+      await getClasslist();
+      state.loading = false;
     });
     const columns = () => {
       return [
@@ -247,6 +309,7 @@ export default defineComponent({
               <SearchInput
                 {...{ placeholder: '请输入学生姓名' }}
                 class={styles.searchInput}
+                style={{ width: '160px' }}
                 searchWord={state.searchForm.keyword}
                 onChangeValue={(val: string) =>
                   (state.searchForm.keyword = val)
@@ -279,6 +342,51 @@ export default defineComponent({
             <NFormItem>
               <CSelect
                 {...({
+                  options: state.popSelectYearList,
+                  placeholder: '选择学年',
+                  clearable: true,
+                  inline: true,
+                  labelField: 'name',
+                  valueField: 'id'
+                } as any)}
+                v-model:value={state.searchForm.gradeYear}></CSelect>
+            </NFormItem>
+            <NFormItem>
+              <CSelect
+                {...({
+                  options: state.popSelectLevelList,
+                  placeholder: '选择学级',
+                  clearable: true,
+                  inline: true,
+                  labelField: 'name',
+                  valueField: 'id'
+                } as any)}
+                v-model:value={state.searchForm.gradeLevel}></CSelect>
+            </NFormItem>
+
+            <NFormItem>
+              <CSelect
+                {...({
+                  options: state.gradeNumList,
+                  placeholder: '选择年级',
+                  clearable: true,
+                  inline: true
+                } as any)}
+                v-model:value={state.searchForm.currentGradeNum}></CSelect>
+            </NFormItem>
+            <NFormItem>
+              <CSelect
+                {...({
+                  options: classArray,
+                  placeholder: '选择班级',
+                  clearable: true,
+                  inline: true
+                } as any)}
+                v-model:value={state.searchForm.currentClass}></CSelect>
+            </NFormItem>
+            {/* <NFormItem>
+              <CSelect
+                {...({
                   options: [
                     { label: '全部年级班级', value: '' },
                     ...state.classList
@@ -288,7 +396,7 @@ export default defineComponent({
                   inline: true
                 } as any)}
                 v-model:value={state.searchForm.classGroupId}></CSelect>
-            </NFormItem>
+            </NFormItem> */}
             <NFormItem>
               <CSelect
                 {...({