优化
This commit is contained in:
parent
94e2cc8a0d
commit
568bcdf140
@ -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;
|
||||
|
@ -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>
|
||||
/* 保留原有样式并补充 */
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user