|
@@ -308,6 +308,15 @@ export default defineComponent({
|
|
|
try {
|
|
|
const res = await request.get('/edu-app/musicTag/tree');
|
|
|
const result = res.data || [];
|
|
|
+ // 去掉上下册
|
|
|
+ result.forEach((item: any) => {
|
|
|
+ if (item.children && item.children.length > 0) {
|
|
|
+ const child = item.children;
|
|
|
+ child?.forEach((c: any) => {
|
|
|
+ c.children = null;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
data.tags = [
|
|
|
{
|
|
|
columnName: result[0].columnName,
|
|
@@ -324,7 +333,7 @@ export default defineComponent({
|
|
|
|
|
|
const changeTag = (item: any, activeIndex?: any) => {
|
|
|
data.tagActiveId = item.id;
|
|
|
- data.childSelectId = null;
|
|
|
+ data.childSelectId = activeIndex;
|
|
|
let children: any;
|
|
|
let columnName = '';
|
|
|
if (item.children) {
|
|
@@ -435,7 +444,6 @@ export default defineComponent({
|
|
|
|
|
|
window.addEventListener('resize', tabResize);
|
|
|
useEventListener(document, 'scroll', () => {
|
|
|
- console.log('1111', state.isFocus)
|
|
|
if(state.isFocus) {
|
|
|
mSearchRef.value?.searchBlur()
|
|
|
}
|
|
@@ -496,16 +504,26 @@ export default defineComponent({
|
|
|
}
|
|
|
state.sNt = allSearch.musicTagIds
|
|
|
if(allSearch.bookVersionId) {
|
|
|
- const ids = formatParentId(allSearch.bookVersionId,data.tags)
|
|
|
- console.log(ids)
|
|
|
-
|
|
|
+ let ids: any = []
|
|
|
+ data.tags.forEach((item: any) => {
|
|
|
+ if(item.id === allSearch.bookVersionId) {
|
|
|
+ ids.push(item.id)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(ids.length <= 0) {
|
|
|
+ ids = formatParentId(allSearch.bookVersionId, data.tags)
|
|
|
+ }
|
|
|
+ // console.log(ids, 'ids', allSearch.bookVersionId)
|
|
|
data.tagActiveId = ids[0]
|
|
|
|
|
|
- if(data.tagActiveId && ids[1]) {
|
|
|
+ if(data.tagActiveId) {
|
|
|
const item = data.tags.find((item) => item.id === ids[0])
|
|
|
- console.log(item, 'item')
|
|
|
- if(item) changeTag(item, ids[1])
|
|
|
+ if(item) changeTag(item, ids[1])
|
|
|
}
|
|
|
+ } else {
|
|
|
+ data.tagActiveId = ''
|
|
|
+ data.childSelectId = null
|
|
|
+ data.selectParents = {};
|
|
|
}
|
|
|
}
|
|
|
} else {
|