<template>
    <div>
        <div class="bigBox">
            <div style="text-align: center;">
                <h2>间隔管理</h2>
            </div>
            <div class="btnBox">
                <el-button type="primary" plain><el-icon>
                        <Plus />
                    </el-icon>添加间隔</el-button>
            </div>
            <div class='tableBox'>
                <el-table :data="tableData" style="width: 100%" :stripe="true" @selection-change="tableChange">
                    <el-table-column type="selection" width="55" />
                    <el-table-column fixed prop="name" label="间隔名称" width="auto" />
                    <el-table-column prop="flash" label="电压等级" width="auto" />
                    <el-table-column prop="type" label="间隔类型" width="auto" />
                    <el-table-column fixed="right" label="操作" width="180">
                        <template #default>
                            <el-button link type="primary" size="small" @click=""><el-icon>
                                    <EditPen />
                                </el-icon>修改</el-button>
                            <el-button link type="primary" size="small" @click="goMap"><el-icon>
                                    <Coin />
                                </el-icon>编辑模型</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </div>
        </div>
    </div>
</template>

<script>
import { ref, onMounted, toRefs } from 'vue';
import { ElMessage } from 'element-plus';
export default {
    setup(props, { emit }) {
        let tableData = ref([
            {
                name: "测试间隔",
                flash: "220kv",
                type: "string",
            }
        ])
        let kisNum = ref(0)
        let { goMap } = toRefs(props)
        function tableChange(e) {
            console.log(e, 'table');
        }
        function cacl() {
            kisNum.value = 1
            if(kisNum.value == 0){
                ElMessage({
                    message:"暂时无法进行模型编辑",
                    type:"error",
                    duration:1500
                })
            }
            emit("backNum", kisNum.value)
        }
        return {
            tableData,
            tableChange,
            kisNum,
            goMap:cacl,
        }
    }
}
</script>

<style lang="scss" scoped></style>