Prechádzať zdrojové kódy

Merge branch 'develop'

yuanliang 1 rok pred
rodič
commit
964e46e26a

+ 35 - 35
src/views/music-library/music-sheet/component/music-list.tsx

@@ -58,6 +58,7 @@ export default defineComponent({
         sourceType: null, //来源类型/作者属性(PLATFORM: 平台; ORG: 机构; PERSON: 个人
         composer: null, //作曲人/音乐人
         userId: null, //所属人
+        applicationId: null, //所属人项目ID
         useAppId: null, //适用项目ID
         status: null, //曲目状态(0:停用,1:启用)
         appAuditFlag: null, //是否审核版本
@@ -112,7 +113,7 @@ export default defineComponent({
         },
         {
           title: '曲目信息',
-          minWidth: '150px',
+          minWidth: '200px',
           key: 'composer',
           render(row: any) {
             return (
@@ -120,6 +121,7 @@ export default defineComponent({
                   <NDescriptionsItem label="音乐人">{row.composer}</NDescriptionsItem>
                   <NDescriptionsItem label="类型">{getMapValueByKey(row.musicSheetType, new Map(Object.entries(musicSheetType)))}</NDescriptionsItem>
                   <NDescriptionsItem label="分类"><TheTooltip content={row.musicCategoryName}/></NDescriptionsItem>
+                  <NDescriptionsItem label="可用声部"><TheTooltip content={row.subjectNames}/></NDescriptionsItem>
                 </NDescriptions>
             )
           }
@@ -139,7 +141,6 @@ export default defineComponent({
         },
         {
           title: '适用项目',
-          width: '300px',
           key: 'projectName',
           render(row: any) {
             return (
@@ -184,15 +185,6 @@ export default defineComponent({
           }
         },
         {
-          title: '可用声部',
-          minWidth: '100px',
-          maxWidth: '300px',
-          key: 'subjectNames',
-          render(row: any) {
-            return <TheTooltip content={row.subjectNames}/>
-          }
-        },
-        {
           title: '审核版本',
           minWidth: '100px',
           key: 'appAuditFlag',
@@ -346,7 +338,7 @@ export default defineComponent({
     }
 
     const updateUserIdData = async (sourceType: any) => {
-      if (!state.searchForm.useAppId) {
+      if (!state.searchForm.applicationId) {
         return
       }
       state.userIdData = []
@@ -356,7 +348,7 @@ export default defineComponent({
           page: 1,
           rows: 9999,
           sourceType: sourceType,
-          applicationId: state.searchForm.useAppId
+          applicationId: state.searchForm.applicationId
         })
         const temp = data.rows || []
         temp.forEach((next: any) => {
@@ -552,7 +544,7 @@ export default defineComponent({
                 state.searchForm.userId = null
                 if (value && value !== 'PLATFORM') {
                   await updateUserIdData(value)
-                  state.userIdDisable = !state.searchForm.useAppId
+                  state.userIdDisable = !state.searchForm.applicationId
                 } else {
                   state.userIdDisable = true
                 }
@@ -560,37 +552,45 @@ export default defineComponent({
               clearable
             />
           </NFormItem>
-          <NFormItem label="适用项目" path="app">
+          <NFormItem label="项目" path="applicationId">
             <NSelect
-              placeholder="请选择适用项目"
-              v-model:value={state.searchForm.useAppId}
-              options={state.useProjectData}
-              clearable
-              onUpdateValue={async (value: any) => {
-                state.searchForm.useAppId = value
-                if (value) {
-                  await updateUserIdData(state.searchForm.sourceType)
-                  state.userIdDisable = !(
-                    state.searchForm.sourceType && state.searchForm.sourceType !== 'PLATFORM'
-                  )
-                } else {
-                  state.searchForm.userId = null
-                  state.userIdDisable = true
-                  state.userIdData = []
-                }
-              }}
+                placeholder="请选择项目"
+                v-model:value={state.searchForm.applicationId}
+                options={state.useProjectData}
+                clearable
+                onUpdateValue={async (value: any) => {
+                  state.searchForm.applicationId = value
+                  if (value) {
+                    await updateUserIdData(state.searchForm.sourceType)
+                    state.userIdDisable = !(
+                        state.searchForm.sourceType && state.searchForm.sourceType !== 'PLATFORM'
+                    )
+                  } else {
+                    state.searchForm.userId = null
+                    state.userIdDisable = true
+                    state.userIdData = []
+                  }
+                }}
             />
           </NFormItem>
-          <NFormItem label="所属人" path="author">
+          <NFormItem label="所属人" path="userId">
             <NSelect
               filterable
               placeholder="请选择所属人"
-              disabled={state.userIdDisable}
+              disabled={state.userIdDisable || (!state.searchForm.applicationId && !state.searchForm.sourceType)}
               v-model:value={state.searchForm.userId}
               options={state.userIdData}
               clearable
             ></NSelect>
           </NFormItem>
+          <NFormItem label="适用项目" path="useAppId">
+            <NSelect
+                placeholder="请选择适用项目"
+                v-model:value={state.searchForm.useAppId}
+                options={state.useProjectData}
+                clearable
+            />
+          </NFormItem>
           <NFormItem label="状态" path="status">
             <NSelect
               v-model={[state.searchForm.status, 'value']}
@@ -680,7 +680,7 @@ export default defineComponent({
             data={state.dataList}
             rowKey={(row: any) => row.id}
             onUpdateCheckedRowKeys={handleCheck}
-            scrollX={'1800'}
+            scrollX={'1200'}
           ></NDataTable>
           <Pagination
             v-model:page={state.pagination.page}

+ 1 - 1
src/views/music-library/music-sheet/index.tsx

@@ -37,7 +37,7 @@ export default defineComponent({
               v-model:value={state.tabName}
               onUpdate:value={(val: any) => setTabs(val)}
             >
-              <NTabPane name="MusicList" tab="曲列表" v-auth="musicSheet/page1751238894313013249">
+              <NTabPane name="MusicList" tab="曲列表" v-auth="musicSheet/page1751238894313013249">
                 <MusicList searchId={state.searchId} musicCategoryId={state.musicCategoryId} />
               </NTabPane>
               <NTabPane

+ 149 - 77
src/views/music-library/music-sheet/modal/music-operation.tsx

@@ -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 || []
     }
@@ -549,6 +570,13 @@ export default defineComponent({
         positiveText: '确定',
         negativeText: '取消',
         onPositiveClick: async () => {
+          const sound = forms.musicSheetSoundList[index];
+          const track = sound.track
+          const selectIndex = forms.multiTracksSelection.indexOf(track)
+          if (selectIndex > -1) {
+            forms.multiTracksSelection.splice(selectIndex, 1)
+          }
+
           forms.musicSheetSoundList.splice(index, 1)
         }
       })
@@ -690,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)
@@ -717,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) => {
@@ -727,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 // 轨道
                 })
               })
             }
@@ -1388,62 +1430,92 @@ export default defineComponent({
             {/* 只有播放类型为mp3时才会有原音 */}
             {forms.playMode === 'MP3' && forms.musicSheetSoundList.length > 0 && (
               <>
-                {forms.musicSheetSoundList.map((item: any, index: number) => (
-                  <>
-                    {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 && (
-                            <NFormItemGi
-                              span={12}
-                              label="所属轨道"
-                              path={`musicSheetSoundList[${index}].track`}
-                              rule={[
-                                {
-                                  required: true,
-                                  message: '请选择所属轨道'
-                                }
-                              ]}
-                            >
-                              <NSelect
-                                placeholder="请选择所属轨道"
-                                v-model:value={item.track}
-                                options={initPartsListStatus(item.track)}
-                              />
-                            </NFormItemGi>
-                          )}
-                        </NGrid>
-                      )}
-                  </>
-                ))}
+                {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}].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 > 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>

+ 124 - 14
src/views/music-library/project-music-sheet/module/gym/addMusic.tsx

@@ -20,11 +20,12 @@ import {
 } from 'naive-ui'
 import Pagination from '@components/pagination'
 import { getMapValueByKey, getSelectDataFromObj } from '@/utils/objectUtil'
-import { musicSheetPaymentType, musicSheetSourceType, musicSheetType } from '@/utils/constant'
-import {musicSheetApplicationExtendCategoryList, musicSheetApplicationExtendSaveBatch, musicSheetPage} from '@views/music-library/api'
+import {appKey, musicSheetPaymentType, musicSheetSourceType, musicSheetType} from '@/utils/constant'
+import {musicSheetApplicationExtendCategoryList, musicSheetApplicationExtendSaveBatch, musicSheetApplicationOwnerList, musicSheetPage} from '@views/music-library/api'
 import deepClone from '@/utils/deep.clone'
 import { getOwnerName } from '@views/music-library/musicUtil'
 import TheTooltip from '@/components/TheTooltip'
+import {sysApplicationPage} from "@views/menu-manage/api";
 
 export default defineComponent({
   name: 'gym-addMusic',
@@ -62,7 +63,10 @@ export default defineComponent({
         keyword: null,
         musicSheetType: null,
         subjectId: null,
-        sourceType: null
+        sourceType: null,
+        composer : null,
+        userId : null,
+        applicationId : null,
       },
       subjectList: [] as any,
       showAdd: false,
@@ -72,10 +76,23 @@ export default defineComponent({
       musicSheetCategories: [] as any,
       startSortNum: null as any, // 排序起始值
       projectMusicCategoryId: null as any, // 曲目分类ID
-      globalPaymentType: null as any //收费方式
+      globalPaymentType: null as any, //收费方式
+
+      userIdDisable: true,
+      userIdData: [] as any,
+      useProjectData: [] as any, // 适用项目行数据
     })
 
     onMounted(async () => {
+      state.searchForm.keyword = null
+      state.searchForm.musicSheetType = null
+      state.searchForm.subjectId = null
+      state.searchForm.sourceType = null
+      state.searchForm.composer = null
+      state.searchForm.userId = null
+      state.searchForm.applicationId = null
+
+
       state.loading = true
       state.subjectList = props.subjectList
       // state.musicSheetCategories = props.musicSheetCategories
@@ -90,16 +107,62 @@ export default defineComponent({
         }
       } catch {
       }
-
+      await initUseAppList()
       await getList()
     })
 
+    const initUseAppList = async () => {
+      try {
+        const appKeys = Object.keys(appKey)
+        const { data } = await sysApplicationPage({ page: 1, rows: 999 })
+        const tempList = data.rows || []
+        state.useProjectData = []
+        const filter = tempList.filter((next: any) => {
+          return appKeys.includes(next.appKey)
+        })
+        filter.forEach((item: any) => {
+          state.useProjectData.push({
+            ...item,
+            label: item.appName,
+            value: item.id
+          })
+        })
+      } catch {}
+    }
+
+    const updateUserIdData = async (sourceType: any) => {
+      if (!state.searchForm.applicationId) {
+        return
+      }
+      state.userIdData = []
+      state.searchForm.userId = null
+      if (sourceType && sourceType !== 'PLATFORM') {
+        const { data } = await musicSheetApplicationOwnerList({
+          page: 1,
+          rows: 9999,
+          sourceType: sourceType,
+          applicationId: state.searchForm.applicationId
+        })
+        const temp = data.rows || []
+        temp.forEach((next: any) => {
+          state.userIdData.push({
+            ...next,
+            label: sourceType === 'PERSON' ? next.userName : next.organizationRole,
+            value: sourceType === 'PERSON' ? next.userId : next.organizationRoleId
+          })
+        })
+      }
+    }
+
     const getList = async () => {
       try {
         state.loading = true
+        const sourceType = state.searchForm.sourceType
         const { data } = await musicSheetPage({
           ...state.pagination,
           ...state.searchForm,
+          userId: (sourceType && sourceType === 'PERSON') ? state.searchForm.userId : null,
+          organizationRoleId: (sourceType && sourceType === 'ORG') ? state.searchForm.userId : null,
           addAppId: props.appId
         })
         state.pagination.pageTotal = Number(data.total)
@@ -134,7 +197,7 @@ export default defineComponent({
           message.error('曲目分类不能为空')
           return
         }
-        if (!item.sortNo || !item.projectMusicCategoryId) {
+        if (item.sortNo === null || item.sortNo === undefined || item.sortNo === '') {
           message.error('排序号不能为空')
           return
         }
@@ -565,24 +628,71 @@ export default defineComponent({
                     clearable
                   />
                 </NFormItem>
-                <NFormItem label="声部" path="musicSubject">
+                <NFormItem label="可用声部" path="musicSubject">
                   <NSelect
-                    placeholder="请选择声部"
+                    placeholder="请选择可用声部"
                     v-model:value={state.searchForm.subjectId}
                     options={state.subjectList}
                     clearable
                   />
                 </NFormItem>
+                <NFormItem label="音乐人" path="composer">
+                  <NInput
+                      placeholder="请选择音乐人"
+                      v-model:value={state.searchForm.composer}
+                      clearable
+                  />
+                </NFormItem>
                 <NFormItem label="曲目来源" path="sourceType">
                   <NSelect
-                    placeholder="请选择曲目来源"
-                    v-model:value={state.searchForm.sourceType}
-                    options={getSelectDataFromObj(musicSheetSourceType)}
-                    // onUpdateValue={async (value: any) => {
-                    // }}
-                    clearable
+                      placeholder="请选择曲目来源"
+                      v-model:value={state.searchForm.sourceType}
+                      options={getSelectDataFromObj(musicSheetSourceType)}
+                      onUpdateValue={async (value: any) => {
+                        state.userIdData = []
+                        state.searchForm.userId = null
+                        if (value && value !== 'PLATFORM') {
+                          await updateUserIdData(value)
+                          state.userIdDisable = false
+                        } else {
+                          state.userIdDisable = true
+                        }
+                      }}
+                      clearable
                   />
                 </NFormItem>
+                <NFormItem label="项目" path="applicationId">
+                  <NSelect
+                      placeholder="请选择项目"
+                      v-model:value={state.searchForm.applicationId}
+                      options={state.useProjectData}
+                      clearable
+                      onUpdateValue={async (value: any) => {
+                        state.searchForm.applicationId = value
+                        if (value) {
+                          await updateUserIdData(state.searchForm.sourceType)
+                          state.userIdDisable = !(
+                              state.searchForm.sourceType && state.searchForm.sourceType !== 'PLATFORM'
+                          )
+                        } else {
+                          state.searchForm.userId = null
+                          state.userIdDisable = true
+                          state.userIdData = []
+                        }
+                      }}
+                  />
+                </NFormItem>
+
+                <NFormItem label="所属人" path="author">
+                  <NSelect
+                      filterable
+                      placeholder="请选择所属人"
+                      disabled={state.userIdDisable || (!state.searchForm.applicationId && !state.searchForm.sourceType)}
+                      v-model:value={state.searchForm.userId}
+                      options={state.userIdData}
+                      clearable
+                  ></NSelect>
+                </NFormItem>
                 <NFormItem>
                   <NSpace>
                     <NButton type="primary" onClick={onSearch}>

+ 93 - 48
src/views/music-library/project-music-sheet/module/gym/music-sheet-gym.tsx

@@ -23,6 +23,7 @@ import TheTooltip from '@components/TheTooltip'
 import AddMusic from '@views/music-library/project-music-sheet/module/gym/addMusic'
 import { getMapValueByKey, getSelectDataFromObj } from '@/utils/objectUtil'
 import {
+  appKey,
   musicSheetAudioType,
   musicSheetPaymentType,
   musicSheetSourceType,
@@ -79,7 +80,8 @@ export default defineComponent({
         topFlag: null, //是否置顶(0:否;1:是)
         availableType: null, //可用途径 ORG 机构 PLATFORM 平台
         appAuditFlag: null, //是否审核版本
-        detailFlag: null //是否查询详情
+        detailFlag: null, //是否查询详情
+        applicationId: null, //所属人项目ID
       },
       subjectList: [],
       dataList: [] as any[],
@@ -92,6 +94,7 @@ export default defineComponent({
       applicationId: null, //应用ID
       musicPreview: false,
       musicScore: null as any,
+      useProjectData: [] as any, // 适用项目行数据
     })
 
     onMounted(async () => {
@@ -134,10 +137,29 @@ export default defineComponent({
       } catch {}
 
       // 加载表格数据
-
+      initUseAppList()
       getList()
     })
 
+    const initUseAppList = async () => {
+      try {
+        const appKeys = Object.keys(appKey)
+        const { data } = await sysApplicationPage({ page: 1, rows: 999 })
+        const tempList = data.rows || []
+        state.useProjectData = []
+        const filter = tempList.filter((next: any) => {
+          return appKeys.includes(next.appKey)
+        })
+        filter.forEach((item: any) => {
+          state.useProjectData.push({
+            ...item,
+            label: item.appName,
+            value: item.id
+          })
+        })
+      } catch {}
+    }
+
     const saveForm = ref()
 
     const onSearch = () => {
@@ -161,17 +183,11 @@ export default defineComponent({
       try {
         state.loading = true
         const sourceType = state.searchForm.sourceType
-        let userId = state.searchForm.userId
-        let organizationRoleId = null
-        if (sourceType && sourceType === 'ORG') {
-          organizationRoleId = deepClone(userId)
-          userId = null
-        }
         const { data } = await musicSheetPageByApplication({
           ...state.pagination,
           ...state.searchForm,
-          userId: userId,
-          organizationRoleId: organizationRoleId,
+          userId: (sourceType && sourceType === 'PERSON') ? state.searchForm.userId : null,
+          organizationRoleId: (sourceType && sourceType === 'ORG') ? state.searchForm.userId : null,
           ...filterTimes(state.searchForm.times, ['startTime', 'endTime']),
           applicationId: state.applicationId
         })
@@ -225,6 +241,30 @@ export default defineComponent({
       })
     }
 
+    const updateUserIdData = async (sourceType: any) => {
+      if (!state.searchForm.applicationId) {
+        return
+      }
+      state.userIdData = []
+      state.searchForm.userId = null
+      if (sourceType && sourceType !== 'PLATFORM') {
+        const { data } = await musicSheetApplicationOwnerList({
+          page: 1,
+          rows: 9999,
+          sourceType: sourceType,
+          applicationId: state.searchForm.applicationId
+        })
+        const temp = data.rows || []
+        temp.forEach((next: any) => {
+          state.userIdData.push({
+            ...next,
+            label: sourceType === 'PERSON' ? next.userName : next.organizationRole,
+            value: sourceType === 'PERSON' ? next.userId : next.organizationRoleId
+          })
+        })
+      }
+    }
+
     const columns = (): any => {
       return [
         {
@@ -245,7 +285,21 @@ export default defineComponent({
           )
         },
         {
-          title: '曲目来源',
+          title: '封面图',
+          key: 'musicCover',
+          render(row: any): JSX.Element {
+            return <NImage width={60} height={60} src={row.musicCover} />
+          }
+        },
+        // {
+        //   title: '可用声部',
+        //   key: 'subjectNames',
+        //   render: (row: any) => {
+        //     return <TheTooltip content={row.subjectNames}/>
+        //   }
+        // },
+        {
+          title: '曲目信息',
           key: 'musicSheetCategoriesName',
           render: (row: any) => (
             <>
@@ -256,18 +310,14 @@ export default defineComponent({
                 <NDescriptionsItem label="所属人">
                   <TheTooltip content={getOwnerName(row.musicSheetExtend, row.sourceType)}/>
                 </NDescriptionsItem>
+                <NDescriptionsItem label="可用声部">
+                  <TheTooltip content={row.subjectNames}/>
+                </NDescriptionsItem>
               </NDescriptions>
             </>
           )
         },
         {
-          title: '封面图',
-          key: 'musicCover',
-          render(row: any): JSX.Element {
-            return <NImage width={60} height={60} src={row.musicCover} />
-          }
-        },
-        {
           title: '曲目类型',
           key: 'musicSheetType',
           render: (row: any) => {
@@ -290,23 +340,9 @@ export default defineComponent({
           }
         },
         {
-          title: '可用声部',
-          key: 'subjectNames',
-          render: (row: any) => {
-            return <TheTooltip content={row.subjectNames}/>
-          }
-        },
-        {
           title: '曲目分类',
           key: 'musicSheetCategoryName'
         },
-        // {
-        //   title: '可用途径',
-        //   key: 'availableType',
-        //   render: (row: any) => {
-        //     return <div>{getMapValueByKey(row.availableType, new Map(Object.entries(musicSheetAvailableType)))}</div>
-        //   }
-        // },
         {
           title: '收费方式',
           key: 'paymentType',
@@ -412,21 +448,8 @@ export default defineComponent({
                   state.userIdData = []
                   state.searchForm.userId = null
                   if (value && value !== 'PLATFORM') {
-                    const { data } = await musicSheetApplicationOwnerList({
-                      page: 1,
-                      rows: 9999,
-                      sourceType: value,
-                      applicationId: state.appId
-                    })
-                    const temp = data.rows || []
-                    temp.forEach((next: any) => {
-                      state.userIdData.push({
-                        ...next,
-                        label: value === 'PERSON' ? next.userName : next.organizationRole,
-                        value: value === 'PERSON' ? next.userId : next.organizationRoleId
-                      })
-                    })
-                    state.userIdDisable = false
+                    await updateUserIdData(value)
+                    state.userIdDisable = !state.searchForm.applicationId
                   } else {
                     state.userIdDisable = true
                   }
@@ -434,8 +457,30 @@ export default defineComponent({
                 clearable
               />
             </NFormItem>
+            <NFormItem label="项目" path="applicationId">
+              <NSelect
+                  placeholder="请选择项目"
+                  v-model:value={state.searchForm.applicationId}
+                  options={state.useProjectData}
+                  clearable
+                  onUpdateValue={async (value: any) => {
+                    state.searchForm.applicationId = value
+                    if (value) {
+                      await updateUserIdData(state.searchForm.sourceType)
+                      state.userIdDisable = !(
+                          state.searchForm.sourceType && state.searchForm.sourceType !== 'PLATFORM'
+                      )
+                    } else {
+                      state.searchForm.userId = null
+                      state.userIdDisable = true
+                      state.userIdData = []
+                    }
+                  }}
+              />
+            </NFormItem>
             <NFormItem label="所属人" path="userId">
               <NSelect
+                filterable
                 placeholder="请选择所属人"
                 disabled={state.userIdDisable}
                 v-model:value={state.searchForm.userId}
@@ -576,7 +621,7 @@ export default defineComponent({
               data={state.dataList}
               rowKey={(row: any) => row.applicationExtendId}
               onUpdateCheckedRowKeys={handleCheck}
-              scrollX={'2100'}
+              scrollX={'1400'}
             ></NDataTable>
 
             <Pagination

+ 125 - 16
src/views/music-library/project-music-sheet/module/gyt/addMusic.tsx

@@ -20,11 +20,12 @@ import {
 } from 'naive-ui'
 import Pagination from '@components/pagination'
 import { getMapValueByKey, getSelectDataFromObj } from '@/utils/objectUtil'
-import { musicSheetSourceType, musicSheetType } from '@/utils/constant'
-import {musicSheetApplicationExtendCategoryList, musicSheetApplicationExtendSaveBatch, musicSheetPage} from '@views/music-library/api'
+import {appKey, musicSheetSourceType, musicSheetType} from '@/utils/constant'
+import {musicSheetApplicationExtendCategoryList, musicSheetApplicationExtendSaveBatch, musicSheetApplicationOwnerList, musicSheetPage} from '@views/music-library/api'
 import deepClone from '@/utils/deep.clone'
 import { getOwnerName } from '@views/music-library/musicUtil'
 import TheTooltip from "@components/TheTooltip";
+import {sysApplicationPage} from "@views/menu-manage/api";
 
 export default defineComponent({
   name: 'gyt-addMusic',
@@ -62,7 +63,10 @@ export default defineComponent({
         keyword: null,
         musicSheetType: null,
         subjectId: null,
-        sourceType: null
+        sourceType: null,
+        composer : null,
+        userId : null,
+        applicationId : null,
       },
       subjectList: [] as any,
       showAdd: false,
@@ -71,10 +75,20 @@ export default defineComponent({
       selectRowData: [] as any, // 选择的数据列表
       musicSheetCategories: [] as any,
       startSortNum: null as any, // 排序起始值
-      projectMusicCategoryId: null as any // 曲目分类ID
+      projectMusicCategoryId: null as any, // 曲目分类ID
+      useProjectData: [] as any, // 适用项目行数据
+      userIdDisable: true,
+      userIdData: [] as any,
     })
 
     onMounted(async () => {
+      state.searchForm.keyword = null
+      state.searchForm.musicSheetType = null
+      state.searchForm.subjectId = null
+      state.searchForm.sourceType = null
+      state.searchForm.composer = null
+      state.searchForm.userId = null
+      state.searchForm.applicationId = null
       state.loading = true
       state.subjectList = props.subjectList
       // state.musicSheetCategories = props.musicSheetCategories
@@ -88,15 +102,40 @@ export default defineComponent({
         }
       } catch {
       }
+      await initUseAppList()
       await getList()
     })
 
+    const initUseAppList = async () => {
+      try {
+        const appKeys = Object.keys(appKey)
+        const { data } = await sysApplicationPage({ page: 1, rows: 999 })
+        const tempList = data.rows || []
+        state.useProjectData = []
+        const filter = tempList.filter((next: any) => {
+          return appKeys.includes(next.appKey)
+        })
+        filter.forEach((item: any) => {
+          state.useProjectData.push({
+            ...item,
+            label: item.appName,
+            value: item.id
+          })
+        })
+      } catch {}
+    }
+
     const getList = async () => {
       try {
         state.loading = true
+        const search = {
+          ...state.searchForm,
+          userId: (state.searchForm.sourceType && state.searchForm.sourceType == 'PERSON') ? state.searchForm.userId : null,
+          organizationRoleId: (state.searchForm.sourceType && state.searchForm.sourceType == 'ORG') ? state.searchForm.userId : null,
+        }
         const { data } = await musicSheetPage({
           ...state.pagination,
-          ...state.searchForm,
+          ...search,
           addAppId: props.appId
         })
         state.pagination.pageTotal = Number(data.total)
@@ -119,6 +158,30 @@ export default defineComponent({
       getList()
     }
 
+    const updateUserIdData = async (sourceType: any) => {
+      if (!state.searchForm.applicationId) {
+        return
+      }
+      state.userIdData = []
+      state.searchForm.userId = null
+      if (sourceType && sourceType !== 'PLATFORM') {
+        const { data } = await musicSheetApplicationOwnerList({
+          page: 1,
+          rows: 9999,
+          sourceType: sourceType,
+          applicationId: state.searchForm.applicationId
+        })
+        const temp = data.rows || []
+        temp.forEach((next: any) => {
+          state.userIdData.push({
+            ...next,
+            label: sourceType === 'PERSON' ? next.userName : next.organizationRole,
+            value: sourceType === 'PERSON' ? next.userId : next.organizationRoleId
+          })
+        })
+      }
+    }
+
     const onSave = async () => {
       if (state.selectRowData.length == 0) {
         message.error('未选择曲目')
@@ -131,7 +194,7 @@ export default defineComponent({
           message.error('曲目分类不能为空')
           return
         }
-        if (!item.sortNo || !item.projectMusicCategoryId) {
+        if (item.sortNo === null || item.sortNo === undefined || item.sortNo === '') {
           message.error('排序号不能为空')
           return
         }
@@ -167,7 +230,7 @@ export default defineComponent({
         }
       },
       {
-        title: '声部',
+        title: '可用声部',
         key: 'subjectNames',
         render: (row: any) => {
           return <TheTooltip content={row.subjectNames}/>
@@ -193,7 +256,7 @@ export default defineComponent({
         }
       },
       {
-        title: '作者属性',
+        title: '曲目来源',
         key: 'sourceType',
         render(row: any) {
           return getMapValueByKey(row.sourceType, new Map(Object.entries(musicSheetSourceType)))
@@ -475,24 +538,70 @@ export default defineComponent({
                     clearable
                   />
                 </NFormItem>
-                <NFormItem label="声部" path="musicSubject">
+                <NFormItem label="可用声部" path="musicSubject">
                   <NSelect
-                    placeholder="请选择声部"
+                    placeholder="请选择可用声部"
                     v-model:value={state.searchForm.subjectId}
                     options={state.subjectList}
                     clearable
                   />
                 </NFormItem>
+                <NFormItem label="音乐人" path="composer">
+                  <NInput
+                      placeholder="请选择音乐人"
+                      v-model:value={state.searchForm.composer}
+                      clearable
+                  />
+                </NFormItem>
                 <NFormItem label="曲目来源" path="sourceType">
                   <NSelect
-                    placeholder="请选择曲目来源"
-                    v-model:value={state.searchForm.sourceType}
-                    options={getSelectDataFromObj(musicSheetSourceType)}
-                    // onUpdateValue={async (value: any) => {
-                    // }}
-                    clearable
+                      placeholder="请选择曲目来源"
+                      v-model:value={state.searchForm.sourceType}
+                      options={getSelectDataFromObj(musicSheetSourceType)}
+                      onUpdateValue={async (value: any) => {
+                        state.userIdData = []
+                        state.searchForm.userId = null
+                        if (value && value !== 'PLATFORM') {
+                          await updateUserIdData(value)
+                          state.userIdDisable = false
+                        } else {
+                          state.userIdDisable = true
+                        }
+                      }}
+                      clearable
                   />
                 </NFormItem>
+                <NFormItem label="项目" path="applicationId">
+                  <NSelect
+                      placeholder="请选择项目"
+                      v-model:value={state.searchForm.applicationId}
+                      options={state.useProjectData}
+                      clearable
+                      onUpdateValue={async (value: any) => {
+                        state.searchForm.applicationId = value
+                        if (value) {
+                          await updateUserIdData(state.searchForm.sourceType)
+                          state.userIdDisable = !(
+                              state.searchForm.sourceType && state.searchForm.sourceType !== 'PLATFORM'
+                          )
+                        } else {
+                          state.searchForm.userId = null
+                          state.userIdDisable = true
+                          state.userIdData = []
+                        }
+                      }}
+                  />
+                </NFormItem>
+                <NFormItem label="所属人" path="author">
+                  <NSelect
+                      filterable
+                      placeholder="请选择所属人"
+                      disabled={state.userIdDisable || (!state.searchForm.applicationId && !state.searchForm.sourceType)}
+                      v-model:value={state.searchForm.userId}
+                      options={state.userIdData}
+                      clearable
+                  ></NSelect>
+                </NFormItem>
                 <NFormItem>
                   <NSpace>
                     <NButton type="primary" onClick={onSearch}>

+ 95 - 40
src/views/music-library/project-music-sheet/module/gyt/music-sheet-gyt.tsx

@@ -23,6 +23,7 @@ import TheTooltip from '@components/TheTooltip'
 import AddMusic from '@views/music-library/project-music-sheet/module/gyt/addMusic'
 import { getMapValueByKey, getSelectDataFromObj } from '@/utils/objectUtil'
 import {
+  appKey,
   musicSheetAudioType,
   musicSheetPaymentType,
   musicSheetSourceType,
@@ -78,7 +79,8 @@ export default defineComponent({
         topFlag: null, //是否置顶(0:否;1:是)
         availableType: null, //可用途径 ORG 机构 PLATFORM 平台
         appAuditFlag: null, //是否审核版本
-        detailFlag: null //是否查询详情
+        detailFlag: null, //是否查询详情
+        applicationId: null, //所属人项目ID
       },
       subjectList: [],
       dataList: [] as any[],
@@ -91,6 +93,7 @@ export default defineComponent({
       applicationId: null, //应用ID
       musicPreview: false,
       musicScore: null as any,
+      useProjectData: [] as any, // 适用项目行数据
     })
 
     onMounted(async () => {
@@ -132,6 +135,7 @@ export default defineComponent({
 
       // 加载表格数据
 
+      initUseAppList()
       getList()
     })
 
@@ -149,6 +153,51 @@ export default defineComponent({
       getList()
     }
 
+
+    const initUseAppList = async () => {
+      try {
+        const appKeys = Object.keys(appKey)
+        const { data } = await sysApplicationPage({ page: 1, rows: 999 })
+        const tempList = data.rows || []
+        state.useProjectData = []
+        const filter = tempList.filter((next: any) => {
+          return appKeys.includes(next.appKey)
+        })
+        filter.forEach((item: any) => {
+          state.useProjectData.push({
+            ...item,
+            label: item.appName,
+            value: item.id
+          })
+        })
+      } catch {}
+    }
+
+    const updateUserIdData = async (sourceType: any) => {
+      if (!state.searchForm.applicationId) {
+        return
+      }
+      state.userIdData = []
+      state.searchForm.userId = null
+      if (sourceType && sourceType !== 'PLATFORM') {
+        const { data } = await musicSheetApplicationOwnerList({
+          page: 1,
+          rows: 9999,
+          sourceType: sourceType,
+          applicationId: state.searchForm.applicationId
+        })
+        const temp = data.rows || []
+        temp.forEach((next: any) => {
+          state.userIdData.push({
+            ...next,
+            label: sourceType === 'PERSON' ? next.userName : next.organizationRole,
+            value: sourceType === 'PERSON' ? next.userId : next.organizationRoleId
+          })
+        })
+      }
+    }
+
+
     const checkedRowKeysRef = ref<DataTableRowKey[]>([])
     const handleCheck = (rowKeys: DataTableRowKey[]) => {
       checkedRowKeysRef.value = rowKeys
@@ -158,17 +207,11 @@ export default defineComponent({
       try {
         state.loading = true
         const sourceType = state.searchForm.sourceType
-        let userId = state.searchForm.userId
-        let organizationRoleId = null
-        if (sourceType && sourceType === 'ORG') {
-          organizationRoleId = deepClone(userId)
-          userId = null
-        }
         const { data } = await musicSheetPageByApplication({
           ...state.pagination,
           ...state.searchForm,
-          userId: userId,
-          organizationRoleId: organizationRoleId,
+          userId: (sourceType && sourceType === 'PERSON') ? state.searchForm.userId : null,
+          organizationRoleId: (sourceType && sourceType === 'ORG') ? state.searchForm.userId : null,
           ...filterTimes(state.searchForm.times, ['startTime', 'endTime']),
           applicationId: state.applicationId
         })
@@ -242,7 +285,21 @@ export default defineComponent({
           )
         },
         {
-          title: '曲目来源',
+          title: '封面图',
+          key: 'musicCover',
+          render(row: any): JSX.Element {
+            return <NImage width={60} height={60} src={row.musicCover} />
+          }
+        },
+        // {
+        //   title: '可用声部',
+        //   key: 'subjectNames',
+        //   render: (row: any) => {
+        //     return <TheTooltip content={row.subjectNames}/>
+        //   }
+        // },
+        {
+          title: '曲目信息',
           key: 'musicSheetCategoriesName',
           render: (row: any) => (
             <>
@@ -253,18 +310,14 @@ export default defineComponent({
                 <NDescriptionsItem label="所属人">
                   <TheTooltip content={getOwnerName(row.musicSheetExtend, row.sourceType)}/>
                 </NDescriptionsItem>
+                <NDescriptionsItem label="可用声部">
+                  <TheTooltip content={row.subjectNames}/>
+                </NDescriptionsItem>
               </NDescriptions>
             </>
           )
         },
         {
-          title: '封面图',
-          key: 'musicCover',
-          render(row: any): JSX.Element {
-            return <NImage width={60} height={60} src={row.musicCover} />
-          }
-        },
-        {
           title: '曲目类型',
           key: 'musicSheetType',
           render: (row: any) => {
@@ -287,13 +340,6 @@ export default defineComponent({
           }
         },
         {
-          title: '可用声部',
-          key: 'subjectNames',
-          render: (row: any) => {
-            return <TheTooltip content={row.subjectNames}/>
-          }
-        },
-        {
           title: '曲目分类',
           key: 'musicSheetCategoryName'
         },
@@ -409,21 +455,8 @@ export default defineComponent({
                   state.userIdData = []
                   state.searchForm.userId = null
                   if (value && value !== 'PLATFORM') {
-                    const { data } = await musicSheetApplicationOwnerList({
-                      page: 1,
-                      rows: 9999,
-                      sourceType: value,
-                      applicationId: state.appId
-                    })
-                    const temp = data.rows || []
-                    temp.forEach((next: any) => {
-                      state.userIdData.push({
-                        ...next,
-                        label: value === 'PERSON' ? next.userName : next.organizationRole,
-                        value: value === 'PERSON' ? next.userId : next.organizationRoleId
-                      })
-                    })
-                    state.userIdDisable = false
+                    await updateUserIdData(value)
+                    state.userIdDisable = !state.searchForm.applicationId
                   } else {
                     state.userIdDisable = true
                   }
@@ -431,8 +464,30 @@ export default defineComponent({
                 clearable
               />
             </NFormItem>
+            <NFormItem label="项目" path="applicationId">
+              <NSelect
+                  placeholder="请选择项目"
+                  v-model:value={state.searchForm.applicationId}
+                  options={state.useProjectData}
+                  clearable
+                  onUpdateValue={async (value: any) => {
+                    state.searchForm.applicationId = value
+                    if (value) {
+                      await updateUserIdData(state.searchForm.sourceType)
+                      state.userIdDisable = !(
+                          state.searchForm.sourceType && state.searchForm.sourceType !== 'PLATFORM'
+                      )
+                    } else {
+                      state.searchForm.userId = null
+                      state.userIdDisable = true
+                      state.userIdData = []
+                    }
+                  }}
+              />
+            </NFormItem>
             <NFormItem label="所属人" path="userId">
               <NSelect
+                filterable
                 placeholder="请选择所属人"
                 disabled={state.userIdDisable}
                 v-model:value={state.searchForm.userId}
@@ -573,7 +628,7 @@ export default defineComponent({
               data={state.dataList}
               rowKey={(row: any) => row.applicationExtendId}
               onUpdateCheckedRowKeys={handleCheck}
-              scrollX={'2100'}
+              scrollX={'1200'}
             ></NDataTable>
 
             <Pagination

+ 123 - 11
src/views/music-library/project-music-sheet/module/klx/addMusic.tsx

@@ -20,15 +20,17 @@ import {
 import Pagination from '@components/pagination'
 import { getMapValueByKey, getSelectDataFromObj } from '@/utils/objectUtil'
 import {
+  appKey,
   musicSheetAvailableType,
   musicSheetPaymentType,
   musicSheetSourceType,
   musicSheetType
 } from '@/utils/constant'
-import {musicSheetApplicationExtendSaveBatch, musicSheetApplicationExtendTagList, musicSheetPage} from '@views/music-library/api'
+import {musicSheetApplicationExtendSaveBatch, musicSheetApplicationExtendTagList, musicSheetApplicationOwnerList, musicSheetPage} from '@views/music-library/api'
 import deepClone from '@/utils/deep.clone'
 import { getOwnerName } from '@views/music-library/musicUtil'
 import TheTooltip from "@components/TheTooltip";
+import {sysApplicationPage} from "@views/menu-manage/api";
 
 export default defineComponent({
   name: 'klx-addMusic',
@@ -66,7 +68,10 @@ export default defineComponent({
         keyword: null,
         musicSheetType: null,
         subjectId: null,
-        sourceType: null
+        sourceType: null,
+        composer : null,
+        userId : null,
+        applicationId : null,
       },
       subjectList: [] as any,
       showAdd: false,
@@ -75,6 +80,10 @@ export default defineComponent({
       selectRowData: [] as any, // 选择的数据列表
       musicSheetCategories: [] as any,
       musicSheetTagList: [] as any,
+      useProjectData: [] as any, // 适用项目行数据
+
+      userIdDisable: true,
+      userIdData: [] as any,
 
       globalMusicTagIds: [] as any, //曲目标签
       globalPaymentType: null as any, //收费方式
@@ -86,6 +95,14 @@ export default defineComponent({
     })
 
     onMounted(async () => {
+      state.searchForm.keyword = null
+      state.searchForm.musicSheetType = null
+      state.searchForm.subjectId = null
+      state.searchForm.sourceType = null
+      state.searchForm.composer = null
+      state.searchForm.userId = null
+      state.searchForm.applicationId = null
+
       state.loading = true
       state.subjectList = props.subjectList
       // state.musicSheetTagList = props.musicSheetTagList
@@ -104,15 +121,40 @@ export default defineComponent({
         }
       } catch (err) {
       }
+      await initUseAppList()
       await getList()
     })
 
+    const initUseAppList = async () => {
+      try {
+        const appKeys = Object.keys(appKey)
+        const { data } = await sysApplicationPage({ page: 1, rows: 999 })
+        const tempList = data.rows || []
+        state.useProjectData = []
+        const filter = tempList.filter((next: any) => {
+          return appKeys.includes(next.appKey)
+        })
+        filter.forEach((item: any) => {
+          state.useProjectData.push({
+            ...item,
+            label: item.appName,
+            value: item.id
+          })
+        })
+      } catch {}
+    }
+
     const getList = async () => {
       try {
         state.loading = true
+        const search = {
+          ...state.searchForm,
+          userId: (state.searchForm.sourceType && state.searchForm.sourceType == 'PERSON') ? state.searchForm.userId : null,
+          organizationRoleId: (state.searchForm.sourceType && state.searchForm.sourceType == 'ORG') ? state.searchForm.userId : null,
+        }
         const { data } = await musicSheetPage({
           ...state.pagination,
-          ...state.searchForm,
+          ...search,
           addAppId: props.appId
         })
         state.pagination.pageTotal = Number(data.total)
@@ -135,6 +177,30 @@ export default defineComponent({
       getList()
     }
 
+    const updateUserIdData = async (sourceType: any) => {
+      if (!state.searchForm.applicationId) {
+        return
+      }
+      state.userIdData = []
+      state.searchForm.userId = null
+      if (sourceType && sourceType !== 'PLATFORM') {
+        const { data } = await musicSheetApplicationOwnerList({
+          page: 1,
+          rows: 9999,
+          sourceType: sourceType,
+          applicationId: state.searchForm.applicationId
+        })
+        const temp = data.rows || []
+        temp.forEach((next: any) => {
+          state.userIdData.push({
+            ...next,
+            label: sourceType === 'PERSON' ? next.userName : next.organizationRole,
+            value: sourceType === 'PERSON' ? next.userId : next.organizationRoleId
+          })
+        })
+      }
+    }
+
     const onSave = async () => {
       if (state.selectRowData.length == 0) {
         message.error('未选择曲目')
@@ -209,7 +275,7 @@ export default defineComponent({
         }
       },
       {
-        title: '声部',
+        title: '可用声部',
         key: 'subjectNames',
         render: (row: any) => {
           return <TheTooltip content={row.subjectNames}/>
@@ -235,7 +301,7 @@ export default defineComponent({
         }
       },
       {
-        title: '作者属性',
+        title: '曲目来源',
         key: 'sourceType',
         render(row: any) {
           return getMapValueByKey(row.sourceType, new Map(Object.entries(musicSheetSourceType)))
@@ -914,7 +980,7 @@ export default defineComponent({
                 ref={saveForm}
                 model={state.searchForm}
                 onSubmit={onSubmit}
-                // saveKey="cooleshow-edu-addMusic"
+                saveKey="klx-addMusic"
                 onSetModel={(val: any) => (state.searchForm = val)}
               >
                 <NFormItem label="关键词" path="keyword">
@@ -932,24 +998,70 @@ export default defineComponent({
                     clearable
                   />
                 </NFormItem>
-                <NFormItem label="声部" path="musicSubject">
+                <NFormItem label="可用声部" path="musicSubject">
                   <NSelect
-                    placeholder="请选择声部"
+                    placeholder="请选择可用声部"
                     v-model:value={state.searchForm.subjectId}
                     options={state.subjectList}
                     clearable
                   />
                 </NFormItem>
+                <NFormItem label="音乐人" path="composer">
+                  <NInput
+                      placeholder="请选择音乐人"
+                      v-model:value={state.searchForm.composer}
+                      clearable
+                  />
+                </NFormItem>
                 <NFormItem label="曲目来源" path="sourceType">
                   <NSelect
                     placeholder="请选择曲目来源"
                     v-model:value={state.searchForm.sourceType}
                     options={getSelectDataFromObj(musicSheetSourceType)}
-                    // onUpdateValue={async (value: any) => {
-                    // }}
+                    onUpdateValue={async (value: any) => {
+                      state.userIdData = []
+                      state.searchForm.userId = null
+                      if (value && value !== 'PLATFORM') {
+                        await updateUserIdData(value)
+                        state.userIdDisable = false
+                      } else {
+                        state.userIdDisable = true
+                      }
+                    }}
                     clearable
                   />
                 </NFormItem>
+                <NFormItem label="项目" path="applicationId">
+                  <NSelect
+                      placeholder="请选择项目"
+                      v-model:value={state.searchForm.applicationId}
+                      options={state.useProjectData}
+                      clearable
+                      onUpdateValue={async (value: any) => {
+                        state.searchForm.applicationId = value
+                        if (value) {
+                          await updateUserIdData(state.searchForm.sourceType)
+                          state.userIdDisable = !(
+                              state.searchForm.sourceType && state.searchForm.sourceType !== 'PLATFORM'
+                          )
+                        } else {
+                          state.searchForm.userId = null
+                          state.userIdDisable = true
+                          state.userIdData = []
+                        }
+                      }}
+                  />
+                </NFormItem>
+                <NFormItem label="所属人" path="author">
+                  <NSelect
+                      filterable
+                      placeholder="请选择所属人"
+                      disabled={state.userIdDisable || (!state.searchForm.applicationId && !state.searchForm.sourceType)}
+                      v-model:value={state.searchForm.userId}
+                      options={state.userIdData}
+                      clearable
+                  ></NSelect>
+                </NFormItem>
                 <NFormItem>
                   <NSpace>
                     <NButton type="primary" onClick={onSearch}>
@@ -978,7 +1090,7 @@ export default defineComponent({
                 v-model:pageTotal={state.pagination.pageTotal}
                 onList={getList}
                 sync
-                // saveKey="cooleshow-edu-addMusic"
+                saveKey="klx-addMusic"
               ></Pagination>
             </div>
           )}

+ 106 - 47
src/views/music-library/project-music-sheet/module/klx/music-sheet-klx.tsx

@@ -22,6 +22,7 @@ import TheTooltip from '@components/TheTooltip'
 import AddMusic from '@views/music-library/project-music-sheet/module/klx/addMusic'
 import { getMapValueByKey, getSelectDataFromObj } from '@/utils/objectUtil'
 import {
+  appKey,
   musicSheetAudioType,
   musicSheetAvailableType,
   musicSheetPaymentType,
@@ -78,7 +79,8 @@ export default defineComponent({
         availableType: null, //可用途径 ORG 机构 PLATFORM 平台
         appAuditFlag: null, //是否审核版本
         detailFlag: null, //是否查询详情
-        musicTagIds: [] as any //曲目标签
+        musicTagIds: [] as any,//曲目标签
+        applicationId: null, //所属人项目ID
       },
       subjectList: [],
       dataList: [] as any[],
@@ -91,6 +93,7 @@ export default defineComponent({
       applicationId: null, //应用ID
       musicPreview: false,
       musicScore: null as any,
+      useProjectData: [] as any, // 适用项目行数据
     })
 
     onMounted(async () => {
@@ -137,7 +140,7 @@ export default defineComponent({
       } catch (err) {}
 
       // 加载表格数据
-
+      initUseAppList()
       getList()
     })
 
@@ -155,6 +158,25 @@ export default defineComponent({
       getList()
     }
 
+    const initUseAppList = async () => {
+      try {
+        const appKeys = Object.keys(appKey)
+        const { data } = await sysApplicationPage({ page: 1, rows: 999 })
+        const tempList = data.rows || []
+        state.useProjectData = []
+        const filter = tempList.filter((next: any) => {
+          return appKeys.includes(next.appKey)
+        })
+        filter.forEach((item: any) => {
+          state.useProjectData.push({
+            ...item,
+            label: item.appName,
+            value: item.id
+          })
+        })
+      } catch {}
+    }
+
     const checkedRowKeysRef = ref<DataTableRowKey[]>([])
     const handleCheck = (rowKeys: DataTableRowKey[]) => {
       checkedRowKeysRef.value = rowKeys
@@ -173,8 +195,8 @@ export default defineComponent({
         const { data } = await musicSheetPageByApplication({
           ...state.pagination,
           ...state.searchForm,
-          userId: userId,
-          organizationRoleId: organizationRoleId,
+          userId: (sourceType && sourceType === 'PERSON') ? state.searchForm.userId : null,
+          organizationRoleId: (sourceType && sourceType === 'ORG') ? state.searchForm.userId : null,
           musicTagIds: state.searchForm.musicTagIds?.join(','),
           ...filterTimes(state.searchForm.times, ['startTime', 'endTime']),
           applicationId: state.applicationId
@@ -243,6 +265,31 @@ export default defineComponent({
       return paymentTypeName.join(',')
     }
 
+    const updateUserIdData = async (sourceType: any) => {
+      if (!state.searchForm.applicationId) {
+        return
+      }
+      state.userIdData = []
+      state.searchForm.userId = null
+      if (sourceType && sourceType !== 'PLATFORM') {
+        const { data } = await musicSheetApplicationOwnerList({
+          page: 1,
+          rows: 9999,
+          sourceType: sourceType,
+          applicationId: state.searchForm.applicationId
+        })
+        const temp = data.rows || []
+        temp.forEach((next: any) => {
+          state.userIdData.push({
+            ...next,
+            label: sourceType === 'PERSON' ? next.userName : next.organizationRole,
+            value: sourceType === 'PERSON' ? next.userId : next.organizationRoleId
+          })
+        })
+      }
+    }
+
+
     const columns = (): any => {
       return [
         {
@@ -263,7 +310,14 @@ export default defineComponent({
           )
         },
         {
-          title: '曲目来源',
+          title: '封面图',
+          key: 'musicCover',
+          render(row: any): JSX.Element {
+            return <NImage width={60} height={60} src={row.musicCover} />
+          }
+        },
+        {
+          title: '曲目信息',
           key: 'musicSheetCategoriesName',
           render: (row: any) => (
             <>
@@ -274,18 +328,14 @@ export default defineComponent({
                 <NDescriptionsItem label="所属人">
                   <TheTooltip content={getOwnerName(row.musicSheetExtend, row.sourceType)}/>
                 </NDescriptionsItem>
+                <NDescriptionsItem label="可用声部">
+                  <TheTooltip content={row.subjectNames}/>
+                </NDescriptionsItem>
               </NDescriptions>
             </>
           )
         },
         {
-          title: '封面图',
-          key: 'musicCover',
-          render(row: any): JSX.Element {
-            return <NImage width={60} height={60} src={row.musicCover} />
-          }
-        },
-        {
           title: '曲目类型',
           key: 'musicSheetType',
           render: (row: any) => {
@@ -307,13 +357,13 @@ export default defineComponent({
             )
           }
         },
-        {
-          title: '可用声部',
-          key: 'subjectNames',
-          render: (row: any) => {
-            return <TheTooltip content={row.subjectNames}/>
-          }
-        },
+        // {
+        //   title: '可用声部',
+        //   key: 'subjectNames',
+        //   render: (row: any) => {
+        //     return <TheTooltip content={row.subjectNames}/>
+        //   }
+        // },
         {
           title: '曲目标签',
           key: 'musicTagNames'
@@ -444,37 +494,46 @@ export default defineComponent({
             </NFormItem>
             <NFormItem label="曲目来源" path="sourceType">
               <NSelect
-                placeholder="请选择曲目来源"
-                v-model:value={state.searchForm.sourceType}
-                options={getSelectDataFromObj(musicSheetSourceType)}
-                onUpdateValue={async (value: any) => {
-                  state.userIdData = []
-                  state.searchForm.userId = null
-                  if (value && value !== 'PLATFORM') {
-                    const { data } = await musicSheetApplicationOwnerList({
-                      page: 1,
-                      rows: 9999,
-                      sourceType: value,
-                      applicationId: state.appId
-                    })
-                    const temp = data.rows || []
-                    temp.forEach((next: any) => {
-                      state.userIdData.push({
-                        ...next,
-                        label: value === 'PERSON' ? next.userName : next.organizationRole,
-                        value: value === 'PERSON' ? next.userId : next.organizationRoleId
-                      })
-                    })
-                    state.userIdDisable = false
-                  } else {
-                    state.userIdDisable = true
-                  }
-                }}
-                clearable
+                  placeholder="请选择曲目来源"
+                  v-model:value={state.searchForm.sourceType}
+                  options={getSelectDataFromObj(musicSheetSourceType)}
+                  onUpdateValue={async (value: any) => {
+                    state.userIdData = []
+                    state.searchForm.userId = null
+                    if (value && value !== 'PLATFORM') {
+                      await updateUserIdData(value)
+                      state.userIdDisable = !state.searchForm.applicationId
+                    } else {
+                      state.userIdDisable = true
+                    }
+                  }}
+                  clearable
+              />
+            </NFormItem>
+            <NFormItem label="项目" path="applicationId">
+              <NSelect
+                  placeholder="请选择项目"
+                  v-model:value={state.searchForm.applicationId}
+                  options={state.useProjectData}
+                  clearable
+                  onUpdateValue={async (value: any) => {
+                    state.searchForm.applicationId = value
+                    if (value) {
+                      await updateUserIdData(state.searchForm.sourceType)
+                      state.userIdDisable = !(
+                          state.searchForm.sourceType && state.searchForm.sourceType !== 'PLATFORM'
+                      )
+                    } else {
+                      state.searchForm.userId = null
+                      state.userIdDisable = true
+                      state.userIdData = []
+                    }
+                  }}
               />
             </NFormItem>
             <NFormItem label="所属人" path="userId">
               <NSelect
+                filterable
                 placeholder="请选择所属人"
                 disabled={state.userIdDisable}
                 v-model:value={state.searchForm.userId}
@@ -614,7 +673,7 @@ export default defineComponent({
               data={state.dataList}
               rowKey={(row: any) => row.applicationExtendId}
               onUpdateCheckedRowKeys={handleCheck}
-              scrollX={'2100'}
+              scrollX={'2000'}
             ></NDataTable>
 
             <Pagination

+ 126 - 15
src/views/music-library/project-music-sheet/module/kt/addMusic.tsx

@@ -20,11 +20,12 @@ import {
 } from 'naive-ui'
 import Pagination from '@components/pagination'
 import { getMapValueByKey, getSelectDataFromObj } from '@/utils/objectUtil'
-import { musicSheetSourceType, musicSheetType } from '@/utils/constant'
-import {musicSheetApplicationExtendCategoryList, musicSheetApplicationExtendSaveBatch, musicSheetPage} from '@views/music-library/api'
+import {appKey, musicSheetSourceType, musicSheetType} from '@/utils/constant'
+import {musicSheetApplicationExtendCategoryList, musicSheetApplicationExtendSaveBatch, musicSheetApplicationOwnerList, musicSheetPage} from '@views/music-library/api'
 import deepClone from '@/utils/deep.clone'
 import { getOwnerName } from '@views/music-library/musicUtil'
 import TheTooltip from '@/components/TheTooltip'
+import {sysApplicationPage} from "@views/menu-manage/api";
 
 export default defineComponent({
   name: 'kt-addMusic',
@@ -63,7 +64,10 @@ export default defineComponent({
         keyword: null,
         musicSheetType: null,
         subjectId: null,
-        sourceType: null
+        sourceType: null,
+        composer : null,
+        userId : null,
+        applicationId : null,
       },
       subjectList: [] as any,
       showAdd: false,
@@ -72,10 +76,21 @@ export default defineComponent({
       selectRowData: [] as any, // 选择的数据列表
       musicSheetCategories: [] as any,
       startSortNum: null as any, // 排序起始值
-      projectMusicCategoryId: null as any // 曲目分类ID
+      projectMusicCategoryId: null as any, // 曲目分类ID
+
+      useProjectData: [] as any, // 适用项目行数据
+      userIdDisable: true,
+      userIdData: [] as any,
     })
 
     onMounted(async () => {
+      state.searchForm.keyword = null
+      state.searchForm.musicSheetType = null
+      state.searchForm.subjectId = null
+      state.searchForm.sourceType = null
+      state.searchForm.composer = null
+      state.searchForm.userId = null
+      state.searchForm.applicationId = null
       state.loading = true
       state.subjectList = props.subjectList
       // state.musicSheetCategories = props.musicSheetCategories
@@ -89,15 +104,41 @@ export default defineComponent({
         }
       } catch {
       }
+      await initUseAppList()
       await getList()
     })
 
+    const initUseAppList = async () => {
+      try {
+        const appKeys = Object.keys(appKey)
+        const { data } = await sysApplicationPage({ page: 1, rows: 999 })
+        const tempList = data.rows || []
+        state.useProjectData = []
+        const filter = tempList.filter((next: any) => {
+          return appKeys.includes(next.appKey)
+        })
+        filter.forEach((item: any) => {
+          state.useProjectData.push({
+            ...item,
+            label: item.appName,
+            value: item.id
+          })
+        })
+      } catch {}
+    }
+
+
     const getList = async () => {
       try {
         state.loading = true
+        const search = {
+          ...state.searchForm,
+          userId: (state.searchForm.sourceType && state.searchForm.sourceType == 'PERSON') ? state.searchForm.userId : null,
+          organizationRoleId: (state.searchForm.sourceType && state.searchForm.sourceType == 'ORG') ? state.searchForm.userId : null,
+        }
         const { data } = await musicSheetPage({
           ...state.pagination,
-          ...state.searchForm,
+          ...search,
           addAppId: props.appId
         })
         state.pagination.pageTotal = Number(data.total)
@@ -171,7 +212,7 @@ export default defineComponent({
         }
       },
       {
-        title: '声部',
+        title: '可用声部',
         key: 'subjectNames',
         render: (row: any) => {
           return <TheTooltip content={row.subjectNames}/>
@@ -197,7 +238,7 @@ export default defineComponent({
         }
       },
       {
-        title: '作者属性',
+        title: '曲目来源',
         key: 'sourceType',
         render(row: any) {
           return getMapValueByKey(row.sourceType, new Map(Object.entries(musicSheetSourceType)))
@@ -441,6 +482,30 @@ export default defineComponent({
       })
     }
 
+    const updateUserIdData = async (sourceType: any) => {
+      if (!state.searchForm.applicationId) {
+        return
+      }
+      state.userIdData = []
+      state.searchForm.userId = null
+      if (sourceType && sourceType !== 'PLATFORM') {
+        const { data } = await musicSheetApplicationOwnerList({
+          page: 1,
+          rows: 9999,
+          sourceType: sourceType,
+          applicationId: state.searchForm.applicationId
+        })
+        const temp = data.rows || []
+        temp.forEach((next: any) => {
+          state.userIdData.push({
+            ...next,
+            label: sourceType === 'PERSON' ? next.userName : next.organizationRole,
+            value: sourceType === 'PERSON' ? next.userId : next.organizationRoleId
+          })
+        })
+      }
+    }
+
     return () => {
       return (
         <div class="system-menu-container">
@@ -480,24 +545,70 @@ export default defineComponent({
                     clearable
                   />
                 </NFormItem>
-                <NFormItem label="声部" path="musicSubject">
+                <NFormItem label="可用声部" path="musicSubject">
                   <NSelect
-                    placeholder="请选择声部"
+                    placeholder="请选择可用声部"
                     v-model:value={state.searchForm.subjectId}
                     options={state.subjectList}
                     clearable
                   />
                 </NFormItem>
+                <NFormItem label="音乐人" path="composer">
+                  <NInput
+                      placeholder="请选择音乐人"
+                      v-model:value={state.searchForm.composer}
+                      clearable
+                  />
+                </NFormItem>
                 <NFormItem label="曲目来源" path="sourceType">
                   <NSelect
-                    placeholder="请选择曲目来源"
-                    v-model:value={state.searchForm.sourceType}
-                    options={getSelectDataFromObj(musicSheetSourceType)}
-                    // onUpdateValue={async (value: any) => {
-                    // }}
-                    clearable
+                      placeholder="请选择曲目来源"
+                      v-model:value={state.searchForm.sourceType}
+                      options={getSelectDataFromObj(musicSheetSourceType)}
+                      onUpdateValue={async (value: any) => {
+                        state.userIdData = []
+                        state.searchForm.userId = null
+                        if (value && value !== 'PLATFORM') {
+                          await updateUserIdData(value)
+                          state.userIdDisable = false
+                        } else {
+                          state.userIdDisable = true
+                        }
+                      }}
+                      clearable
                   />
                 </NFormItem>
+                <NFormItem label="项目" path="applicationId">
+                  <NSelect
+                      placeholder="请选择项目"
+                      v-model:value={state.searchForm.applicationId}
+                      options={state.useProjectData}
+                      clearable
+                      onUpdateValue={async (value: any) => {
+                        state.searchForm.applicationId = value
+                        if (value) {
+                          await updateUserIdData(state.searchForm.sourceType)
+                          state.userIdDisable = !(
+                              state.searchForm.sourceType && state.searchForm.sourceType !== 'PLATFORM'
+                          )
+                        } else {
+                          state.searchForm.userId = null
+                          state.userIdDisable = true
+                          state.userIdData = []
+                        }
+                      }}
+                  />
+                </NFormItem>
+                <NFormItem label="所属人" path="author">
+                  <NSelect
+                      filterable
+                      placeholder="请选择所属人"
+                      disabled={state.userIdDisable || (!state.searchForm.applicationId && !state.searchForm.sourceType)}
+                      v-model:value={state.searchForm.userId}
+                      options={state.userIdData}
+                      clearable
+                  ></NSelect>
+                </NFormItem>
                 <NFormItem>
                   <NSpace>
                     <NButton type="primary" onClick={onSearch}>

+ 106 - 53
src/views/music-library/project-music-sheet/module/kt/music-sheet-kt.tsx

@@ -29,7 +29,7 @@ import {
   musicSheetPageByApplication
 } from '@views/music-library/api'
 import { getMapValueByKey, getSelectDataFromObj } from '@/utils/objectUtil'
-import { musicSheetAudioType, musicSheetSourceType, musicSheetType } from '@/utils/constant'
+import {appKey, musicSheetAudioType, musicSheetSourceType, musicSheetType} from '@/utils/constant'
 import { sysApplicationPage } from '@views/menu-manage/api'
 import { musicSheetApplicationExtendSubjectList } from '@views/system-manage/api'
 import { filterTimes } from '@/utils/dateUtil'
@@ -76,7 +76,8 @@ export default defineComponent({
         topFlag: null, //是否置顶(0:否;1:是)
         availableType: null, //可用途径 ORG 机构 PLATFORM 平台
         appAuditFlag: null, //是否审核版本
-        detailFlag: null //是否查询详情
+        detailFlag: null, //是否查询详情
+        applicationId: null, //所属人项目ID
       },
       subjectList: [],
       dataList: [] as any[],
@@ -89,6 +90,7 @@ export default defineComponent({
       applicationId: null, //应用ID
       musicPreview: false,
       musicScore: null as any,
+      useProjectData: [] as any, // 适用项目行数据
     })
 
     onMounted(async () => {
@@ -127,9 +129,30 @@ export default defineComponent({
         }
       } catch {}
       // 加载表格数据
+      initUseAppList()
       getList()
     })
 
+    const initUseAppList = async () => {
+      try {
+        const appKeys = Object.keys(appKey)
+        const { data } = await sysApplicationPage({ page: 1, rows: 999 })
+        const tempList = data.rows || []
+        state.useProjectData = []
+        const filter = tempList.filter((next: any) => {
+          return appKeys.includes(next.appKey)
+        })
+        filter.forEach((item: any) => {
+          state.useProjectData.push({
+            ...item,
+            label: item.appName,
+            value: item.id
+          })
+        })
+      } catch {}
+    }
+
+
     const saveForm = ref()
 
     const onSearch = () => {
@@ -153,17 +176,11 @@ export default defineComponent({
       state.loading = true
       try {
         const sourceType = state.searchForm.sourceType
-        let userId = state.searchForm.userId
-        let organizationRoleId = null
-        if (sourceType && sourceType === 'ORG') {
-          organizationRoleId = deepClone(userId)
-          userId = null
-        }
         const { data } = await musicSheetPageByApplication({
           ...state.pagination,
           ...state.searchForm,
-          userId: userId,
-          organizationRoleId: organizationRoleId,
+          userId: (sourceType && sourceType === 'PERSON') ? state.searchForm.userId : null,
+          organizationRoleId: (sourceType && sourceType === 'ORG') ? state.searchForm.userId : null,
           ...filterTimes(state.searchForm.times, ['startTime', 'endTime']),
           applicationId: state.applicationId
         })
@@ -217,6 +234,31 @@ export default defineComponent({
       })
     }
 
+    const updateUserIdData = async (sourceType: any) => {
+      if (!state.searchForm.applicationId) {
+        return
+      }
+      state.userIdData = []
+      state.searchForm.userId = null
+      if (sourceType && sourceType !== 'PLATFORM') {
+        const { data } = await musicSheetApplicationOwnerList({
+          page: 1,
+          rows: 9999,
+          sourceType: sourceType,
+          applicationId: state.searchForm.applicationId
+        })
+        const temp = data.rows || []
+        temp.forEach((next: any) => {
+          state.userIdData.push({
+            ...next,
+            label: sourceType === 'PERSON' ? next.userName : next.organizationRole,
+            value: sourceType === 'PERSON' ? next.userId : next.organizationRoleId
+          })
+        })
+      }
+    }
+
+
     const columns = (): any => {
       return [
         {
@@ -237,7 +279,14 @@ export default defineComponent({
           )
         },
         {
-          title: '曲目来源',
+          title: '封面图',
+          key: 'musicCover',
+          render(row: any): JSX.Element {
+            return <NImage width={60} height={60} src={row.musicCover} />
+          }
+        },
+        {
+          title: '曲目信息',
           key: 'musicSheetCategoriesName',
           render: (row: any) => (
             <>
@@ -248,18 +297,14 @@ export default defineComponent({
                 <NDescriptionsItem label="所属人">
                   <TheTooltip content={getOwnerName(row.musicSheetExtend, row.sourceType)} />
                 </NDescriptionsItem>
+                <NDescriptionsItem label="可用声部">
+                  <TheTooltip content={row.subjectNames}/>
+                </NDescriptionsItem>
               </NDescriptions>
             </>
           )
         },
         {
-          title: '封面图',
-          key: 'musicCover',
-          render(row: any): JSX.Element {
-            return <NImage width={60} height={60} src={row.musicCover} />
-          }
-        },
-        {
           title: '曲目类型',
           key: 'musicSheetType',
           render: (row: any) => {
@@ -281,13 +326,13 @@ export default defineComponent({
             )
           }
         },
-        {
-          title: '可用声部',
-          key: 'subjectNames',
-          render: (row: any) => {
-            return <TheTooltip content={row.subjectNames}/>
-          }
-        },
+        // {
+        //   title: '可用声部',
+        //   key: 'subjectNames',
+        //   render: (row: any) => {
+        //     return <TheTooltip content={row.subjectNames}/>
+        //   }
+        // },
         {
           title: '乐谱教材',
           key: 'musicSheetCategoryName'
@@ -393,33 +438,41 @@ export default defineComponent({
             </NFormItem>
             <NFormItem label="曲目来源" path="sourceType">
               <NSelect
-                placeholder="请选择曲目来源"
-                v-model:value={state.searchForm.sourceType}
-                options={getSelectDataFromObj(musicSheetSourceType)}
-                onUpdateValue={async (value: any) => {
-                  state.userIdData = []
-                  state.searchForm.userId = null
-                  if (value && value !== 'PLATFORM') {
-                    const { data } = await musicSheetApplicationOwnerList({
-                      page: 1,
-                      rows: 9999,
-                      sourceType: value,
-                      applicationId: state.appId
-                    })
-                    const temp = data.rows || []
-                    temp.forEach((next: any) => {
-                      state.userIdData.push({
-                        ...next,
-                        label: value === 'PERSON' ? next.userName : next.organizationRole,
-                        value: value === 'PERSON' ? next.userId : next.organizationRoleId
-                      })
-                    })
-                    state.userIdDisable = false
-                  } else {
-                    state.userIdDisable = true
-                  }
-                }}
-                clearable
+                  placeholder="请选择曲目来源"
+                  v-model:value={state.searchForm.sourceType}
+                  options={getSelectDataFromObj(musicSheetSourceType)}
+                  onUpdateValue={async (value: any) => {
+                    state.userIdData = []
+                    state.searchForm.userId = null
+                    if (value && value !== 'PLATFORM') {
+                      await updateUserIdData(value)
+                      state.userIdDisable = !state.searchForm.applicationId
+                    } else {
+                      state.userIdDisable = true
+                    }
+                  }}
+                  clearable
+              />
+            </NFormItem>
+            <NFormItem label="项目" path="applicationId">
+              <NSelect
+                  placeholder="请选择项目"
+                  v-model:value={state.searchForm.applicationId}
+                  options={state.useProjectData}
+                  clearable
+                  onUpdateValue={async (value: any) => {
+                    state.searchForm.applicationId = value
+                    if (value) {
+                      await updateUserIdData(state.searchForm.sourceType)
+                      state.userIdDisable = !(
+                          state.searchForm.sourceType && state.searchForm.sourceType !== 'PLATFORM'
+                      )
+                    } else {
+                      state.searchForm.userId = null
+                      state.userIdDisable = true
+                      state.userIdData = []
+                    }
+                  }}
               />
             </NFormItem>
             <NFormItem label="所属人" path="userId">
@@ -557,7 +610,7 @@ export default defineComponent({
               data={state.dataList}
               rowKey={(row: any) => row.applicationExtendId}
               onUpdateCheckedRowKeys={handleCheck}
-              scrollX={'2100'}
+              scrollX={'1400'}
             ></NDataTable>
 
             <Pagination

+ 6 - 1
src/views/system-manage/subject-manage/instrument/modal/instrument-save.tsx

@@ -23,7 +23,7 @@ export default defineComponent({
   setup(props, { slots, attrs, emit }) {
     const forms = reactive({
       name: null,
-      defaultScore: null,
+      defaultScore: null as any,
       code: null,
       hz: null,
       transferFlag: true
@@ -114,6 +114,11 @@ export default defineComponent({
                 ] as any
               }
               placeholder="请选择是否支持转简谱"
+              onUpdateValue={async (value: any) => {
+                if(!value){ //如果不支持,修改默认谱面
+                  forms.defaultScore = 'STAVE'
+                }
+              }}
               clearable
             ></NSelect>
           </NFormItem>