Merge pull request #10491 from dataease/pr@dev@fix_default-auth
fix(仪表板): 修复未给用户授权对默认仪表板的管理权限,用户却可以设置默认仪表板问题 #10442
This commit is contained in:
commit
a0c8e6cf0e
@ -167,7 +167,7 @@ public class PanelGroupService {
|
|||||||
panelGroupRequest.setUserId(userId);
|
panelGroupRequest.setUserId(userId);
|
||||||
panelGroupRequest.setIsAdmin(AuthUtils.getUser().getIsAdmin());
|
panelGroupRequest.setIsAdmin(AuthUtils.getUser().getIsAdmin());
|
||||||
List<PanelGroupDTO> panelGroupDTOList = extPanelGroupMapper.panelGroupListDefault(panelGroupRequest);
|
List<PanelGroupDTO> panelGroupDTOList = extPanelGroupMapper.panelGroupListDefault(panelGroupRequest);
|
||||||
return TreeUtils.mergeTree(panelGroupDTOList, "default_panel");
|
return TreeUtils.mergeTree(panelGroupDTOList, "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PanelGroup> list() {
|
public List<PanelGroup> list() {
|
||||||
|
|||||||
@ -94,7 +94,7 @@
|
|||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row class="de-tree">
|
<el-row class="de-tree" v-if="hasDataPermission('view', rootDefaultAuth)">
|
||||||
<span class="header-title">{{ $t('panel.default_panel') }}</span>
|
<span class="header-title">{{ $t('panel.default_panel') }}</span>
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<el-tree
|
<el-tree
|
||||||
@ -356,7 +356,7 @@
|
|||||||
{{ $t('panel.create_public_links') }}
|
{{ $t('panel.create_public_links') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
v-if="data.nodeType === 'panel'"
|
v-if="data.nodeType === 'panel' && hasDataPermission('manage', rootDefaultAuth)"
|
||||||
:disabled="data.isDefault"
|
:disabled="data.isDefault"
|
||||||
icon="el-icon-copy-document"
|
icon="el-icon-copy-document"
|
||||||
:command="beforeClickMore('toDefaultPanel', data, node)"
|
:command="beforeClickMore('toDefaultPanel', data, node)"
|
||||||
@ -536,6 +536,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
rootAuth: '',
|
rootAuth: '',
|
||||||
|
rootDefaultAuth: 'view',
|
||||||
originResourceTree: [],
|
originResourceTree: [],
|
||||||
curSortType: 'time_desc',
|
curSortType: 'time_desc',
|
||||||
localSortParams: null,
|
localSortParams: null,
|
||||||
@ -1041,11 +1042,12 @@ export default {
|
|||||||
this.activeDefaultNodeAndClickOnly(this.defaultData[0].id)
|
this.activeDefaultNodeAndClickOnly(this.defaultData[0].id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const currentKey = this.$refs.default_panel_tree.getCurrentKey()
|
|
||||||
defaultTree(requestInfo, false).then((res) => {
|
defaultTree(requestInfo, false).then((res) => {
|
||||||
localStorage.setItem('panel-default-tree', JSON.stringify(res.data))
|
this.rootDefaultAuth = res.data ? res.data[0]?.privileges || '' : ''
|
||||||
|
const resDefaultData = res.data ? res.data[0]?.children || [] : []
|
||||||
|
localStorage.setItem('panel-default-tree', JSON.stringify(resDefaultData))
|
||||||
if (!userCache) {
|
if (!userCache) {
|
||||||
this.defaultData = res.data || []
|
this.defaultData = resDefaultData
|
||||||
if (showFirst && this.defaultData && this.defaultData.length > 0) {
|
if (showFirst && this.defaultData && this.defaultData.length > 0) {
|
||||||
this.activeDefaultNodeAndClickOnly(this.defaultData[0].id)
|
this.activeDefaultNodeAndClickOnly(this.defaultData[0].id)
|
||||||
}
|
}
|
||||||
@ -1055,12 +1057,15 @@ export default {
|
|||||||
this.$refs.default_panel_tree.filter(this.filterText)
|
this.$refs.default_panel_tree.filter(this.filterText)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
this.$nextTick(() => {
|
||||||
|
const currentKey = this.$refs.default_panel_tree?.getCurrentKey()
|
||||||
if (currentKey) {
|
if (currentKey) {
|
||||||
this.$nextTick(() =>{
|
this.$nextTick(() =>{
|
||||||
this.$refs.default_panel_tree.setCurrentKey(currentKey)
|
this.$refs.default_panel_tree.setCurrentKey(currentKey)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeClick(data, node) {
|
nodeClick(data, node) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user