yuanliang 1 рік тому
батько
коміт
025e01b9e1

+ 38 - 38
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) => {
@@ -542,6 +534,27 @@ 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="sourceType">
             <NSelect
               placeholder="请选择作者属性"
@@ -552,7 +565,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 +573,24 @@ export default defineComponent({
               clearable
             />
           </NFormItem>
-          <NFormItem label="适用项目" path="app">
-            <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 = []
-                }
-              }}
-            />
-          </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

+ 119 - 13
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,10 +107,53 @@ 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
@@ -565,24 +625,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="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="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="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}>

+ 19 - 23
src/views/music-library/project-music-sheet/module/gym/music-sheet-gym.tsx

@@ -245,7 +245,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 +270,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 +300,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',
@@ -576,7 +572,7 @@ export default defineComponent({
               data={state.dataList}
               rowKey={(row: any) => row.applicationExtendId}
               onUpdateCheckedRowKeys={handleCheck}
-              scrollX={'2100'}
+              scrollX={'1400'}
             ></NDataTable>
 
             <Pagination

+ 124 - 15
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('未选择曲目')
@@ -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="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="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="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}>

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

@@ -242,7 +242,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 +267,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 +297,6 @@ export default defineComponent({
           }
         },
         {
-          title: '可用声部',
-          key: 'subjectNames',
-          render: (row: any) => {
-            return <TheTooltip content={row.subjectNames}/>
-          }
-        },
-        {
           title: '曲目分类',
           key: 'musicSheetCategoryName'
         },
@@ -573,7 +576,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="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="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="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>
           )}

+ 19 - 16
src/views/music-library/project-music-sheet/module/klx/music-sheet-klx.tsx

@@ -263,7 +263,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 +281,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 +310,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'
@@ -614,7 +617,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="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="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="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}>

+ 19 - 16
src/views/music-library/project-music-sheet/module/kt/music-sheet-kt.tsx

@@ -237,7 +237,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 +255,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 +284,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'
@@ -557,7 +560,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>