schangxiang@126.com
2025-09-03 e91def8bc6774a5511542292ed2db1e44b685972
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
<template>
    <view class="page-containter page-containter-x">
        <view class="page-header">
            <page-header-x ctitle="缸盖上线" />
            <user-row></user-row>
        </view>
        <view class="page-content">
            <view class="online">
                <!-- 叫料 -->
                <view class="online_site">
                    <u-form :model="callForm" ref="callRef">
                        <!-- 站点 -->
                        <u-row gutter="16">
                            <u-col span="3">站点选择:</u-col>
                            <u-col span="9">
                                <u-input placeholder="请选择站点" v-model="callForm.station" type="select" :border="true" @click="siteFlag = true"></u-input>
                                <u-action-sheet :list="siteList" v-model="siteFlag" @click="confirm"></u-action-sheet>
                            </u-col>
                        </u-row>
                        <!-- 物料编号 -->
                        <u-row gutter="16">
                            <u-col span="3">物料编号:</u-col>
                            <u-col span="9">
                                <u-input v-model="callForm.materialCode"  :border="true" placeholder="请输入物料编号" @blur="getSelectMaterialList"/>
                            </u-col>
                        </u-row>
                        <!-- 呼叫物料 -->
                        <u-row>
                            <u-col span="6" offset="3">
                                <u-button type="success"  :disabled=" !(callForm.materialCode.length > 0 && callForm.station.length > 0)" @click="callMaterial">呼叫物料</u-button>
                            </u-col>
                        </u-row>
                    </u-form>
                </view>
                <!-- 托盘回库 -->
                <view class="online_site">
                    <u-form :model="backForm" ref="backRef">
                        <!-- 站点选择 -->
                        <u-row gutter="16">
                            <u-col span="3">站点选择:</u-col>
                            <u-col span="9">
                                <u-input placeholder="请选择站点" v-model="backForm.station" type="select" :border="true" @click="siteBack = true"></u-input>
                                <u-action-sheet :list="siteList" v-model="siteBack" @click="confirmBack"></u-action-sheet>
                            </u-col>
                        </u-row>
                        <!-- 回库数量 -->
                        <u-row gutter="16">
                            <u-col span="3">回库数量:</u-col>
                            <!-- 物料编号 -->
                            <u-col span="9">
                                <u-input v-model="backForm.quality" type="number" max="3" :border="true" :disabled="true" placeholder="请输入回库数量"/>
                            </u-col>
                        </u-row>
                        <!-- 空托盘回库 -->
                        <u-row gutter="16">
                            <u-col span="6" offset="3">        
                                <u-button type="warning"  :disabled="!(backForm.quality > 0 && backForm.station.length > 0)" @click="emptyBack">空托盘回库</u-button>
                            </u-col>
                        </u-row>
                    </u-form>
                </view>
                <u-picker v-model="materialFlag" mode="selector" :default-selector="[0]" :range="selectMaterialList" @confirm="confirmMaterial"></u-picker>
            </view>
        </view>
    </view>
</template>
 
<script>
    import {callMaterial,emptyBack,geMaterialList} from '../../api/online/online.js'
    import PageHeaderX from '../../compontents/PageHeaderX.vue'
    import UserRow from '../../compontents/UserRow.vue'
    import $config from '../../util/config.js'
    export default {
        components:{"page-header-x":PageHeaderX,UserRow},
        data() {
            return {
                callForm: { //呼叫物料请求参数
                    station: '',
                    materialCode: ''
                },
                backForm: { // 空托盘回库
                    station: '',
                    quality: 3,
                },
                siteFlag:false,//叫料站点列表
                siteBack:false, //空托站点列表
                siteList:$config.sites.onLineHeader,
                totalMaterialList:[], //总的物料列表数据
                selectMaterialList:[], //匹配成功的 物料列表数据
                materialFlag: false, //物料picker的状态
            }
        },
        //页面加载事件
        onReady() {
            this.geMaterialList();
        },
        //下来刷新,清空请求数据
        onPullDownRefresh() {
            this.resetForm(() => {
                uni.stopPullDownRefresh();
            })
        },
        methods: {
            //叫料站点点击确定
            confirm(index) {
                this.callForm.station = this.siteList[index].text;
            },
            //空托站点点击确定
            confirmBack(index) {
                this.backForm.station = this.siteList[index].text;
            },
            //获取物料列表
            geMaterialList(){
                this.totalMaterialList = [];
                geMaterialList().then(res => {
                    res.data.forEach(item => {
                        this.totalMaterialList.push(item.materialCode);
                    })
                }).catch(()=>{})
            },
            //物料输入框失焦事件
            getSelectMaterialList(){
                this.selectMaterialList = [];
                this.selectMaterialList = this.totalMaterialList.filter(item => item.includes(this.callForm.materialCode));
                this.materialFlag = true;
            },
            //picker选择器点击确定事件
            confirmMaterial(selectArr) {
                this.callForm.materialCode = this.selectMaterialList[selectArr[0]];
            },
            //清空请求参数
            resetForm(callback){
                this.callForm.materialCode = '';
                this.callForm.station = '';
                this.backForm.station = '';
                callback && callback();
            },
            // 呼叫物料
            callMaterial(){
                callMaterial(this.callForm).then(res => {
                    //叫料成功
                    uni.showToast({
                        title:'叫料成功',
                        icon:'success'
                    })
                    //清空物料
                    this.callForm.materialCode = '';
                }).catch(()=>{})
            },
            //空托盘回库
            emptyBack(){
                emptyBack(this.backForm).then(res => {
                    uni.showToast({
                        title:'回库成功',
                        icon: 'success'
                    });
                }).catch(()=>{})
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .online {
        width: 100%;
        height: 100%;
        overflow: hidden;
    }
    .online_site {
        width: 96%;
        margin: 50rpx auto;
        border: 1px solid #ccc;
        border-radius: 6rpx;
        box-shadow: 5rpx 5rpx 3rpx #eee;
        .u-row {
            margin: 40rpx auto;
            font-size: 32rpx;
            .u-col {
                text-align: center !important;
            }
        }
    }
    .online_item {
        width: 94%;
        margin: 20rpx auto;
        border: 1px solid #eee;
        padding: 10rpx;
        box-shadow: 5rpx 5rpx 5rpx #eee;
        border-radius: 10rpx;
        .u-row {
            font-size: 32rpx;
            margin-bottom: 10rpx;
            .sendBtn {
                text-align: center !important;
            }
        }
    }
</style>