<template>
    <!-- 退料申请 -->
    <div class="app-container">
        <PageHeader
            v-if="isShowComponent !== 'Home'"
            :pageContent="pageContent"
            @goBack="goBack"
        />
        <component
            :is="isShowComponent"
            :rejectId="rejectId"
            :agreementId="agreementId"
            :isEdit="isEdit"
            @returnApply="returnApply"
            @rejectSubmit="rejectSubmit"
            @goBackPage="goBack"
        />
    </div>
</template>

<script>
import PageHeader from '@/components/pageHeader'
// import Home from './component/home.vue'
import Home from './component/home1.vue'
// import AddReturn from './component/addReturn.vue'
import AddReturn from './component/addReturn1.vue'
export default {
    components: {
        PageHeader,
        Home,
        AddReturn,
    },
    data() {
        return {
            isShowComponent: 'Home',
            pageContent: '',
            rejectId: '',
            agreementId: '',
            isView: false,
            isEdit: false,
        }
    },
    methods: {
        // 退料申请
        returnApply() {
            this.rejectId = ''
            this.pageContent = '新建退料任务'
            this.isShowComponent = 'AddReturn'
            this.isEdit = false
        },
        // 驳回提交
        rejectSubmit({id, agreementId}) {
            this.rejectId = id
            this.agreementId = agreementId
            this.isEdit = true
            this.pageContent = '编辑退料任务'
            this.isShowComponent = 'AddReturn'
        },
        goBack() {
            this.isShowComponent = 'Home'
        },
    },
}
</script>
