修改
This commit is contained in:
parent
a236819f94
commit
fe5ff3c61d
@ -4,13 +4,11 @@ import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
// import Assocmodule from '@/viewsnew/application/SfcEditor/NavbarEditor/assocPage.vue'
|
||||
import PermissionSet from '@/views/system/manage/index.vue'
|
||||
import UserInfoSet from '@/views/system/manage/user/userinfo.vue'
|
||||
import {useRoute, useRouter } from 'vue-router'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useCache } from '@/data-visualization/hooks/web/useCache'
|
||||
import dataVisualization from '@/data-visualization/index.vue'
|
||||
import FormCreate from '@/views/BuiltInPage/FormCreate.vue'
|
||||
const { wsCache } = useCache()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const props = defineProps({
|
||||
menuList: {
|
||||
type: Array, // 根据实际数据结构调整
|
||||
@ -21,14 +19,14 @@ const props = defineProps({
|
||||
projectName: String,
|
||||
applicationId: String,
|
||||
})
|
||||
const navtitle:any = ref('')
|
||||
const navtitle: any = ref('')
|
||||
const navmenulist: any = ref([
|
||||
])
|
||||
const checkindex = ref(null)
|
||||
const currentMoudleId = ref('')
|
||||
const currentMoudleType = ref('')
|
||||
const currentrow:any = ref({})
|
||||
const userList:any = ref({})
|
||||
const currentrow: any = ref({})
|
||||
const userList: any = ref({})
|
||||
const showcontent = ref('')
|
||||
watch(
|
||||
() => props.menuList,
|
||||
@ -40,20 +38,27 @@ watch(
|
||||
{ immediate: true } // 立即执行一次
|
||||
)
|
||||
function menuclick(index: any) {
|
||||
showcontent.value = ''
|
||||
if (navmenulist.value[index].children.length == 0 || navmenulist.value[index].children == undefined) {
|
||||
checkindex.value = index
|
||||
currentMoudleId.value = navmenulist.value[index].module_id
|
||||
if (navmenulist.value[index].module_id && navmenulist.value[index].module_id !== '') {
|
||||
showcontent.value = ''
|
||||
currentMoudleId.value = navmenulist.value[index].module_id
|
||||
currentrow.value = navmenulist.value[index]
|
||||
if(currentrow.value.module_type == '03'){
|
||||
if (currentrow.value.module_type == '03') {
|
||||
currentMoudleType.value = 'dataV'
|
||||
showcontent.value = 'dataVisualization'
|
||||
}else if(currentrow.value.module_type == '0301'){
|
||||
} else if (currentrow.value.module_type == '0301') {
|
||||
currentMoudleType.value = 'dashboard'
|
||||
showcontent.value = 'dataVisualization'
|
||||
} else if (currentrow.value.module_type == '05') {
|
||||
showcontent.value = 'FormCreate'
|
||||
}
|
||||
const currentInfo = {
|
||||
showcontent: showcontent.value,
|
||||
currentrow: currentrow.value
|
||||
}
|
||||
localStorage.setItem('currentInfo', JSON.stringify(currentInfo))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -62,15 +67,20 @@ function childmenuclick(item: any) {
|
||||
if (item.module_id && item.module_id !== '') {
|
||||
currentrow.value = item
|
||||
currentMoudleId.value = item.module_id
|
||||
if(currentrow.value.module_type == '03'){
|
||||
if (currentrow.value.module_type == '03') {
|
||||
currentMoudleType.value = 'dataV'
|
||||
showcontent.value = 'dataVisualization'
|
||||
}else if(currentrow.value.module_type == '0301'){
|
||||
} else if (currentrow.value.module_type == '0301') {
|
||||
currentMoudleType.value = 'dashboard'
|
||||
showcontent.value = 'dataVisualization'
|
||||
}else if(currentrow.value.module_type == '05'){
|
||||
} else if (currentrow.value.module_type == '05') {
|
||||
showcontent.value = 'FormCreate'
|
||||
}
|
||||
const currentInfo = {
|
||||
showcontent: showcontent.value,
|
||||
currentrow: currentrow.value
|
||||
}
|
||||
localStorage.setItem('currentInfo', JSON.stringify(currentInfo))
|
||||
}
|
||||
}
|
||||
// 时间相关逻辑移动到独立组件中
|
||||
@ -116,14 +126,36 @@ onMounted(() => {
|
||||
navmenulist.value = props.menuList
|
||||
navtitle.value = props.projectName
|
||||
userList.value = JSON.parse(localStorage.getItem('userInfo'))
|
||||
const currentInfo:any = JSON.parse(localStorage.getItem('currentInfo'))
|
||||
if (currentInfo?.showcontent) {
|
||||
if(currentInfo.showcontent !=='FormCreate' && currentInfo.showcontent !=='dataVisualization'){
|
||||
showcontent.value = currentInfo.showcontent
|
||||
}else{
|
||||
currentrow.value = currentInfo.currentrow
|
||||
if (currentrow.value.module_type == '03') {
|
||||
currentMoudleType.value = 'dataV'
|
||||
showcontent.value = 'dataVisualization'
|
||||
} else if (currentrow.value.module_type == '0301') {
|
||||
currentMoudleType.value = 'dashboard'
|
||||
showcontent.value = 'dataVisualization'
|
||||
} else if (currentrow.value.module_type == '05') {
|
||||
showcontent.value = 'FormCreate'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
});
|
||||
function permissionClick() {
|
||||
showcontent.value = 'PermissionSet'
|
||||
const currentInfo = {
|
||||
showcontent: showcontent.value,
|
||||
currentrow: currentrow.value
|
||||
}
|
||||
localStorage.setItem('currentInfo', JSON.stringify(currentInfo))
|
||||
}
|
||||
function logout(){
|
||||
function logout() {
|
||||
ElMessageBox.confirm(
|
||||
'确定退出登录?',
|
||||
'提示',
|
||||
@ -137,14 +169,20 @@ function logout(){
|
||||
localStorage.removeItem('token')
|
||||
localStorage.removeItem('userInfo')
|
||||
localStorage.removeItem('permissions')
|
||||
localStorage.removeItem('currentInfo')
|
||||
router.push({
|
||||
path: '/UserLogin',
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
.catch(() => { })
|
||||
}
|
||||
function userdetails(){
|
||||
function userdetails() {
|
||||
showcontent.value = 'UserInfoSet'
|
||||
const currentInfo = {
|
||||
showcontent: showcontent.value,
|
||||
currentrow: currentrow.value
|
||||
}
|
||||
localStorage.setItem('currentInfo', JSON.stringify(currentInfo))
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
@ -176,15 +214,19 @@ function userdetails(){
|
||||
<div class="Navbar-box-right">
|
||||
<div style="margin-right: 10px;cursor: pointer;" @click="permissionClick"><img
|
||||
src="@/assets/system/navpermission.png" alt=""></div>
|
||||
<div style="margin-right: 10px;cursor: pointer;" @click="userdetails"><img src="@/assets/system/nav1.png" alt=""></div>
|
||||
<div style="margin-right: 15px;min-width: 45px;cursor: pointer;" @click="userdetails">{{ userList.nickname }}</div>
|
||||
<div style="margin-right: 10px;cursor: pointer;" @click="userdetails"><img src="@/assets/system/nav1.png"
|
||||
alt="">
|
||||
</div>
|
||||
<div style="margin-right: 15px;min-width: 45px;cursor: pointer;" @click="userdetails">{{ userList.nickname }}
|
||||
</div>
|
||||
<div style="margin-right: 15px;cursor: pointer;"><img src="@/assets/system/nav3.png" alt=""></div>
|
||||
<div @click="logout" style="cursor: pointer;"><img src="@/assets/system/nav4.png" alt=""></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="system-box-content" style="height: calc(100vh - 65px);">
|
||||
<dataVisualization v-if="showcontent == 'dataVisualization'" :appId="currentrow.module_id" :busiFlag="currentMoudleType" />
|
||||
<dataVisualization v-if="showcontent == 'dataVisualization'" :appId="currentrow.module_id"
|
||||
:busiFlag="currentMoudleType" />
|
||||
<FormCreate v-if="showcontent == 'FormCreate'" :appId="currentrow.module_id" />
|
||||
<PermissionSet v-if="showcontent == 'PermissionSet'" :isshowheader="true" />
|
||||
<UserInfoSet v-if="showcontent == 'UserInfoSet'" :userList="userList" :applicationId="props.applicationId" />
|
||||
|
@ -8,7 +8,6 @@ import { i18n } from '@/data-visualization/plugins/vue-i18n'
|
||||
import * as ElementPlus from 'element-plus'
|
||||
import less from 'less'
|
||||
import defaultTemplate from '@/views/system/userlogin/login.vue?raw'
|
||||
// import { moduleList, moduleById } from '@/api/application/module'
|
||||
import { userLogin } from '@/api/data-visualization/manage/user'
|
||||
import { useCache } from '@/data-visualization/hooks/web/useCache'
|
||||
import { encrypt,decrypt } from '@/utils/rsaEncrypt';
|
||||
@ -76,7 +75,7 @@ const runCode = async () => {
|
||||
try {
|
||||
const response = await fetch(resolvedPath)
|
||||
return { content: await response.text() }
|
||||
} catch (e) {
|
||||
} catch (e:any) {
|
||||
console.error(`文件加载失败: ${resolvedPath}`, e)
|
||||
return { content: '<!-- 文件加载失败 -->' }
|
||||
}
|
||||
@ -94,7 +93,7 @@ const runCode = async () => {
|
||||
filename: 'dynamic.less'
|
||||
})
|
||||
code = code.replace(full, `<style>${css}</style>`)
|
||||
} catch (e) {
|
||||
} catch (e:any) {
|
||||
console.error('Less编译错误:', e.message)
|
||||
code = code.replace(full, `<style>/* Less Error: ${e.message} */</style>`)
|
||||
}
|
||||
@ -121,7 +120,7 @@ const runCode = async () => {
|
||||
const content = await response.text()
|
||||
const { css } = await less.render(content, { filename: fileName })
|
||||
return { content: css, mediaType: 'text/css' }
|
||||
} catch (e) {
|
||||
} catch (e:any) {
|
||||
return { content: `/* Less Error: ${e.message} */`, mediaType: 'text/css' }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user