更新
This commit is contained in:
parent
072757fada
commit
732ca54eef
@ -71,7 +71,6 @@
|
||||
}
|
||||
|
||||
.el-menu-item, .el-submenu__title {
|
||||
overflow: hidden !important;
|
||||
text-overflow: ellipsis !important;
|
||||
white-space: nowrap !important;
|
||||
}
|
||||
|
@ -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" /> -->
|
||||
|
||||
|
@ -1,33 +1,57 @@
|
||||
<script>
|
||||
export default {
|
||||
name: 'MenuItem',
|
||||
functional: true,
|
||||
props: {
|
||||
icon: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
render(h, context) {
|
||||
const { icon, title } = context.props
|
||||
const vnodes = []
|
||||
name: 'MenuItem',
|
||||
functional: true,
|
||||
props: {
|
||||
icon: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
num: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
}, //用来传入小红点个数
|
||||
},
|
||||
render(h, context) {
|
||||
const { icon, title, num } = context.props;
|
||||
const vnodes = [];
|
||||
|
||||
if (icon) {
|
||||
vnodes.push(<svg-icon icon-class={icon}/>)
|
||||
}
|
||||
if (icon) {
|
||||
vnodes.push(<svg-icon icon-class={icon} />);
|
||||
}
|
||||
|
||||
if (title) {
|
||||
if (title.length > 5) {
|
||||
vnodes.push(<span slot='title' title={(title)}>{(title)}</span>)
|
||||
} else {
|
||||
vnodes.push(<span slot='title'>{(title)}</span>)
|
||||
}
|
||||
}
|
||||
return vnodes
|
||||
}
|
||||
}
|
||||
if (title) {
|
||||
if (title == '膜卷熟化时间提醒') {
|
||||
vnodes.push(
|
||||
<span slot="title" title={title}>
|
||||
{title}
|
||||
<el-badge value={num} class="item" id="elBadge" />
|
||||
</span>
|
||||
);
|
||||
} else {
|
||||
if (title.length > 5) {
|
||||
vnodes.push(
|
||||
<span slot="title" title={title}>
|
||||
{title}
|
||||
</span>
|
||||
);
|
||||
} else {
|
||||
vnodes.push(<span slot="title">{title}</span>);
|
||||
}
|
||||
}
|
||||
}
|
||||
return vnodes;
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.item {
|
||||
margin-top: -20px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
</style>
|
||||
|
@ -1,96 +1,160 @@
|
||||
<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>
|
||||
<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
|
||||
: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>
|
||||
<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>
|
||||
<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'
|
||||
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',
|
||||
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
|
||||
}
|
||||
})
|
||||
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: {
|
||||
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;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// When there is only one child router, the child router is displayed by default
|
||||
if (showingChildren.length === 1) {
|
||||
return true
|
||||
}
|
||||
// 重新设置定时器
|
||||
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) => {
|
||||
if (item.hidden) {
|
||||
return false;
|
||||
} else {
|
||||
// Temp set(will be used if only has one showing child)
|
||||
this.onlyOneChild = item;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// Show parent if there are no child router to display
|
||||
if (showingChildren.length === 0) {
|
||||
this.onlyOneChild = { ... parent, path: '', noShowingChildren: true }
|
||||
return true
|
||||
}
|
||||
// When there is only one child router, the child router is displayed by default
|
||||
if (showingChildren.length === 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false
|
||||
},
|
||||
resolvePath(routePath) {
|
||||
if (isExternal(routePath)) {
|
||||
return routePath
|
||||
}
|
||||
if (isExternal(this.basePath)) {
|
||||
return this.basePath
|
||||
}
|
||||
return path.resolve(this.basePath, routePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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>
|
||||
|
@ -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) {
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user