<template> 
 | 
    <div class="content"> 
 | 
        <div :class="{ 'content_top': status }" class="content_search"> 
 | 
            <v-Search @searchInput="searchInput" @submit="submit" :isShow="false" placeholder="搜索物料名称/编码/工序名称"> 
 | 
            </v-Search> 
 | 
        </div> 
 | 
        <van-pull-refresh v-model="refreshing" @refresh="onRefresh"> 
 | 
            <van-list 
 | 
                v-model:loading="loading" 
 | 
                :finished="finished" 
 | 
                finished-text="没有更多了~" 
 | 
                @load="onLoad"> 
 | 
                <div class="content_list"> 
 | 
                    <van-swipe-cell v-for="(item, i) in listData" :key="i"> 
 | 
                        <div class="content_list_item" @click="clickItem(item)"> 
 | 
                            <div class="content_list_item_title"> 
 | 
                                <span>{{item.materialName}}|{{item.produceName}}</span> 
 | 
                                <div class="content_list_item_title_tips" v-if="item.urgent">优先{{ item.urgent }}</div> 
 | 
                            </div> 
 | 
                            <div class="content_list_item_nr"> 
 | 
                                <div class="content_list_item_nr_box"> 
 | 
                                    <div class="label">物料编码:</div> 
 | 
                                    <div class="cr">{{item.materialName}}丨{{item.materialCode}}</div> 
 | 
                                </div> 
 | 
                                <div class="content_list_item_nr_box"> 
 | 
                                    <div class="label">计划数量:</div> 
 | 
                                    <div class="cr">{{item.num}}{{item.umodel.name}}</div> 
 | 
                                </div> 
 | 
                                <div class="content_list_item_nr_box"> 
 | 
                                    <div class="label">计划日期:</div> 
 | 
                                    <div class="cr">{{item.workPlanStartDate}} ~ {{item.workPlanEndDate}}</div> 
 | 
                                </div> 
 | 
                                <div class="content_list_item_nr_box"> 
 | 
                                    <div class="label">计划员:</div> 
 | 
                                    <div class="cr">{{item.planUserName}}</div> 
 | 
                                </div> 
 | 
                                <div class="content_list_item_nr_box"> 
 | 
                                    <div class="label">生产批次:</div> 
 | 
                                    <div class="cr">{{item.batch}}</div> 
 | 
                                </div> 
 | 
                                <div class="content_list_item_nr_box" v-if="item.salesOrder"> 
 | 
                                    <div class="label">销售订单:</div> 
 | 
                                    <div class="cr">{{ item.salesOrder }}</div> 
 | 
                                </div> 
 | 
                            </div> 
 | 
                        </div> 
 | 
                    </van-swipe-cell> 
 | 
                </div> 
 | 
            </van-list> 
 | 
        </van-pull-refresh> 
 | 
    </div> 
 | 
</template> 
 | 
  
 | 
<script setup lang="ts"> 
 | 
    import { reactive, ref, onBeforeUnmount, getCurrentInstance, onMounted } from "vue" 
 | 
    import { useRouter, useRoute } from "vue-router" 
 | 
    import { getList } from "@/apis/PlanningAPI" 
 | 
    import { judgmentPlatform } from '@/utils/utils' 
 | 
  
 | 
    const route = useRoute() 
 | 
    const router = useRouter() 
 | 
  
 | 
    let status = ref<boolean>(false)    // 根据平台是否需要设置top 
 | 
  
 | 
    const { $Bus }  = getCurrentInstance().appContext.config.globalProperties  
 | 
  
 | 
    // 分页查询数据 
 | 
    const pageData = reactive({ 
 | 
        capacity: 10, 
 | 
        page: 0, 
 | 
        total: 0, 
 | 
        name: '' 
 | 
    }) 
 | 
  
 | 
    // 列表数据 
 | 
    let listData: any = ref([]) 
 | 
    const loading = ref(false) 
 | 
    const finished = ref(false) 
 | 
    const refreshing = ref(false) 
 | 
  
 | 
    const clickItem = (obj: any) => { 
 | 
        $Bus.emit('callback', obj) 
 | 
        router.go(-1) 
 | 
    } 
 | 
  
 | 
    // 搜索提交 
 | 
    const submit = (): void => { 
 | 
        pageData.page = 0 
 | 
        finished.value = false 
 | 
        listData.value = [] 
 | 
        onLoad() 
 | 
    } 
 | 
  
 | 
    // 搜索框 
 | 
    const searchInput = (data: any) => { 
 | 
        pageData.name = data 
 | 
        pageData.page = 0 
 | 
        finished.value = false 
 | 
        listData.value = [] 
 | 
        onLoad() 
 | 
    } 
 | 
  
 | 
    // 列表 
 | 
    const onLoad = () => { 
 | 
        if (!finished.value) { 
 | 
            pageData.page = pageData.page + 1 
 | 
            loading.value = true 
 | 
            getList({ 
 | 
                capacity: pageData.capacity, 
 | 
                page: pageData.page, 
 | 
                model: { 
 | 
                    statusList: [1, 4], 
 | 
                    paused: 0 
 | 
                }, 
 | 
                sorts: [ 
 | 
                    { direction: 'DESC', property: 'CREATE_TIME' } 
 | 
                ] 
 | 
            }).then(res => { 
 | 
                if (refreshing.value) { 
 | 
                    listData.value = [] 
 | 
                    refreshing.value = false; 
 | 
                } 
 | 
                loading.value = false 
 | 
                if (res.code === 200 && res.data.records && res.data.records.length !== 0) { 
 | 
                    pageData.total = res.data.total 
 | 
                    listData.value.push(...res.data.records) 
 | 
                } else { 
 | 
                    finished.value = true 
 | 
                } 
 | 
            }).catch(err => { 
 | 
                loading.value = false 
 | 
                finished.value = true 
 | 
                if (refreshing.value) { 
 | 
                    listData.value = [] 
 | 
                    refreshing.value = false; 
 | 
                } 
 | 
            }) 
 | 
        } 
 | 
    } 
 | 
  
 | 
    // 下拉刷新优化页面 
 | 
    const onRefresh = () => { 
 | 
        finished.value = false; 
 | 
        pageData.page = 0 
 | 
        loading.value = true; 
 | 
        onLoad(); 
 | 
    } 
 | 
  
 | 
    onBeforeUnmount(() => { 
 | 
        $Bus.all.delete("changeOdr") 
 | 
    }) 
 | 
  
 | 
    onMounted(() => { 
 | 
        status.value = judgmentPlatform() 
 | 
    }) 
 | 
</script> 
 | 
  
 | 
<style lang="scss" scoped> 
 | 
    .content { 
 | 
        width: 100%; 
 | 
        // height: 100%; 
 | 
        position: absolute; 
 | 
        background: #F7F7F7; 
 | 
        .content_top { 
 | 
            top: 0 !important; 
 | 
        } 
 | 
        .content_search { 
 | 
            padding: 30px; 
 | 
            background: white; 
 | 
            box-sizing: border-box; 
 | 
            position: sticky; 
 | 
            top: 88px; 
 | 
            z-index: 9; 
 | 
            .Search_item { 
 | 
                margin-bottom: 40px; 
 | 
                .Search_item_label { 
 | 
                    font-size: 30px; 
 | 
                    font-weight: 500; 
 | 
                    color: #222222; 
 | 
                } 
 | 
                .Search_item_content { 
 | 
                    display: flex; 
 | 
                    align-items: center; 
 | 
                    justify-content: space-between; 
 | 
                    margin-top: 30px; 
 | 
                    .tag { 
 | 
                        display: flex; 
 | 
                        flex-wrap: wrap; 
 | 
                        align-items: center; 
 | 
                        .tag_active { 
 | 
                            background: $nav-color !important; 
 | 
                            color: #ffffff !important; 
 | 
                        } 
 | 
                        .tag_item { 
 | 
                            width: 156px; 
 | 
                            height: 70px; 
 | 
                            box-sizing: border-box; 
 | 
                            background: #F2F2F2; 
 | 
                            border-radius: 8px; 
 | 
                            font-size: 26px; 
 | 
                            font-weight: 400; 
 | 
                            color: #333333; 
 | 
                            display: flex; 
 | 
                            align-items: center; 
 | 
                            justify-content: center; 
 | 
                            margin-right: 22px; 
 | 
                            margin-bottom: 22px; 
 | 
                            &:nth-child(4n) { 
 | 
                                margin-right: 0; 
 | 
                            } 
 | 
                        } 
 | 
                    } 
 | 
                    span { 
 | 
                        font-size: 26px; 
 | 
                        font-weight: 400; 
 | 
                        color: #333333; 
 | 
                    } 
 | 
                    .Search_item_content_a { 
 | 
                        width: 308px; 
 | 
                        height: 70px; 
 | 
                        background: #F7F7F7; 
 | 
                        border-radius: 8px; 
 | 
                        border: 1px solid #EEEEEE; 
 | 
                        font-size: 26px; 
 | 
                        font-weight: 400; 
 | 
                        color: #B2B2B2; 
 | 
                        display: flex; 
 | 
                        align-items: center; 
 | 
                        justify-content: center; 
 | 
                    } 
 | 
                } 
 | 
            } 
 | 
            .content_search_x { 
 | 
                height: 24px; 
 | 
            } 
 | 
        } 
 | 
        .content_list { 
 | 
            width: 100%; 
 | 
            height: 100%; 
 | 
            display: flex; 
 | 
            flex-direction: column; 
 | 
            .content_list_item { 
 | 
                padding: 30px; 
 | 
                background: #ffffff; 
 | 
                margin-bottom: 20px; 
 | 
                .content_list_item_title { 
 | 
                    display: flex; 
 | 
                    align-items: center; 
 | 
                    .content_list_item_title_tips { 
 | 
                        padding: 4px 8px; 
 | 
                        box-sizing: border-box; 
 | 
                        background: #DE5243; 
 | 
                        border-radius: 8px; 
 | 
                        font-size: 22px; 
 | 
                        font-family: PingFangSC-Regular, PingFang SC; 
 | 
                        font-weight: 400; 
 | 
                        color: #FFFFFF; 
 | 
                        margin-left: 16px; 
 | 
                    } 
 | 
                    .warning { 
 | 
                        color: $nav-stateColor1 !important; 
 | 
                    } 
 | 
                    .green { 
 | 
                        color: $nav-stateColor6 !important; 
 | 
                    } 
 | 
                    span { 
 | 
                        font-size: 32px; 
 | 
                        font-family: PingFangSC-Medium, PingFang SC; 
 | 
                        font-weight: 500; 
 | 
                        color: #333333; 
 | 
                    } 
 | 
                } 
 | 
                .content_list_item_nr { 
 | 
                    padding: 24px 30px; 
 | 
                    background: #F7F7F7; 
 | 
                    border-radius: 16px; 
 | 
                    margin-top: 30px; 
 | 
                    display: flex; 
 | 
                    justify-content: space-between; 
 | 
                    flex-wrap: wrap; 
 | 
                    .content_list_item_nr_boxs { 
 | 
                        width: 45%; 
 | 
                        display: flex; 
 | 
                        margin-top: 24px; 
 | 
                        &:nth-child(1) { 
 | 
                            margin-top: 0; 
 | 
                        } 
 | 
                        &:nth-child(2) { 
 | 
                            margin-top: 0; 
 | 
                        } 
 | 
                        .warning { 
 | 
                            color: $nav-stateColor4 !important; 
 | 
                        } 
 | 
                        .label { 
 | 
                            flex-shrink: 0; 
 | 
                            font-size: 24px; 
 | 
                            font-weight: 400; 
 | 
                            color: #666666; 
 | 
                        } 
 | 
                        .cr { 
 | 
                            flex: 1; 
 | 
                            font-size: 24px; 
 | 
                            font-weight: 400; 
 | 
                            color: #222222; 
 | 
                            overflow: hidden; 
 | 
                            white-space: nowrap; 
 | 
                            text-overflow: ellipsis; 
 | 
                            -o-text-overflow:ellipsis; 
 | 
                        } 
 | 
                    } 
 | 
                    .content_list_item_nr_box { 
 | 
                        width: 100%; 
 | 
                        display: flex; 
 | 
                        margin-top: 24px; 
 | 
                        &:nth-child(1) { 
 | 
                            margin-top: 0; 
 | 
                        } 
 | 
                        .label { 
 | 
                            font-size: 24px; 
 | 
                            font-weight: 400; 
 | 
                            color: #666666; 
 | 
                            flex-shrink: 0; 
 | 
                        } 
 | 
                        .cr { 
 | 
                            font-size: 24px; 
 | 
                            font-weight: 400; 
 | 
                            color: #222222; 
 | 
                        } 
 | 
                    } 
 | 
                } 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
</style> 
 |