<template>
    <el-drawer v-model="open" :title="`申领记录清单`" :before-close="handleClose" direction="rtl" class="demo-drawer"
        modal-class="el-subscribe-drawer" size="80%">
        <div class="flex" v-loading="loading">
            <div class="flex-sub">
                <Index :form="form" :editable="false" />
            </div>
            <div class="padding-left" style="width:30%;max-width:400px">
                <WfJobList :list="form.wfJobList" />
            </div>
        </div>
        <template #footer>
            <div class="">
                <el-button plain @click="handleRevoke" v-if="form.isWithdraw == 1">撤 回</el-button>
                <!-- <el-button plain @click="handleClose">取 消</el-button>
        <el-button :disabled="loading" type="primary" @click="submitForm">提 交</el-button> -->
            </div>
        </template>
    </el-drawer>
</template>

<script setup>
import { getWarehouseApply } from "@/api/warehouseApply/warehouseApply";
import Index from "@/components/WarehouseApply/detail/index";
import WfJobList from "@/components/WfJobList/index";


const { proxy, ctx } = getCurrentInstance();
const store = useStore();
const open = ref(false);
const loading = ref(true);

const props = defineProps({
    warehouseApplyId: {
        type: [Number, String],
        default: null,
    },
});

const { warehouseApplyId } = toRefs(props);
const data = reactive({
    form: {},
})

const { form } = toRefs(data);


// 显示弹框
function show() {
    open.value = true;
    loading.value = true;
    nextTick(() => {
        getData()
    })
}

// 关闭按钮
function handleClose() {
    form.value = {}
    open.value = false;
}



function getData() {
    if (warehouseApplyId.value) {
        getWarehouseApply(warehouseApplyId.value).then(response => {
            form.value = response.data;
            loading.value = false;
        });
    }
}

function handleRevoke() {

}



defineExpose({
    show,
    handleClose,
});
</script>