#
whycq
2024-03-15 a7ee747fceb29f9dca920dea0c2a0865d5c8e0ed
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<template>
    <view  class="container">
        <uni-icons type="bars" size="30" color="#b1b3b8" class="select" @click="jump()"></uni-icons>
        <!-- 左 -->
        <view class="zcard">
            <view class="zcard-flex">
                <view class="button-nk" @click="click('left')">上架</view>
            </view>
        </view>
        <!-- 右 -->
        <view class="zcard">
            <view class="zcard-flex">
                <view class="button-nk" style="background-color: brown;" @click="click('right')">下架</view>
            </view>
        </view>
        
        <view>
            <uni-popup ref="revise" type="dialog">
                <view class="popup">
                    <view  class="popup3-input-title">{{text}}</view>
                    <view class="button-nk" @click="option(item)" v-for="item in btns">{{item.name}}</view>
                </view>
            </uni-popup>
        </view>
        
        <view>
            <uni-popup ref="numberPopup" type="dialog">
                <view class="popup2">
                    <view  class="popup3-input-title">{{tipsTitle}}</view>
                    <view class="button-nk" @click="goUp(2)">2个</view>
                    <view class="button-nk" @click="goUp(4)">4个</view>
                </view>
            </uni-popup>
        </view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                baseUrl: '',
                token: '',
                onBtns: [
                    {name: '1号空盘位上架',code:'1-Q1',traget: '12-F1',type: 'foolr'},
                    {name: '2号空盘位上架',code:'1-Q1',traget: '12-F1',type: 'foolr'},
                ],
                outBtns: [
                    {name: '下架至1号位',code:'11-Q1',traget: '1-F1',type: 'foolr'},
                    {name: '下架至2号位',code:'11-Q1',traget: '2-F1',type: 'foolr'},
                    {name: '下架至3号位',code:'11-Q1',traget: '3-F1',type: 'foolr'},
                ],
                btns: [],
                outType: '',
                text: '',
                btnTitle: '',
                type: '',
                tipsTitle: '',
                item: {}
                
            }
        },
        onShow() {
            if (uni.getStorageSync('Network')) {
                let network = uni.getStorageSync('Network')
                this.baseUrl = `http://${network[0].ip}:${network[0].port}/${network[0].address}`
                this.token = uni.getStorageSync('token');
            }
        },
        methods: {
            jump() {
                uni.redirectTo({
                    url: '/pages/project/jmAGV/home'
                })
            },
            click(type) {
                if (type == 'left') {
                    this.btns = this.onBtns
                    this.text = '上架'
                    this.type = 'load'
                    this.tipsTitle = '上架数量'
                } else {
                    this.btns = this.outBtns
                    this.type = 'unload'
                    this.text = '下架'
                    this.tipsTitle = '下架数量'
                }
                this.$refs.revise.open(type)
            },
            option(item) {
                this.item = item
                this.$refs.numberPopup.open('center')
            },
            goUp(num) {
                let _this = this
                let data = {
                    originLocal: this.item.code,
                    targetLocal: this.item.traget,
                    type: this.type,
                    anfme: num
                }
                this.webServer(data)
            },
            // 所有服务
            webServer(data) {
                let _this = this
                uni.request({
                    url: `${_this.baseUrl}/agv/requestTask`,
                    data: data,
                    header: { 'token': uni.getStorageSync('token') },
                    method: 'POST',
                    success(res) {
                        res = res.data
                        if (res.code === 200) {
                            setTimeout(()=>{
                                this.$refs.revise.close()
                            },300)
                            uni.showToast({ title: '操作成功', icon: "none", position: 'top' })
                        } else {
                            uni.showToast({ title: res.msg, icon: "none", position: 'top' })
                        }
                    }
                })
            }
        }
    }
</script>
 
<style>
    .container {
        height: 100%;
        display: grid;
        grid-template-columns: 50% 50%;
        width: 100%;
    }
    .zcard-flex {
        /* background-color: coral; */
        margin-top: 20rpx;
        width: 100%;
        height: 100%;
        display: flex;
        flex-wrap: wrap;
        /* flex-direction: column; */
        justify-content: space-around;
        align-items: center;
    }
    .button-nk {
        margin: 10rpx 0rpx;
        /* padding: 20rpx 70rpx; */
        /* background-color: azure; */
        min-width: 150rpx;
        /* margin: 0 auto; */
        height: 50rpx;
        text-align: center;
        line-height: 50rpx;
        font-size: 20rpx;
        background-color: #409EFF;
        color: #ECF0F1;
        border-radius: 7px;
        box-shadow: inset 4px 4px 4px rgba(0, 0, 0, .3),
            inset -4px -4px 4px rgba(255, 255, 255, .4),
            -4px -4px 5px rgba(0, 0, 0, .4);
    }
    .button-nk:active {
        transform: translateY(2px) scale(0.99, 0.99);
        box-shadow: inset 4px 4px 4px rgba(0, 0, 0, .3),
            inset -4px -4px 8px rgba(255, 255, 255, .7),
            -5px -5px 5px rgba(0, 0, 0, .3);
    }
    .popup {
        background-color: #eee;
        width: 30vw;
        height: 100%;
        padding: 0 10vw;
        display: flex;
        flex-direction: column;
        justify-content: space-around;
    }
    .popup2 {
        background-color: #eee;
        width: 30vw;
        height: 100%;
        padding: 0 10vw;
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        border-radius: 10rpx;
    }
    .popup3-input-title {
        text-align: center;
        margin: 10rpx;
        font-size: 18px;
        font-weight: bold;
    }
    .select {
        position: absolute;
        bottom: 12px;
        right: 16px;
        border-radius: 10px;
        padding: 4px 10px;
        box-shadow: inset 2px 2px 2px rgba(0, 0, 0, .3),
            inset -2px -2px 2px rgba(255, 255, 255, .7),
            -2px -2px 2px rgba(0, 0, 0, .4);
    }
</style>