wankeda
2025-06-24 6cc35000a6e138cfad96e7b02f8aeddcdb4ba6bf
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
<template>
    <view>
        <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem">
        </uni-segmented-control>
        <view class="content">
            <view v-if="current === 0" class="headerstyle">
                <view class="itemstyle">
                    <uni-forms label-width="120">
                        <uni-forms-item label="烘烤出料编码">
                            <uni-easyinput type="text" :focus="!addressFocus" v-model="sourceAddress"
                                placeholder="请扫描烘烤编码" ref='midInput' @input="inputChangebarcode" />
                            </uni-easyinput>
                        </uni-forms-item>
                        <button @click="inbound" type="primary" size="default" style="margin-top: 2%;">搬运确认</button>
                        </uni-forms-item>
                    </uni-forms>
                </view>
            </view>
        </view>
        <u-toast ref="uToast" />
    </view>
</template>
 
<script>
    const innerAudioContext = uni.createInnerAudioContext();
    export default {
        data() {
            return {
                items: ['输送线搬运'],
                current: 0,
                label: "",
                focus: false,
                addressFocus: false,
                sourceAddress: "",
            }
        },
        methods: {
            voiceSpeech(src) {
                innerAudioContext.src = src; // '../../static/success.mp3';
                innerAudioContext.play();
            },
            onClickItem(e) {
                this.focus = false;
                this.addressFocus = false;
                if (this.current !== e.currentIndex) {
                    this.current = e.currentIndex;
                    if (this.current == 2) {
                        this.getData();
                    }
                }
            },
            inbound() {
                var postData = {
                    MainData: {
                        "sourceAddress": this.sourceAddress,
                    }
                }
                // 提取输入框的值
                // const sourceAddress = this.sourceAddress;
 
                // if (sourceAddress == "") {
                //     this.$t.message.toast('请选择起点位置');
                //     return;
                // }
                // console.log(Exception);
                this.$u.post('/api/PDA/OutBoundTask', postData).then(res => {
                    this.$t.message.closeLoading();
                                if (res.code == 200) {
                        this.$t.message.toast('呼叫成功');
                        this.sourceAddress = "";
                        // this.$refs.popup.close();
                        // this.submit();
                    } else {
                        this.$t.message.toast(res.message);
                    }
                }).catch(err => {
                    this.$refs.uToast.show({
                        title: err.message,
                        type: "error"
                    })
                })
            },
 
            inputChangebarcode() {
                this.addressFocus = false;
                this.$nextTick(function(x) {
                    if (this.sourceAddress != '') {
                        this.addressFocus = true;
                    }
                })
            },
        }
    }
</script>
<style lang="scss">
    @import '@/common/uni-ui.scss';
 
    .content {
        display: flex;
        height: 150px;
    }
 
    .content-text {
        font-size: 14px;
        color: #666;
    }
 
    .itemstyle {
        margin-top: 30px;
        margin-left: 5%;
    }
 
    .headerstyle {
        width: 90%;
    }
</style>