feat: 完成用户页面查询
This commit is contained in:
@@ -17,7 +17,7 @@ type ResultTable = {
|
||||
|
||||
/** 获取系统管理-用户管理列表 */
|
||||
export const getUserList = (data?: object) => {
|
||||
return http.request<ResultTable>("get", "/user", { data });
|
||||
return http.request<ResultTable>("get", "/user", { params: data });
|
||||
};
|
||||
|
||||
/** 系统管理-用户管理-获取所有角色列表 */
|
||||
|
||||
@@ -84,7 +84,6 @@ export function setToken(data: DataInfo<Date>) {
|
||||
permissions
|
||||
});
|
||||
}
|
||||
console.log(data,"storeData");
|
||||
if (data.username && data.roles) {
|
||||
const { username, roles } = data;
|
||||
setUserKey({
|
||||
|
||||
@@ -7,8 +7,7 @@ import { $t, transformI18n } from "@/plugins/i18n";
|
||||
export const REGEXP_SIX = /^\d{6}$/;
|
||||
|
||||
/** 密码正则(密码格式应为8-18位数字、字母、符号的任意两种组合) */
|
||||
export const REGEXP_PWD =
|
||||
/^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)]|[()])+$)(?!^.*[\u4E00-\u9FA5].*$)([^(0-9a-zA-Z)]|[()]|[a-z]|[A-Z]|[0-9]){6,18}$/;
|
||||
export const REGEXP_PWD = /^[\s\S]{6,127}$/;
|
||||
|
||||
/** 登录校验 */
|
||||
const loginRules = reactive<FormRules>({
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 ?? ""
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user