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 { .el-menu-item, .el-submenu__title {
overflow: hidden !important;
text-overflow: ellipsis !important; text-overflow: ellipsis !important;
white-space: nowrap !important; white-space: nowrap !important;
} }

View File

@ -10,7 +10,7 @@
<!-- <search id="header-search" class="right-menu-item" /> --> <!-- <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" /> --> <!-- <screenfull id="screenfull" class="right-menu-item hover-effect" /> -->

View File

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

View File

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

View File

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

View File

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