This commit is contained in:
朱文强 2024-08-22 08:50:30 +08:00
parent 072757fada
commit 732ca54eef
6 changed files with 229 additions and 119 deletions

View File

@ -71,7 +71,6 @@
}
.el-menu-item, .el-submenu__title {
overflow: hidden !important;
text-overflow: ellipsis !important;
white-space: nowrap !important;
}

View File

@ -10,7 +10,7 @@
<!-- <search id="header-search" class="right-menu-item" /> -->
<!-- 站内信 -->
<notify-message class="right-menu-item hover-effect" />
<!-- <notify-message class="right-menu-item hover-effect" /> -->
<!-- <screenfull id="screenfull" class="right-menu-item hover-effect" /> -->

View File

@ -5,29 +5,53 @@ export default {
props: {
icon: {
type: String,
default: ''
default: '',
},
title: {
type: String,
default: ''
}
default: '',
},
num: {
type: Number,
default: 0,
}, //
},
render(h, context) {
const { icon, title } = context.props
const vnodes = []
const { icon, title, num } = context.props;
const vnodes = [];
if (icon) {
vnodes.push(<svg-icon icon-class={icon}/>)
vnodes.push(<svg-icon icon-class={icon} />);
}
if (title) {
if (title.length > 5) {
vnodes.push(<span slot='title' title={(title)}>{(title)}</span>)
if (title == '膜卷熟化时间提醒') {
vnodes.push(
<span slot="title" title={title}>
{title}
<el-badge value={num} class="item" id="elBadge" />
</span>
);
} else {
vnodes.push(<span slot='title'>{(title)}</span>)
if (title.length > 5) {
vnodes.push(
<span slot="title" title={title}>
{title}
</span>
);
} else {
vnodes.push(<span slot="title">{title}</span>);
}
}
return vnodes
}
}
return vnodes;
},
};
</script>
<style>
.item {
margin-top: -20px;
margin-right: 10px;
}
</style>

View File

@ -1,16 +1,33 @@
<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
:num="message_num(onlyOneChild.meta)"
: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>
<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="item.meta && item.meta.icon"
:title="item.meta.title" />
</template>
<sidebar-item
v-for="(child, index) in item.children"
@ -18,18 +35,19 @@
: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 { listData } from '@/api/system/dict/data';
import { rollTimeRemind } from '@/api/asrs/warehouseStorehouseGoodsSpecification';
export default {
name: 'SidebarItem',
@ -39,58 +57,104 @@ export default {
// 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: {
setTimer() {
//
const now = new Date();
// 12
const timeToMidnight =
23 * 60 * 60 * 1000 +
59 * 60 * 1000 +
59 * 1000 -
(now.getTime() % (24 * 60 * 60 * 1000));
//
this.timer = setTimeout(this.refreshPage, timeToMidnight);
},
refreshPage() {
let remindCount = 0;
const queryParams = {
pageNo: 1,
pageSize: 99,
dictType: 'rollTimeRemind',
};
listData(queryParams).then((response) => {
if (response.data.list.length > 0) {
rollTimeRemind(response.data.list[0].value).then((response) => {
remindCount = response.length;
const elx = document
.getElementById('elBadge')
.getElementsByClassName('el-badge__content')[0];
console.log(elx)
elx.innerHTML = remindCount;
});
}
});
//
this.setTimer();
},
message_num(data) {
if (data.title == '膜卷熟化时间提醒') {
//
this.refreshPage();
setInterval(() => {
this.refreshPage();
}, 1000 * 60 * 60 * 12);
let num = 0; //
return num;
}
},
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 this.basePath;
}
return path.resolve(this.basePath, routePath)
}
}
}
return path.resolve(this.basePath, routePath);
},
},
};
</script>

View File

@ -161,6 +161,7 @@ export default {
},
tableProps,
tableData: [],
getTrayCode: undefined,
formConfig: [
{
type: 'input',
@ -226,7 +227,11 @@ export default {
};
},
components: {},
created() {},
created() {
this.listQuery.trayCode = this.$route.query && this.$route.query.trayCode
this.formConfig[0].placeholder = this.listQuery.trayCode || '托盘编码'
this.getDataList();
},
methods: {
buttonClick(val) {
switch (val.btnName) {

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2024-02-27 14:43:14
* @LastEditors: zwq
* @LastEditTime: 2024-08-20 16:17:36
* @LastEditTime: 2024-08-21 14:04:09
* @Description:
-->
<template>
@ -39,13 +39,14 @@
:label="'第' + i + '页'"
:name="i + '页'">
<el-tag
style="margin: 5px; border: 1px solid #67c23a"
style="margin: 5px; border: 1px solid #67c23a;cursor: pointer;"
v-for="(item, index) in containerCodeArr.slice(
(i - 1) * pageSize,
i * pageSize
)"
:key="index"
effect="plain"
@click="toRollMessagePage(item.containerCode)"
size="small">
{{ item.containerCode }}
</el-tag>
@ -158,6 +159,23 @@ export default {
})
.catch(() => {});
},
/** 跳转膜卷信息页面 */
toRollMessagePage(trayCode){
this.$confirm(`是否跳转到膜卷信息页面? 托盘编码:[ ${trayCode} ]`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "success ",
})
.then(() => {
this.$router.push({
path: "rollMessage",
query:{
trayCode: trayCode
}
});
})
.catch(() => { });
}
},
};
</script>