schangxiang@126.com
2025-09-02 8b3046790fd09138da072edd4ef48fdeb16e1879
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
<template>
    <view class="page-containter page-containter-x">
        <view class="page-header">
            <page-header-x :ctitle="page_ctitle" />
            <user-row></user-row>
        </view>
        <view class="page-content">
            <view class="add_site">
                <u-form :model="addForm" ref="addRef" label-width="180">
                    <!-- 托盘号 -->
                    <u-form-item label="托盘号:">
                        <u-input v-model="addForm.containerCode" :focus="true" placeholder="请扫描托盘条码" border></u-input>
                    </u-form-item>
                    <u-form-item label="站点选择:">
                        <u-input placeholder="请选择站点" v-model="addForm.station" type="select" :border="true"
                            @click="siteFlag = true"></u-input>
                        <u-action-sheet :list="siteList" v-model="siteFlag" @click="confirm"></u-action-sheet>
                    </u-form-item>
                </u-form>
                <view class="btns-row">
                    <view class="btn-block"><u-button type="error" @click="cancalAdd">取消</u-button></view>
                    <view class="divider-block"></view>
                    <view class="btn-block"><u-button type="primary" @click="confirmAdd">确定</u-button></view>
                    </view>
            </view>
        </view>
    </view>
</template>
 
<script>
    import {
        intoEmpty
    } from '../../api/addSite/addSite.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 {
                focus_productCode:true,
                page_ctitle:'空托入库',
                materialList: [], //物料列表数据
                addForm: {
                    type:'', //类型:body header
                    station: '',
                    containerCode: ''//托盘号
                },
                result: {},
                siteFlag: false,
                siteList: []
            }
        },
        watch: {
            addForm: {
                handler(val) {
                },
                deep: true
            }
        },
        /* 通常只用于获取传递参数 */
        onLoad(options) {
            console.log('load')
            this.addForm.type=options.type;//记住type值 【EditBy shaocx,2022-03-16】
            if (options.type === 'body') {
                this.siteList = $config.sites.offlineBody;
                this.page_ctitle='空托入库(缸体)';
            } else {
                this.siteList = $config.sites.offlineHeader;
                this.page_ctitle='空托入库(缸盖)';
            }
        },
        //页面加载事件
        onReady() {
            
        },
 
        //下拉刷新
        onPullDownRefresh() {
            this.clearAddForm();
            //重新获取物料列表
            uni.stopPullDownRefresh();
        },
        methods: {
            confirm(index) {
                this.addForm.station = this.siteList[index].text;
            },
            confirm_toPlace(index) {
                this.addForm.toStieCode = this.to_siteList[index].text;
            },
            change(e) {
                console.log(e.detail);
            },
            edit(item) {
                uni.showToast({
                    title: item.name,
                    icon: 'none'
                });
            },
            subList(index)
            {
            },
            //清空添加数据
            clearAddForm() {
                this.addForm.station = '';
                this.addForm.containerCode = '';
            },
            //聚焦事件
            focus() {
                //阻止软件盘弹出
                uni.hideKeyboard()
            },
            //取消添加
            cancalAdd() {
                uni.navigateBack({
                    delta: 1
                })
            },
            //提交添加
            confirmAdd() {
                if (this.addForm.station&&this.addForm.containerCode) {
                    intoEmpty(this.addForm.station,this.addForm.type,this.addForm.containerCode).then(res => {
                        uni.showToast({
                            title: '提交成功',
                            icon: 'success'
                        })
                        //关闭当前页面
                        setTimeout(() => {
                            //关闭当前页面
                            this.cancalAdd();
                        }, 2000)
                    }).catch(() => {
 
                    })
                } else {
                    uni.showToast({
                        title: '参数不规范'
                    })
                }
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .add_site {
        width: 94%;
        margin: 10rpx auto;
        font-size: 30rpx;
        text-align: left;
 
        .btns-row{
            display: flex;
            padding: 12rpx 0;
            .btn-block{
                width: 10rpx;
                flex: 1;
            }
            .divider-block{
                width: 8px;
                flex-shrink: 0;
            }
        }
        
        .list-item{
            display: flex;
            padding-bottom: 16rpx;
            border-bottom: 1px solid #dcdcdc;
            .list-no{
                width: 100rpx;
                flex-shrink: 0;
                display: flex;
                align-items: center;
            }
            .list-value{
                flex: 1;
                word-break:break-all;
                word-wrap:break-word;
            }
        }
    }
</style>