Browse Source

修改问题

lex 1 year ago
parent
commit
16f8af1450

+ 1 - 1
public/version.json

@@ -1 +1 @@
-{"version":1714284936219}
+{"version":1714296618537}

+ 2 - 2
src/views/homework-record/index.tsx

@@ -101,7 +101,7 @@ export default defineComponent({
         selfFlag: true
       };
       if (state.popSelectYearList.length > 0) {
-        state.searchForm.gradeYear = state.popSelectYearList[1].id;
+        state.searchForm.gradeYear = state.popSelectYearList[2].id;
       }
       //
       setCache({ current: state.searchForm, saveKey: route.path });
@@ -197,7 +197,7 @@ export default defineComponent({
         });
         state.popSelectYearList = temp || [];
         if (temp.length > 0 && !state.searchForm.gradeYear) {
-          state.searchForm.gradeYear = temp[1].id;
+          state.searchForm.gradeYear = temp[2].id;
         }
       } catch {
         //

+ 15 - 2
src/views/prepare-lessons/components/lesson-main/train/assign-homework.tsx

@@ -21,6 +21,7 @@ import { usePrepareStore } from '/src/store/modules/prepareLessons';
 import AssignStudent from './assign-student';
 import { state } from '/src/state';
 import { nextTick } from 'process';
+import { api_getCurrentGradeYear } from '/src/views/studentList/api';
 
 export default defineComponent({
   name: 'assign-homework',
@@ -57,6 +58,7 @@ export default defineComponent({
     const message = useMessage();
     const prepareStore = usePrepareStore();
     const forms = reactive({
+      gradeYear: '' as any,
       currentTime: dayjs(dayjs().format('YYYY-MM-DD')).valueOf(),
       homeworkObj: 'CLASS' as 'PERSON' | 'CLASS',
       homeworkType: props.homeworkType,
@@ -82,7 +84,8 @@ export default defineComponent({
         const defaultSelectClassGroupId =
           props.classGroupId || prepareStore.getClassGroupId;
         const { data } = await classGroupList({
-          upgradeFlag: true
+          upgradeFlag: true,
+          gradeYear: forms.gradeYear
         });
         const cList = data || [];
         const gradeList: any = [];
@@ -137,7 +140,7 @@ export default defineComponent({
         }
         forms.uploading = true;
         try {
-          const trainList = props.item.lessonPreTrainingDetails || [];
+          const trainList: any = props.item.lessonPreTrainingDetails || [];
           const details: any[] = [];
           trainList.forEach((item: any) => {
             details.push({
@@ -177,8 +180,18 @@ export default defineComponent({
         forms.uploading = false;
       });
     };
+    const getCurrentGradeYear = async () => {
+      try {
+        const { data } = await api_getCurrentGradeYear({});
+        console.log(data);
+        forms.gradeYear = data;
+      } catch {
+        //
+      }
+    };
 
     onMounted(async () => {
+      await getCurrentGradeYear();
       await getClassGroupList();
     });
     return () => (

+ 1 - 1
src/views/prepare-lessons/components/lesson-main/train/assign-student/index.module.less

@@ -19,7 +19,7 @@
     margin-bottom: 13px;
 
     :global {
-      .n-select+.n-select {
+      .n-select+.n-cascader {
         margin-left: 13px;
       }
     }

+ 33 - 12
src/views/prepare-lessons/components/lesson-main/train/assign-student/index.tsx

@@ -3,6 +3,7 @@ import styles from './index.module.less';
 import {
   NAvatar,
   NButton,
+  NCascader,
   NCheckbox,
   NCheckboxGroup,
   NInput,
@@ -18,6 +19,7 @@ import { getStudentList } from '/src/views/classList/api';
 import { useThrottleFn } from '@vueuse/core';
 import TheEmpty from '/src/components/TheEmpty';
 import { getGradeYearList } from '/src/views/home/api';
+import { api_getCurrentGradeYear } from '/src/views/studentList/api';
 
 export default defineComponent({
   name: 'assign-student',
@@ -78,15 +80,17 @@ export default defineComponent({
     // 获取学年
     const getYearList = async () => {
       try {
-        const { data } = await getGradeYearList();
-        const temp = data || [];
-        temp.forEach((i: any) => {
-          i.name = i.name + '学年';
-        });
-        state.popSelectYearList = temp || [];
-        if (temp.length > 0 && !state.searchFrom.gradeYear) {
-          state.searchFrom.gradeYear = temp[0].id;
-        }
+        const { data } = await api_getCurrentGradeYear({});
+        state.searchFrom.gradeYear = data;
+        // const { data } = await getGradeYearList();
+        // const temp = data || [];
+        // temp.forEach((i: any) => {
+        //   i.name = i.name + '学年';
+        // });
+        // state.popSelectYearList = temp || [];
+        // if (temp.length > 0 && !state.searchFrom.gradeYear) {
+        //   state.searchFrom.gradeYear = temp[0].id;
+        // }
       } catch {
         //
       }
@@ -220,14 +224,31 @@ export default defineComponent({
                   [{ label: '全部班级', value: '' }, ...props.classList] as any
                 }
               />
-              <NSelect
+              {/* <NSelect
+                options={[
+                  { label: '全部乐器', value: '' },
+                  ...catchStore.getEnableSubjects
+                ]}
+                placeholder="全部乐器"
+                v-model:value={state.searchFrom.subjectId}
+                onUpdate:value={() => onSearch()}
+              /> */}
+              <NCascader
                 options={[
-                  { label: '全部声部', value: '' },
+                  { name: '全部乐器', id: '' },
                   ...catchStore.getSubjectList
                 ]}
-                placeholder="全部声部"
+                placeholder="全部乐器"
                 v-model:value={state.searchFrom.subjectId}
                 onUpdate:value={() => onSearch()}
+                checkStrategy="child"
+                showPath
+                childrenField="instruments"
+                expandTrigger="hover"
+                labelField="name"
+                valueField="id"
+                clearable
+                filterable
               />
             </div>
             <SearchInput

+ 3 - 2
src/views/studentList/studentDetail.tsx

@@ -35,6 +35,7 @@ export default defineComponent({
         nickname: '',
         gender: null,
         subjectNames: '',
+        classInstrumentName: '',
         classGroupName: ''
       }
     });
@@ -104,8 +105,8 @@ export default defineComponent({
               </h4>
               <p>
                 {state.studentInfo.classGroupName}{' '}
-                {state.studentInfo.subjectNames
-                  ? '| ' + state.studentInfo.subjectNames
+                {state.studentInfo.classInstrumentName
+                  ? '| ' + state.studentInfo.classInstrumentName
                   : ' '}
               </p>
             </div>

+ 16 - 1
src/views/xiaoku-ai/index.tsx

@@ -28,7 +28,7 @@ export default defineComponent({
       tagChildren: [] as any[],
       tagActiveId: xiaokuAi.tagActiveId || '',
       tagActive: {} as any,
-      tagIndex: 0,
+      tagIndex: xiaokuAi.instrumentId || 0,
       list: [] as any,
       loading: false
     });
@@ -108,6 +108,21 @@ export default defineComponent({
             musicTagIds: forms.musicTagIds
           })
         );
+        if (forms.instrumentId) {
+          let childInstruments: any[] = [];
+          catchStore.getSubjectInstruments.forEach((item: any) => {
+            if (Array.isArray(item.instruments)) {
+              item.instruments.forEach((child: any) => {
+                if (forms.instrumentId === child.value) {
+                  childInstruments = item.instruments || [];
+                }
+              });
+            }
+          });
+          if (childInstruments.length > 0) {
+            selectChildObj(childInstruments);
+          }
+        }
       } catch {
         //
       }