<template>
    <section class="layout-bottom">
        <CapitalInfo class="capital-info-container"></CapitalInfo>
        <main>
            <div class="conditionIcon icon iconfont icon-shouqi"></div>
            <firstMenu :list="list" :value="'value'" @selectMenu="selectMenu" />
            <quoteTable :columns="columns" :dataSource="data" />
            <thirdMenu></thirdMenu>
        </main>
    </section>
</template>
<script lang="ts">
    import { defineComponent } from 'vue';
    import CapitalInfo from '@/common/components/capitalInfo/index.vue';
    import firstMenu from '@/common/components/firstMenu/index.vue';
    import thirdMenu from '@/common/components/thirdMenu/index.vue';
    import quoteTable from '@/common/components/quoteTable/index.vue';
    import { MenuItem } from '@/common/components/contextMenu/interface';

    const columns = [
        { title: '序号', width: 100, dataIndex: 'name', key: 'name', fixed: 'left', align: 'center' },
        { title: '品种', width: 100, dataIndex: 'age', key: 'age', fixed: 'left', align: 'center' },
        { title: '种类', dataIndex: 'address', key: '1', width: 200, align: 'center' },
        { title: '品牌', dataIndex: 'address', key: '2', width: 200, align: 'center' },
        { title: '数量', dataIndex: 'address', key: '3', width: 200, align: 'center' },
        { title: '价格', dataIndex: 'address', key: '4', width: 200, align: 'center' },
        { title: '仓库', dataIndex: 'address', key: '5', width: 200, align: 'center' },
        { title: '所在地', dataIndex: 'address', key: '6', width: 200, align: 'center' },
        { title: '挂牌方', dataIndex: 'address', key: '7', width: 'auto', align: 'center' },
        // {
        //     title: 'Action',
        //     key: 'operation',
        //     fixed: 'right',
        //     align: 'center',
        //     width: 100,
        //     slots: { customRender: 'action' },
        // },
    ];

    interface DataItem {
        key: number;
        name: string;
        age: number;
        address: string;
    }

    const data: DataItem[] = [];
    for (let i = 0; i < 100; i++) {
        data.push({
            key: i,
            name: `Edrward ${i}`,
            age: 32,
            address: `London Park no. ${i}`,
        });
    }

    function handleMenu() {
        const list = [
            { key: '1', value: '仓单贸易' },
            { key: '2', value: '拍卖' },
        ];
        function selectMenu(item: any) {
            console.log(item);
        }
        return { list, selectMenu };
    }

    export default defineComponent({
        name: 'layout-top',
        components: {
            CapitalInfo,
            firstMenu,
            quoteTable,
            thirdMenu,
        },
        setup() {
            const { list, selectMenu } = handleMenu();
            return {
                columns,
                data,
                list,
                selectMenu,
            };
        },
    });
</script>
<style lang="less">
    .layout-bottom {
        display: flex;
        width: 100%;
        overflow: hidden;
        .capital-info-container {
            width: 180px;
        }
        main {
            max-width: calc(100% - 180px);
            flex: 1;
            .flex;
            flex-direction: column;
            background: rgb(14, 14, 15);
            position: relative;
            .conditionIcon {
                font-size: 16px;
                color: @m-grey1;
                width: 16px;
                height: 16px;
                line-height: 16px;
                cursor: pointer;
                .position(absolute, 8px, 14px, auto, auto);
                z-index: 2;
                &:hover {
                    color: rgba(@m-grey1, 0.8);
                }
            }
        }
    }
</style>
