<template>
    <!-- 退料申请 -->
    <div class="app-container">
        <PageHeader
            v-if="isShowComponent !== 'Home'"
            :pageContent="pageContent"
            @goBack="goBack"
        />
        <keep-alive include="Home">
        <component
            ref="componentRef"
            :is="isShowComponent"
            :repairRow="repairRow"
            :isView="isView"
            @handelAdd="handelAdd"
            @handelEdit="handelEdit"
            @handelView="handelView"
            @goBackPage="goBack"
        />
        </keep-alive>
    </div>
</template>

<script>
import PageHeader from '@/components/pageHeader' 
import Home from './component/home.vue' 
import EditPage from './component/edit.vue'
import viewPage from './component/view.vue'
export default {
    name: 'RepairManage',
    components: {
        PageHeader,
        Home,
        EditPage,
        viewPage
    },
    data() {
        return {
            isShowComponent: 'Home',
            pageContent: '',
            repairRow: {},
            isView: false,
        }
    },
    methods: { 
        handelAdd() { 
            this.pageContent = '新建任务'
            this.isShowComponent = 'EditPage'
        }, 
        handelEdit(row) {
            this.repairRow = row
            this.pageContent = '编辑任务'
            this.isShowComponent = 'EditPage'
        }, 
        handelView(row) {
            this.isView = true
            this.repairRow = row
            this.pageContent = '查看任务'  
            this.isShowComponent = 'viewPage' 
        }, 
        goBack() {
            this.isShowComponent = 'Home'
        },
    },
}
</script>
