liuying
2024-11-25 84138b3f42b218ecc2efaa54ec31a1c1be29e326
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<template>
    <div>
 
        <!-- 库位列表 -->
 
        <div v-for="(itemW, indexW) in storageList" :key="indexW">
            <p>巷道:{{ itemW.laneCode }}</p>
            <div v-for="(itemIN, indexIN) in itemW.rows" :key="indexIN">
                <div class="content-view">
                    <!-- 每个库位方块     查询库位全部库存 -->
                    <div class="mask100" v-for="(itemSmall, itemSmallIndex) in itemIN.rowLocations2" :key="itemSmallIndex">
                        <content-item
                            v-for="item in itemSmall"
                            :key="item.wareLocationCode"
                            :itemData="item"
                            :index="item.wareLocationCode"
                            @show="show(item, item.wareLocationCode)"
                            @click="openDialog(item.wareLocationCode)"
                            :class="'laneCodeBox_' + item.showInventoryType"
                        >
                        </content-item>
                    </div>
                </div>
                <div v-if="itemW.rows.length > 1" class="stripe stripeM"></div>
            </div>
        </div>
        <!-- 库位悬浮层 -->
        <teleport :to="'#item' + count" v-if="itemVisible">
            <div class="item-detail" v-if="!detailData.isDeleted">
                <p>{{ setKwStauts(detailData.inventoryType) }}</p>
                {{ containerCodeSHsow }}
            </div>
        </teleport>
        <!-- 详情弹框 -->
        <prop-detail ref="propDetailRef"></prop-detail>
    </div>
</template>
<script lang="ts" setup>
import { ElMessage } from 'element-plus';
import { ref, defineProps, computed, getCurrentInstance } from 'vue';
import ContentItem from './ContentItem.vue';
import PropDetail from './propDetail.vue';
const { proxy }: any = getCurrentInstance(); // 访问实例上下文 proxy同时支持开发 线上环境
//props
const props = defineProps({
    contentData: {
        type: Array,
        required: true,
        default: [],
    },
});
const containerCodeSHsow = ref('');
//库位列表
const storageList: Record<any, any> = computed(() => props.contentData);
//每个库位详情的显示
const itemVisible = ref(false);
//详情数据
const detailData = ref({} as Record<string, any>);
//当前选中的库位
const count = ref(String);
//显示 隐藏详情
const show = (item: any, index: any) => {
    // console.log('item:'+JSON.stringify(item) )
    // console.log('库位号'+index)
    if (item) {
        itemVisible.value = true;
        count.value = index;
        detailData.value = item;
        containerCodeSHsow.value = item.wareContainerCode;
    } else {
        itemVisible.value = false;
        count.value = index;
        detailData.value = {};
        containerCodeSHsow.value = '';
    }
};
 
// 显示库位状态
const setKwStauts = (type: number): string => {
    let status = '';
    switch (type) {
        case 0:
            status = '空库位';
            break;
        case 1:
            status = '有货库位(空容器)';
            break;
        case 2:
            status = '有货库位(物料)';
    }
    return status;
};
 
//打开窗口
const openDialog = (type: string) => {
    //托盘号
    if (!type || type == null) {
        ElMessage.warning('不存在托盘号!');
        return;
    }
    proxy.$refs['propDetailRef'].openDialog(type);
};
</script>
<style lang="less" scoped>
.content-view {
    width: 100%;
    padding-left: 14px;
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    justify-content: end;
    align-content: flex-start;
    flex-direction: column-reverse;
    height: 480px;
    overflow-x: auto;
    // border-bottom: 10px solid #e0e0e0;
 
    .item-detail {
        min-width: 100%;
        position: absolute;
        left: 50%;
        top: 20px;
        transform: translate(-50%, -102%);
        padding: 2px;
        background: #000;
        opacity: 0.7;
        color: #fff;
        border-radius: 4px;
        box-sizing: content-box;
        white-space: nowrap;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        z-index: 3;
 
        p {
            margin: 5px;
        }
    }
}
 
.stripe {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 58px;
    color: white;
    font-size: 25px;
}
 
/*斑马条纹*/
.stripeM {
    background: linear-gradient(#dbd4b4 50%, #f5be6a 50%);
    background-size: 100% 40px;
}
.laneCodeBox_0 {
    visibility: hidden;
}
.laneCodeBox_1 {
    visibility: visible;
}
 
.mask100 {
    height: 100%;
    display: flex;
    flex-direction: column-reverse;
}
// #item3-4-3-3,#item3-4-1-3,#item3-4-2-3,#item3-4-4-3{
//     margin-bottom: 104px;
// }
// #item3-1-3-4,#item3-1-4-4{
//     margin-bottom: 149px;
 
// }
</style>