优化代码

This commit is contained in:
RuoYi
2025-03-05 20:28:38 +08:00
parent 15b2502ffa
commit 4257ca91b2
21 changed files with 80 additions and 124 deletions

View File

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

View File

@@ -117,11 +117,9 @@
/** 表格布局 **/
.pagination-container {
position: relative;
height: 32px;
margin-bottom: 10px;
margin-top: 15px;
padding: 10px 20px !important;
display: flex;
justify-content: flex-end;
margin-top: 20px;
}
/* tree border */
@@ -132,11 +130,6 @@
border-radius: 4px;
}
.pagination-container .el-pagination {
right: 0;
position: absolute;
}
@media (max-width: 768px) {
.pagination-container .el-pagination > .el-pagination__jump {
display: none !important;
@@ -201,8 +194,6 @@
}
.card-box {
padding-right: 15px;
padding-left: 15px;
margin-bottom: 10px;
}

View File

@@ -106,7 +106,6 @@ export default {
<style scoped>
.pagination-container {
background: #fff;
padding: 32px 16px;
}
.pagination-container.hidden {
display: none;

View File

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

View File

@@ -82,28 +82,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
}
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))
} else {
children.push(el)
}
if (lastRouter) {
el.path = lastRouter.path + '/' + el.path
if (el.children && el.children.length) {
children = children.concat(filterChildren(el.children, el))
return
}
}
children = children.concat(el)
})
return children
}

View File

@@ -1,5 +1,3 @@
/**
* 通用js方法封装处理
* Copyright (c) 2019 ruoyi
@@ -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,6 +207,18 @@ export function tansParams(params) {
return result
}
// 返回项目路径
export function getNormalPath(p) {
if (p.length === 0 || !p || p == 'undefined') {
return p
};
let res = p.replace('//', '/')
if (res[res.length - 1] === '/') {
return res.slice(0, res.length - 1)
}
return res
}
// 验证是否为blob格式
export function blobValidate(data) {
return data.type !== 'application/json'

View File

@@ -1,13 +1,5 @@
<template>
<div class="app-container home">
<el-row :gutter="20">
<el-col :sm="24" :lg="24">
<blockquote class="text-warning" style="font-size: 14px">
阿里云服务器折扣区<el-link href="http://aly.ruoyi.vip" type="primary" target="_blank">点我进入</el-link> &nbsp;&nbsp;&nbsp; 腾讯云服务器秒杀区<el-link href="http://txy.ruoyi.vip" type="primary" target="_blank">点我进入</el-link>
</blockquote>
<hr />
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :sm="24" :lg="12" style="padding-left: 20px">
<h2>若依后台管理框架</h2>

View File

@@ -153,7 +153,7 @@ export default {
// 日期范围
dateRange: [],
// 默认排序
defaultSort: {prop: 'accessTime', order: 'descending'},
defaultSort: { prop: "accessTime", order: "descending" },
// 查询参数
queryParams: {
pageNum: 1,

View File

@@ -231,7 +231,7 @@ export default {
// 日期范围
dateRange: [],
// 默认排序
defaultSort: {prop: 'operTime', order: 'descending'},
defaultSort: { prop: "operTime", order: "descending" },
// 表单参数
form: {},
// 查询参数