forked from github/dataease
refactor: 视图新建追加自动点击事件,当前新加视图高亮显示
This commit is contained in:
parent
92bdf3717c
commit
abb9f45698
@ -422,7 +422,9 @@ export default {
|
||||
searchMap: {
|
||||
all: this.$t('commons.all'),
|
||||
folder: this.$t('commons.folder')
|
||||
}
|
||||
},
|
||||
currentNodeData: {},
|
||||
currentKey: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -626,16 +628,28 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
initCurrentNode() {
|
||||
if (this.currentKey) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.chartTreeRef.setCurrentKey(this.currentKey)
|
||||
this.$nextTick(() => {
|
||||
document.querySelector('.is-current').firstChild.click()
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
treeNode(cache = false) {
|
||||
const modelInfo = localStorage.getItem('chart-tree')
|
||||
const userCache = (modelInfo && cache)
|
||||
if (userCache) {
|
||||
this.tData = JSON.parse(modelInfo)
|
||||
this.initCurrentNode()
|
||||
}
|
||||
queryAuthModel({ modelType: 'chart' }, !userCache).then(res => {
|
||||
localStorage.setItem('chart-tree', JSON.stringify(res.data))
|
||||
if (!userCache) {
|
||||
this.tData = res.data
|
||||
this.initCurrentNode()
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -655,6 +669,7 @@ export default {
|
||||
},
|
||||
|
||||
nodeClick(data, node) {
|
||||
this.currentNodeData = data
|
||||
if (data.modelInnerType !== 'group') {
|
||||
this.$emit('switchComponent', { name: 'ChartEdit', param: data })
|
||||
}
|
||||
@ -767,8 +782,7 @@ export default {
|
||||
this.$emit('newViewInfo', { 'id': response.data.id })
|
||||
} else {
|
||||
_this.expandedArray.push(response.data.sceneId)
|
||||
_this.$refs.chartTreeRef.setCurrentKey(response.data.id)
|
||||
_this.$emit('switchComponent', { name: 'ChartEdit', param: response.data })
|
||||
_this.currentKey = response.data.id
|
||||
_this.treeNode()
|
||||
}
|
||||
})
|
||||
@ -923,6 +937,11 @@ export default {
|
||||
},
|
||||
searchTypeClick(searchTypeInfo) {
|
||||
this.searchType = searchTypeInfo
|
||||
},
|
||||
nodeTypeChange(newType) {
|
||||
if (this.currentNodeData) {
|
||||
this.currentNodeData.modelInnerType = newType
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,12 +2,12 @@
|
||||
<de-container v-loading="$store.getters.loadingMap[$store.getters.currentPath]">
|
||||
|
||||
<de-aside-container>
|
||||
<group :save-status="saveStatus" @switchComponent="switchComponent" />
|
||||
<group ref="group" :save-status="saveStatus" @switchComponent="switchComponent" />
|
||||
</de-aside-container>
|
||||
|
||||
<de-main-container>
|
||||
<!-- <router-view />-->
|
||||
<component :is="component" :param="param" @switchComponent="switchComponent" @saveSuccess="saveSuccess" />
|
||||
<component :is="component" :param="param" @switchComponent="switchComponent" @saveSuccess="saveSuccess" @typeChange="typeChange" />
|
||||
</de-main-container>
|
||||
</de-container>
|
||||
</template>
|
||||
@ -49,6 +49,9 @@ export default {
|
||||
},
|
||||
saveSuccess(val) {
|
||||
this.saveStatus = val
|
||||
},
|
||||
typeChange(newType) {
|
||||
this.$refs.group.nodeTypeChange(newType)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1100,6 +1100,7 @@ export default {
|
||||
if (newVal === 'map' && newVal !== oldVal) {
|
||||
this.initAreas()
|
||||
}
|
||||
this.$emit('typeChange', newVal)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
Loading…
Reference in New Issue
Block a user