yuanliang vor 1 Jahr
Ursprung
Commit
3d9d0b9adf
1 geänderte Dateien mit 32 neuen und 24 gelöschten Zeilen
  1. 32 24
      src/views/music-library/music-sheet/modal/music-operationV2.tsx

+ 32 - 24
src/views/music-library/music-sheet/modal/music-operationV2.tsx

@@ -789,7 +789,6 @@ export default defineComponent({
         try {
           const {data} = await musicalInstrumentPage({page: 1, rows: 999})
           const tempList = data.rows || []
-          state.instrumentData = tempList
           tempList.forEach((item: any) => {
             item.label = item.name
             item.value = item.id + ''
@@ -805,7 +804,8 @@ export default defineComponent({
               'audioPlayType': 'PLAY'
             });
           })
-          state.instrumentList = tempList
+          state.instrumentData = tempList
+          // state.instrumentList = tempList
         } catch {
         }
       }
@@ -986,9 +986,9 @@ export default defineComponent({
         state.subjectList = state.subjectList.filter((next: any) => {
           return next.enableFlag == true
         })
-        state.instrumentList = state.instrumentList.filter((next: any) => {
-          return next.enableFlag == true
-        })
+        // state.instrumentList = state.instrumentList.filter((next: any) => {
+        //   return next.enableFlag == true
+        // })
       }
       state.loading = false
     })
@@ -1362,21 +1362,29 @@ export default defineComponent({
                           maxTagCount={2}
                           onUpdateValue={async (val: any) => {
                             state.instrumentList = []
-                            let tempMusicalInstrumentIdList = [] as any
-                            const {data} = await musicalInstrumentPage({page: 1, rows: 999, subjectIds: val});
-                            data.rows.map((item: any) => {
-                              tempMusicalInstrumentIdList.push(item.id + '')
-                              state.instrumentList.push(
-                                  {
-                                    label: item.name,
-                                    value: item.id + '',
-                                    disabled: !item.enableFlag
-                                  }
-                              )
-                            })
-                            forms.musicalInstrumentIdList = forms.musicalInstrumentIdList.filter((item: any) => {
-                              return tempMusicalInstrumentIdList.includes(item)
-                            })
+                            if (val.length == 0) {
+                              forms.musicalInstrumentIdList = []
+                            } else {
+                              let tempMusicalInstrumentIdList = [] as any
+                              let enableFlag = null;
+                              if(props.type === 'add'){
+                                enableFlag = true;
+                              }
+                              const {data} = await musicalInstrumentPage({page: 1, rows: 999, subjectIds: val, enableFlag: enableFlag});
+                              data.rows.map((item: any) => {
+                                tempMusicalInstrumentIdList.push(item.id + '')
+                                state.instrumentList.push(
+                                    {
+                                      label: item.name,
+                                      value: item.id + '',
+                                      disabled: !item.enableFlag
+                                    }
+                                )
+                              })
+                              forms.musicalInstrumentIdList = forms.musicalInstrumentIdList.filter((item: any) => {
+                                return tempMusicalInstrumentIdList.includes(item)
+                              })
+                            }
                           }}
                       />
                     </NFormItemGi>
@@ -1818,8 +1826,8 @@ export default defineComponent({
               {forms.musicSheetType == 'SINGLE' && forms.playMode === 'MP3' && !forms.isAllSubject && forms.musicSheetSoundList_YZ.map((item: any, index: any) => {
                 return (
                     <>
-                      <NGrid cols={1}>
-                        {forms.musicalInstrumentIdList.includes(item.musicalInstrumentId) && (
+                      {forms.musicalInstrumentIdList.includes(item.musicalInstrumentId) && (
+                          <NGrid class={styles.audioSection}>
                             <NFormItemGi
                                 span={12}
                                 label={item.musicalInstrumentName}
@@ -1843,8 +1851,8 @@ export default defineComponent({
                                   bucketName="cloud-coach"
                               />
                             </NFormItemGi>
-                        )}
-                      </NGrid>
+                          </NGrid>
+                      )}
                     </>
                 )
               })