<!--终端的新增编辑弹出框-->
<template>
    <el-dialog class='cn-operate-dialog' v-model='machineVisible' :title='title' style='width: 415px;height: 400px'
               top='30vh'>
        <el-scrollbar>
            <el-table :data='tableData' border style='width: 100%'
                      :cell-style="{ textAlign: 'center' }"
                      :height='250'
                      :header-cell-style="{ 'text-align': 'center' }">
                <el-table-column prop='name' label='终端名称' width='180' />
                <el-table-column prop='machinePower' label='终端容量（kW）' width='180' />
            </el-table>
        </el-scrollbar>
        <template #footer>
            <span class='dialog-footer'>
                <el-button type='primary' @click='machineVisible = false'>确认</el-button>
            </span>
        </template>
    </el-dialog>
</template>
<script lang='ts' setup>
import { ref  } from 'vue'
import { listMachine } from '@/api/advance-boot/sgGroven/sgMachine'

const machineVisible = ref(false)
const title = ref('')
const tableData = ref()

//弹出界面，默认选择用户的第一个生产线的第一条进线进行数据导入
const open = async (text: string, id: string) => {
    title.value = text
    machineVisible.value = true
    await listMachine(id).then(res => {
        tableData.value = res.data.records
    })
}

/************针对tab切换*************/


defineExpose({ open })
</script>

<style scoped>
.cn-operate-dialog .cell {
    text-align: center !important;
}
</style>