<template> 
 | 
    <van-popup 
 | 
        v-model:show="props.show" 
 | 
        position="bottom" 
 | 
        :style="{ height: '100%' }"> 
 | 
        <div class="title"> 
 | 
            <div class="close" @click="close"><van-icon name="arrow-down" size="30" color="#ffffff" /></div> 
 | 
        </div> 
 | 
        <div class="content"> 
 | 
            <van-pull-refresh v-model="refreshing" @refresh="onRefresh"> 
 | 
                <van-list 
 | 
                    v-model:loading="loading" 
 | 
                    :finished="finished" 
 | 
                    finished-text="没有更多了~" 
 | 
                    @load="onLoad" 
 | 
                > 
 | 
                    <div class="content_list"> 
 | 
                        <div class="page_content" v-for="(item1, idx) in list" :key="idx" @click="jump(item1)"> 
 | 
                            <div class="page_content_title"> 
 | 
                                <div class="page_content_title_top"> 
 | 
                                    <span v-if="item1.batch">{{ item1.materialName + ' | ' + item1.materialCode }}</span> 
 | 
                                    <span v-else>{{ item1.materialName + ' | ' + item1.materialCode }}</span> 
 | 
                                    <!-- <span>{{item1.num}}{{item1.unitName}}</span> --> 
 | 
                                </div> 
 | 
                                <div class="page_content_title_bottom"> 
 | 
                                    <span>{{ item1.locationName }} / </span> 
 | 
                                    <span>{{ item1.num }}{{ item1.unitName }}</span> 
 | 
                                </div> 
 | 
                                <div class="page_content_title_bottom"> 
 | 
                                    <span class="green" v-if="item1.qualityType == 0">合格 <span class="black">/</span> </span> 
 | 
                                    <span class="warning" v-else-if="item1.qualityType == 1">不良 <span class="black">/</span> </span> 
 | 
                                    <span class="error" v-else-if="item1.qualityType == 2">报废 <span class="black">/</span> </span> 
 | 
                                    <span v-else>- / </span> 
 | 
                                    <span>{{item1.procedureName ? item1.procedureName : '-'}} / </span> 
 | 
                                    <span>{{item1.batch ? item1.batch : '-'}}</span> 
 | 
                                </div> 
 | 
                            </div> 
 | 
                        </div> 
 | 
                        <!-- <div class="content_list_item" v-for="(item, i) in props.list" :key="i" @click="jump(item)"> 
 | 
                            <div class="content_list_item_name">{{item.materialName}}</div> 
 | 
                        </div> --> 
 | 
                    </div> 
 | 
                </van-list> 
 | 
            </van-pull-refresh> 
 | 
        </div> 
 | 
    </van-popup> 
 | 
</template> 
 | 
  
 | 
<script setup lang="ts"> 
 | 
    import { defineProps, defineEmits, onMounted, ref, reactive } from 'vue' 
 | 
    import { choiceStockListPage, choiceStockPageForStandard } from '@/apis/agencyAPI' 
 | 
    import { model } from '@/interface' 
 | 
    import { judgmentPlatform } from "@/utils/utils" 
 | 
  
 | 
    // 搜索数据接口 
 | 
    interface form extends model { 
 | 
        total: number, 
 | 
        name: string 
 | 
    } 
 | 
  
 | 
    const form = reactive<form>({ 
 | 
        capacity: 50, 
 | 
        page: 0, 
 | 
        total: 0, 
 | 
        name: '', 
 | 
    }) 
 | 
  
 | 
    // 搜索分类标签 
 | 
    let tagList = ref<Array<{id: string, name: string, num: string}>>([]) 
 | 
  
 | 
    // 列表数据 
 | 
    const list: any = ref([]); 
 | 
    const loading = ref(false); 
 | 
    const finished = ref(false); 
 | 
    const refreshing = ref(false) 
 | 
    let isOne = ref<boolean>(true) 
 | 
  
 | 
    // 搜索框 
 | 
    const searchInput = (data: any) => { 
 | 
        form.page = 0 
 | 
        finished.value = false 
 | 
        list.value = [] 
 | 
        form.name = data 
 | 
        onLoad() 
 | 
    } 
 | 
  
 | 
    // 搜索提交 
 | 
    const submit = (): void => { 
 | 
        form.page = 0 
 | 
        finished.value = false 
 | 
        list.value = [] 
 | 
        onLoad() 
 | 
    } 
 | 
  
 | 
    // 返回上一页带参数 
 | 
    const jump = (item: any) => { 
 | 
        emit('value', item) 
 | 
    } 
 | 
  
 | 
    // 获取物料列表数据 
 | 
    const onLoad = async () => { 
 | 
        if (!finished.value) { 
 | 
            loading.value = true; 
 | 
            form.page = form.page + 1 
 | 
            choiceStockPageForStandard({ 
 | 
                capacity: form.capacity, 
 | 
                page: form.page, 
 | 
                model: { 
 | 
                    workorderId: props.workorderId, 
 | 
                    deviceId: props.deviceId 
 | 
                } 
 | 
            }).then(res => { 
 | 
                if (refreshing.value) { 
 | 
                    list.value = []; 
 | 
                    refreshing.value = false; 
 | 
                } 
 | 
                loading.value = false; 
 | 
                if (res.code === 200 && res.data.records && res.data.records.length !== 0) { 
 | 
                    form.total = res.data.total 
 | 
                    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; 
 | 
                } 
 | 
            }) 
 | 
        } 
 | 
    } 
 | 
  
 | 
    // 下拉刷新优化页面 
 | 
    const onRefresh = () => { 
 | 
        finished.value = false; 
 | 
        form.page = 0 
 | 
        loading.value = true; 
 | 
        onLoad() 
 | 
    } 
 | 
  
 | 
    let status = ref<boolean>(false) 
 | 
  
 | 
    const props = defineProps({ 
 | 
        show: { 
 | 
            type: Boolean, 
 | 
            required: true 
 | 
        }, 
 | 
        workorderId: { 
 | 
            type: String, 
 | 
            required: true 
 | 
        }, 
 | 
        deviceId: { 
 | 
            type: String, 
 | 
            required: true 
 | 
        } 
 | 
    }) 
 | 
  
 | 
    const emit = defineEmits(['close', 'value']) 
 | 
  
 | 
    // 关闭回调 
 | 
    const close = () => { 
 | 
        emit('close') 
 | 
    } 
 | 
  
 | 
    onMounted(() => { 
 | 
        status.value = judgmentPlatform() 
 | 
    }) 
 | 
</script> 
 | 
  
 | 
<style lang="scss" scoped> 
 | 
    .title { 
 | 
        position: fixed; 
 | 
        right: 50px; 
 | 
        bottom: 100px; 
 | 
        z-index: 9; 
 | 
        .close { 
 | 
            width: 80px; 
 | 
            height: 80px; 
 | 
            border-radius: 50%; 
 | 
            background: #999999; 
 | 
            display: flex; 
 | 
            align-items: center; 
 | 
            justify-content: center; 
 | 
        } 
 | 
    } 
 | 
    .content { 
 | 
        .content_code { 
 | 
            position: fixed; 
 | 
            right: 30px; 
 | 
            bottom: 100px; 
 | 
            img { 
 | 
                width: 138px; 
 | 
                height: 138px; 
 | 
            } 
 | 
        } 
 | 
        .content_top { 
 | 
            top: 0 !important; 
 | 
        } 
 | 
        .content_search { 
 | 
            padding: 30px; 
 | 
            background: white; 
 | 
            position: sticky; 
 | 
            top: 88px; 
 | 
            z-index: 9; 
 | 
            .content_search_x { 
 | 
                height: 24px; 
 | 
            } 
 | 
        } 
 | 
        .content_total { 
 | 
            padding: 24px 30px; 
 | 
            background: #F7F7F7; 
 | 
            font-size: 24px; 
 | 
            font-weight: 400; 
 | 
            color: #666666; 
 | 
        } 
 | 
        .content_list { 
 | 
            width: 100%; 
 | 
            height: 100%; 
 | 
            display: flex; 
 | 
            padding: 0 30px; 
 | 
            box-sizing: border-box; 
 | 
            flex-direction: column; 
 | 
            .page_content { 
 | 
                margin-top: 36px; 
 | 
                .page_content_title { 
 | 
                    display: flex; 
 | 
                    flex-direction: column; 
 | 
                    margin-bottom: 10px; 
 | 
                    .page_content_title_top { 
 | 
                        display: flex; 
 | 
                        align-items: center; 
 | 
                        justify-content: space-between; 
 | 
                        span { 
 | 
                            &:nth-child(1) { 
 | 
                                font-size: 30px; 
 | 
                                font-weight: 500; 
 | 
                                color: #222222; 
 | 
                            } 
 | 
                            &:nth-child(2) { 
 | 
                                flex-shrink: 0; 
 | 
                                font-size: 24px; 
 | 
                                font-weight: 400; 
 | 
                                color: #333333; 
 | 
                                span { 
 | 
                                    font-size: 24px; 
 | 
                                    color: $nav-color; 
 | 
                                } 
 | 
                            } 
 | 
                        } 
 | 
                    } 
 | 
                    .page_content_title_bottom { 
 | 
                        margin-top: 10px; 
 | 
                        .green { 
 | 
                            color: $nav-stateColor7 !important; 
 | 
                            .black { 
 | 
                                color: black !important; 
 | 
                            } 
 | 
                        } 
 | 
                        .warning { 
 | 
                            color: $nav-stateColor5 !important; 
 | 
                            .black { 
 | 
                                color: black !important; 
 | 
                            } 
 | 
                        } 
 | 
                        .error { 
 | 
                            color: $nav-stateColor4 !important; 
 | 
                            .black { 
 | 
                                color: black !important; 
 | 
                            } 
 | 
                        } 
 | 
                        span { 
 | 
                            font-size: 24px; 
 | 
                            font-weight: 400; 
 | 
                            color: #666666; 
 | 
                        } 
 | 
                    } 
 | 
                } 
 | 
                .lineBorder { 
 | 
                    border: none !important; 
 | 
                    padding-bottom: 0 !important; 
 | 
                    margin-bottom: 24px; 
 | 
                } 
 | 
                .page_content_list { 
 | 
                    width: 100%; 
 | 
                    display: flex; 
 | 
                    align-items: center; 
 | 
                    flex-wrap: wrap; 
 | 
                    &:first-child { 
 | 
                        margin: 0; 
 | 
                    } 
 | 
                    &:last-child { 
 | 
                        border: none; 
 | 
                    } 
 | 
                    .page_content_list_nums { 
 | 
                        width: 30%; 
 | 
                        display: flex; 
 | 
                        .page_content_list_num_label { 
 | 
                            font-size: 26px; 
 | 
                            font-weight: 400; 
 | 
                            color: #666666; 
 | 
                        } 
 | 
                        .page_content_list_num_nr { 
 | 
                            font-size: 26px; 
 | 
                            font-weight: 400; 
 | 
                            color: #222222; 
 | 
                        } 
 | 
                    } 
 | 
                    .page_content_list_num { 
 | 
                        width: 70%; 
 | 
                        display: flex; 
 | 
                        .page_content_list_num_label { 
 | 
                            font-size: 26px; 
 | 
                            font-weight: 400; 
 | 
                            color: #666666; 
 | 
                        } 
 | 
                        .page_content_list_num_nr { 
 | 
                            font-size: 26px; 
 | 
                            font-weight: 400; 
 | 
                            color: #222222; 
 | 
                        } 
 | 
                    } 
 | 
                    .page_content_list_items { 
 | 
                        width: 30%; 
 | 
                        display: flex; 
 | 
                        margin-top: 24px; 
 | 
                        .page_content_list_item_label { 
 | 
                            font-size: 26px; 
 | 
                            font-weight: 400; 
 | 
                            color: #666666; 
 | 
                            flex-shrink: 0; 
 | 
                        } 
 | 
                        .page_content_list_item_nr { 
 | 
                            font-size: 26px; 
 | 
                            font-weight: 400; 
 | 
                            color: #222222; 
 | 
                        } 
 | 
                    } 
 | 
                    .page_content_list_item { 
 | 
                        width: 70%; 
 | 
                        display: flex; 
 | 
                        .page_content_list_item_label { 
 | 
                            font-size: 26px; 
 | 
                            font-weight: 400; 
 | 
                            color: #666666; 
 | 
                            flex-shrink: 0; 
 | 
                        } 
 | 
                        .page_content_list_item_nr { 
 | 
                            font-size: 26px; 
 | 
                            font-weight: 400; 
 | 
                            color: #222222; 
 | 
                        } 
 | 
                    } 
 | 
                } 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
</style> 
 |