feat: 完成用户页面查询

This commit is contained in:
橙子
2024-08-31 12:55:04 +08:00
parent 6e9dd669ba
commit cf5c46b2ce
6 changed files with 24 additions and 24 deletions

View File

@@ -128,7 +128,7 @@ defineExpose({ getRef });
:options="newFormInline.higherDeptOptions"
:props="{
value: 'id',
label: 'name',
label: 'deptName',
emitPath: false,
checkStrictly: true
}"
@@ -137,7 +137,7 @@ defineExpose({ getRef });
placeholder="请选择归属部门"
>
<template #default="{ node, data }">
<span>{{ data.name }}</span>
<span>{{ data.deptName }}</span>
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
</template>
</el-cascader>

View File

@@ -47,7 +47,9 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
deptId: "",
userName: "",
phone: "",
state: true
state: true,
skipCount: 1,
maxResultCount: 10
});
const formRef = ref();
const ruleFormRef = ref();
@@ -150,9 +152,9 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
{
label: "创建时间",
minWidth: 90,
prop: "createTime",
formatter: ({ createTime }) =>
dayjs(createTime).format("YYYY-MM-DD HH:mm:ss")
prop: "creationTime",
formatter: ({ creationTime }) =>
dayjs(creationTime).format("YYYY-MM-DD HH:mm:ss")
},
{
label: "操作",
@@ -190,7 +192,7 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
`确认要<strong>${
row.status === 0 ? "停用" : "启用"
}</strong><strong style='color:var(--el-color-primary)'>${
row.username
row.userName
}</strong>用户吗?`,
"系统提示",
{
@@ -237,11 +239,13 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
}
function handleSizeChange(val: number) {
console.log(`${val} items per page`);
form.maxResultCount = val;
onSearch();
}
function handleCurrentChange(val: number) {
console.log(`current page: ${val}`);
form.skipCount = val;
onSearch();
}
/** 当CheckBox选择项发生变化时会触发该事件 */
@@ -315,14 +319,14 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
formInline: {
title,
higherDeptOptions: formatHigherDeptOptions(higherDeptOptions.value),
parentId: row?.dept.id ?? 0,
nickname: row?.nick ?? "",
username: row?.userName ?? "",
parentId: row?.deptId ?? 0,
nick: row?.nick ?? "",
userName: row?.userName ?? "",
password: row?.password ?? "",
phone: row?.phone ?? "",
email: row?.email ?? "",
sex: row?.sex ?? "",
status: row?.state ?? false,
state: row?.state ?? false,
remark: row?.remark ?? ""
}
},

View File

@@ -1,9 +1,9 @@
interface FormItemProps {
id?: number;
id?: string;
/** 用于判断是`新增`还是`修改` */
title: string;
higherDeptOptions: Record<string, unknown>[];
parentId: number;
parentId: string;
nick: string;
userName: string;
password: string;
@@ -11,10 +11,8 @@ interface FormItemProps {
email: string;
sex: string | number;
state: boolean;
dept?: {
id?: number;
name?: string;
};
deptName?: string;
deptId?: string;
remark: string;
}
interface FormProps {
@@ -27,7 +25,7 @@ interface RoleFormItemProps {
/** 角色列表 */
roleOptions: any[];
/** 选中的角色列表 */
ids: Record<number, unknown>[];
ids: Record<string, unknown>[];
}
interface RoleFormProps {
formInline: RoleFormItemProps;