|
@@ -257,6 +257,24 @@ export default defineComponent({
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ const formatParentId = (id: any, list: any, ids = [] as any) => {
|
|
|
+ for (const item of list) {
|
|
|
+ if (item.children && item.children.length > 0) {
|
|
|
+ const cIds: any = formatParentId(id, item.children, [
|
|
|
+ ...ids,
|
|
|
+ item.id
|
|
|
+ ]);
|
|
|
+ if (cIds.includes(id)) {
|
|
|
+ return cIds;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (item.id === id) {
|
|
|
+ return [...ids, id];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ids;
|
|
|
+ };
|
|
|
+
|
|
|
const onSearch = () => {
|
|
|
musicForms.page = 1;
|
|
|
state.musics = [];
|
|
@@ -270,13 +288,13 @@ export default defineComponent({
|
|
|
data.tagActiveId = '';
|
|
|
data.childSelectId = null;
|
|
|
data.selectParents = {}
|
|
|
- state.allSearch.bookVersionId = data.childSelectId || data.tagActiveId;
|
|
|
- state.allSearch.audioPlayTypes = state.sAPT
|
|
|
- ? state.sAPT === 'PLAY_SING'
|
|
|
- ? ['SING', 'PLAY']
|
|
|
- : [state.sAPT]
|
|
|
- : [];
|
|
|
- state.allSearch.musicTagIds = state.sNt;
|
|
|
+ // state.allSearch.bookVersionId = data.childSelectId || data.tagActiveId;
|
|
|
+ // state.allSearch.audioPlayTypes = state.sAPT
|
|
|
+ // ? state.sAPT === 'PLAY_SING'
|
|
|
+ // ? ['SING', 'PLAY']
|
|
|
+ // : [state.sAPT]
|
|
|
+ // : [];
|
|
|
+ // state.allSearch.musicTagIds = state.sNt;
|
|
|
// state.searchPopup = false;
|
|
|
// onSearch();
|
|
|
};
|
|
@@ -303,7 +321,7 @@ export default defineComponent({
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- const changeTag = (item: any) => {
|
|
|
+ const changeTag = (item: any, activeIndex?: any) => {
|
|
|
data.tagActiveId = item.id;
|
|
|
data.childSelectId = null;
|
|
|
let children: any;
|
|
@@ -321,7 +339,7 @@ export default defineComponent({
|
|
|
data.selectParents = {
|
|
|
...item,
|
|
|
columnName,
|
|
|
- activeIndex: '',
|
|
|
+ activeIndex: activeIndex || '',
|
|
|
children
|
|
|
};
|
|
|
} else {
|
|
@@ -462,7 +480,29 @@ export default defineComponent({
|
|
|
if (state.isAllStatus) {
|
|
|
state.searchPopup = !state.searchPopup;
|
|
|
if (state.searchPopup) {
|
|
|
-
|
|
|
+ const allSearch = state.allSearch
|
|
|
+ if(allSearch.audioPlayTypes.length > 0) {
|
|
|
+ if(allSearch.audioPlayTypes.length == 1) {
|
|
|
+ state.sAPT = allSearch.audioPlayTypes.join(',')
|
|
|
+ } else {
|
|
|
+ state.sAPT = 'PLAY_SING'
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ state.sAPT = ''
|
|
|
+ }
|
|
|
+ state.sNt = allSearch.musicTagIds
|
|
|
+ if(allSearch.bookVersionId) {
|
|
|
+ const ids = formatParentId(allSearch.bookVersionId,data.tags)
|
|
|
+ console.log(ids)
|
|
|
+
|
|
|
+ data.tagActiveId = ids[0]
|
|
|
+
|
|
|
+ if(data.tagActiveId && ids[1]) {
|
|
|
+ const item = data.tags.find((item) => item.id === ids[0])
|
|
|
+ console.log(item, 'item')
|
|
|
+ if(item) changeTag(item, ids[1])
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
state.isAllStatus = true;
|