}
},
{
title: '曲目信息',
minWidth: '200px',
key: 'composer',
render(row: any) {
return (
{row.composer}
{getMapValueByKey(row.musicSheetType, new Map(Object.entries(musicSheetType)))}
)
}
},
{
title: '作者属性',
minWidth: '250px',
key: 'sourceType',
render(row: any) {
return (
{getMapValueByKey(row.sourceType, new Map(Object.entries(musicSheetSourceType)))}
{getOwnerName(row.musicSheetExtend, row.sourceType)}
)
}
},
{
title: '适用项目',
key: 'projectName',
render(row: any) {
return (
{
state.showUseProject = true
state.showUseProjectId = row.id
}}
>
)
}
},
{
title: '更新信息',
minWidth: '250px',
key: 'updateBy',
render(row: any) {
return (
{row.updateByName}
{row.updateTime}
)
}
},
{
title: '审核版本',
minWidth: '100px',
key: 'appAuditFlag',
render(row: any) {
return {row.appAuditFlag ? '是' : '否'}
}
},
{
title: '状态',
minWidth: '50px',
key: 'status',
render(row: any) {
return (
{row.status ? '启用' : '停用'}
)
}
},
{
title: '操作',
key: 'operation',
fixed: 'right',
width: '300px',
render(row: any) {
return (
{
state.musicPreview = true
state.musicScore = row
}}
>
预览
{
state.visiableMusic = true
state.musicOperation = 'preview'
state.musicData = row
state.detailReadonly = true
}}
>
查看
{
state.visiableMusic = true
state.musicOperation = 'edit'
state.musicData = row
state.detailReadonly = true
}}
>
修改
onChangeStatus(row)}
>
{row.status ? '停用' : '启用'}
{
state.productOpen = true
state.productItem = row
// handleAutoProduct(row)
}}
>
生成图片
onRmove(row)}
v-auth="musicSheet/save1751241178962984962"
>
删除
)
}
}
]
}
const checkedRowKeysRef = ref([])
const handleCheck = (rowKeys: DataTableRowKey[]) => {
checkedRowKeysRef.value = rowKeys
}
const onChangeStatus = (row: any) => {
const statusStr = row.status ? '停用' : '启用'
dialog.warning({
title: '提示',
content: `是否${statusStr}?`,
positiveText: '确定',
negativeText: '取消',
onPositiveClick: async () => {
try {
await musicSheetStatusList({
ids: new Array(row.id),
status: !row.status
})
getList()
message.success(`${statusStr}成功`)
} catch {}
}
})
}
const onBatchChangeStatus = (status: boolean) => {
const length = checkedRowKeysRef.value.length
if (length == 0) {
message.warning('未选择数据')
}
const statusStr = !status ? '停用' : '启用'
dialog.warning({
title: '提示',
content: `是否${statusStr}` + length + `条数据?`,
positiveText: '确定',
negativeText: '取消',
onPositiveClick: async () => {
try {
await musicSheetStatusList({
ids: checkedRowKeysRef.value,
status: status
})
getList()
message.success(`${statusStr}成功`)
} 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 onRmove = (row: any): void => {
dialog.warning({
title: '提示',
content: `删除"${row.name}",是否继续?`,
positiveText: '确定',
negativeText: '取消',
onPositiveClick: async () => {
try {
await musicSheetRemove({ id: row.id })
getList()
message.success('删除成功')
} catch {}
}
})
}
const getList = async () => {
try {
state.loading = true
const sourceType = state.searchForm.sourceType;
const userId = state.searchForm.userId
let search = {
...state.searchForm,
useAppId: state.searchForm.useAppId ? state.searchForm.useAppId.join(',') : state.searchForm.useAppId
} as any
if (sourceType) {
if (sourceType == 'ORG') {
search.organizationRoleId = userId
search.userId = null
}
}
const { data } = await musicSheetPage({ ...state.pagination, ...search})
state.pagination.pageTotal = Number(data.total)
state.dataList = data.rows || []
} catch {}
state.loading = false
}
// 获取标签
const getTagList = async () => {
try {
const { data } = await musicTagPage({ page: 1, rows: 999 })
const tempList = data.rows || []
tempList.forEach((item: any) => {
item.label = item.name
item.value = item.id
})
state.tagList = tempList
} catch {}
}
// 获取分类
const getMusicSheetCategorieList = async () => {
try {
const { data } = await musicSheetCategoriesQueryTree({})
// state.musicSheetCategories = filterPointCategory(data, 'musicSheetCategoriesList')
state.musicSheetCategories = data || []
} catch (e) {}
}
// 获取声部
const initSubjectList = async () => {
try {
const { data } = await subjectPage({ page: 1, rows: 999 })
const tempList = data.rows || []
tempList.forEach((item: any) => {
item.label = item.name
item.value = item.id + ''
})
state.subjectList = tempList
} catch {}
}
// app列表
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 onSubmit = () => {
state.pagination.page = 1
getList()
}
watch(
() => props.searchId,
(val) => {
console.log(val, 'searchId')
}
)
const onSearch = () => {
saveForm.value?.submit()
}
const onBtnReset = () => {
saveForm.value?.reset()
}
onMounted(async () => {
state.loading = true
// getTagList()
if (props.searchId) {
state.searchForm.categoriesId = props.searchId || null
}
if (props.musicCategoryId) {
state.searchForm.musicCategoryId = props.musicCategoryId || null
}
initSubjectList()
initUseAppList()
getMusicSheetCategorieList()
getList()
})
return () => (
)
}
})