首页+侧边栏

This commit is contained in:
朱菊兰 2024-08-05 15:34:57 +08:00
parent ad0acc0f22
commit 38145f08ac
22 changed files with 308 additions and 314 deletions

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title></title>
<g id="页面" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="栏" transform="translate(-383.000000, -639.000000)" fill="#FFFFFF" fill-rule="nonzero">
<g id="制度流程" transform="translate(383.000000, 639.000000)">
<rect id="矩形" opacity="0" x="0" y="0" width="24" height="24"></rect>
<path d="M4.37117174,17.071929 L2.37885068,17.071929 C2.0028361,17.071929 1.69692899,17.3771995 1.69692899,17.7524526 L1.69692899,19.7475474 C1.69692899,20.1227781 2.00283612,20.428071 2.37885068,20.428071 L4.37117174,20.428071 C4.74718632,20.428071 5.05307101,20.1228005 5.05307101,19.7475474 L5.05307101,17.7524526 C5.05307101,17.3771996 4.74718632,17.071929 4.37117174,17.071929 Z M7.36536289,6.40073051 L21.8846371,6.40073051 C22.2245029,6.40073051 22.5,6.06492662 22.5,5.65073051 C22.5,5.2365344 22.2245029,4.90073051 21.8846371,4.90073051 L7.36536289,4.90073051 C7.02549709,4.90073051 6.75,5.23653442 6.75,5.65073054 C6.75,6.06492665 7.02549711,6.40073051 7.36536289,6.40073051 Z M3.14077284,5.95492436 L2.03265569,4.84248673 C1.8767502,4.68597337 1.62348469,4.6854806 1.46697133,4.84138609 C1.4665023,4.8418533 1.46603442,4.84232168 1.46556772,4.84279121 L1.18448184,5.12557972 C1.0295067,5.28149361 1.02939503,5.5332514 1.1842318,5.6893027 L2.85590574,7.37408916 C3.01150401,7.53090793 3.26476807,7.53189735 3.42158685,7.37629907 C3.42263304,7.37526103 3.42367349,7.3742172 3.42470814,7.37316765 L5.7220224,5.04277966 C5.87599957,4.88658572 5.87547971,4.63552909 5.72085699,4.47997417 L5.4403523,4.19777835 C5.28461275,4.04109986 5.0313479,4.04033871 4.87466942,4.19607825 C4.87370895,4.19703297 4.87275333,4.19799256 4.8718026,4.19895698 L3.14077284,5.95492436 L3.14077284,5.95492436 Z M21.8846371,11.25 L7.36536289,11.25 C7.02549709,11.25 6.75,11.5857972 6.75,11.999985 C6.75,12.4141729 7.02552167,12.75 7.36536289,12.75 L21.8846371,12.75 C22.2245029,12.75 22.5,12.4142028 22.5,11.999985 C22.5,11.5857672 22.2245029,11.25 21.8846371,11.25 Z M21.8846371,17.972656 L7.36536289,17.972656 C7.02549709,17.972656 6.75,18.30843 6.75,18.722656 C6.75,19.1368821 7.02552167,19.472656 7.36536289,19.472656 L21.8846371,19.472656 C22.2245029,19.472656 22.5,19.1368821 22.5,18.722656 C22.5,18.30843 22.2245029,17.972656 21.8846371,17.972656 Z M4.37117174,10.321929 L2.37885068,10.321929 C2.0028361,10.321929 1.69692899,10.6271975 1.69692899,11.0024481 L1.69692899,12.9975519 C1.69692899,13.3727801 2.00283612,13.678071 2.37885068,13.678071 L4.37117174,13.678071 C4.74718632,13.678071 5.05307101,13.3728025 5.05307101,12.9975519 L5.05307101,11.0024481 C5.05307101,10.6271975 4.74718632,10.321929 4.37117174,10.321929 Z" id="形状"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -80,7 +80,7 @@
.submenu-title-noDropdown,
.el-submenu__title {
&:hover {
background-color: rgba(0, 0, 0, 0.06) !important;
background-color: #0b58ff !important;
}
}

View File

@ -37,14 +37,14 @@ $base-sub-menu-hover:#001528;
*/
$base-menu-color: #fff;
$base-menu-color-active:#fff;
$base-menu-background:#001529;
$base-menu-background:#1E1651;
$base-logo-title-color: #ffffff;
$base-menu-light-color:rgba(0,0,0,.70);
$base-menu-light-background:#ffffff;
$base-logo-light-title-color: #001529;
$base-sub-menu-background:#0B253F;
$base-sub-menu-background:#15063C;
$base-sub-menu-hover:#0b50ff;

View File

@ -53,8 +53,6 @@ export default {
return {
//
visibleNumber: 5,
// index
// currentIndex: undefined,
};
},
computed: {
@ -140,10 +138,10 @@ export default {
methods: {
//
setVisibleNumber() {
const width = window.innerWidth - 800;
const width = window.innerWidth - 700;
console.log(width);
console.log('window.innerWidth:', window.innerWidth);
this.visibleNumber = parseInt(width / 100);
this.visibleNumber = parseInt(width / 120);
console.log('this.visibleNumber:', this.visibleNumber);
},
//
@ -181,6 +179,7 @@ export default {
},
//
activeRoutes(key) {
this.$store.dispatch('app/setChoicepart', key);
const routes = [];
if (this.childrenMenus && this.childrenMenus.length > 0) {
this.childrenMenus.map((item) => {

View File

@ -10,26 +10,26 @@
</template>
<script>
import iframeToggle from "./IframeToggle/index"
import iframeToggle from './IframeToggle/index';
export default {
name: 'AppMain',
components: { iframeToggle },
computed: {
cachedViews() {
return this.$store.state.tagsView.cachedViews
return this.$store.state.tagsView.cachedViews;
},
key() {
return this.$route.path
}
}
}
return this.$route.path;
},
},
};
</script>
<style lang="scss" scoped>
.app-main {
/* 48= navbar 48 */
min-height: calc(100vh - 56px);
// min-height: calc(100vh - 84px);
min-width: calc(100vh - 280px);
position: relative;
overflow: visible;
@ -39,13 +39,13 @@ export default {
}
.fixed-header + .app-main {
padding-top: 56px;
padding-top: 84px;
}
.hasTagsView {
.app-main {
/* 84 = navbar + tags-view = 50 + 34 */
min-height: calc(100vh - 120px - 8px);
min-height: calc(100vh - 164px);
display: flex;
flex-direction: column;
}

View File

@ -17,7 +17,9 @@ export default {
const vnodes = []
if (icon) {
vnodes.push(<svg-icon icon-class={icon}/>)
vnodes.push(<svg-icon style="font-size: 18px;margin-right: 10px;vertical-align: middle;" icon-class={icon}/>)
} else {
vnodes.push(<span style="display: inline-block; width: 10px;"/>)
}
if (title) {

View File

@ -4,7 +4,7 @@
:class="{ collapse: collapse }"
:style="{
backgroundColor:
sideTheme === 'theme-dark' ? '#1f2d3d' : variables.menuLightBackground,
sideTheme === 'theme-dark' ? '#1E1651' : variables.menuLightBackground,
}">
<!-- sideTheme === 'theme-dark'
? variables.menuBackground

View File

@ -1,96 +0,0 @@
<template>
<div v-if="!item.hidden">
<template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow">
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)">
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">
<item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="onlyOneChild.meta.title" />
</el-menu-item>
</app-link>
</template>
<el-submenu v-else ref="subMenu" :index="resolvePath(item.path)" popper-append-to-body>
<template slot="title">
<item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" />
</template>
<sidebar-item
v-for="(child, index) in item.children"
:key="child.path + index"
:is-nest="true"
:item="child"
:base-path="resolvePath(child.path)"
class="nest-menu"
/>
</el-submenu>
</div>
</template>
<script>
import path from 'path'
import { isExternal } from '@/utils/validate'
import Item from './Item'
import AppLink from './Link'
import FixiOSBug from './FixiOSBug'
export default {
name: 'SidebarItem',
components: { Item, AppLink },
mixins: [FixiOSBug],
props: {
// route object
item: {
type: Object,
required: true
},
isNest: {
type: Boolean,
default: false
},
basePath: {
type: String,
default: ''
}
},
data() {
this.onlyOneChild = null
return {}
},
methods: {
hasOneShowingChild(children = [], parent) {
if (!children) {
children = [];
}
const showingChildren = children.filter(item => {
if (item.hidden) {
return false
} else {
// Temp set(will be used if only has one showing child)
this.onlyOneChild = item
return true
}
})
// When there is only one child router, the child router is displayed by default
if (showingChildren.length === 1) {
return true
}
// Show parent if there are no child router to display
if (showingChildren.length === 0) {
this.onlyOneChild = { ... parent, path: '', noShowingChildren: true }
return true
}
return false
},
resolvePath(routePath) {
if (isExternal(routePath)) {
return routePath
}
if (isExternal(this.basePath)) {
return this.basePath
}
return path.resolve(this.basePath, routePath)
}
}
}
</script>

View File

@ -1,96 +1,107 @@
<template>
<div v-if="!item.hidden">
<template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow">
<template
v-if="
hasOneShowingChild(item.children, item) &&
(!onlyOneChild.children || onlyOneChild.noShowingChildren) &&
!item.alwaysShow
">
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)">
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">
<item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="onlyOneChild.meta.title" />
<el-menu-item
:index="resolvePath(onlyOneChild.path)"
:class="{ 'submenu-title-noDropdown': !isNest }">
<item icon="menuIcon" :title="onlyOneChild.meta.title" />
</el-menu-item>
</app-link>
</template>
<el-submenu v-else ref="subMenu" :index="resolvePath(item.path)" popper-append-to-body>
<el-submenu
v-else
ref="subMenu"
:index="resolvePath(item.path)"
popper-append-to-body>
<template slot="title">
<item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" />
<item v-if="item.meta" icon="menuIcon" :title="item.meta.title" />
</template>
<sidebar-item
<sidebar-item-sub
v-for="(child, index) in item.children"
:key="child.path + index"
:is-nest="true"
:item="child"
:base-path="resolvePath(child.path)"
class="nest-menu"
/>
class="nest-menu" />
</el-submenu>
</div>
</template>
<script>
import path from 'path'
import { isExternal } from '@/utils/validate'
import Item from './Item'
import AppLink from './Link'
import FixiOSBug from './FixiOSBug'
import path from 'path';
import { isExternal } from '@/utils/validate';
import Item from './Item';
import AppLink from './Link';
import FixiOSBug from './FixiOSBug';
import SidebarItemSub from './SidebarItemSub';
export default {
name: 'SidebarItem',
components: { Item, AppLink },
components: { Item, AppLink, SidebarItemSub },
mixins: [FixiOSBug],
props: {
// route object
item: {
type: Object,
required: true
required: true,
},
isNest: {
type: Boolean,
default: false
default: false,
},
basePath: {
type: String,
default: ''
}
default: '',
},
},
data() {
this.onlyOneChild = null
return {}
this.onlyOneChild = null;
return {};
},
methods: {
hasOneShowingChild(children = [], parent) {
if (!children) {
children = [];
}
const showingChildren = children.filter(item => {
const showingChildren = children.filter((item) => {
if (item.hidden) {
return false
return false;
} else {
// Temp set(will be used if only has one showing child)
this.onlyOneChild = item
return true
this.onlyOneChild = item;
return true;
}
})
});
// When there is only one child router, the child router is displayed by default
if (showingChildren.length === 1) {
return true
return true;
}
// Show parent if there are no child router to display
if (showingChildren.length === 0) {
this.onlyOneChild = { ... parent, path: '', noShowingChildren: true }
return true
this.onlyOneChild = { ...parent, path: '', noShowingChildren: true };
return true;
}
return false
return false;
},
resolvePath(routePath) {
if (isExternal(routePath)) {
return routePath
return routePath;
}
if (isExternal(this.basePath)) {
return this.basePath
}
return path.resolve(this.basePath, routePath)
}
}
return this.basePath;
}
return path.resolve(this.basePath, routePath);
},
},
};
</script>

View File

@ -0,0 +1,106 @@
<template>
<div v-if="!item.hidden">
<template
v-if="
hasOneShowingChild(item.children, item) &&
(!onlyOneChild.children || onlyOneChild.noShowingChildren) &&
!item.alwaysShow
">
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)">
<el-menu-item
:index="resolvePath(onlyOneChild.path)"
:class="{ 'submenu-title-noDropdown': !isNest }">
<item icon="" :title="onlyOneChild.meta.title" />
</el-menu-item>
</app-link>
</template>
<el-submenu
v-else
ref="subMenu"
:index="resolvePath(item.path)"
popper-append-to-body>
<template slot="title">
<item v-if="item.meta" icon="" :title="item.meta.title" />
</template>
<sidebar-item-sub
v-for="(child, index) in item.children"
:key="child.path + index"
:is-nest="true"
:item="child"
:base-path="resolvePath(child.path)"
class="nest-menu" />
</el-submenu>
</div>
</template>
<script>
import path from 'path';
import { isExternal } from '@/utils/validate';
import Item from './Item';
import AppLink from './Link';
import FixiOSBug from './FixiOSBug';
export default {
name: 'SidebarItemSub',
components: { Item, AppLink },
mixins: [FixiOSBug],
props: {
// route object
item: {
type: Object,
required: true,
},
isNest: {
type: Boolean,
default: false,
},
basePath: {
type: String,
default: '',
},
},
data() {
this.onlyOneChild = null;
return {};
},
methods: {
hasOneShowingChild(children = [], parent) {
if (!children) {
children = [];
}
const showingChildren = children.filter((item) => {
if (item.hidden) {
return false;
} else {
// Temp set(will be used if only has one showing child)
this.onlyOneChild = item;
return true;
}
});
// When there is only one child router, the child router is displayed by default
if (showingChildren.length === 1) {
return true;
}
// Show parent if there are no child router to display
if (showingChildren.length === 0) {
this.onlyOneChild = { ...parent, path: '', noShowingChildren: true };
return true;
}
return false;
},
resolvePath(routePath) {
if (isExternal(routePath)) {
return routePath;
}
if (isExternal(this.basePath)) {
return this.basePath;
}
return path.resolve(this.basePath, routePath);
},
},
};
</script>

View File

@ -1,71 +0,0 @@
<template>
<div
:class="{ 'has-logo': showLogo }"
:style="{
backgroundColor:
settings.sideTheme === 'theme-dark'
? variables.menuBackground
: variables.menuLightBackground,
}">
<logo v-if="showLogo" :collapse="isCollapse" />
<el-scrollbar :class="settings.sideTheme" wrap-class="scrollbar-wrapper">
<el-menu
:default-active="activeMenu"
:collapse="isCollapse"
:background-color="
settings.sideTheme === 'theme-dark'
? variables.menuBackground
: variables.menuLightBackground
"
:text-color="
settings.sideTheme === 'theme-dark'
? variables.menuColor
: variables.menuLightColor
"
:unique-opened="true"
active-text-color="#fff"
:collapse-transition="false"
mode="vertical">
<!-- 根据 sidebarRouters 路由生成菜单 -->
<sidebar-item
v-for="(route, index) in sidebarRouters"
:key="route.path + index"
:item="route"
:base-path="route.path" />
</el-menu>
</el-scrollbar>
</div>
</template>
<script>
import { mapGetters, mapState } from 'vuex';
import Logo from './Logo';
import SidebarItem from './SidebarItem';
import variables from '@/assets/styles/variables.scss';
export default {
components: { SidebarItem, Logo },
computed: {
...mapState(['settings']),
...mapGetters(['sidebarRouters', 'sidebar']),
activeMenu() {
const route = this.$route;
const { meta, path } = route;
// if set path, the sidebar will highlight the path you set
if (meta.activeMenu) {
return meta.activeMenu;
}
return path;
},
showLogo() {
return this.$store.state.settings.sidebarLogo;
},
variables() {
return variables;
},
isCollapse() {
return !this.sidebar.opened;
},
},
};
</script>

View File

@ -1,6 +1,7 @@
<template>
<div
:class="{ 'has-logo': showLogo }"
class="left-menu-box"
:style="{
backgroundColor:
settings.sideTheme === 'theme-dark'
@ -72,3 +73,10 @@ export default {
},
};
</script>
<style lang="scss">
.left-menu-box {
.el-menu-item.is-active {
background-color: #0b58ff !important;
}
}
</style>

View File

@ -1,11 +1,11 @@
export default {
data() {
return {
tableH: this.tableHeight(260),
tableH: this.tableHeight(296),
};
},
created() {
this.tableH = this?.heightNum ? this.tableHeight(this.heightNum) : this.tableHeight(260);
this.tableH = this?.heightNum ? this.tableHeight(this.heightNum) : this.tableHeight(296);
window.addEventListener('resize', this._setTableHeight);
},
destroyed() {
@ -13,7 +13,7 @@ export default {
},
methods: {
_setTableHeight() {
this.tableH = this?.heightNum ? this.tableHeight(this.heightNum) : this.tableHeight(260);
this.tableH = this?.heightNum ? this.tableHeight(this.heightNum) : this.tableHeight(296);
// this.tableH = this.tableHeight(260);
},
},

View File

@ -23,11 +23,15 @@ const permission = {
state.topbarRouters = routes
},
SET_SIDEBAR_ROUTERS: (state, routes) => {
console.log('=========:',routes)
console.log('==SET_SIDEBAR_ROUTERS==:',routes)
state.sidebarRouters = routes
},
},
actions: {
// 生成路由
GenerateRoutes({commit}) {
return new Promise(resolve => {

View File

@ -141,7 +141,7 @@ export default {
const width = window.innerWidth - 700;
console.log(width);
console.log('window.innerWidth:', window.innerWidth);
this.visibleNumber = parseInt(width / 120);
this.visibleNumber = parseInt(width / 110);
console.log('this.visibleNumber:', this.visibleNumber);
},
//

View File

@ -141,7 +141,7 @@ export default {
const width = window.innerWidth - 700;
console.log(width);
console.log('window.innerWidth:', window.innerWidth);
this.visibleNumber = parseInt(width / 120);
this.visibleNumber = parseInt(width / 110);
console.log('this.visibleNumber:', this.visibleNumber);
},
//
@ -207,6 +207,9 @@ export default {
.homemenu-container.el-menu.el-menu--horizontal > .el-submenu.is-active {
--theme: none !important;
}
.homemenu-container.el-menu.el-menu--horizontal > .el-menu-item.is-active {
border-bottom: none !important;
}
.homemenu-container.el-menu--horizontal > .el-menu-item {
float: left;
height: 84px !important;

View File

@ -434,3 +434,11 @@ export default {
}
}
</style>
<style lang="scss">
.home-page {
.el-progress-bar__inner {
background-image: url('~@/assets/img/home-progress-bg.png');
background-size: cover;
}
}
</style>

View File

@ -70,7 +70,7 @@ export default {
};
},
mounted() {
this.getList();
// this.getList();
},
methods: {
/** 查询列表 */

View File

@ -24,7 +24,7 @@ export default {
},
data() {
return {
heightNum: 200,
heightNum: 236,
nameData: [],
list: [],
};

View File

@ -45,7 +45,7 @@ export default {
<style scoped lang="scss">
.currentDataContainer {
width: 100%;
min-height: calc(100vh - 120px - 8px);
min-height: calc(100vh - 164px);
background: rgba(242, 244, 249, 1);
.topBox {
.el-menu {
@ -79,10 +79,11 @@ export default {
}
}
.bottomBox {
min-height: calc(100vh - 184px);
height: calc(100vh - 220px);
background: #fff;
padding: 16px;
border-radius: 8px;
overflow-y: auto;
}
}
</style>

View File

@ -48,7 +48,7 @@
</div>
</div>
<!-- side bar -->
<div class="side-bar__left" style="width: 240px; height: 100%">
<div class="side-bar__left">
<el-tree
class="custom-tree-class"
:data="currentFactory?.children"
@ -87,6 +87,7 @@
:table-props="table.tableProps"
:table-data="table.dataManager?.dataList ?? []"
:span-method="spanMethod"
:max-height="tableH"
@emitFun="(val) => handleEmitFun(table, val)"></base-table>
<pagination
:key="table.key + '__pagination'"
@ -115,9 +116,11 @@
<script>
// import Graph from './graph.vue';
import { getWorkOrderList, getTreeData } from '@/api/quality/deviceParameters';
import tableHeightMixin from '@/mixins/tableHeightMixin';
export default {
name: 'EquipmentProcessAmount',
// components: { Graph },
mixins: [tableHeightMixin],
props: {},
data() {
const now = new Date();
@ -578,6 +581,10 @@ export default {
</script>
<style scoped>
.side-bar__left {
width: 240px;
height: calc(100% - 70px);
}
.side-bar__left >>> .is-current {
padding: 0;
color: #111;

View File

@ -81,7 +81,7 @@ export default {
mixins: [tableHeightMixin],
data() {
return {
heightNum: 220,
heightNum: 256,
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:packaging-print-log:update`)