Merge remote-tracking branch 'origin/main'

This commit is contained in:
root 2025-06-26 18:27:03 +08:00
commit e5bcf392fd
5 changed files with 96 additions and 114 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 = {
@ -153,6 +164,9 @@ function permissionClick() {
}
localStorage.setItem('currentInfo', JSON.stringify(currentInfo))
}
function routerlink(){
router.push({ path: '/UserLogin' })
}
function logout() {
ElMessageBox.confirm(
'确定退出登录?',
@ -168,9 +182,7 @@ function logout() {
localStorage.removeItem('userInfo')
localStorage.removeItem('permissions')
localStorage.removeItem('currentInfo')
router.push({
path: '/UserLogin',
})
routerlink()
})
.catch(() => { })
}
@ -227,7 +239,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

@ -5,16 +5,11 @@ import { ElMessage } from 'element-plus'
import { useRoute, useRouter } from 'vue-router'
import { userLogin } from '@/api/data-visualization/manage/user'
import { useCache } from '@/data-visualization/hooks/web/useCache'
import { encrypt,decrypt } from '@/utils/rsaEncrypt';
import { encrypt, decrypt } from '@/utils/rsaEncrypt';
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,41 +25,56 @@ 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,
password: password
}
userLogin(params).then((res:any) => {
if(res.code == '0'){
userLogin(params).then((res: any) => {
if (res.code == '0') {
errormsg.value = ''
let userInfo:any = {
let userInfo: any = {
nickname: res.data.nickname,
username: res.data.username,
id: res.data.userid,
appid:res.data.appid,
appid: res.data.appid,
app_name: res.data.app_name
}
localStorage.setItem('userInfo',JSON.stringify(userInfo))
localStorage.setItem('userInfo', JSON.stringify(userInfo))
localStorage.setItem('token', res.data.token)
localStorage.setItem('permissions', JSON.stringify(res.data.permissions))
ElMessage.success('登录成功')
router.push({
path: '/AppFrame',
})
}else{
doubleClick.value = true
} else {
errormsg.value = res.msg
doubleClick.value = true
return
}
}).catch((err:any) => {
}).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>
@ -111,7 +121,7 @@ onBeforeUnmount(() => {
style="width:100%;height: 1px;" alt="">
</div>
</el-form-item>
<div style="color:red;margin-top:10px">{{errormsg}}</div>
<div style="color:red;margin-top:10px">{{ errormsg }}</div>
<div class="login-button" @click="submitForm(ruleFormRef)">登录</div>
</el-form>
</div>

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,