Storehouse/src/views/index.vue

328 lines
8.4 KiB
Vue

<template>
<div class="aside" @click="stopHandle()">
<div class="aside-box">
<div class="left-item">
<div class="logo">
<img src="@/assets/images/logo.png" alt="" />
</div>
<!-- 右边小图标样式 -->
<ul class="icons">
<li
class="icon-item"
ref="iconItem"
v-for="(s, i) in asideList"
data-num="0"
:key="i"
@click="updateImg(i, $event)"
>
<img :src="i == index ? s.select : s.pic" alt="" />
<span :style="i == index ? 'color:#2620b1' : ''">{{ s.name }}</span>
<div class="mark"></div>
</li>
</ul>
</div>
<!-- <transition name="slide-fade"> -->
<!-- </transition> -->
<!-- <transition name="move"> -->
<!-- 库存组件 -->
<!-- <Stock v-if="index == 1" class="right-item" /> -->
<!-- 入库的组件 -->
<!-- <EnterStore v-if="index == 2" class="right-item" /> -->
<!-- 出库组件 -->
<!-- <OutStore v-if="index == 3" class="right-item" /> -->
<!-- <Manage v-if="index == 4" class="right-item" /> -->
<!-- </transition> -->
<keep-alive>
<transition name="slide-fade" mode="out-in">
<component ref="rightItem" :is="view" class="right-item"></component>
</transition>
</keep-alive>
</div>
</div>
</template>
<script>
// 库存组件
import Stock from "@/component/Stock.vue";
// 管理组件
import Manage from "@/component/Manage.vue";
// 入库组件
import EnterStore from "@/component/EnterStore.vue";
// 出库组件
import OutStore from "@/component/OutStore.vue";
import OverView from "@/component/OverView.vue";
import {getBacklogMaterialInfo,byPosition, byBatchAndMateri ,getWarehouseUsages,getTurnoverRate,getChangeAmount ,getInventoryAgeInfo ,getStore,getMaterialDataList} from "@/api/index";
export default {
name: "index",
components: {
Stock,
Manage,
EnterStore,
OutStore,
OverView,
},
data() {
return {
index: 0,
asideList: [
{
name: "总览",
select: require("@/assets/images/overview-select.png"),
pic: require("@/assets/images/overview-default.png"),
},
{
name: "库存",
select: require("@/assets/images/stock-select.png"),
pic: require("@/assets/images/stock-default.png"),
},
{
name: "入库",
select: require("@/assets/images/enter-select.png"),
pic: require("@/assets/images/enter-default.png"),
},
{
name: "出库",
select: require("@/assets/images/out-select.png"),
pic: require("@/assets/images/out-default.png"),
},
{
name: "管理",
select: require("@/assets/images/manage-select.png"),
pic: require("@/assets/images/manage-default.png"),
},
],
view: "",
asideShow: false,
};
},
mounted() {
// setTimeout(()=>{
this.view = "OverView";
// },2000)
// 获取仓位号接口
// byPosition({ wareHouseCode: "HA1", position: "B01-010102" }).then((res) => {
// console.log(res, "仓位号");
// });
// // 获取物料批次
// byBatchAndMateri({ batch:"2021093009",wareHouseCode:'HA1' }).then((res) => {
// console.log(res,'物料批次');
// });
// // 仓库的使用率
// getWarehouseUsages({wareHouseCode:'HA1'}).then(res=>{
// console.log(res,'仓库使用率');
// })
//每月的周转率
// getTurnoverRate({wareHouseCode:'HA1'}).then(res=>{
// console.log(res,'每月的周转率');
// })
// 当月出入库金额
// getChangeAmount({wareHouseCode:'HA1'}).then(res=>{
// console.log(res,'当月出入库金额');
// })
// 积压物资
// 库龄结构
// getInventoryAgeInfo({wareHouseCode:'HA1'}).then(res=>{
// console.log(res,'库龄结构');
// })
// 库存构成
// getStore({wareHouseCode:'HA1'}).then(res=>{
// console.log(res,'库存结构');
// })
// 库容预测
// getMaterialDataList({method:'getYckc',LGUNM:"HA1",NY:"202304"}).then(res=>{
// console.log(res,'库容预测');
// })
},
created() {},
computed: {},
methods: {
stopHandle(){
// console.log(this.$parent,'父组件');
if(this.$parent.index==0||this.$parent.index==2){
this.$parent.index=null
}
},
// 切图
updateImg(i, event) {
// 当页面显示出来时 再次点击隐藏
this.asideShow = !this.asideShow;
if (this.index == i && this.asideShow) {
// console.log(1);
this.view = "";
return;
}
this.index = i;
// let rightBox = document.querySelector('.right-item')
// rightBox.style.transform = 'translateX(0)'
// console.log(rightBox,'dom元素');
// console.log(event.target,'....');
if (this.index == 0) {
// this.$nextTick(() => {
// // 总览界面echarts
// this.drawStore()
// this.drawTurnoverChart()
// this.drawOutbound()
// this.drawOverStock()
// })
this.view = "OverView";
} else if (this.index == 1) {
this.view = "Stock";
} else if (this.index == 2) {
this.view = "EnterStore";
} else if (this.index == 3) {
this.view = "OutStore";
} else if (this.index == 4) {
this.view = "Manage";
}
this.asideShow = false;
},
},
};
</script>
<style scoped lang="less">
.mark {
// display: none;
position: absolute;
top: 0;
right: 0;
width: 100%;
height: 100%;
// background-color: #888888;
}
.slide-fade-enter-active {
transition: all 1s;
}
.slide-fade-leave-active {
transition: all 1s cubic-bezier(1, 0.5, 0.8, 1);
}
.slide-fade-enter,
.slide-fade-leave-to {
transform: translateX(-100%);
opacity: 0;
}
.aside {
width: 21.4%;
height: 100%;
display: flex;
align-items: center;
margin-left: 3%;
position: relative;
z-index: 99;
.aside-box {
width: 100%;
height: 92.6%;
overflow: hidden;
// background-color: rgba(229, 237, 242, .5);
border-radius: 20px;
display: flex;
.left-item {
width: 18.8%;
height: 100%;
background-color: #f7f8f9;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
position: relative;
z-index: 15;
.logo {
margin-top: 15px;
display: flex;
justify-content: center;
margin-bottom: 32px;
}
.icons {
width: 100%;
height: 10%;
.icon-item {
width: 100%;
height: 100%;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
align-content: center;
cursor: pointer;
position: relative;
img {
display: block;
}
span {
display: inline-block;
width: 100%;
text-align: center;
color: #888888;
}
}
}
}
.right-item {
width: 81.2%;
// display: none;
// opacity: 0;
// transition: all 1s;
height: 100%;
// transform: translateX(-100%);
background-color: rgba(229, 237, 242, 0.5);
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
position: relative;
z-index: 10;
.title {
font-size: 16px;
margin-left: 7%;
margin-bottom: 4%;
}
.storeUse {
width: 100%;
height: 21.5%;
}
.monthlyTurnover,
.outboundAmount {
width: 100%;
height: 25%;
.turnoverChart,
.outboundChart {
width: 90%;
height: 80%;
background-color: #fff;
margin: 0 auto;
border-radius: 10px;
}
}
.overStock {
height: calc(100% - 71.5%);
width: 100%;
.overChart {
width: 100%;
height: 80%;
}
}
}
}
}
</style>