<template>
    <a-drawer
        :placement="placement"
        :closable="false"
        :visible="visible"
        :destroyOnClose="true"
        class="bottomListed"
        height="405px"
    >
        <!-- 摘牌是top  挂牌是bottom 期货交易是tradeDialog -->
        <div class="collapse" @click="cancel">
            <DoubleRightOutlined />
        </div>
        <div class="collapseCont">
            <div class="title">{{ title }}</div>
            <div class="content highContent">
                <!-- <Listed></Listed> -->
                <!-- <Delisting></Delisting> -->
                <slot></slot>
                <!-- <Trade></Trade> -->
            </div>
        </div>
    </a-drawer>
</template>

<script lang="ts">
import { defineComponent, ref, PropType } from 'vue';
import { closeModal, ModalName } from '@/common/setup/modal/index';
import Listed from '@/views/market/warehouseTrade/components/listed/index.vue';
import Delisting from '@/views/market/warehouseTrade/components/delisting/index.vue';
import Trade from '@/views/market/warehouseTrade/components/trade/index.vue';
import { _closeModal } from '@/common/setup/modal/modal';
import { DoubleRightOutlined } from '@ant-design/icons-vue';

export default defineComponent({
    name: 'drawer',
    emits: ['cancel', 'update'],
    props: {
        modalName: {
            default: 'drawer',
            type: String as PropType<keyof ModalName>,
        },
        title: {
            default: '',
            type: String,
        },
        placement: {
            // 需要绑定的值得 key
            default: 'right',
            type: String,
        },
        visible: {
            default: false,
            type: Boolean,
        },
    },
    components: {
        Listed,
        Delisting,
        Trade,
        DoubleRightOutlined,
    },
    setup(props, context) {
        function cancel() {
            context.emit('cancel');
        }
        return {
            cancel,
        };
    },
});
</script>

<style lang="less">
.bottom {
    .position(fixed, auto, 0, -2px, auto);
    width: 586px;
    height: 450px;
    background: transparent;
    z-index: 10;
    .ant-drawer-content-wrapper {
        width: 586px !important;
    }
}
.bottom486 {
    .position(fixed, auto, 0, -2px, auto);
    width: 486px;
    height: 450px;
    background: transparent;
    z-index: 10;
    .ant-drawer-content-wrapper {
        width: 486px !important;
    }
}
.delistingBottom {
    .position(fixed, auto, 0, -2px, auto);
    width: 586px;
    height: 450px;
    background: transparent;
    z-index: 10;
    .ant-drawer-content-wrapper {
        width: 586px !important;
    }
}
.top {
    .position(fixed, 101px, 0, auto, auto);
    width: 430px;
    height: 450px;
    background: transparent;
    z-index: 10;
    .ant-drawer-content-wrapper {
        width: 430px !important;
    }
}
.top486 {
    width: 486px;
    .ant-drawer-content-wrapper {
        width: 486px !important;
    }
}
.top500 {
    .position(fixed, 101px, 0, auto, auto);
    width: 500px;
    height: 450px;
    background: transparent;
    z-index: 10;
    .ant-drawer-content-wrapper {
        width: 500px !important;
    }
}
.topHigh {
    .position(fixed, 101px, 0, auto, auto);
    width: 580px;
    height: 450px;
    background: transparent;
    z-index: 10;
    .ant-drawer-content-wrapper {
        width: 580px !important;
    }
}
.bottomWidth {
    .position(fixed, auto, 0, 0, auto);
    width: 765px;
    height: 396px;
    background: transparent;
    z-index: 10;
    .ant-drawer-content-wrapper {
        width: 765px !important;
    }
}
.tradeDialog {
    .position(fixed, 116px, 0, auto, auto);
    width: 467px;
    height: 310px;
    background: transparent;
    z-index: 10;
    .ant-drawer-content-wrapper {
        width: 467px !important;
    }
}
.collapse {
    width: 52px;
    height: 38px;
    cursor: pointer;
    .position(absolute, 0, auto, auto, 0);
    z-index: 11;
    text-align: center;
    line-height: 38px;
    .anticon {
        color: @m-blue25;
        font-weight: bold;
    }
}
.ant-drawer.ant-drawer-open {
    .ant-drawer-mask {
        background: transparent;
    }
    .ant-drawer-content-wrapper {
        box-shadow: none;
        .ant-drawer-content {
            background: transparent;
            .ant-drawer-wrapper-body {
                overflow: hidden;
                .ant-drawer-body {
                    width: 100%;
                    height: 100%;
                    padding: 0;
                    .inlineflex;

                    .collapseCont {
                        flex: 1;
                        height: 100%;
                        // border: 8px solid @m-blue5;
                        // border-right: 0;
                        .flex;
                        flex-direction: column;
                        .title {
                            width: 100%;
                            height: 38px;
                            line-height: 38px;
                            text-align: center;
                            background: linear-gradient(0deg, @m-blue4, @m-blue5);
                            font-size: 16px;
                            color: @m-white10;
                            // border-bottom: 2px solid @m-blue0;
                            .rounded-corners(5px, 5px, 0, 0);
                        }
                        .content {
                            flex: 1;
                            width: 100%;
                            max-height: calc(100% - 36px);
                            overflow-y: auto;
                            overflow-x: hidden;
                            background: @m-grey11;
                            border: 8px solid @m-blue21;
                            border-top: 0;
                        }
                        .highContent {
                            max-height: 100%;
                        }
                    }
                }
            }
        }
    }
}
.ant-form.inlineForm .ant-row.ant-form-item .ant-form-item-label label {
    width: 90px;
}
.ant-drawer.ant-drawer-bottom.ant-drawer-open.bottomListed {
    .position(fixed, auto, 0, 0, auto);
    width: 566px;
    height: 405px !important;
    background: transparent;
    z-index: 10;
    .ant-drawer-content-wrapper {
        width: 566px !important;
    }
}
</style>
