<template>
    <flow-resource-view :flowObj="flowObj" :initMessageFunc="initMessageFunc" v-if="loadSuccess"></flow-resource-view>
</template>

<script>
    export default {
        name: "flow-res-preview",
        components: {
            FlowResourceView: () => import("./flowResourceView")
        },
        props:{
            defaultTab:{type:String,default:""},
            operateRootArr:{type:Array,default:() => {
                return [];
            }},
            dataPermis:{type:String,default:""},
            flowId:{type: String,required:true},
            initMessageFunc:{type: Function,default:null}
        },
        data(){
            return {
                flowObj: {},
                loadSuccess: false
            }
        },
        created() {
            this.init();
        },
        methods:{
            init(){
                this.flowObj["flowId"] = this.flowId;
                this.FORM_GLOBAL.getPageInfoByFlowId(this.flowId).then(pageInfo => {
                    if(!pageInfo){
                        this.$message.error("未查询到流程数据！");
                        return;
                    }
                    this.flowObj["formId"] = pageInfo.formId;
                    this.flowObj["flowId"] = pageInfo.flowId;
                    this.flowObj["tableViewId"] = pageInfo.tableViewId;
                    this.flowObj.operateArr = this.operateRootArr;
                    this.flowObj.dataPermis = this.dataPermis;
                    this.loadSuccess = true;
                })
            }
        }
    }
</script>

<style scoped>

</style>
