<template>
    <el-dialog class='cn-operate-dialog' v-model='dialogVisible' :title='title'>
        <el-scrollbar>
            <el-form :inline='false' :model='form' label-width='120px'>
                <el-form-item label='用户名称:'>
                    <el-input v-model='form.name' :disabled='true'></el-input>
                </el-form-item>
                <el-form-item label='登录名称:' class='top'>
                    <el-input v-model='form.loginName' :disabled='true'></el-input>
                </el-form-item>
                <el-form-item label='归属部门名称:' class='top'>
                    <el-input v-model='form.deptName' :disabled='true'></el-input>
                </el-form-item>
                <el-form-item label='拥有的角色:' class='top'>
                    <el-input v-model='form.role' :disabled='true'></el-input>
                </el-form-item>
                <el-form-item label='电话号码:' class='top'>
                    <el-input v-model='form.phone' :disabled='true'></el-input>
                </el-form-item>
                <el-form-item label='电子邮箱:' class='top'>
                    <el-input v-model='form.email' :disabled='true'></el-input>
                </el-form-item>
            </el-form>
        </el-scrollbar>
    </el-dialog>
</template>
<script lang='ts' setup>
import { ref, inject } from 'vue'
import { reactive } from 'vue'
import { useAdminInfo } from '@/stores/adminInfo'


const dialogVisible = ref(false)
const title = ref('用户信息')
const adminInfo = useAdminInfo()
const formRef = ref()
const form = reactive({
    name: '',
    deptName: '',
    phone: '',
    email: '',
    role: '',
    loginName: ''
})


const open = () => {
    dialogVisible.value = true
    for (const key in form) {
        form[key] = Array.isArray(adminInfo.$state[key]) ? adminInfo.$state[key].join(',') : adminInfo.$state[key]
    }
}
defineExpose({ open })
</script>
