Browse Source

乐器添加多声轨支持,暂时不上

yuanliang 1 year ago
parent
commit
192a8ad067
1 changed files with 26 additions and 15 deletions
  1. 26 15
      src/views/music-library/music-sheet/modal/music-operation.tsx

+ 26 - 15
src/views/music-library/music-sheet/modal/music-operation.tsx

@@ -463,26 +463,37 @@ export default defineComponent({
           instrumentCodeList.push(instrumentCode)
         }
       }
-      const codeIdMap = new Map<string, []>() as any
+      // 乐器支持多编码,暂不开放
+      // const codeIdMap = new Map<string, []>() as any
+      // state.instrumentData.forEach((data: any) => {
+      //   const codes = data.code.split(/,|,/)
+      //   codes.forEach((code: string) => {
+      //     if (codeIdMap.has(code)) {
+      //       codeIdMap.get(code).push(data.id + '')
+      //     } else {
+      //       const arr = [] as any;
+      //       arr.push(data.id + '')
+      //       codeIdMap.set(code, arr)
+      //     }
+      //     // codeIdMap.set(code, data.id + '')
+      //   })
+      // })
+      // forms.musicalInstrumentIdList = []
+      // instrumentCodeList.forEach((code: string) => {
+      //   if (codeIdMap.has(code)) {
+      //     codeIdMap.get(code).forEach((c: any) => {
+      //       forms.musicalInstrumentIdList.push(c)
+      //     })
+      //   }
+      // })
+      const codeIdMap = new Map<string, string>()
       state.instrumentData.forEach((data: any) => {
-        const codes = data.code.split(/,|,/)
-        codes.forEach((code: string) => {
-          if (codeIdMap.has(code)) {
-            codeIdMap.get(code).push(data.id + '')
-          } else {
-            const arr = [] as any;
-            arr.push(data.id + '')
-            codeIdMap.set(code, arr)
-          }
-          // codeIdMap.set(code, data.id + '')
-        })
+        codeIdMap.set(data.code, data.id + '')
       })
       forms.musicalInstrumentIdList = []
       instrumentCodeList.forEach((code: string) => {
         if (codeIdMap.has(code)) {
-          codeIdMap.get(code).forEach((c: any) => {
-            forms.musicalInstrumentIdList.push(c)
-          })
+          forms.musicalInstrumentIdList.push(codeIdMap.get(code))
         }
       })