ke_junjie
2025-06-04 4bf0783db564f0d446c74d7b42242aff879b894c
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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
<template>
    <view class="">
        <view class="line space-between" @click="pncode">
            <text class="col7">零件号:</text>
            <view class="">
                <text class="ml10 col7">{{pn}}</text>
                <u-icon name="arrow-right"></u-icon>
            </view>
 
        </view>
        <u-collapse :arrow="false">
            <u-collapse-item title="" :open="open" v-for="(item,index) in pnOpen" :key="index"
                style="border-bottom: 1px solid #eaeaea;padding-bottom: 20px;background-color: #fff;margin-top: -11px;">
                <view class="collapse-item" style="padding: 0 48px;">
                    零件号:{{item.itemName}}
                    零件数量:{{item.itemNum}}
                </view>
            </u-collapse-item>
        </u-collapse>
        <view class="line space-between" @click="bourn">
            <text class="col7">器具号:</text>
            <view class="">
                <text class="ml10 col7">{{destination.containerName}}</text>
                <u-icon name="arrow-right"></u-icon>
            </view>
        </view>
        <view>
            <u-select :list="state" mode="single-column" v-model="dialogVisible" @confirm="target">
            </u-select>
        </view>
 
        <view class="line space-between" @click="place">
            <text class="col7">起始位置:</text>
            <view class="">
                <text class="ml10 col7">{{type}}</text>
                <u-icon name="arrow-right"></u-icon>
            </view>
        </view>
        <view class="line space-between" @click="dialogVisible=true">
            <text class="col7">目标位置:</text>
            <view class="">
                <text class="ml10 col7">{{stateText}}</text>
                <u-icon name="arrow-right"></u-icon>
            </view>
        </view>
        <view>
            <u-select :list="stateType" mode="single-column" v-model="dialogType" @confirm="stateLable">
            </u-select>
        </view>
        <view class="fix">
            <u-button type="success" @click="add">出库</u-button>
            <u-button type="success" plain @click="clear">取消</u-button>
        </view>
        <u-popup v-model="dialogShow" mode="bottom" height="350px">
            <view class="title">
                <text>零件号</text>
            </view>
            <view class="search">
                <u-search placeholder="搜索零件编号" @search="pncode" v-model="keyword" input-align="center" bg-color="#fff"
                    shape="square" :show-action="false"></u-search>
            </view>
            <view class="line3" v-for="(item,index) in pnList" :key="index" @click="picker(item, $event)">
                <text style="color:#000">{{item.itemName}}</text>
                <text class="col7 ml10">{{item.itemDes}}</text>
            </view>
        </u-popup>
        <u-popup v-model="dialogShowGoal" mode="bottom" height="350px">
            <view class="title">
                <text>器具号</text>
            </view>
            <view class="search">
                <u-search placeholder="搜索器具号" @search="bourn" v-model="keyword2" input-align="center" bg-color="#fff"
                    shape="square" :show-action="false"></u-search>
            </view>
            <view class="line3" v-for="(item,index) in destination" :key="index" @click="pickerB(item, $event)">
                <text style="color:#000">{{item.containerName}}</text>
            </view>
 
        </u-popup>
    </view>
</template>
<script>
    import {
        PlaceVsContainer,
        Task
    } from '../../../api/operation.js'
    export default {
        data() {
            return {
                dialogVisible: false, //目标位置弹窗
                dialogType: false, //起始位置弹窗
                dialogShow: false, //零件号弹窗
                dialogShowGoal: false, //器具号弹窗
                open: false, //零件号折叠
                pn: '', //零件号
                keyword: '', //零件号搜索
                keyword2: '', //器具号搜索
                type: '', //起始位置回显
                stateText: '', //目标位置回显
                destination: [], //目的地列表
                shipping: '', //目标位置传参
                list: [], //库位列表
                pnList: [], //零件列表
                pnOpen: [], //选择零件号后回显
                itemList: [{
                    head: "零件号",
                    open: true,
                    disabled: true
                }],
                state: [{
                    num: 51,
                    label: '2号口'
                }, {
                    num: 64,
                    label: '3号口'
                }, {
                    num: 67,
                    label: '4号口'
                }, {
                    num: 34,
                    label: '5号口'
                }, {
                    num: 30,
                    label: '6号口'
                }, {
                    num: 19,
                    label: '7号口'
                }, {
                    num: 12,
                    label: '8号口'
                }, {
                    num: 997,
                    label: '冲压出口'
                }, {
                    num: 999,
                    label: '焊装出口'
                }],
                stateType: [],
            };
        },
        created() {
            this.PlaceVsContainer()
        },
        onBackPress(options) {
            if (options.from == 'navigateBack') {
                uni.switchTab({
                    url: '../../Home/index'
                });
            }
            if (options.from == 'backbutton') {
                uni.switchTab({
                    url: '../../Home/index'
                });
            }
            return true
        },
        methods: {
            //库存列表
            PlaceVsContainer() {
                let params = {
                    page: 1,
                    onePageNum: 20
                }
                PlaceVsContainer(params).then((res) => {
                    if (res.code == 0) {
                        this.list = res.data
                    }
                })
            },
 
            //出库
            add() {
                this.state.forEach(i => {
                    if (this.stateText == i.label) {
                        this.shipping = i.num
                    }
                })
                let params = {
                    sourcePlace: this.type, //起始位置
                    toPlace: this.shipping, //目标位置
                    containerName: this.destination.containerName,
                    taskType: 2,
                    taskStatus: '新建',
                    taskLevel: 0,
                    hasReaded: 0
                }
                Task(params).then((res) => {
                    if (res.code == 1) {
                        this.$u.toast(res.msg)
                    } else {
                        this.$u.toast('出库成功')
                        uni.switchTab({
                            url: '../../Home/index'
                        });
                    }
                })
 
            },
            clear() {
                this.pn = ''
                this.destination.containerName = ''
                this.type = ''
                this.pnOpen = []
                this.stateText = ''
            },
            //零件列表
            pncode() {
                this.pnList = []
                let params = {
                    page: '1',
                    itemName: this.keyword,
                    onePageNum: 20
                }
                PlaceVsContainer(params).then((res) => {
                    if (res.code == 0) {
                        this.list = res.data
                    }
                    this.pnList = this.list.filter(function(s) {
                        return s.itemName && s.itemName.trim();
                    })
                })
                this.dialogShow = true
            },
            //零件号回显
            picker(val, event) {
                this.pn = val.itemName
                this.dialogShow = false
                this.pnOpen = []
            },
            //器具号列表
            bourn() {
                this.destination = []
                if (this.pn === '') {
                    let params = {
                        page: '1',
                        containerName: this.keyword2,
                        onePageNum: 20
                    }
                    PlaceVsContainer(params).then((res) => {
                        if (res.code == 0) {
                            this.list = res.data
                        }
                        this.destination = this.list.filter(function(s) {
                            return s.containerName && s.containerName.trim();
                        })
                    })
                } else {
                    let params = {
                        page: '1',
                        itemName: this.pn,
                        onePageNum: 20
                    }
                    PlaceVsContainer(params).then((res) => {
                        if (res.code == 0) {
                            this.list = res.data
                        }
                        this.destination = this.list.filter(function(s) {
                            return s.containerName && s.containerName.trim();
                        })
                    })
                }
                this.dialogShowGoal = true
            },
            //器具号回显
            pickerB(val, event) {
                this.destination.containerName = val.containerName
                let params = {
                    page: '1',
                    onePageNum: 20,
                    containerName: this.destination.containerName
                }
                PlaceVsContainer(params).then((res) => {
                    if (res.code == 0) {
                        this.list = res.data
                    }
                    this.pnOpen = this.list.filter(function(s) {
                        return s.itemName && s.itemName.trim();
                    })
                    this.type = this.list[0].place
                    this.open = true
                    this.pn = ''
                })
 
                this.dialogShowGoal = false
            },
            //起始位置列表
            place() {
                this.stateType = [{}]
                this.dialogType = true
 
                let params = {
                    page: '1',
                    itemName: this.pn,
                    onePageNum: 20
                }
                PlaceVsContainer(params).then((res) => {
                    if (res.code == 0) {
                        this.list = res.data
                    }
                    let data = this.list.filter(function(s) {
                        return s.place && s.place.trim();
                    })
                    data.forEach((item, index) => {
                        this.stateType.push({
                            value: JSON.stringify(index + 1),
                            label: item.place
                        })
                    })
                })
 
            },
            //起始位置回显
            stateLable(e) {
                this.type = e[0].label
 
                let params = {
                    page: '1',
                    place: this.type,
                    onePageNum: 20
                }
                PlaceVsContainer(params).then((res) => {
                    if (res.code == 0) {
                        this.list = res.data
                        this.pnOpen = this.list.filter(function(s) {
                            return s.itemName && s.itemName.trim();
                        })
                        this.destination.containerName = this.list[0].containerName
                        this.pn = ''
                        this.open = true
                    }
                })
 
            },
            //目标位置回显
            target(e) {
                this.stateText = e[0].label
            }
        }
    };
</script>
 
<style lang="scss" scoped>
    page {
        background-color: #f5f5f9;
    }
 
    .search {
        background-color: #f2f2f2;
        padding: 5px;
    }
 
    .title {
        display: flex;
        height: 2.2rem;
        font-size: 1rem;
        align-items: center;
        justify-content: center;
        /* padding-right: 9px; */
    }
 
    .fix {
        position: fixed;
        bottom: 0;
        width: 100%;
        height: 100px;
        padding: 0 3px;
 
        >.u-btn {
            margin: 5px 0;
        }
    }
 
    .line {
        height: 50px;
        border-bottom: 1px solid #eaeaea;
        padding-left: 3rem;
        font-size: 1rem;
        padding-right: 10px;
        display: flex;
        align-items: center;
        background-color: #fff;
        margin: 10px 0;
    }
 
    .line2 {
        line-height: 2.3rem;
        padding: 8px 10px 8px 3rem;
        font-size: 0.93rem;
    }
 
    .line3 {
        line-height: 1.8rem;
        padding: 8px 3px;
        font-size: 0.93rem;
        border-bottom: 1px solid #eaeaea;
        text-align: center;
    }
 
    .pl2 {
        padding-left: 2rem !important;
    }
 
    .col7 {
        color: #777;
    }
 
    .ml10 {
        margin-left: 10px;
    }
 
    .tr {
        text-align: right;
    }
 
    .btn {
        font-size: 0.8rem;
        position: absolute !important;
        right: 10px;
        height: 30px !important;
    }
 
    .center {
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }
 
    .space-between {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
</style>