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