zs
2025-05-14 3ec65a96dd073e598e58c12fb0b5af31e38bc20e
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
<template>
    <view class="plywood-instore-edit-page-content">
        <view class="form-view">
            <!-- ******************** -->
            <long-width-height-form-item 
                class="forma-item"
                label="尺寸" 
                :long.sync="form.materiallength" 
                :width.sync="form.materialwidth" 
                :height.sync="form.materialhigh"
                :msg="msg.materialspec"
                :required="true"
            />
            <scan-input-form-item
                type="digit"
                label="数量"
                v-model="form.bindquantity"
                :msg="msg.bindquantity"
                :has-scan="false"
                :has-search="false"
                :required="true"
            />
            <!-- ******************** -->
        </view>
    </view>
</template>
 
<script>
import ScanInputFormItem from '@/components/ScanInputFormItem.vue'
import LongWidthHeightFormItem from '@/pages/components/LongWidthHeightFormItem.vue'
const defaultForm = {
    bindquantity:null,
    materiallength:null,
    materialwidth:null,
    materialhigh:null
}
export default {
    name:'plywoodInstoreEditPageContent',
    components:{ScanInputFormItem,LongWidthHeightFormItem},
    data(){
        return {
            form:{...defaultForm},
            msg:{
                materialspec:'',
                bindquantity:''
            }
        }
    },
    watch:{
        'form.materiallength'(newVal,oldVal) {
            if (newVal!==oldVal) {
                this.watchSpec()
            }
        },
        'form.materialwidth'(newVal,oldVal) {
            if (newVal!==oldVal) {
                this.watchSpec()
            }
        },
        'form.materialhigh'(newVal,oldVal) {
            if (newVal!==oldVal) {
                this.watchSpec()
            }
        },
        'form.bindquantity'(newVal,oldVal) {
            if (newVal!==oldVal) {
                this.watchBindquantity()
            }
        }
    },
    methods:{
        init(obj){
            if (obj) {
                this.form = {...obj}
            } else {
                this.form = {...defaultForm}
            }
        },
        getFormValues(){
            return {...this.form}
        },
        checkConfirm(){
            let res = {flag:true,data:{}}
            res.data = this.getFormValues()
            if (res.flag && (!res.data.materiallength || !res.data.materialwidth || !res.data.materialhigh)) {
                this.msg.materialspec = '请先录入尺寸!'
                res.flag = false
            } else {
                this.msg.materialspec = ''
            }
            if (res.flag && !res.data.bindquantity) {
                this.msg.bindquantity = '请先录入数量!'
                res.flag = false
            } else {
                this.msg.bindquantity = ''
            }
            return res;
        },
        watchSpec(){
            if (this.form.materiallength && this.form.materialwidth && this.form.materialhigh) {
                this.msg.materialspec = ''
            }
        },
        watchBindquantity(){
            if(this.form.bindquantity) {
                this.msg.bindquantity = ''
            } else {
                this.msg.bindquantity = '请先录入数量!'
            }
        }
    }
}
</script>
 
<style scoped lang="scss">
.plywood-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>