预览加载菜单

This commit is contained in:
jingna 2025-06-17 10:20:02 +08:00
parent d9ce1f746b
commit 98898b9bce
3 changed files with 83 additions and 74 deletions

View File

@ -5,48 +5,67 @@ import { useRoute, useRouter } from 'vue-router'
import { getMenuTree } from '@/api/permission/menu'
import { moduleList } from '@/api/application/module'
const route = useRoute()
const applicationId:any = ref('')
const applicationId: any = ref('')
const menuList = ref([])
const isNavbar = ref(false)
const projectName:any = ref('')
const projectList:any = ref({})
onMounted(()=>{
const projectName: any = ref('')
const projectList: any = ref({})
onMounted(() => {
if (route.query.id) {
applicationId.value = route.query.id
projectName.value = route.query.name
getmenuinfo()
}
})
function getmenuinfo() {
const params = {
appId: applicationId.value,
name:'',
isdisplay:''
}
getMenuTree(params).then(res => {
menuList.value = res.data
const paramss = {appId:applicationId.value}
moduleList(paramss).then(ress => {
var arr = ress.data.data
let list:any = {}
arr.forEach((item:any) => {
if(item.type == '02' && item.node_type == '02'){
list = item
const processMenuTree = (menuNodes: any[], moduleData: any[]) => {
const typeMap = new Map(
moduleData.map(({ id, type }) => [id, type])
);
const traverseMenu = (nodes: any[]) => {
for (const node of nodes) {
if (node.module_id && typeMap.has(node.module_id)) {
node.module_type = typeMap.get(node.module_id);
}
if (node.children?.length) {
traverseMenu(node.children);
}
}
};
traverseMenu(menuNodes);
return menuNodes;
};
function getmenuinfo() {
const params = {
appId: applicationId.value,
name: '',
isdisplay: ''
}
getMenuTree(params).then(res => {
menuList.value = res.data
const paramss = { appId: applicationId.value }
moduleList(paramss).then(ress => {
var arr = ress.data.data
let list: any = {}
menuList.value = processMenuTree(menuList.value, arr)
arr.forEach((item: any) => {
if (item.type == '02' && item.node_type == '02') {
list = item
}
})
if (list.id) {
projectList.value = list
isNavbar.value = true
}
})
if(list.id){
projectList.value = list
isNavbar.value = true
}
})
})
}
</script>
<template>
<div class="system-box">
<Navbar v-if="isNavbar" :menuList="menuList" :projectName="projectName"
:isFixed="true" :projectId="projectList.id" :applicationId="applicationId" :isExecuteEvent="false">
</Navbar>
<Navbar v-if="isNavbar" :menuList="menuList" :projectName="projectName" :isFixed="true"
:projectId="projectList.id" :applicationId="applicationId" :isExecuteEvent="false">
</Navbar>
</div>
</template>

View File

@ -43,7 +43,13 @@ function menuclick(index: any) {
return
}
currentMoudleId.value = navmenulist.value[index].module_id
showmodule.value = true
if (navmenulist.value[index].module_id && navmenulist.value[index].module_id !== '') {
currentMoudleId.value = navmenulist.value[index].module_id
currentrow.value = navmenulist.value[index]
showmodule.value = true
showermission.value = false
showUserInfo.value = false
}
}
}
function childmenuclick(item: any) {
@ -54,8 +60,8 @@ function childmenuclick(item: any) {
showmodule.value = false
showUserInfo.value = false
if (item.module_id && item.module_id !== '') {
currentrow.value = item
currentMoudleId.value = item.module_id
console.log('传递给 Assocmodule 的 props:',item)
showmodule.value = true
} else {
showmodule.value = false
@ -179,7 +185,7 @@ function userdetails(){
<div v-if="!props.isExecuteEvent" class="system-box-content"
:style="{ height: props.isFixed ? 'calc(100vh - 65px)' : 'calc(100vh - 125px)' }">
<Assocmodule v-if="showmodule" :applicationId="props.applicationId"
:moduleinfo="{ module_id: currentMoudleId }" />
:moduleinfo="currentrow" />
<PermissionSet v-if="showermission" />
<UserInfoSet v-if="showUserInfo" :applicationId="props.applicationId" />
</div>

View File

@ -1,5 +1,5 @@
<script lang="ts" setup>
import { ref, onMounted, onUnmounted,computed, reactive,nextTick,onBeforeMount, watch } from 'vue'
import { ref, onMounted, onUnmounted, computed, reactive, nextTick, onBeforeMount, watch } from 'vue'
import DvPreview from '@/viewsnew/data-visualization/DvPreview.vue'
import FormCreate from '@/viewsnew/common/FormCreate.vue'
import { initCanvasData } from '@/utils/canvasUtils'
@ -7,8 +7,8 @@ import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { moduleList } from '@/api/application/module'
import Navbar from '@/viewsnew/application/SfcEditor/NavbarEditor/assocPage.vue'
const props = defineProps({
moduleinfo:Object,
applicationId:String
moduleinfo: Object,
applicationId: String
})
const dvMainStore = dvMainStoreWithOut()
const showPosition = ref("preview")
@ -20,7 +20,7 @@ const state = reactive({
dvInfo: null,
curPreviewGap: 0
})
const moduleInfo = ref({})
const moduleInfo = ref({})
const isFormCreate = ref(false)
const busiFlag = ref('dataV')
const dataInitState = ref(true)
@ -69,36 +69,30 @@ onBeforeMount(() => {
dvMainStore.canvasDataInit()
})
function getInit() {
loading.value = true
let params = {appId:props.applicationId}
moduleList(params).then(res => {
let list:any = {}
const arr = res.data.data
arr.forEach((item:any) => {
if(item.id === props.moduleinfo.module_id){
list = item
}
})
handleNodeClick(list)
})
loading.value = true
const params = {
id: props.moduleinfo.module_id,
type: props.moduleinfo.module_type
}
handleNodeClick(params)
}
function handleNodeClick(e){
function handleNodeClick(e) {
isFormCreate.value = false
dataInitState.value = false
isNavbar.value = false
if(e.type == '0301'){
if (e.type == '0301') {
busiFlag.value = 'dashboard'
loadCanvasData(e.id,9,0)
loadCanvasData(e.id, 9, 0)
loading.value = false
}else if(e.type == '03'){
} else if (e.type == '03') {
busiFlag.value = 'dataV'
loading.value = false
loadCanvasData(e.id,9,0)
}else if(e.type == '04'||e.type == '05'||e.type == '06'){
loadCanvasData(e.id, 9, 0)
} else if (e.type == '04' || e.type == '05' || e.type == '06') {
moduleInfo.value = e
isFormCreate.value = true
loading.value = false
} else if(e.type == '02'){
} else if (e.type == '02') {
isNavbar.value = true
loading.value = false
}
@ -106,23 +100,13 @@ function handleNodeClick(e){
}
</script>
<template>
<div v-loading="loading" style="width: 100%;height: 100%;overflow: hidden;">
<dv-preview
ref="dvPreviewRef"
class="dvPreviewRef"
v-if="state.canvasStylePreview && dataInitState"
:show-position="showPosition"
:canvas-data-preview="state.canvasDataPreview"
:canvas-style-preview="state.canvasStylePreview"
:canvas-view-info-preview="state.canvasViewInfoPreview"
:dv-info="state.dvInfo"
:cur-preview-gap="state.curPreviewGap"
:download-status="downloadStatus"
></dv-preview>
<form-create v-if="isFormCreate" :moduleInfo="moduleInfo"></form-create>
<Navbar v-if="isNavbar"></Navbar>
</div>
<div v-loading="loading" style="width: 100%;height: 100%;overflow: hidden;">
<dv-preview ref="dvPreviewRef" class="dvPreviewRef" v-if="state.canvasStylePreview && dataInitState"
:show-position="showPosition" :canvas-data-preview="state.canvasDataPreview"
:canvas-style-preview="state.canvasStylePreview" :canvas-view-info-preview="state.canvasViewInfoPreview"
:dv-info="state.dvInfo" :cur-preview-gap="state.curPreviewGap" :download-status="downloadStatus"></dv-preview>
<form-create v-if="isFormCreate" :moduleInfo="moduleInfo"></form-create>
<Navbar v-if="isNavbar"></Navbar>
</div>
</template>
<style lang="less" scoped>
</style>
<style lang="less" scoped></style>