141 lines
4.3 KiB
Vue
141 lines
4.3 KiB
Vue
<template>
|
|
<!--
|
|
结构与 executor/NewPerson.vue 一致, 但只读, 不显示用户名/初始密码/状态
|
|
字段精简: 姓名 / 手机号 / 所属公司 / 部门 / 职务 / 角色
|
|
-->
|
|
<div class="page-card person-detail">
|
|
<!-- 面包屑 -->
|
|
<div class="breadcrumb">
|
|
<a @click="goBack">人员管理</a> > 人员详情
|
|
</div>
|
|
|
|
<!-- 详情卡片 -->
|
|
<el-card v-loading="loadingDetail" shadow="never" class="form-card nested">
|
|
<el-form :model="form" label-width="120px" class="readonly-form">
|
|
|
|
<el-row :gutter="12">
|
|
<el-col :span="12">
|
|
<el-form-item label="姓名">
|
|
<el-input v-model="form.name" readonly />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="手机号">
|
|
<el-input v-model="form.phone" readonly />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row :gutter="12">
|
|
<el-col :span="12">
|
|
<el-form-item label="所属公司">
|
|
<el-input v-model="form.orgName" readonly />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="部门">
|
|
<el-input v-model="form.department" readonly />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row :gutter="12">
|
|
<el-col :span="12">
|
|
<el-form-item label="职务">
|
|
<el-input v-model="form.position" readonly />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="角色">
|
|
<!-- 角色与账号类型合并: 由 account_type + unitType 推导 (MAIN=管理员, SUB=执行人员) -->
|
|
<el-tag :type="accountTypeRoleTagType(form.accountType)" disable-transitions>
|
|
{{ accountTypeRoleLabel(form.unitType, form.accountType) || '—' }}
|
|
</el-tag>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
</el-form>
|
|
</el-card>
|
|
|
|
<!-- 操作按钮 -->
|
|
<div class="form-actions">
|
|
<el-button @click="goBack">返回</el-button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { reactive, ref, onMounted } from 'vue'
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
import { ElMessage } from 'element-plus'
|
|
import { bizGet } from '@/api/public'
|
|
import { accountTypeRoleLabel, accountTypeRoleTagType } from '@/utils/roleMap'
|
|
|
|
const router = useRouter()
|
|
const route = useRoute()
|
|
|
|
const loadingDetail = ref(false)
|
|
const personId = route.params.id
|
|
|
|
const form = reactive({
|
|
name: '',
|
|
phone: '',
|
|
orgName: '',
|
|
department: '',
|
|
position: '',
|
|
unitType: '',
|
|
accountType: '',
|
|
})
|
|
|
|
async function loadDetail() {
|
|
loadingDetail.value = true
|
|
try {
|
|
const res = await bizGet('person', personId)
|
|
if (res?.code === 200 && res.data) {
|
|
const d = res.data
|
|
Object.assign(form, {
|
|
name: d.name || '',
|
|
phone: d.phone || '',
|
|
orgName: d.orgName || '',
|
|
department: d.department || '',
|
|
position: d.position || '',
|
|
unitType: d.unitType || '',
|
|
accountType: d.accountType || '',
|
|
})
|
|
} else {
|
|
ElMessage.error(res?.msg || '加载失败')
|
|
goBack()
|
|
}
|
|
} catch (e) {
|
|
ElMessage.error(e?.msg || '加载失败')
|
|
goBack()
|
|
} finally {
|
|
loadingDetail.value = false
|
|
}
|
|
}
|
|
|
|
function goBack() {
|
|
router.push({ path: '/executor/people', query: { _t: Date.now() } })
|
|
}
|
|
|
|
onMounted(loadDetail)
|
|
</script>
|
|
|
|
<style scoped>
|
|
/* 结构对齐 executor/NewPerson.vue (page-card / form-card nested / form-actions 风格) */
|
|
.person-detail { max-width: 1200px; }
|
|
.page-card { background: #fff; padding: 16px 20px; border-radius: 6px; border: 1px solid #f0f0f0; }
|
|
.breadcrumb { font-size: 13px; color: #8c8c8c; margin-bottom: 16px; }
|
|
.breadcrumb a { color: var(--brand-primary); cursor: pointer; text-decoration: none; }
|
|
.breadcrumb a:hover { color: var(--brand-primary-deep); }
|
|
|
|
.form-card.nested { background: transparent; border: none; box-shadow: none; }
|
|
:deep(.form-card .el-card__body) { padding: 24px 28px; }
|
|
|
|
.form-actions { margin-top: 16px; display: flex; gap: 8px; }
|
|
|
|
:deep(.el-input__wrapper), :deep(.el-textarea__inner) { border-radius: 4px; }
|
|
/* readonly 输入框视觉降级 (灰色背景) */
|
|
:deep(.el-input.is-readonly .el-input__wrapper) { background-color: #fafafa; box-shadow: none; }
|
|
</style> |