This commit is contained in:
jingna 2025-06-23 18:28:14 +08:00
parent 94e2cc8a0d
commit 568bcdf140
5 changed files with 97 additions and 113 deletions

View File

@ -120,17 +120,19 @@ function menuclick(name:any){
color: #383838;
}
:deep(.ed-button){
border-color: #dcdfe6;
border-color: #dcdfe6 !important;
background-color:#ffffff !important;
color: #1f2329 !important;
}
:deep(.ed-button--primary){
background-color:#409eff;
color: #ffffff;
border-color: #409eff;
background-color:#409eff !important;
color: #ffffff !important;
border-color: #409eff !important;
}
:deep(.ed-button.is-disabled){
background: #ffffff;
color:#C9C9C9;
border-color: #f2f2f2;
background: #ffffff !important;
color:#C9C9C9 !important;
border-color: #f2f2f2 !important;
}
:deep(.ed-button.is-disabled, .ed-button.is-disabled:focus, .ed-button.is-disabled:hover){
background: #ffffff;

View File

@ -21,9 +21,6 @@ const router = useRouter()
const sfcCode = ref(defaultTemplate)
const previewContainer:any = ref(null)
let prevApp:any = null
const projectName:any = ref('')
const applicationId:any = ref('')
const menuList:any= ref([])
// Base64
const convertToBase64 = async (imagePath:any) => {
try {
@ -119,8 +116,6 @@ const runCode = async () => {
const componentModule:any = await loadModule('dynamic.vue', options)
const component = componentModule.default || componentModule
const dynamicProps = Vue.reactive({
menuList: menuList.value,
applicationId: applicationId.value,
})
// createApp
prevApp = Vue.createApp({
@ -147,40 +142,9 @@ const runCode = async () => {
}
}
onMounted(() => {
const appInfo:any = JSON.parse(localStorage.getItem('userInfo'))
if (appInfo.id) {
applicationId.value = appInfo.id
getmenuinfo()
}
})
function gettreeData(orglist:any) {
const res:any = {};
for (const row of orglist) {
// parentid
const parentid = row.parentid || "0";
const { id, name,code, isdisplay, appId, type,module_id,module_type } = row;
//
const nodeData = { parentid, id, name,code, isdisplay, appId, type,module_id,module_type }
//
if (res[id]) {
Object.assign(res[id], nodeData);
} else {
res[id] = { ...nodeData, children: [] };
}
//
if (res[parentid]) {
res[parentid].children.push(res[id]);
} else {
res[parentid] = { children: [res[id]] };
}
}
return res[0].children;
}
function getmenuinfo() {
const permissions:any = JSON.parse(localStorage.getItem('permissions'))
menuList.value = gettreeData(permissions)
runCode()
}
})
</script>
<style>
/* 保留原有样式并补充 */

View File

@ -5,18 +5,9 @@ import { ElMessage, ElMessageBox } from 'element-plus'
import PermissionSet from '@/views/system/manage/index.vue'
import UserInfoSet from '@/views/system/manage/user/userinfo.vue'
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 router = useRouter()
const props = defineProps({
menuList: {
type: Array, //
required: true, //
default: () => [] //
},
applicationId: String,
})
const navtitle: any = ref('')
const navmenulist: any = ref([
])
@ -26,15 +17,7 @@ const currentMoudleType = ref('')
const currentrow: any = ref({})
const userList: any = ref({})
const showcontent = ref('')
watch(
() => props.menuList,
(newVal) => {
if (newVal) {
navmenulist.value = newVal
}
},
{ immediate: true } //
)
const applicationId = ref('')
function menuclick(index: any) {
if (navmenulist.value[index].children.length == 0 || navmenulist.value[index].children == undefined) {
checkindex.value = index
@ -92,7 +75,7 @@ const TimeDisplay = {
setup() {
const currentTime = shallowRef('')
const currentDate = shallowRef('')
let timer: number
let timer: any
function updateTime() {
const now = new Date();
@ -121,10 +104,18 @@ const TimeDisplay = {
}
}
onMounted(() => {
navmenulist.value = props.menuList
userList.value = JSON.parse(localStorage.getItem('userInfo'))
init()
})
onBeforeUnmount(() => {
});
function init(){
userList.value = JSON.parse(localStorage.getItem('userInfo') || '{}')
navtitle.value = userList.value.app_name
const currentInfo:any = JSON.parse(localStorage.getItem('currentInfo'))
applicationId.value = userList.id
const permissions:any = JSON.parse(localStorage.getItem('permissions')|| '{}')
navmenulist.value = gettreeData(permissions)
const currentInfo:any = JSON.parse(localStorage.getItem('currentInfo')|| '{}')
if (currentInfo?.showcontent) {
if(currentInfo.showcontent !=='FormCreate' && currentInfo.showcontent !=='dataVisualization'){
showcontent.value = currentInfo.showcontent
@ -141,10 +132,30 @@ onMounted(() => {
}
}
}
})
onBeforeUnmount(() => {
});
}
function gettreeData(orglist:any) {
const res:any = {};
for (const row of orglist) {
// parentid
const parentid = row.parentid || "0";
const { id, name,code, isdisplay, appId, type,module_id,module_type } = row;
//
const nodeData = { parentid, id, name,code, isdisplay, appId, type,module_id,module_type }
//
if (res[id]) {
Object.assign(res[id], nodeData);
} else {
res[id] = { ...nodeData, children: [] };
}
//
if (res[parentid]) {
res[parentid].children.push(res[id]);
} else {
res[parentid] = { children: [res[id]] };
}
}
return res[0].children;
}
function permissionClick() {
showcontent.value = 'PermissionSet'
const currentInfo = {
@ -168,8 +179,11 @@ function logout() {
localStorage.removeItem('userInfo')
localStorage.removeItem('permissions')
localStorage.removeItem('currentInfo')
router.push({
path: '/UserLogin',
const router = useRouter()
router.push({ path: '/UserLogin' })
.catch((err:any) => {
console.error("路由跳转失败:", err)
// ElMessage.error("")
})
})
.catch(() => { })
@ -227,7 +241,7 @@ function userdetails() {
: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" />
<UserInfoSet v-if="showcontent == 'UserInfoSet'" :userList="userList" :applicationId="applicationId" />
</div>
</div>
</template>

View File

@ -10,11 +10,6 @@ import { useUserStore } from '@/store/user'
import { set } from 'lodash'
const router = useRouter()
const userStore = useUserStore()
const props = defineProps({
id: String,
name: String,
isExecuteEvent: Boolean,
})
const form = ref({
username: '',
password: ''
@ -30,13 +25,25 @@ const loginRules = ref({
const ruleFormRef = ref<FormInstance>()
const loginTitle: any = ref('')
const errormsg = ref('')
const doubleClick = ref(false)
const submitForm = async (formEl: FormInstance | undefined) => {
if (props.isExecuteEvent) {
return
}
if (!formEl) return
await formEl.validate((valid, fields) => {
if (valid) {
if (doubleClick.value) {
return
}
doubleClick.value = true
localStorage.getItem('userInfo')
if (localStorage.getItem('userInfo')) {
localStorage.removeItem('userInfo')
}
if (localStorage.getItem('token')) {
localStorage.removeItem('token')
}
if (localStorage.getItem('permissions')) {
localStorage.removeItem('permissions')
}
var password = encrypt(form.value.password)
const params = {
username: form.value.username,
@ -59,12 +66,15 @@ const submitForm = async (formEl: FormInstance | undefined) => {
router.push({
path: '/AppFrame',
})
doubleClick.value = true
} else {
errormsg.value = res.msg
doubleClick.value = true
return
}
}).catch((err: any) => {
errormsg.value = err
doubleClick.value = true
})
} else {
@ -72,7 +82,7 @@ const submitForm = async (formEl: FormInstance | undefined) => {
})
}
onMounted(() => {
loginTitle.value = props.name
loginTitle.value = '测试'
})
onBeforeUnmount(() => {
@ -102,7 +112,7 @@ onBeforeUnmount(() => {
</el-form-item>
<el-form-item label="" prop="password">
<div class="logininput">
<el-input v-model="form.password" show-password placeholder="请输入密码" type="password">
<el-input v-model="form.password" show-password placeholder="请输入密码" type="password" @keyup.enter.native="submitForm(ruleFormRef)">
<template #prepend>
<img src="@/assets/system/password.png" alt="">
</template>

View File

@ -139,13 +139,7 @@ const runCode = async () => {
const componentModule:any = await loadModule('dynamic.vue', options)
const component = componentModule.default || componentModule
const dynamicProps = ref({
id: '1927554158852841473',
name: '测试',
isExecuteEvent: false
})
// prevApp = Vue.createApp({
// render: () => Vue.h(component, dynamicProps.value)
// })
prevApp = Vue.createApp({
render: () => Vue.h(component, {
...dynamicProps.value,