schangxiang@126.com
2024-11-21 60735779c303c2dd10feea45d7fd761103b225e0
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
<template>
    <div class="item" :id="'item' + count" :style="{background: setBgColor(content.inventoryType),
    boxShadow: '0 3px 3px' + setBgColor(content.inventoryType),
    }"  :class="content.isDeleted ? 'isDeleted' : ''" @mouseenter.native="popTip(content)" @mouseleave.native="popTip()">
        <div class="count">
            <p class="txt-code">{{content.wareLocationCode}}</p>
        
            <span class="triangle-stop" v-if="content.status==2"><span class="stopBg">封存</span></span>
            <span class="triangle-stop" v-if="content.status==3"><span class="stopBg">禁出</span></span>
            <span class="triangle-stop" v-if="content.status==4"><span class="stopBg">禁入</span></span>
            
            <span class="triangle-stop" v-if="content.status==5"><span class="stopBg">锁定</span></span>
        </div>
    </div>
</template>
<script lang="ts" setup>
import { defineProps, computed, defineEmits } from 'vue'
const props = defineProps({
    itemData: {
        type: Object,
        required: true,
        default: {}
    },
    index: {
        type: String,
        required: true,
        default: ""
    }
})
const emits = defineEmits(['show'])
// 鼠标移入移出
const popTip = (param?: any) => {
    emits('show', param)
}
//库位数据
const content = computed(() => props.itemData)
//当前元素的索引元素,区别id
const count = computed(() => props.itemData.wareLocationCode)
 
//库位状态计算
const type = computed(() => {
    if (content.value.inventoryType == null) {
        return 0
    } else {
        if ((Array.isArray(content.value.inventoryType) && content.value.inventoryType.length == 0) || content.value.inventoryType == null) {
            return 1
        } else {
            return 2
        }
    }
})
 
//0:灰色  1橙色
//设置背景
const setBgColor = (type: number): string => {
    let color = ''
    switch (type) {
        case 0:
            color = '#A2A2A2';
            break;
        case 1:
            color = '#F18201';
            break;
        case 2:
            color = '#2BA6FF';
            break;
        case 3:
            color = '#FF0000';
            break;
        case 4:
            color = '#FFFF00';
            break;
    }
    return color;
}
 
</script>
<style lang="less" scoped>
.item {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 80px;
    height: 30px;
    border-radius: 4px;
    justify-content: center;
    align-items: center;
    margin-right: 15px;
    font-size: 12px;
    color: white;
    margin-bottom: 15px;
    cursor: pointer;
}
 
.count {
    margin: auto;
}
 
.lockBg {
    position: absolute;
    right: 5px;
    transform: rotate(-45deg) scale(0.8);
    color: #4b4948;
    top: -39px;
    display: block;
    z-index: 5;
}
 
 
.stopBg {
    text-align: center;
    color: white;
    left: 5px;
    transform: rotate(-45deg) scale(0.8);
    top: 11px;
    display: block;
    z-index: 5;
    position: absolute;
}
 
.triangle-topright {
    width: 0;
    height: 0;
    border-top: 37px solid #ffff00;
    border-left: 31px solid transparent;
    position: absolute;
    top: 0;
    right: 0px;
}
 
.triangle-stop {
    width: 0;
    height: 0;
    border-bottom: 37px solid #ff0000;
    border-right: 31px solid transparent;
    position: absolute;
    bottom: -3px;
    left: 0px;
}
.isDeleted{
    background: transparent !important;
    box-shadow: none !important
}
</style>