schangxiang@126.com
2025-05-20 e92383f760f42050f55aa032c649814deb3b7752
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
<template>
    <view class="unstacking-instore-edit-page-content">
        <view class="form-view">
            <!-- ******************** -->
            <scan-input-form-item
                class="forma-item"
                label="物料编码"
                v-model="form.materialNo"
                :msg="msg.materialNo"
                :has-search="false"
                :required="true"
            />
            <scan-input-form-item
                class="forma-item"
                label="图号"
                v-model="form.drawingNo"
                :msg="msg.drawingNo"
                :has-scan="false"
                :has-search="false"
                :required="true"
            />
            <scan-input-form-item
                class="forma-item"
                label="船号"
                v-model="form.shipNo"
                :msg="msg.shipNo"
                :has-scan="false"
                :has-search="false"
                :required="true"
            />
            <long-width-height-form-item 
                class="forma-item"
                label="尺寸" 
                :long.sync="form.long" 
                :width.sync="form.wide" 
                :height.sync="form.high"
                :msg="msg.materialspec"
                :required="true"
            />
            <!-- ******************** -->
        </view>
    </view>
</template>
 
<script>
import ScanInputFormItem from '@/components/ScanInputFormItem.vue'
import LongWidthHeightFormItem from '@/pages/components/LongWidthHeightFormItem.vue'
const defaultForm = {
    materialNo:'',
    shipNo:'',
    drawingNo:'',
    long:null,
    wide:null,
    high:null
}
export default {
    name:'unstackingInstoreEditPageContent',
    components:{ScanInputFormItem,LongWidthHeightFormItem},
    data(){
        return {
            form:{...defaultForm},
            msg:{
                materialNo:'',
                shipNo:'',
                drawingNo:'',
                materialspec:'',
                noWarn:false
            }
        }
    },
    watch:{
        'form.long'(newVal,oldVal) {
            if (newVal!==oldVal) {
                this.watchSpec()
            }
        },
        'form.wide'(newVal,oldVal) {
            if (newVal!==oldVal) {
                this.watchSpec()
            }
        },
        'form.high'(newVal,oldVal) {
            if (newVal!==oldVal) {
                this.watchSpec()
            }
        },
        'form.materialNo'(newVal,oldVal) {
            if (newVal!==oldVal) {
                this.watchMaterialNo()
            }
        },
        'form.shipNo'(newVal,oldVal) {
            if (newVal!==oldVal) {
                this.watchShipNo()
            }
        },
        'form.drawingNo'(newVal,oldVal) {
            if (newVal!==oldVal) {
                this.watchDrawingNo()
            }
        }
    },
    methods:{
        init(obj){
            this.noWarn = true
            if (obj) {
                this.form = {...obj}
            } else {
                this.form.materialNo = ''
            }
            this.$nextTick(()=>{
                this.noWarn = false
            })
        },
        getFormValues(){
            return {...this.form}
        },
        checkConfirm(){
            let res = {flag:true,data:{}}
            res.data = this.getFormValues()
            if (!res.data.materialNo) {
                this.msg.materialNo = '请录入物料编码!'
                res.flag = false
            } else {
                this.msg.materialNo = ''
            }        
            if (res.flag && (!res.data.long || !res.data.wide || !res.data.high)) {
                this.msg.materialspec = '请录入尺寸!'
                res.flag = false
            } else {
                this.msg.materialspec = ''
            }
            if (res.flag && !res.data.drawingNo) {
                this.msg.drawingNo = '请录入图号!'
                res.flag = false
            } else {
                this.msg.drawingNo = ''
            }
            if (res.flag && !res.data.shipNo) {
                this.msg.shipNo = '请录入船号!'
                res.flag = false
            } else {
                this.msg.shipNo = ''
            }
            return res;
        },
        watchSpec(){
            if (this.form.long && this.form.wide && this.form.high) {
                this.msg.materialspec = ''
            }
        },
        watchMaterialNo(){
            if(!this.form.materialNo && !this.noWarn) {
                this.msg.materialNo = '请录入物料编码!'
            } else {
                this.msg.materialNo = ''
            }
        },
        watchDrawingNo(){
            if(!this.form.drawingNo && !this.noWarn) {
                this.msg.drawingNo = '请录入图号!'
            } else {
                this.msg.drawingNo = ''
            }
        },
        watchShipNo(){
            if(!this.form.shipNo && !this.noWarn) {
                this.msg.shipNo = '请录入船号!'
            } else {
                this.msg.shipNo = ''
            }
        }
    }
}
</script>
 
<style scoped lang="scss">
.unstacking-instore-edit-page-content{
    height: 100%;
    box-sizing: border-box;
    padding-bottom: 12rpx;
    .form-view{
        height: 100%;
        overflow: auto;
    }
    .forma-item{
        margin-bottom: 24rpx;
    }
}
</style>