优化代码

This commit is contained in:
RuoYi
2025-03-05 18:23:05 +08:00
parent 5784bc7eb5
commit 8fccdd4efe
6 changed files with 118 additions and 170 deletions

View File

@@ -131,10 +131,6 @@ aside {
position: relative;
}
.pagination-container {
margin-top: 30px;
}
.text-center {
text-align: center
}

View File

@@ -102,21 +102,12 @@
/** 表格布局 **/
.pagination-container {
position: relative;
height: 25px;
margin-bottom: 10px;
margin-top: 15px;
padding: 10px 20px !important;
display: flex;
justify-content: flex-end;
margin-top: 20px;
background-color: transparent !important;
}
/* 分页器定位 */
.pagination-container .el-pagination {
position: absolute;
right: 0;
top: 0;
}
/* 弹窗中的分页器 */
.el-dialog .pagination-container {
position: static !important;
@@ -207,8 +198,6 @@
}
.card-box {
padding-right: 15px;
padding-left: 15px;
margin-bottom: 10px;
}

View File

@@ -97,7 +97,6 @@ function handleCurrentChange(val) {
<style scoped>
.pagination-container {
background: #fff;
padding: 32px 16px;
}
.pagination-container.hidden {
display: none;

View File

@@ -1,8 +1,8 @@
<template>
<div class="navbar">
<hamburger id="hamburger-container" :is-active="appStore.sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!settingsStore.topNav" />
<top-nav id="topmenu-container" class="topmenu-container" v-if="settingsStore.topNav" />
<breadcrumb v-if="!settingsStore.topNav" id="breadcrumb-container" class="breadcrumb-container" />
<top-nav v-if="settingsStore.topNav" id="topmenu-container" class="topmenu-container" />
<div class="right-menu">
<template v-if="appStore.device !== 'mobile'">

View File

@@ -85,28 +85,13 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
function filterChildren(childrenMap, lastRouter = false) {
var children = []
childrenMap.forEach((el, index) => {
if (el.children && el.children.length) {
if (el.component === 'ParentView' && !lastRouter) {
el.children.forEach(c => {
c.path = el.path + '/' + c.path
if (c.children && c.children.length) {
children = children.concat(filterChildren(c.children, c))
return
}
children.push(c)
})
return
}
}
if (lastRouter) {
el.path = lastRouter.path + '/' + el.path
if (el.children && el.children.length) {
childrenMap.forEach(el => {
el.path = lastRouter ? lastRouter.path + '/' + el.path : el.path
if (el.children && el.children.length && el.component === 'ParentView') {
children = children.concat(filterChildren(el.children, el))
return
} else {
children.push(el)
}
}
children = children.concat(el)
})
return children
}
@@ -136,7 +121,7 @@ export const loadView = (view) => {
res = () => modules[path]();
}
}
return res;
return res
}
export default usePermissionStore

View File

@@ -1,5 +1,3 @@
/**
* 通用js方法封装处理
* Copyright (c) 2019 ruoyi
@@ -86,7 +84,7 @@ export function selectDictLabel(datas, value) {
return actions.join('');
}
// 回显数据字典(字符串数组)
// 回显数据字典(字符串数组)
export function selectDictLabels(datas, value, separator) {
if (value === undefined || value.length ===0) {
return "";
@@ -165,37 +163,19 @@ export function handleTree(data, id, parentId, children) {
};
var childrenListMap = {};
var nodeIds = {};
var tree = [];
for (let d of data) {
let parentId = d[config.parentId];
if (childrenListMap[parentId] == null) {
childrenListMap[parentId] = [];
}
nodeIds[d[config.id]] = d;
childrenListMap[parentId].push(d);
let id = d[config.id];
childrenListMap[id] = d;
}
for (let d of data) {
let parentId = d[config.parentId];
if (nodeIds[parentId] == null) {
let parentId = d[config.parentId]
let parentObj = childrenListMap[parentId]
if (!parentObj) {
tree.push(d);
}
}
for (let t of tree) {
adaptToChildrenList(t);
}
function adaptToChildrenList(o) {
if (childrenListMap[o[config.id]] !== null) {
o[config.childrenList] = childrenListMap[o[config.id]];
}
if (o[config.childrenList]) {
for (let c of o[config.childrenList]) {
adaptToChildrenList(c);
}
} else {
parentObj[config.childrenList].push(d)
}
}
return tree;
@@ -227,7 +207,6 @@ export function tansParams(params) {
return result
}
// 返回项目路径
export function getNormalPath(p) {
if (p.length === 0 || !p || p == 'undefined') {