<template>
    <div>
        <component
            ref="layout"
            :is="uiLayoutType"
            :config="uiconfig"
            :dictData="globalConfig.dictData"
            :moduleMethod="globalConfig.userModuleMethod"
            @handleSuccessAfter="handleSuccessAfter"
            @onSubmitBefore="onSubmitBefore"
            @doAction="doAction"
        >
            <!-- 组件原始slot透传 -->
            <template v-for="(_, name) in $slots" #[name]="slotData">
                <slot :name="name" v-bind="slotData || {}"></slot>
            </template>
            <!-- ============================ -->
        </component>
        <Modal
            title="附件"
            v-model="showDetailAppendix"
            :width="appendixCurrentWidth"
            :footer-hide="true"
        >
            <AppendixBoxs
                v-if="detalAppendixFlag"
                ref="detailappendix"
                :config="billDetailAppendixConfig"
                @doAction="doAction"
            />
        </Modal>
        <Modal
            title="模版打印"
            v-model="showPrintMode"
            :width="appendixCurrentWidth"
            :footer-hide="true"
            :fullscreen="true"
            class-name="print-bill-panel-modal"
        >
            <iframe
                ref="iframetemplate"
                v-if="printModeReset"
                :src="printModeUrl"
                width="100%"
                height="100%"
                allowtransparency="true"
                frameborder="0"
            ></iframe>
        </Modal>
        <BillAsyncImport
            v-if="importReset"
            ref="billAsyncImport"
            :config="billAsyncImportConfig"
        />
        <BillImport
            v-if="importReset"
            ref="billImport"
            :config="billImportConfig"
        >
        </BillImport>
        <Modal
            title="合同模版"
            v-model="ContractModalShowType"
            :width="ContractModalWidth"
            :mask-closable="false"
            :footer-hide="true"
            class-name="contract-print-panel-modal"
            @on-cancel="HideContractPrintModal"
        >
            <iframe
                ref="iframetemplate"
                v-if="ContractModalContentShowType"
                :src="ContractModalIframeUrl"
                width="100%"
                height="100%"
                allowtransparency="true"
                frameborder="0"
            ></iframe>
        </Modal>
    </div>
</template>

<script>
import Base from "./base.vue";
import AppendixBoxs from "./appendix.vue";
import BillAsyncImport from "./billasyncimport.vue";
import BillImport from "./billimport.vue";
import ContractPrintMixins from "@/components/base/ContractPrintMixins";
export default {
    name: "BillTemplate",
    extends: Base,
    mixins: [ContractPrintMixins],
    components: { AppendixBoxs, BillAsyncImport, BillImport },
    computed: {
        uiLayoutType() {
            return "m" + this.uiconfig.layoutType;
        },
        appendixCurrentWidth() {
            return this.$Store.state.app.clientWidth * 0.8;
        },
    },
};
</script>
<style lang="less">
.print-bill-panel-modal {
    .ivu-modal-body {
        padding: 0px !important;
        overflow: hidden !important;
    }
}
.contract-print-panel-modal {
    .ivu-modal-body {
        height: 300px !important;
    }
}
</style>
