<template>
    <!-- 结算申请-->
    <div class="app-container">
        <PageHeader
            v-if="isShowComponent !== 'ApplyHome'"
            :pageContent="pageContent"
            @goBack="goBack"
        />
        <keep-alive>
            <component
                :is="isShowComponent"
                :row="rowData"
                @goDetail="goDetail"
                @goBackPage="goBack"
            />
        </keep-alive>
    </div>
</template>

<script>
import PageHeader from '@/components/pageHeader'
import ApplyHome from './component/applyHome.vue'
import ApplyDetail from './component/applyDetail.vue'
export default {
    name: 'CostApplyList',
    components: {
        PageHeader,
        ApplyHome,
        ApplyDetail
    },
    data() {
        return {
            isShowComponent: 'ApplyHome',
            pageContent: '',
            rowData: null,
            isView: false,
        }
    },
    methods: {
        // 退料编辑
        goDetail(rowData) {
            console.log('🎯 父组件接收到 goDetail 事件，数据:', rowData);
            this.rowData = rowData;
            this.pageContent = '结算详情';
            this.isShowComponent = 'ApplyDetail';
            console.log('🎯 组件已切换到 ApplyDetail');
        },
        goBack() {
            this.isShowComponent = 'ApplyHome'
        },
    },
}
</script>
