<template>
    <el-dialog draggable width="600px" v-model="dialogVisible" :title="title">
            <el-form :inline="false" :model="form" label-width="auto" class="form-one">
                <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-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>
