<template> 
 | 
    <div class="page"> 
 | 
        <div class="page_title">当前:<template v-if="info.wmodel">{{info.wmodel.name}}</template> / {{info.unionName}}</div> 
 | 
        <van-pull-refresh v-model="refreshing" @refresh="onRefresh"> 
 | 
            <van-list 
 | 
                v-model:loading="loading" 
 | 
                :finished="finished" 
 | 
                finished-text="没有更多了~" 
 | 
                @load="getList" 
 | 
            > 
 | 
                <div class="page_info" v-for="(item, index) in list" :key="index"> 
 | 
                    <div class="page_info_nr"> 
 | 
                        <div class="item"> 
 | 
                            <div class="item_label">{{item.materialName}} | {{item.materialCode}}</div> 
 | 
                            <div class="item_label1"> 
 | 
                                <span class="green" v-if="item.qualityType === '0'">合格</span> 
 | 
                                <span class="yellow" v-if="item.qualityType === '1'">不良</span> 
 | 
                                <span class="red" v-if="item.qualityType === '2'">报废</span> 
 | 
                                | {{item.procedureName ? item.procedureName : '-'}} | {{item.batch ? item.batch : '-'}} 
 | 
                            </div> 
 | 
                            <div class="item_label2">数量:{{item.num}}{{item.unitName}}</div> 
 | 
                        </div> 
 | 
                    </div> 
 | 
                </div> 
 | 
            </van-list> 
 | 
        </van-pull-refresh> 
 | 
    </div> 
 | 
</template> 
 | 
  
 | 
<script setup lang="ts"> 
 | 
    import { ref, onMounted, reactive } from 'vue' 
 | 
    import { useRoute } from "vue-router" 
 | 
    import { pageForH5, pageHW } from '@/apis/WorkOrderAPI' 
 | 
    import { getLocationInfo } from '@/apis/ExWarehouse' 
 | 
  
 | 
    const route = useRoute() 
 | 
  
 | 
    const form = reactive({ 
 | 
        capacity: 10, 
 | 
        page: 0 
 | 
    }) 
 | 
  
 | 
    // 列表数据 
 | 
    const list: any = ref([]); 
 | 
    const loading = ref(false); 
 | 
    const finished = ref(false); 
 | 
    const refreshing = ref(false) 
 | 
  
 | 
    // 货位信息 
 | 
    let info = ref({}) 
 | 
  
 | 
    // 下拉刷新优化页面 
 | 
    const onRefresh = () => { 
 | 
        finished.value = false; 
 | 
        form.page = 0 
 | 
        loading.value = true; 
 | 
        getList() 
 | 
    } 
 | 
  
 | 
    // 通过货位id获取id详情 
 | 
    const getLocation = () => { 
 | 
        pageHW({ 
 | 
            capacity: 1, 
 | 
            page: 1, 
 | 
            model: { 
 | 
                id: route.query.id 
 | 
            } 
 | 
        }) 
 | 
            .then(res => { 
 | 
                if (res.code === 200) { 
 | 
                    info.value = res.data.records[0] 
 | 
                } 
 | 
            }) 
 | 
    } 
 | 
  
 | 
    const getList = () => { 
 | 
        if (!finished.value) { 
 | 
            loading.value = true; 
 | 
            form.page = form.page + 1 
 | 
            pageForH5({ 
 | 
                capacity: form.capacity, 
 | 
                page: form.page, 
 | 
                model: { 
 | 
                    locationId: route.query.id, 
 | 
                    groupType: 3, 
 | 
                    greaterZero: 1 
 | 
                } 
 | 
            }).then(res => { 
 | 
                loading.value = false; 
 | 
                if (refreshing.value) { 
 | 
                    list.value = [] 
 | 
                    refreshing.value = false; 
 | 
                } 
 | 
                if (res.code === 200 && res.data.records && res.data.records.length !== 0) { 
 | 
                    list.value.push(...res.data.records) 
 | 
                } else { 
 | 
                    finished.value = true; 
 | 
                } 
 | 
            }).catch((err: any) => { 
 | 
                loading.value = false; 
 | 
                finished.value = true; 
 | 
                if (refreshing.value) { 
 | 
                    list.value = [] 
 | 
                    refreshing.value = false; 
 | 
                } 
 | 
            }) 
 | 
        } 
 | 
    } 
 | 
  
 | 
    onMounted(() => { 
 | 
        getList() 
 | 
        getLocation() 
 | 
    }) 
 | 
</script> 
 | 
  
 | 
<style lang="scss" scoped> 
 | 
    .page { 
 | 
        width: 100%; 
 | 
        height: 100%; 
 | 
        position: absolute; 
 | 
        background: #F7F7F7; 
 | 
        .page_info { 
 | 
            padding: 30px; 
 | 
            background: #ffffff; 
 | 
            margin-bottom: 30px; 
 | 
            &:last-child { 
 | 
                margin-bottom: 0 !important; 
 | 
            } 
 | 
            .page_info_nr { 
 | 
                border-radius: 16px; 
 | 
                display: flex; 
 | 
                align-items: center; 
 | 
                flex-wrap: wrap; 
 | 
                .item { 
 | 
                    width: 55%; 
 | 
                    display: flex; 
 | 
                    flex-direction: column; 
 | 
                    margin-top: 24px; 
 | 
                    &:first-child { 
 | 
                        margin-top: 0 !important; 
 | 
                    } 
 | 
                    .item_label { 
 | 
                        font-size: 28px; 
 | 
                        font-weight: 400; 
 | 
                        color: #000000; 
 | 
                        flex-shrink: 0; 
 | 
                    } 
 | 
                    .item_label1 { 
 | 
                        font-size: 24px; 
 | 
                        font-weight: 400; 
 | 
                        color: #666666; 
 | 
                        flex-shrink: 0; 
 | 
                        margin-top: 20px; 
 | 
                    } 
 | 
                    .item_label2 { 
 | 
                        font-size: 24px; 
 | 
                        font-weight: 400; 
 | 
                        color: #000000; 
 | 
                        flex-shrink: 0; 
 | 
                        margin-top: 20px; 
 | 
                    } 
 | 
                } 
 | 
            } 
 | 
        } 
 | 
        .page_title { 
 | 
            padding: 20px 30px 20px 30px; 
 | 
            font-size: 24px; 
 | 
            font-weight: 500; 
 | 
            color: #222222; 
 | 
        } 
 | 
    } 
 | 
</style> 
 |