wanshenmean
2025-04-08 ef0a08b828d021bdc7978406e72bbde000097f5e
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
<template>
    <view class="example">
        <!-- <u-tabs :list="list" :is-Scroll="false" :current="current"></u-tabs> -->
        <!-- <view v-show="current===0"> -->
            <!-- <uni-section title="缓存架状态设置" type="line" padding style="height: calc(100vh - 100px);"> -->
                <uni-forms ref="formup" :modelValue="baseFormData" :rules="formRules">
                    <uni-forms-item label="缓存架条码" label-width="120" required name="HCJInput">
                        <uni-easyinput v-model="baseFormData.HCJInput" focus placeholder="请扫描缓存架条码"></uni-easyinput>
                    </uni-forms-item>
                    <uni-forms-item label="缓存架状态" label-width="120" required name="classes">
                        <uni-data-select placeholder="请选择缓存架状态" :localdata="dataTree"
                            v-model="baseFormData.classes">
                        </uni-data-select>
                    </uni-forms-item>
                    <uni-forms-item label="启用/禁用:" label-width="120" required name="status">
                        <uni-data-checkbox v-model="baseFormData.status" :localdata="statuslist" />
                    </uni-forms-item> 
                </uni-forms>
                <u-button type="success" size="default" shape="circle" :ripple="true" ripple-bg-color="#909399"
                    @click="submit">
                    设置状态
                </u-button>
            <!-- </uni-section> -->
        <!-- </view> -->
    </view>
</template>
<script>
    export default {
        data() {
            return {
                baseFormData: {
                    HCJInput: '',
                    classes: 'LocationState_Empty',
                    status:0,
                    ng: 0,
                    pb: 0
                },
                dataTree: [{
                        text: "有货缓存架",
                        value: "LocationState_Stored",
                    },
                    {
                        text: "无货缓存架",
                        value: "LocationState_Empty",
                    }
                ],
                formRules: {
                    classes: {
                        rules: [{
                            required: true,
                            errorMessage: '缓存架状态不能为空'
                        }]
                    },
                    HCJInput: {
                        rules: [{
                            required: true,
                            errorMessage: '缓存架不能为空'
                        }]
                    },
                    ng: {
                        rules: [{
                            required: true,
                            errorMessage: '缓存架不能为空'
                        }]
                    },
                    pb: {
                        rules: [{
                            required: true,
                            errorMessage: '缓存架不能为空'
                        }]
                    }
                },
                list: [{
                    name: '缓存架设置'
                }],
                current: 0,
                // 单选数据源
                ngs: [{
                    text: '是',
                    value: 1
                }, {
                    text: '否',
                    value: 0
                }],
                // 单选数据源
                pbs: [{
                    text: '是',
                    value: 1
                }, {
                    text: '否',
                    value: 0
                }],
                // 单选数据源
                statuslist: [{
                    text: '启用',
                    value: 0
                }, {
                    text: '禁用',
                    value: 1
                }],
            }
        },
 
        methods: {
        
            // onClickItem(e) {
            //     if (this.current != e.currentIndex) {
            //         this.current = e.currentIndex;
            //     }
            // },
            submit() {
                this.$refs.formup.validate().then((res) => {
                    this.$t.message.loading()
                    let formDataParam = {
                        UpperCode: this.baseFormData.HCJInput,
                        LocationState: this.baseFormData.classes,
                        status:this.baseFormData.status
                        // Ng: this.baseFormData.ng,
                        // Pb: this.baseFormData.pb,
                    }
                    this.$u.post('/api/PDA/UpdateLocationState', formDataParam).then(res => {
                        this.$t.message.closeLoading()
                        if (res.status) {
                            this.$t.message.toast(res.message)
                            setTimeout(() => {
                                this.baseFormData.HCJInput = ''
                                this.baseFormData.classes = 'LocationState_Empty'
                            }, 100);
                        } else
                            this.$t.message.toast(res.message)
 
                    }).catch((err) => {
                        this.$t.message.toast(res.message)
                    })
                })
            }
 
        },
    }
</script>
 
<style lang="scss" scoped>
    .example {
        padding: 15px;
        background-color: #fff;
    }
</style>