update: 用户管理优化

This commit is contained in:
easy 2023-03-04 11:10:59 +08:00
parent 0c515e849e
commit 89310a6c8d
2 changed files with 98 additions and 15 deletions

View File

@ -232,6 +232,8 @@ const dialog = reactive({
*/ */
changeVisible: (type: modalType, defaultForm: formType) => { changeVisible: (type: modalType, defaultForm: formType) => {
dialog.setTitle(type); dialog.setTitle(type);
console.log(defaultForm);
form.getUserInfo(defaultForm.id || '', type); form.getUserInfo(defaultForm.id || '', type);
dialog.type = type; dialog.type = type;
dialog.visible = type !== ''; dialog.visible = type !== '';

View File

@ -1,11 +1,11 @@
<template> <template>
<page-container> <page-container>
<div class="user-container"> <div class="user-container">
<Search :columns="query.columns" @search="query.search" /> <Search :columns="columns" @search="query.search" />
<j-pro-table <j-pro-table
ref="tableRef" ref="tableRef"
:columns="table.columns" :columns="columns"
:request="getUserList_api" :request="getUserList_api"
model="TABLE" model="TABLE"
:params="query.params.value" :params="query.params.value"
@ -14,12 +14,6 @@
}" }"
> >
<template #headerTitle> <template #headerTitle>
<!-- <a-button
type="primary"
@click="table.openDialog('add')"
style="margin-right: 10px"
><AIcon type="PlusOutlined" />新增</a-button
> -->
<PermissionButton <PermissionButton
:uhasPermission="`${permission}:add`" :uhasPermission="`${permission}:add`"
type="primary" type="primary"
@ -42,15 +36,14 @@
></BadgeStatus> ></BadgeStatus>
</template> </template>
<template #action="slotProps"> <template #action="slotProps">
<a-space :size="16"> <j-space :size="16">
<PermissionButton <PermissionButton
:uhasPermission="`${permission}:update`" :uhasPermission="`${permission}:update`"
type="link" type="link"
:tooltip="{ :tooltip="{
title: '编辑', title: '编辑',
}" }"
@click="table.openDialog('edit')" @click="table.openDialog('edit',slotProps)"
> >
<AIcon type="EditOutlined" /> <AIcon type="EditOutlined" />
</PermissionButton> </PermissionButton>
@ -96,13 +89,11 @@
> >
<AIcon type="DeleteOutlined" /> <AIcon type="DeleteOutlined" />
</PermissionButton> </PermissionButton>
</a-space> </j-space>
</template> </template>
</j-pro-table> </j-pro-table>
<div class="dialogs"> <EditUserDialog ref="editDialogRef" @confirm="table.refresh" />
<EditUserDialog ref="editDialogRef" @confirm="table.refresh" />
</div>
</div> </div>
</page-container> </page-container>
</template> </template>
@ -121,6 +112,96 @@ import { message } from 'ant-design-vue';
const permission = 'system/User'; const permission = 'system/User';
const columns = [
{
title: '名称',
dataIndex: 'name',
key: 'name',
ellipsis: true,
search: {
type: 'string',
},
},
{
title: '用户名',
dataIndex: 'username',
key: 'username',
ellipsis: true,
fixed: 'left',
search: {
type: 'string',
},
},
{
title: '用户类型',
dataIndex: 'type',
key: 'type',
ellipsis: true,
fixed: 'left',
search: {
type: 'select',
options: () =>
new Promise((resolve) => {
getUserType_api().then((resp: any) => {
resolve(
resp.result.map((item: dictType) => ({
label: item.name,
value: item.id,
})),
);
});
}),
},
scopedSlots: true,
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
ellipsis: true,
search: {
rename: 'status',
type: 'select',
options: [
{
label: '启用',
value: 1,
},
{
label: '禁用',
value: 0,
},
],
},
scopedSlots: true,
},
{
title: '手机号',
dataIndex: 'telephone',
key: 'telephone',
ellipsis: true,
fixed: 'left',
search: {
type: 'string',
},
},
{
title: '邮箱',
dataIndex: 'email',
key: 'email',
ellipsis: true,
fixed: 'left',
search: {
type: 'string',
},
},
{
title: '操作',
dataIndex: 'action',
key: 'action',
scopedSlots: true,
},
];
const query = { const query = {
columns: [ columns: [
{ {