<template>
    <div class="container">
        <!-- 顶部信息 -->
        <div class="containertop">
            <div class="topleft">
                <img src="../../../assets/images/detailsicon/1.png" alt="">
                <span>建筑信息</span>
            </div>
            <div class="topright">
                <el-button type="primary" size="mini" plain
                    style="border: none;background-color: rgba(43,98,241,0.1);color: #2B62F1;" @click="addBuildingTag">
                    <img src="../../../assets/images/detailsicon/icon-xz@2x.png" alt="编辑"
                        style="width: 0.6rem; height: 0.6rem; margin-right: 4px;">
                    新增
                </el-button>
                <el-button type="primary" size="mini" plain
                    style="border: none;background-color: rgba(43,98,241,0.1);color: #2B62F1;">
                    <img src="../../../assets/images/detailsicon/icon-bj@2x.png" alt="编辑"
                        style="width: 0.6rem; height: 0.6rem; margin-right: 4px;">
                    编辑
                </el-button>
                <el-button type="primary" size="mini" plain
                    style="border: none;background-color: rgba(43,98,241,0.1);color: #2B62F1;">
                    <img src="../../../assets/images/detailsicon/icon-dc@2x.png" alt="编辑"
                        style="width: 0.6rem; height: 0.6rem; margin-right: 4px;">
                    导出
                </el-button>
            </div>
        </div>
        <!-- 栋数 -->
        <div class="tagdiv">
            <el-tag :key="tag" v-for="tag in dynamicTags" closable :disable-transitions="false"
                @close="handleClose(tag)"
                @click="handleTagClick(tag)"
                :class="{'active-tag': activeTag === tag}">
                <img src="../../../assets/images/detailsicon/icon-楼栋@2x.png" alt="">
                {{ tag }}
            </el-tag>
        </div>
        <!-- 内容区 -->
        <div class="content">
            <div class="descriptionsdiv">
                <el-descriptions class="margin-top" :column="4" border>
                    <el-descriptions-item>
                        <template slot="label">
                            是否为重要楼栋
                        </template>
                            是
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            层数
                        </template>
                            6
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            总建筑高度（米）
                        </template>
                                41.2
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            首层高度（平方米）
                        </template>
                        kooriookami
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            二至四层层高(米)
                        </template>
                                3.2
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            4层以上层高（米）
                        </template>
                        苏州市
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                                首层地面荷载(吨/平方米)
                        </template>
                        kooriookami
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            二至三层楼面荷载(吨/平方米)
                        </template>
                        18100000000
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            标准层面积(千平方米)
                        </template>
                        苏州市
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            柱距
                        </template>
                        kooriookami
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            是否有吊装口
                        </template>
                        18100000000
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            是否有汽车盘道
                        </template>
                        苏州市
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label">
                            四层及以上楼面荷载(吨/平方米)
                        </template>
                        kooriookami
                    </el-descriptions-item>
                </el-descriptions>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    props: {
        size: {
            type: String,
            default: ''
        }
    },
    data() {
        return {
            dynamicTags: ['1栋', '2栋', '3栋'],
            inputVisible: false,
            inputValue: '',
            currentBuildingNumber: 3,
            activeTag: '1栋'
        };
    },
    methods: {
        handleClose(tag) {
            this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1);
            if (this.activeTag === tag) {
                this.activeTag = null;
            }
        },
        handleInputConfirm() {
            let inputValue = this.inputValue;
            if (inputValue) {
                this.dynamicTags.push(inputValue);
            }
            this.inputVisible = false;
            this.inputValue = '';
        },
        handleTagClick(tag) {
            this.activeTag = tag;
        },
        addBuildingTag() {
            this.currentBuildingNumber++;
            this.dynamicTags.push(`${this.currentBuildingNumber}栋`);
        }
    }
}
</script>

<style scoped>
.container {
    display: flex;
    flex-direction: column;
    width: 100%;
    background-color: #FFFFFF;
    box-shadow: 0rem 0.13rem 0.63rem 0rem rgba(177, 177, 177, 0.1);
    border-radius: 0.5rem 0.5rem 0.5rem 0.5rem;
}

.content {
    padding: 1rem;
    display: flex;
}

.containertop {
    height: auto;
    display: flex;
    justify-content: space-between;
    padding: .7rem 0;
    padding: .5rem;
    border-bottom: 1px solid #E5E5E5;
}

.topleft {
    width: 8rem;
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.topleft img {
    width: 0.81rem;
    height: 0.81rem;
}

.topleft span {
    width: auto;
    height: 0.88rem;
    font-family: AlibabaPuHuiTi, AlibabaPuHuiTi;
    font-weight: 500;
    font-size: 0.88rem;
    color: #3D424C;
    line-height: 0.88rem;
    text-align: right;
    font-style: normal;
    text-transform: none;
}

.picturediv {
    width: 18.31rem;
    height: 25.31rem;
    background-color: lightblue;
}

.descriptionsdiv {
    width: 100%;
    margin-left: 1rem;
    height: auto;
}

.two-row-item {
    height: 20rem;
}

.tagdiv {
    padding: 1rem 2rem 0 2rem;
    display: flex;
}
.tagdiv img{
    width: 1.4rem;
    height: 1.5rem;
}
.el-tag{
    border-radius: 1rem;
    width: 6.25rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-around;
    background-color: #FAFAFA;
    color: #808080;
    border: none;
}
.el-tag+.el-tag {
    margin-left: 10px;
    border-radius: 1rem;
}


.input-new-tag {
    width: 90px;
    margin-left: 10px;
    vertical-align: bottom;
    border-radius: 1rem;
}

.el-tag {
    cursor: pointer; 
}

.active-tag {
    background-color: rgba(43,98,241,0.1); 
    color: #2B62F1 !important; 
}
</style>