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

@ -5,29 +5,53 @@ export default {
props: { props: {
icon: { icon: {
type: String, type: String,
default: '' default: '',
}, },
title: { title: {
type: String, type: String,
default: '' default: '',
} },
num: {
type: Number,
default: 0,
}, //
}, },
render(h, context) { render(h, context) {
const { icon, title } = context.props const { icon, title, num } = context.props;
const vnodes = [] 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(
<span slot="title" title={title}>
{title}
<el-badge value={num} class="item" id="elBadge" />
</span>
);
} else { } 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> </script>
<style>
.item {
margin-top: -20px;
margin-right: 10px;
}
</style>

View File

@ -1,16 +1,33 @@
<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
v-if="
hasOneShowingChild(item.children, item) &&
(!onlyOneChild.children || onlyOneChild.noShowingChildren) &&
!item.alwaysShow
">
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)"> <app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)">
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}"> <el-menu-item
<item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="onlyOneChild.meta.title" /> :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> </el-menu-item>
</app-link> </app-link>
</template> </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"> <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> </template>
<sidebar-item <sidebar-item
v-for="(child, index) in item.children" v-for="(child, index) in item.children"
@ -18,18 +35,19 @@
:is-nest="true" :is-nest="true"
:item="child" :item="child"
:base-path="resolvePath(child.path)" :base-path="resolvePath(child.path)"
class="nest-menu" class="nest-menu" />
/>
</el-submenu> </el-submenu>
</div> </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',
@ -39,58 +57,104 @@ export default {
// 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: {
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) { hasOneShowingChild(children = [], parent) {
if (!children) { if (!children) {
children = []; children = [];
} }
const showingChildren = children.filter(item => { const showingChildren = children.filter((item) => {
if (item.hidden) { if (item.hidden) {
return false return false;
} else { } else {
// Temp set(will be used if only has one showing child) // Temp set(will be used if only has one showing child)
this.onlyOneChild = item this.onlyOneChild = item;
return true return true;
} }
}) });
// When there is only one child router, the child router is displayed by default // When there is only one child router, the child router is displayed by default
if (showingChildren.length === 1) { if (showingChildren.length === 1) {
return true return true;
} }
// Show parent if there are no child router to display // Show parent if there are no child router to display
if (showingChildren.length === 0) { if (showingChildren.length === 0) {
this.onlyOneChild = { ... parent, path: '', noShowingChildren: true } this.onlyOneChild = { ...parent, path: '', noShowingChildren: true };
return true return true;
} }
return false return false;
}, },
resolvePath(routePath) { resolvePath(routePath) {
if (isExternal(routePath)) { if (isExternal(routePath)) {
return routePath return routePath;
} }
if (isExternal(this.basePath)) { if (isExternal(this.basePath)) {
return this.basePath return this.basePath;
}
return path.resolve(this.basePath, routePath)
}
}
} }
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>