diff --git a/src/router/modules/auth.ts b/src/router/modules/auth.ts index 92a09c3..3291fa3 100644 --- a/src/router/modules/auth.ts +++ b/src/router/modules/auth.ts @@ -11,6 +11,14 @@ export default { rank: 1 }, children: [ + { + path: "/auth/backendUser", + name: "backendUser", + component: () => import("@/views/auth/backendUser/index.vue"), + meta: { + title: "管理端用户" + } + }, { path: "/auth/company", name: "company", diff --git a/src/views/auth/frontendUser/index.vue b/src/views/auth/frontendUser/index.vue index 4ac1cde..08a7a9e 100644 --- a/src/views/auth/frontendUser/index.vue +++ b/src/views/auth/frontendUser/index.vue @@ -37,13 +37,52 @@ const tableData = ref([]); const loading = ref(false); const total = ref(0); +// 公司列表数据 +const companyOptions = ref([]); + +// 获取公司列表 +const getCompanyList = async () => { + try { + const res = await request(authApi("getCompanyPrimaryInfo"), { + method: "post" + }); + console.info(res); + if (res.status === 200) { + companyOptions.value = res.data.map(item => ({ + value: item.id, + label: item.companyName + })); + } + } catch (error) { + console.error("获取公司列表失败:", error); + } +}; + +// 角色列表数据 +const roleOptions = ref([]); +// 获得角色列表 +const getRoleList = async () => { + try { + const res = await request(authApi("getRoles"), { + method: "post" + }); + console.info(res); + if (res.status === 200) { + roleOptions.value = res.data.map(item => ({ + value: item.id, + label: item.roleName + })); + } + } catch (error) { + console.error("获取角色列表失败:", error); + } +}; + // 获得前端用户列表 const getUserList = async () => { try { loading.value = true; const params = { ...queryParams.value }; - - console.info(params); const data = await request(authApi("frontendUserPage"), { method: "post", body: JSON.stringify(params) @@ -99,48 +138,59 @@ const columns: TableColumnList = [ { label: "账号", prop: "name", - width: "260", + width: "160", fixed: true }, { label: "昵称", prop: "nickName", - width: "260" + width: "180" }, { label: "电话", prop: "phoneNum", - width: "260" + width: "120" }, { label: "邮件", prop: "email", - width: "260" + width: "200" }, { label: "所属公司", prop: "companyId", - width: "260" + width: "150", + formatter: row => { + const company = companyOptions.value.find( + item => item.value === row.companyId + ); + return company ? company.label : ""; + } }, { label: "角色", prop: "roleId", - width: "260" - }, - { - label: "微信ID", - prop: "wxOpenid", - width: "260" + width: "150", + formatter: row => { + const role = roleOptions.value.find(item => item.value === row.roleId); + return role ? role.label : ""; + } }, + // { + // label: "微信ID", + // prop: "wxOpenid", + // width: "260" + // }, { label: "状态", prop: "status", - width: "100" + width: "100", + slot: "status" }, { label: "上次登陆时间", prop: "createTime", - width: "260", + width: "155", formatter: row => { return row.createTime ? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss") @@ -150,7 +200,7 @@ const columns: TableColumnList = [ { label: "创建时间", prop: "createTime", - width: "260", + width: "155", formatter: row => { return row.createTime ? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss") @@ -199,44 +249,85 @@ const handleDelete = row => { // 页面加载时获取数据 onMounted(() => { getUserList(); + getCompanyList(); // 获取公司列表数据 + getRoleList(); // 获取角色列表数据 }); + +