lex 2 лет назад
Родитель
Сommit
b4f4e26a80
1 измененных файлов с 4 добавлено и 3 удалено
  1. 4 3
      src/school/orchestra/create-orchestra/index.tsx

+ 4 - 3
src/school/orchestra/create-orchestra/index.tsx

@@ -69,9 +69,10 @@ export default defineComponent({
     const onSelectSubject = (ids: any) => {
       state.selectSubjectIds = [...ids]
       const temps: any = []
+      console.log(state.selectSubjects, '1212', state.subjectList)
       state.subjectList.forEach((item: any) => {
-        const index = state.selectSubjects.findIndex((select: any) => select.id === item.id)
-        if (ids.includes(item.id)) {
+        const index = state.selectSubjects.findIndex((select: any) => select.id === item.subjectId)
+        if (ids.includes(item.subjectId)) {
           // 判断是否在数据里,如果在则直接添加,不能重置数据
           if (index < 0) {
             temps.push({
@@ -83,7 +84,7 @@ export default defineComponent({
               students: [] as any // 选中的数据数
             })
           } else {
-            temps.push(state.selectSubjects.find((select: any) => select.id === item.id))
+            temps.push(state.selectSubjects.find((select: any) => select.id === item.subjectId))
           }
         }
       })