refactor: ♻️ 用户管理增加email字段,修复table-select性别不显示的问题
用户管理增加email字段,修复table-select性别不显示的问题
This commit is contained in:
@@ -97,7 +97,14 @@ const selectConfig: ISelectConfig = {
|
|||||||
{ label: "编号", align: "center", prop: "id", width: 100 },
|
{ label: "编号", align: "center", prop: "id", width: 100 },
|
||||||
{ label: "用户名", align: "center", prop: "username" },
|
{ label: "用户名", align: "center", prop: "username" },
|
||||||
{ label: "用户昵称", align: "center", prop: "nickname", width: 120 },
|
{ label: "用户昵称", align: "center", prop: "nickname", width: 120 },
|
||||||
{ label: "性别", align: "center", prop: "genderLabel", width: 100 },
|
{
|
||||||
|
label: "性别",
|
||||||
|
align: "center",
|
||||||
|
prop: "gender",
|
||||||
|
width: 100,
|
||||||
|
templet: "custom",
|
||||||
|
slotName: "gender",
|
||||||
|
},
|
||||||
{ label: "部门", align: "center", prop: "deptName", width: 120 },
|
{ label: "部门", align: "center", prop: "deptName", width: 120 },
|
||||||
{ label: "手机号码", align: "center", prop: "mobile", width: 120 },
|
{ label: "手机号码", align: "center", prop: "mobile", width: 120 },
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
<!-- 列表选择器示例 -->
|
<!-- 列表选择器示例 -->
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import selectConfig from "./config/select";
|
import selectConfig from "./config/select";
|
||||||
|
import { useDictStore } from "@/store";
|
||||||
|
const dictStore = useDictStore();
|
||||||
interface IUser {
|
interface IUser {
|
||||||
id: number;
|
id: number;
|
||||||
username: string;
|
username: string;
|
||||||
nickname: string;
|
nickname: string;
|
||||||
mobile: string;
|
mobile: string;
|
||||||
genderLabel: string;
|
gender: string;
|
||||||
avatar: string;
|
avatar: string;
|
||||||
email: string | null;
|
email: string | null;
|
||||||
status: number;
|
status: number;
|
||||||
@@ -20,8 +21,11 @@ function handleConfirm(data: IUser[]) {
|
|||||||
selectedUser.value = data[0];
|
selectedUser.value = data[0];
|
||||||
}
|
}
|
||||||
const text = computed(() => {
|
const text = computed(() => {
|
||||||
|
// 获取字典数据
|
||||||
|
const dictData = dictStore.getDictionary("gender");
|
||||||
|
const genderLabel = dictData.find((item: any) => item.value == selectedUser.value?.gender)?.label;
|
||||||
return selectedUser.value
|
return selectedUser.value
|
||||||
? `${selectedUser.value.username} - ${selectedUser.value.genderLabel} - ${selectedUser.value.deptName}`
|
? `${selectedUser.value.username} - ${genderLabel} - ${selectedUser.value.deptName}`
|
||||||
: "";
|
: "";
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@@ -42,6 +46,9 @@ const text = computed(() => {
|
|||||||
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
|
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
|
<template #gender="scope">
|
||||||
|
<DictLabel v-model="scope.row.gender" code="gender" />
|
||||||
|
</template>
|
||||||
</table-select>
|
</table-select>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -101,6 +101,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="部门" width="120" align="center" prop="deptName" />
|
<el-table-column label="部门" width="120" align="center" prop="deptName" />
|
||||||
<el-table-column label="手机号码" align="center" prop="mobile" width="120" />
|
<el-table-column label="手机号码" align="center" prop="mobile" width="120" />
|
||||||
|
<el-table-column label="邮箱" align="center" prop="email" width="160" />
|
||||||
<el-table-column label="状态" align="center" prop="status" width="80">
|
<el-table-column label="状态" align="center" prop="status" width="80">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag :type="scope.row.status == 1 ? 'success' : 'info'">
|
<el-tag :type="scope.row.status == 1 ? 'success' : 'info'">
|
||||||
|
|||||||
Reference in New Issue
Block a user