|
@@ -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>
|
|
|
)}
|