schangxiang@126.com
2024-12-08 df485888ecb9f69c0051fc192b87aec700cc4f89
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<template>
    <view class="">
        <cu-custom bgColor="bg-white" :isBack="true">
            <block slot="backText">
            </block>
            <block slot="content">呼叫空托</block>
        </cu-custom>
        <view class="flex justify-end align-center padding_right30rpx padding_top12rpx">
            <text class="fontSize12rpx"> 操作人:{{operator}} </text>
        </view>
        <modal-code ref="resmodal" :rescode='rescode' :resmessage='resmessage' />
        <view class="">
            <u-form labelPosition="top" :model="warehouse" ref="warehouseRef">
                <u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
                    <u-col span="10" @tap="getVehicleType">
                        <u-form-item label="容器类型:" prop="tray" required
                            style="font-size: 16px;font-weight: bold;padding: 0;">
                            <text class="padding_left30rpx fontSize32rpx" :class="warehouse.tray?'':'text-80'"
                                style="font-weight: bolder;">{{warehouse.tray?warehouse.tray:'请选择容器类型'}}</text>
                            <u-select v-model="modalshow" :list="wolist" @confirm="confirm"></u-select>
                        </u-form-item>
                    </u-col>
                    <u-col span="2">
                        <u-icon name="arrow-down" class="padding_left30rpx"></u-icon>
                    </u-col>
                </u-row>
                <u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
                    <u-col span="10">
                        <u-form-item label="容器数量:" prop="num" required
                            style="font-size: 16px;font-weight: bold;padding: 0 0 10rpx;">
                            <input v-model="warehouse.num" type="number" @focus="focu=true" @blur="clear"
                                placeholder="请输入容器数量" class="width"
                                style="font-weight: bolder;margin-left: 30rpx;margin-top: 16rpx;">
                            </input>
                            <u-icon name="close-circle-fill" color="#848484" v-if="warehouse.num && focu"
                                @click="warehouse.num=''"></u-icon>
                        </u-form-item>
                    </u-col>
                    <u-col span="2">
                        <u-icon class="padding_left30rpx " name="arrow-down"></u-icon>
                    </u-col>
                </u-row>
                <u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
                    <u-col span="10" @tap="getCollect">
                        <u-form-item label="目标位置:" prop="locaddr" required
                            style="font-size: 16px;font-weight: bold;padding: 0;">
                            <text class="padding_left30rpx fontSize32rpx" :class="warehouse.locaddr?'':'text-80'"
                                style="font-weight: bolder">{{warehouse.locaddr?warehouse.locaddr:'请选择目标位置'}}</text>
                        </u-form-item>
                    </u-col>
                    <u-col span="2">
                        <u-icon class="padding_left30rpx " name="arrow-down"></u-icon>
                    </u-col>
                </u-row>
            </u-form>
        </view>
        <u-popup v-model="bottomshow" mode="bottom" border-radius="14">
            <view>
                <cu-custom bgColor="bg-white" :isBack="false">
                    <block slot="backText">
                    </block>
                    <block slot="content">选择目标位置</block>
                </cu-custom>
                <view class="width flex justify-around flex-wrap">
                    <view class="width30 radius margin_top20rpx" v-for="(item,eindex) in addrlist"
                        @tap="addtap(item,eindex)" :key='eindex'>
                        <view
                            class="width flex align-center padding20_0 justify-center text_align_center height56rpx padding5_10 fontSize36rpx"
                            :class="active==eindex?'bg-f18202':'color_f18202 border_1989FA' ">
                            <text class="text_overflow text-bold ">{{item.value}}</text>
                        </view>
                    </view>
                </view>
 
                <view class="flex">
                    <button class="width45 margin_top40rpx margin_bottom30rpx bg-grey" @tap="bottomRest">取消</button>
                    <button class=" width45 margin_top40rpx margin_bottom30rpx bg-f18202" @tap="bottomSub">确认</button>
                </view>
            </view>
        </u-popup>
        <button-modal :subShow='true' garmenTitle='呼叫空托' @submit='call' @reset='rest' />
 
    </view>
</template>
 
<script>
    import ButtonModal from '../../components/buttonModal.vue'
    import ModalCode from '../../components/ModalCode.vue'
    import {
        getCallTray,
        getContainerTypes,
        getCollect
    } from '../../api/putIn/callTray.js'
    export default {
        data() {
            return {
                rescode: 0,
                resmessage: "",
                wolist: [{
                        key: '1205',
                        value: '江'
                    },
                    {
                        key: '24432',
                        value: '湖'
                    }
                ],
                warehouse: {
                    tray: '', //载具类型
                    num: "", //载具数量
                    locaddr: '' //目标位置
                },
                focu: false, //清空按钮隐显
                show: false,
                modalshow: false,
                bottomshow: false,
                addrlist: [],
                value: '',
                active: -1,
                // flag: false,
                vehiclelist: [], //载具参数
                storehouselist: [], //目标位置参数
                warehouseRules: {
                    tray: [{
                        required: true,
                        message: '容器类型不能为空',
                        trigger: 'blur'
                    }],
                    num: [{
                        required: true,
                        message: '容器数量不能为空',
                        trigger: 'blur'
                    }],
                    locaddr: [{
                        required: true,
                        message: '目标位置不能为空',
                        trigger: 'blur'
                    }]
                },
                trayRules: {
                    tray: [{
                        required: true,
                        message: '容器类型不能为空',
                        trigger: 'blur'
                    }],
                },
                numRules: {
                    num: [{
                        required: true,
                        message: '容器数量不能为空',
                        trigger: 'blur'
                    }]
                },
                locaddrRules: {
                    locaddr: [{
                        required: true,
                        message: '目标位置不能为空',
                        trigger: 'blur'
                    }]
                },
                operator: ''
            }
        },
        components: {
            ButtonModal,
            ModalCode
        },
        onReady() {},
        mounted() {
            this.operator = JSON.parse(uni.getStorageSync('userInfo')).name
        },
        methods: {
            //载具类型
            getVehicleType() {
                getContainerTypes({
                    WareContainerType: ""
                }).then((res) => {
                    if (res.code == 200) {
                        if (res.data.length == 0) {
                            this.rescode = 400
                            this.resmessage = '暂无数据'
                            this.$refs.resmodal.show = true
                            return
                        }
                        this.wolist = res.data
                        this.wolist.forEach((item, index) => {
                            item.label = `${item.TypeName}(${item.Sums})`
                            item.value = index + 1
                        })
                        this.modalshow = true
                    } else {
                        uni.showModal({
                            title: '提示',
                            content: res.message,
                            showCancel: false,
                        });
                    }
                })
            },
            // 注意返回值为一个数组,单列时取数组的第一个元素即可(只有一个元素)
            confirm(e) {
                let index = e[0].value - 1
                this.vehiclelist = this.wolist[index]
                // this.warehouse.locaddr = e[0].label
                this.warehouse.tray = e[0].label
                this.$refs.warehouseRef.setRules(this.trayRules)
                this.$refs.warehouseRef.validate(valid => {})
            },
            clear() {
                setTimeout(() => {
                    this.focu = false
                }, 200)
                this.$refs.warehouseRef.setRules(this.numRules)
                this.$refs.warehouseRef.validate(valid => {})
            },
            //目标位置
            getCollect() {
                getCollect().then((res) => {
                    if (res.code == 200) {
                        this.addrlist = res.data
                    } else {
                        uni.showModal({
                            title: '提示',
                            content: res.message,
                            showCancel: false,
                        });
                    }
                })
                this.bottomshow = true
            },
            //选择目标位置
            addtap(val, index) {
                this.active = index
                this.warehouse.locaddr = val.value
                this.storehouselist = val
                this.$refs.warehouseRef.setRules(this.locaddrRules)
                this.$refs.warehouseRef.validate(valid => {})
            },
            //目标位置取消
            bottomRest() {
                this.active = -1
                this.bottomshow = false
            },
            //目标位置确认
            bottomSub() {
                this.active = -1
                this.bottomshow = false
            },
            //重置
            rest() {
                this.warehouse.tray = ''
                this.warehouse.num = ''
                this.warehouse.locaddr = ''
            },
            //呼叫容器
            call() {
                this.$refs.warehouseRef.setRules(this.warehouseRules)
                this.$refs.warehouseRef.validate(valid => {
                    if (valid) {
                        let params = {
                            vehicleKey: this.vehiclelist.key,
                            vehicleValue: this.vehiclelist.label,
                            num: this.warehouse.num,
                            storehouseKey: this.storehouselist.key,
                            storehouseName: this.storehouselist.value
                        }
                        getCallTray(params).then((res) => {
                            this.$refs.resmodal.show = true
                            this.rescode = res.code
                            this.resmessage = res.message
                            if (res.code == 200) {
                                this.rest()
                            }
                        })
 
                    } else {}
                })
 
            }
        }
    }
</script>
 
<style scoped>
    .text-80 {
        color: #808080;
    }
</style>