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

@@ -17,7 +17,7 @@ type ResultTable = {
/** 获取系统管理-用户管理列表 */ /** 获取系统管理-用户管理列表 */
export const getUserList = (data?: object) => { export const getUserList = (data?: object) => {
return http.request<ResultTable>("get", "/user", { data }); return http.request<ResultTable>("get", "/user", { params: data });
}; };
/** 系统管理-用户管理-获取所有角色列表 */ /** 系统管理-用户管理-获取所有角色列表 */

View File

@@ -84,7 +84,6 @@ export function setToken(data: DataInfo<Date>) {
permissions permissions
}); });
} }
console.log(data,"storeData");
if (data.username && data.roles) { if (data.username && data.roles) {
const { username, roles } = data; const { username, roles } = data;
setUserKey({ setUserKey({

View File

@@ -7,8 +7,7 @@ import { $t, transformI18n } from "@/plugins/i18n";
export const REGEXP_SIX = /^\d{6}$/; export const REGEXP_SIX = /^\d{6}$/;
/** 密码正则密码格式应为8-18位数字、字母、符号的任意两种组合 */ /** 密码正则密码格式应为8-18位数字、字母、符号的任意两种组合 */
export const REGEXP_PWD = export const REGEXP_PWD = /^[\s\S]{6,127}$/;
/^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)]|[()])+$)(?!^.*[\u4E00-\u9FA5].*$)([^(0-9a-zA-Z)]|[()]|[a-z]|[A-Z]|[0-9]){6,18}$/;
/** 登录校验 */ /** 登录校验 */
const loginRules = reactive<FormRules>({ const loginRules = reactive<FormRules>({

View File

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

View File

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

View File

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