<template>
    <el-dialog draggable width="600px" v-model.trim="dialogVisible" :title="title">
  
            <el-form :inline="false" :model="form" label-width="auto" class="form-one">
                <el-form-item label="用户名称:">
                    <el-input v-model.trim="form.name" :disabled="true"></el-input>
                </el-form-item>
                <el-form-item label="登录名称:" class="top">
                    <el-input v-model.trim="form.loginName" :disabled="true"></el-input>
                </el-form-item>
                <el-form-item label="归属部门名称:" class="top">
                    <el-input v-model.trim="form.deptName" :disabled="true"></el-input>
                </el-form-item>
                <el-form-item label="拥有的角色:" class="top">
                    <el-input v-model.trim="form.role" :disabled="true"></el-input>
                </el-form-item>
                <el-form-item label="电话号码:" class="top">
                    <el-input v-model.trim="form.phone" :disabled="true"></el-input>
                </el-form-item>
                <el-form-item label="电子邮箱:" class="top">
                    <el-input v-model.trim="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>
