|
@@ -504,46 +504,50 @@ export default defineComponent({
|
|
|
for (let index = 0; index < instrumentEle.length; index++) {
|
|
|
const note = instrumentEle[index]
|
|
|
let instrumentCode = note.getElementsByTagName('virtual-name')?.[0]?.textContent || ''
|
|
|
- instrumentCode = instrumentCode.toLocaleLowerCase().trim()
|
|
|
+ instrumentCode = instrumentCode.trim().toLocaleLowerCase()
|
|
|
if (instrumentCode && !instrumentCodeList.includes(instrumentCode)) {
|
|
|
instrumentCodeList.push(instrumentCode)
|
|
|
}
|
|
|
}
|
|
|
// 乐器支持多编码,暂不开放
|
|
|
- // 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>()
|
|
|
+ const codeIdMap = new Map<string, []>() as any
|
|
|
state.instrumentData.forEach((data: any) => {
|
|
|
if (!data.disabled) {
|
|
|
- codeIdMap.set(data.code.toLocaleLowerCase().trim(), data.id + '')
|
|
|
+ const codes = data.code.split(/[,,]/)
|
|
|
+ codes.forEach((code: string) => {
|
|
|
+ let codeTemp = code.trim().toLowerCase()
|
|
|
+ if (codeIdMap.has(codeTemp)) {
|
|
|
+ codeIdMap.get(codeTemp).push(data.id + '')
|
|
|
+ } else {
|
|
|
+ const arr = [] as any;
|
|
|
+ arr.push(data.id + '')
|
|
|
+ codeIdMap.set(codeTemp, arr)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
forms.musicalInstrumentIdList = []
|
|
|
instrumentCodeList.forEach((code: string) => {
|
|
|
if (codeIdMap.has(code)) {
|
|
|
- forms.musicalInstrumentIdList.push(codeIdMap.get(code))
|
|
|
+ codeIdMap.get(code).forEach((c: any) => {
|
|
|
+ if (!forms.musicalInstrumentIdList.includes(c)) {
|
|
|
+ forms.musicalInstrumentIdList.push(c)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
+ // const codeIdMap = new Map<string, string>()
|
|
|
+ // state.instrumentData.forEach((data: any) => {
|
|
|
+ // if (!data.disabled) {
|
|
|
+ // codeIdMap.set(data.code.toLocaleLowerCase().trim(), data.id + '')
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // forms.musicalInstrumentIdList = []
|
|
|
+ // instrumentCodeList.forEach((code: string) => {
|
|
|
+ // if (codeIdMap.has(code)) {
|
|
|
+ // forms.musicalInstrumentIdList.push(codeIdMap.get(code))
|
|
|
+ // }
|
|
|
+ // })
|
|
|
|
|
|
// 声部
|
|
|
if (forms.musicalInstrumentIdList.length > 0) {
|