|
|
|
|
@@ -12,7 +12,6 @@ const totalRecords = ref(0);
|
|
|
|
|
const page = ref(1);
|
|
|
|
|
const rows = ref(10);
|
|
|
|
|
|
|
|
|
|
const tenantID = ref(null);
|
|
|
|
|
const username = ref('');
|
|
|
|
|
const sortField = ref('id');
|
|
|
|
|
const sortOrder = ref(-1);
|
|
|
|
|
@@ -96,7 +95,6 @@ async function loadUsers() {
|
|
|
|
|
const result = await UserService.listUsers({
|
|
|
|
|
page: page.value,
|
|
|
|
|
limit: rows.value,
|
|
|
|
|
tenantID: tenantID.value ?? undefined,
|
|
|
|
|
username: username.value,
|
|
|
|
|
sortField: sortField.value,
|
|
|
|
|
sortOrder: sortOrder.value
|
|
|
|
|
@@ -121,7 +119,6 @@ function onSearch() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function onReset() {
|
|
|
|
|
tenantID.value = null;
|
|
|
|
|
username.value = '';
|
|
|
|
|
sortField.value = 'id';
|
|
|
|
|
sortOrder.value = -1;
|
|
|
|
|
@@ -153,10 +150,8 @@ onMounted(() => {
|
|
|
|
|
<div class="flex flex-wrap items-center justify-between gap-3 mb-4">
|
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
|
<h4 class="m-0">用户列表</h4>
|
|
|
|
|
<Tag :value="`总数:${totalRecords}`" severity="secondary" />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flex flex-wrap items-center gap-2">
|
|
|
|
|
<InputNumber v-model="tenantID" placeholder="TenantID" :useGrouping="false" class="w-40" />
|
|
|
|
|
<IconField>
|
|
|
|
|
<InputIcon>
|
|
|
|
|
<i class="pi pi-search" />
|
|
|
|
|
@@ -168,32 +163,19 @@ onMounted(() => {
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<DataTable
|
|
|
|
|
:value="users"
|
|
|
|
|
dataKey="id"
|
|
|
|
|
:loading="loading"
|
|
|
|
|
lazy
|
|
|
|
|
:paginator="true"
|
|
|
|
|
:rows="rows"
|
|
|
|
|
:totalRecords="totalRecords"
|
|
|
|
|
:first="(page - 1) * rows"
|
|
|
|
|
:rowsPerPageOptions="[10, 20, 50, 100]"
|
|
|
|
|
sortMode="single"
|
|
|
|
|
:sortField="sortField"
|
|
|
|
|
:sortOrder="sortOrder"
|
|
|
|
|
@page="onPage"
|
|
|
|
|
@sort="onSort"
|
|
|
|
|
<DataTable :value="users" dataKey="id" :loading="loading" lazy :paginator="true" :rows="rows"
|
|
|
|
|
:totalRecords="totalRecords" :first="(page - 1) * rows" :rowsPerPageOptions="[10, 20, 50, 100]"
|
|
|
|
|
sortMode="single" :sortField="sortField" :sortOrder="sortOrder" @page="onPage" @sort="onSort"
|
|
|
|
|
currentPageReportTemplate="显示第 {first} - {last} 条,共 {totalRecords} 条"
|
|
|
|
|
paginatorTemplate="FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink CurrentPageReport RowsPerPageDropdown"
|
|
|
|
|
scrollable
|
|
|
|
|
scrollHeight="flex"
|
|
|
|
|
responsiveLayout="scroll"
|
|
|
|
|
>
|
|
|
|
|
scrollable scrollHeight="flex" responsiveLayout="scroll">
|
|
|
|
|
<Column field="id" header="ID" sortable style="min-width: 6rem" />
|
|
|
|
|
<Column field="username" header="用户名" sortable style="min-width: 14rem" />
|
|
|
|
|
<Column field="status" header="状态" sortable style="min-width: 10rem">
|
|
|
|
|
<template #body="{ data }">
|
|
|
|
|
<Tag :value="data.status_description || data.status || '-'" :severity="getStatusSeverity(data.status)" class="cursor-pointer" @click="openStatusDialog(data)" />
|
|
|
|
|
<Tag :value="data.status_description || data.status || '-'"
|
|
|
|
|
:severity="getStatusSeverity(data.status)" class="cursor-pointer"
|
|
|
|
|
@click="openStatusDialog(data)" />
|
|
|
|
|
</template>
|
|
|
|
|
</Column>
|
|
|
|
|
<Column field="roles" header="角色" style="min-width: 16rem">
|
|
|
|
|
@@ -232,12 +214,15 @@ onMounted(() => {
|
|
|
|
|
<div class="flex flex-col gap-4">
|
|
|
|
|
<div>
|
|
|
|
|
<label class="block font-medium mb-2">用户状态</label>
|
|
|
|
|
<Select v-model="statusValue" :options="statusOptions" optionLabel="label" optionValue="value" placeholder="选择状态" :disabled="statusLoading" fluid />
|
|
|
|
|
<Select v-model="statusValue" :options="statusOptions" optionLabel="label" optionValue="value"
|
|
|
|
|
placeholder="选择状态" :disabled="statusLoading" fluid />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<Button label="取消" icon="pi pi-times" text @click="statusDialogVisible = false" :disabled="statusLoading" />
|
|
|
|
|
<Button label="确认" icon="pi pi-check" @click="confirmUpdateStatus" :loading="statusLoading" :disabled="!statusValue" />
|
|
|
|
|
<Button label="取消" icon="pi pi-times" text @click="statusDialogVisible = false"
|
|
|
|
|
:disabled="statusLoading" />
|
|
|
|
|
<Button label="确认" icon="pi pi-check" @click="confirmUpdateStatus" :loading="statusLoading"
|
|
|
|
|
:disabled="!statusValue" />
|
|
|
|
|
</template>
|
|
|
|
|
</Dialog>
|
|
|
|
|
</div>
|
|
|
|
|
|