|  | @@ -1,15 +1,18 @@
 | 
	
		
			
				|  |  | -import type { SelectOption } from 'naive-ui'
 | 
	
		
			
				|  |  | +import type {SelectOption} from 'naive-ui'
 | 
	
		
			
				|  |  |  import {
 | 
	
		
			
				|  |  |    NAlert,
 | 
	
		
			
				|  |  |    NButton,
 | 
	
		
			
				|  |  |    NCascader,
 | 
	
		
			
				|  |  |    NCheckbox,
 | 
	
		
			
				|  |  |    NCheckboxGroup,
 | 
	
		
			
				|  |  | -  NForm, NFormItem,
 | 
	
		
			
				|  |  | +  NForm,
 | 
	
		
			
				|  |  | +  NFormItem,
 | 
	
		
			
				|  |  |    NFormItemGi,
 | 
	
		
			
				|  |  |    NGi,
 | 
	
		
			
				|  |  |    NGrid,
 | 
	
		
			
				|  |  | -  NInput, NInputGroup, NInputGroupLabel,
 | 
	
		
			
				|  |  | +  NInput,
 | 
	
		
			
				|  |  | +  NInputGroup,
 | 
	
		
			
				|  |  | +  NInputGroupLabel,
 | 
	
		
			
				|  |  |    NInputNumber,
 | 
	
		
			
				|  |  |    NModal,
 | 
	
		
			
				|  |  |    NRadio,
 | 
	
	
		
			
				|  | @@ -20,20 +23,21 @@ import {
 | 
	
		
			
				|  |  |    useDialog,
 | 
	
		
			
				|  |  |    useMessage
 | 
	
		
			
				|  |  |  } from 'naive-ui'
 | 
	
		
			
				|  |  | -import { defineComponent, onMounted, PropType, reactive, ref } from 'vue'
 | 
	
		
			
				|  |  | -import { musicSheetCategoriesQueryTree, musicSheetDetail, musicSheetSave } from '../../api'
 | 
	
		
			
				|  |  | +import {defineComponent, nextTick, onMounted, PropType, reactive, ref} from 'vue'
 | 
	
		
			
				|  |  | +import {musicSheetCategoriesQueryTree, musicSheetDetail, musicSheetSave} from '../../api'
 | 
	
		
			
				|  |  |  import UploadFile from '@/components/upload-file'
 | 
	
		
			
				|  |  |  import styles from './index.module.less'
 | 
	
		
			
				|  |  |  import deepClone from '@/utils/deep.clone'
 | 
	
		
			
				|  |  |  import axios from 'axios'
 | 
	
		
			
				|  |  | -import { appKey, clientType, musicSheetSourceType, musicSheetType } from '@/utils/constant'
 | 
	
		
			
				|  |  | -import { getMapValueByKey, getSelectDataFromObj } from '@/utils/objectUtil'
 | 
	
		
			
				|  |  | -import { musicalInstrumentPage } from '@views/system-manage/subject-manage/api'
 | 
	
		
			
				|  |  | -import { subjectPage } from '@views/system-manage/api'
 | 
	
		
			
				|  |  | +import {appKey, clientType, musicSheetSourceType, musicSheetType} from '@/utils/constant'
 | 
	
		
			
				|  |  | +import {getMapValueByKey, getSelectDataFromObj} from '@/utils/objectUtil'
 | 
	
		
			
				|  |  | +import {musicalInstrumentPage} from '@views/system-manage/subject-manage/api'
 | 
	
		
			
				|  |  | +import {subjectPage} from '@views/system-manage/api'
 | 
	
		
			
				|  |  |  import MusicSheetOwnerDialog from '@views/music-library/music-sheet/modal/musicSheetOwnerDialog'
 | 
	
		
			
				|  |  | -import { sysApplicationPage } from '@views/menu-manage/api'
 | 
	
		
			
				|  |  | -import { filterPointCategory } from '@views/teaching-manage/unit-test'
 | 
	
		
			
				|  |  | +import {sysApplicationPage} from '@views/menu-manage/api'
 | 
	
		
			
				|  |  | +import {filterPointCategory} from '@views/teaching-manage/unit-test'
 | 
	
		
			
				|  |  |  import MusicCreateImg from './music-create-img'
 | 
	
		
			
				|  |  | +import {onUpdated} from "vue-demi";
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /**
 | 
	
		
			
				|  |  |   * 获取指定元素下一个Note元素
 | 
	
	
		
			
				|  | @@ -437,6 +441,15 @@ export default defineComponent({
 | 
	
		
			
				|  |  |        xmlRead.readAsText(file)
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    const containOther = (track:any)=>{
 | 
	
		
			
				|  |  | +      for (let i = 0; i < state.partListNames.length; i++) {
 | 
	
		
			
				|  |  | +        if(state.partListNames[i].value == track){
 | 
	
		
			
				|  |  | +          return true
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      return false;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      const parseInstrumentAndSubject = (xml: any) => {
 | 
	
		
			
				|  |  |        if (!xml) return
 | 
	
		
			
				|  |  |        const xmlParse = new DOMParser().parseFromString(xml, 'text/xml')
 | 
	
	
		
			
				|  | @@ -505,15 +518,23 @@ export default defineComponent({
 | 
	
		
			
				|  |  |        //   (n: any) => n.value?.toLocaleUpperCase?.() != 'COMMON'
 | 
	
		
			
				|  |  |        // )
 | 
	
		
			
				|  |  |        const partListNames = deepClone(state.partListNames) || []
 | 
	
		
			
				|  |  | +      const multiTracksSelection = forms.multiTracksSelection;
 | 
	
		
			
				|  |  |        partListNames.forEach((item: any) => {
 | 
	
		
			
				|  |  | -        const index = forms.musicSheetSoundList.findIndex(
 | 
	
		
			
				|  |  | -          (ground: any) => item.value == ground.track
 | 
	
		
			
				|  |  | -        )
 | 
	
		
			
				|  |  | -        if (index > -1 && track == item.value) {
 | 
	
		
			
				|  |  | -          item.disabled = false
 | 
	
		
			
				|  |  | -        } else {
 | 
	
		
			
				|  |  | +        if (multiTracksSelection.includes(item.value)) {
 | 
	
		
			
				|  |  |            item.disabled = true
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +          item.disabled = false
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        // const index = forms.musicSheetSoundList.findIndex(
 | 
	
		
			
				|  |  | +        //   (ground: any) => item.value == ground.track
 | 
	
		
			
				|  |  | +        // )
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        // if (index > -1 && track == item.value) {
 | 
	
		
			
				|  |  | +        //   item.disabled = false
 | 
	
		
			
				|  |  | +        // } else {
 | 
	
		
			
				|  |  | +        //   item.disabled = true
 | 
	
		
			
				|  |  | +        // }
 | 
	
		
			
				|  |  |        })
 | 
	
		
			
				|  |  |        return partListNames || []
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -697,7 +718,7 @@ export default defineComponent({
 | 
	
		
			
				|  |  |                }
 | 
	
		
			
				|  |  |              })
 | 
	
		
			
				|  |  |            }
 | 
	
		
			
				|  |  | -          forms.musicalInstrumentIdList = data.musicalInstrumentIds?.split(',') || []
 | 
	
		
			
				|  |  | +          forms.musicalInstrumentIdList = data.musicalInstrumentIds ? data.musicalInstrumentIds.split(',') : []
 | 
	
		
			
				|  |  |            forms.musicCategoryId = data.musicCategoryId
 | 
	
		
			
				|  |  |            data.musicSheetAccompanimentList?.forEach((next: any) => {
 | 
	
		
			
				|  |  |              state.musicSheetAccompanimentUrlList.push(next.audioFileUrl)
 | 
	
	
		
			
				|  | @@ -724,9 +745,10 @@ export default defineComponent({
 | 
	
		
			
				|  |  |                state.partListNames = getPartListNames(res?.data as any) as any
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                // 初始化音轨和原音
 | 
	
		
			
				|  |  | -              forms.multiTracksSelection = data.multiTracksSelection?.split(',') || []
 | 
	
		
			
				|  |  | +              forms.multiTracksSelection = data.multiTracksSelection ? data.multiTracksSelection.split(',') : []
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                const existSoundList = data.musicSheetSoundList || []
 | 
	
		
			
				|  |  | +              const tracks = [] as any
 | 
	
		
			
				|  |  |                state.partListNames.forEach((item: any) => {
 | 
	
		
			
				|  |  |                  let audioFileUrl
 | 
	
		
			
				|  |  |                  existSoundList.forEach((next: any) => {
 | 
	
	
		
			
				|  | @@ -734,9 +756,22 @@ export default defineComponent({
 | 
	
		
			
				|  |  |                      audioFileUrl = next.audioFileUrl
 | 
	
		
			
				|  |  |                    }
 | 
	
		
			
				|  |  |                  })
 | 
	
		
			
				|  |  | +                if (audioFileUrl) {
 | 
	
		
			
				|  |  | +                  forms.musicSheetSoundList.push({
 | 
	
		
			
				|  |  | +                    audioFileUrl: audioFileUrl, // 原音
 | 
	
		
			
				|  |  | +                    track: item.value // 轨道
 | 
	
		
			
				|  |  | +                  })
 | 
	
		
			
				|  |  | +                  tracks.push(item.value)
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +              })
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +              // 处理没有声轨,但有原音
 | 
	
		
			
				|  |  | +              existSoundList.filter((next: any) => {
 | 
	
		
			
				|  |  | +                return !tracks.includes(next.track)
 | 
	
		
			
				|  |  | +              }).forEach((next: any) => {
 | 
	
		
			
				|  |  |                  forms.musicSheetSoundList.push({
 | 
	
		
			
				|  |  | -                  audioFileUrl: audioFileUrl, // 原音
 | 
	
		
			
				|  |  | -                  track: item.value // 轨道
 | 
	
		
			
				|  |  | +                  audioFileUrl: next.audioFileUrl, // 原音
 | 
	
		
			
				|  |  | +                  track: next.track ? next.track : null // 轨道
 | 
	
		
			
				|  |  |                  })
 | 
	
		
			
				|  |  |                })
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -1395,72 +1430,92 @@ export default defineComponent({
 | 
	
		
			
				|  |  |              {/* 只有播放类型为mp3时才会有原音 */}
 | 
	
		
			
				|  |  |              {forms.playMode === 'MP3' && forms.musicSheetSoundList.length > 0 && (
 | 
	
		
			
				|  |  |                <>
 | 
	
		
			
				|  |  | -                {forms.musicSheetSoundList.map((item: any, index: number) => (
 | 
	
		
			
				|  |  | -                  <>
 | 
	
		
			
				|  |  | -                    {((!item.track)||(item.track?.toLocaleUpperCase?.() != 'COMMON' && forms.multiTracksSelection.indexOf(item.track) > -1))
 | 
	
		
			
				|  |  | -                        && (
 | 
	
		
			
				|  |  | -                            <NGrid
 | 
	
		
			
				|  |  | -                                class={styles.audioSection}
 | 
	
		
			
				|  |  | -                                // v-show={forms.multiTracksSelection.indexOf(item.track) > -1}
 | 
	
		
			
				|  |  | -                            >
 | 
	
		
			
				|  |  | -                              <NFormItemGi
 | 
	
		
			
				|  |  | -                                  span={12}
 | 
	
		
			
				|  |  | -                                  label="原音"
 | 
	
		
			
				|  |  | -                                  path={`musicSheetSoundList[${index}].audioFileUrl`}
 | 
	
		
			
				|  |  | -                                  rule={[
 | 
	
		
			
				|  |  | -                                    {
 | 
	
		
			
				|  |  | -                                      // required: forms.multiTracksSelection.indexOf(forms.musicSheetSoundList[index].audioFileUrl) > -1,
 | 
	
		
			
				|  |  | -                                      required: true,
 | 
	
		
			
				|  |  | -                                      message: `请上传${
 | 
	
		
			
				|  |  | -                                          item.track ? item.track + '的' : '第' + (index + 1) + '个'
 | 
	
		
			
				|  |  | -                                      }原音`
 | 
	
		
			
				|  |  | -                                    }
 | 
	
		
			
				|  |  | -                                  ]}
 | 
	
		
			
				|  |  | -                              >
 | 
	
		
			
				|  |  | -                                <UploadFile
 | 
	
		
			
				|  |  | -                                    desc={'原音文件'}
 | 
	
		
			
				|  |  | -                                    disabled={state.previewMode}
 | 
	
		
			
				|  |  | -                                    size={100}
 | 
	
		
			
				|  |  | -                                    v-model:fileList={item.audioFileUrl}
 | 
	
		
			
				|  |  | -                                    tips="仅支持上传.mp3格式文件"
 | 
	
		
			
				|  |  | -                                    listType="image"
 | 
	
		
			
				|  |  | -                                    accept=".mp3"
 | 
	
		
			
				|  |  | -                                    bucketName="cloud-coach"
 | 
	
		
			
				|  |  | -                                />
 | 
	
		
			
				|  |  | -                              </NFormItemGi>
 | 
	
		
			
				|  |  | -                              {state.partListNames.length > 1 && (
 | 
	
		
			
				|  |  | +                {forms.musicSheetSoundList.map((item: any, index: number) => {
 | 
	
		
			
				|  |  | +                  return (
 | 
	
		
			
				|  |  | +                      <>
 | 
	
		
			
				|  |  | +                        {(!containOther(item.track) || (item.track?.toLocaleUpperCase?.() != 'COMMON' && forms.multiTracksSelection.includes(item.track)))
 | 
	
		
			
				|  |  | +                            && (
 | 
	
		
			
				|  |  | +                                <NGrid
 | 
	
		
			
				|  |  | +                                    class={styles.audioSection}
 | 
	
		
			
				|  |  | +                                    // v-show={forms.multiTracksSelection.indexOf(item.track) > -1}
 | 
	
		
			
				|  |  | +                                >
 | 
	
		
			
				|  |  |                                    <NFormItemGi
 | 
	
		
			
				|  |  |                                        span={12}
 | 
	
		
			
				|  |  | -                                      label="所属轨道"
 | 
	
		
			
				|  |  | -                                      path={`musicSheetSoundList[${index}].track`}
 | 
	
		
			
				|  |  | +                                      label="原音"
 | 
	
		
			
				|  |  | +                                      path={`musicSheetSoundList[${index}].audioFileUrl`}
 | 
	
		
			
				|  |  |                                        rule={[
 | 
	
		
			
				|  |  |                                          {
 | 
	
		
			
				|  |  | +                                          // required: forms.multiTracksSelection.indexOf(forms.musicSheetSoundList[index].audioFileUrl) > -1,
 | 
	
		
			
				|  |  |                                            required: true,
 | 
	
		
			
				|  |  | -                                          message: '请选择所属轨道'
 | 
	
		
			
				|  |  | +                                          message: `请上传${
 | 
	
		
			
				|  |  | +                                              item.track ? item.track + '的' : '第' + (index + 1) + '个'
 | 
	
		
			
				|  |  | +                                          }原音`
 | 
	
		
			
				|  |  |                                          }
 | 
	
		
			
				|  |  |                                        ]}
 | 
	
		
			
				|  |  |                                    >
 | 
	
		
			
				|  |  | -                                    <NSelect
 | 
	
		
			
				|  |  | -                                        placeholder="请选择所属轨道"
 | 
	
		
			
				|  |  | -                                        v-model:value={item.track}
 | 
	
		
			
				|  |  | -                                        options={initPartsListStatus(item.track)}
 | 
	
		
			
				|  |  | +                                    <UploadFile
 | 
	
		
			
				|  |  | +                                        desc={'原音文件'}
 | 
	
		
			
				|  |  | +                                        disabled={state.previewMode}
 | 
	
		
			
				|  |  | +                                        size={100}
 | 
	
		
			
				|  |  | +                                        v-model:fileList={item.audioFileUrl}
 | 
	
		
			
				|  |  | +                                        tips="仅支持上传.mp3格式文件"
 | 
	
		
			
				|  |  | +                                        listType="image"
 | 
	
		
			
				|  |  | +                                        accept=".mp3"
 | 
	
		
			
				|  |  | +                                        bucketName="cloud-coach"
 | 
	
		
			
				|  |  |                                      />
 | 
	
		
			
				|  |  |                                    </NFormItemGi>
 | 
	
		
			
				|  |  | -                              )}
 | 
	
		
			
				|  |  | -                              <NGi class={styles.btnRemove}>
 | 
	
		
			
				|  |  | -                                <NButton
 | 
	
		
			
				|  |  | -                                    type="primary"
 | 
	
		
			
				|  |  | -                                    text
 | 
	
		
			
				|  |  | -                                    disabled={forms.musicSheetSoundList.length === 1}
 | 
	
		
			
				|  |  | -                                    onClick={() => removeSys(index)}
 | 
	
		
			
				|  |  | -                                >
 | 
	
		
			
				|  |  | -                                  删除
 | 
	
		
			
				|  |  | -                                </NButton>
 | 
	
		
			
				|  |  | -                              </NGi>
 | 
	
		
			
				|  |  | -                            </NGrid>
 | 
	
		
			
				|  |  | -                        )}
 | 
	
		
			
				|  |  | -                  </>
 | 
	
		
			
				|  |  | -                ))}
 | 
	
		
			
				|  |  | +                                  {state.partListNames.length > 0 && (
 | 
	
		
			
				|  |  | +                                      <NFormItemGi
 | 
	
		
			
				|  |  | +                                          span={12}
 | 
	
		
			
				|  |  | +                                          label="所属轨道"
 | 
	
		
			
				|  |  | +                                          path={`musicSheetSoundList[${index}].track`}
 | 
	
		
			
				|  |  | +                                          rule={[
 | 
	
		
			
				|  |  | +                                            {
 | 
	
		
			
				|  |  | +                                              required: true,
 | 
	
		
			
				|  |  | +                                              message: '请选择所属轨道'
 | 
	
		
			
				|  |  | +                                            }
 | 
	
		
			
				|  |  | +                                          ]}
 | 
	
		
			
				|  |  | +                                      >
 | 
	
		
			
				|  |  | +                                        <NSelect
 | 
	
		
			
				|  |  | +                                            placeholder="请选择所属轨道"
 | 
	
		
			
				|  |  | +                                            value={item.track}
 | 
	
		
			
				|  |  | +                                            options={initPartsListStatus(item.track)}
 | 
	
		
			
				|  |  | +                                            onUpdateValue={(value: any) => {
 | 
	
		
			
				|  |  | +                                              const track = item.track
 | 
	
		
			
				|  |  | +                                              // 声轨交换
 | 
	
		
			
				|  |  | +                                              forms.musicSheetSoundList.forEach((next:any)=>{
 | 
	
		
			
				|  |  | +                                                if (next.track == value) {
 | 
	
		
			
				|  |  | +                                                  next.track = track
 | 
	
		
			
				|  |  | +                                                }
 | 
	
		
			
				|  |  | +                                              })
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                                              if (track) {
 | 
	
		
			
				|  |  | +                                                const index = forms.multiTracksSelection.indexOf(item.track)
 | 
	
		
			
				|  |  | +                                                forms.multiTracksSelection.splice(index, 1)
 | 
	
		
			
				|  |  | +                                              }
 | 
	
		
			
				|  |  | +                                              if (value && !forms.multiTracksSelection.includes(value)) {
 | 
	
		
			
				|  |  | +                                                forms.multiTracksSelection.push(value)
 | 
	
		
			
				|  |  | +                                              }
 | 
	
		
			
				|  |  | +                                              item.track = value
 | 
	
		
			
				|  |  | +                                            }}
 | 
	
		
			
				|  |  | +                                        />
 | 
	
		
			
				|  |  | +                                      </NFormItemGi>
 | 
	
		
			
				|  |  | +                                  )}
 | 
	
		
			
				|  |  | +                                  <NGi class={styles.btnRemove}>
 | 
	
		
			
				|  |  | +                                    <NButton
 | 
	
		
			
				|  |  | +                                        type="primary"
 | 
	
		
			
				|  |  | +                                        text
 | 
	
		
			
				|  |  | +                                        disabled={forms.musicSheetSoundList.length === 1}
 | 
	
		
			
				|  |  | +                                        onClick={() => removeSys(index)}
 | 
	
		
			
				|  |  | +                                    >
 | 
	
		
			
				|  |  | +                                      删除
 | 
	
		
			
				|  |  | +                                    </NButton>
 | 
	
		
			
				|  |  | +                                  </NGi>
 | 
	
		
			
				|  |  | +                                </NGrid>
 | 
	
		
			
				|  |  | +                            )}
 | 
	
		
			
				|  |  | +                      </>
 | 
	
		
			
				|  |  | +                  );
 | 
	
		
			
				|  |  | +                })}
 | 
	
		
			
				|  |  |                </>
 | 
	
		
			
				|  |  |              )}
 | 
	
		
			
				|  |  |            </NForm>
 |