zs
2025-06-04 5a149d626ae8bc3fa4bddbb53f8caf40f51f6da6
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
<template>
    <view class="temporary-instore-step2-page-content">
        <easy-select-form-item
            class="forma-item"
            label="起始位置"
            v-model="form.stationCode"
            :list="selectOptions.startPlaces"
            value-field="stationCode"
            label-field="stationName"
        />
        
        <easy-select-form-item
            class="forma-item"
            label="目标库"
            v-model="form.areaId"
            :list="selectOptions.endAreas"
            value-field="areaId"
            label-field="areaName"
        />
    </view>
</template>
 
<script>
import EasySelectFormItem from '@/components/EasySelectFormItem.vue'
import { $alert } from '@/static/js/utils/index.js'
const defaultForm = {
    stationCode:'',
    areaId:''
}
export default {
    name:'temporaryInstoreStep2PageContent',
    components:{EasySelectFormItem},
    data(){
        return {
            form: {...defaultForm},
            selectOptions:{
                endAreas:[],
                startPlaces:[]
            },
            loaded:false
        }
    },
    methods:{
        show(){
            this.getSelectsOptions((f)=>{
                if (f) {
                    this.resetForm()
                }
            })
        },
        resetForm(){
            if (this.selectOptions.startPlaces.length===1) {
                this.form.stationCode = this.selectOptions.startPlaces[0].stationCode
            } else {
                this.form.stationCode = ''
            }
            if (this.selectOptions.endAreas.length===1) {
                this.form.areaId = this.selectOptions.endAreas[0].areaId
            } else {
                this.form.areaId = ''
            }
        },
        getSelectsOptions(callback){
            if (this.loaded) {
                callback && callback(true)
            } else {
                uni.showLoading({
                    title: '加载中...',
                    mask:true
                });
                Promise.all([
                    this.$api.get('StarPlaceList',{},{block:'quickIn',warn:false,loading:false}),
                    this.$api.get('PdaGetAreaList',{},{block:'quickIn',warn:false,loading:false})
                ]).then(res=>{
                    this.selectOptions.startPlaces = res[0] || []
                    this.selectOptions.endAreas = res[1] || []
                    this.loaded = true
                    uni.hideLoading();
                    callback && callback(true)
                }).catch(ex=>{
                    uni.hideLoading();
                    $alert(ex)
                    callback && callback(false)
                })
            }
        },
        get(){
            return this.form
        }
    }
}
</script>
 
<style scoped lang="scss">
.temporary-instore-step2-page-content{
    height: 100%;
    overflow: auto;
    .forma-item{
        margin-bottom: 24rpx;
    }
}
</style>