mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 10:12:51 +00:00
feat: enhance user search functionality with additional filters for active status and source
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
--bug=1059690 --user=王孝刚 【用户管理】筛选项加上:状态、用户来源 https://www.tapd.cn/62980211/s/1744107
This commit is contained in:
parent
53f83d3292
commit
fbef7232da
|
|
@ -7,7 +7,7 @@
|
|||
type="primary"
|
||||
@click="createUser"
|
||||
v-hasPermission="[RoleConst.ADMIN, PermissionConst.USER_CREATE]"
|
||||
>{{ $t('views.userManage.createUser') }}
|
||||
>{{ $t('views.userManage.createUser') }}
|
||||
</el-button>
|
||||
<div class="flex-between complex-search">
|
||||
<el-select
|
||||
|
|
@ -16,9 +16,17 @@
|
|||
style="width: 120px"
|
||||
@change="search_type_change"
|
||||
>
|
||||
<el-option :label="$t('views.login.loginForm.username.label')" value="username" />
|
||||
<el-option :label="$t('views.userManage.userForm.nick_name.label')" value="nick_name" />
|
||||
<el-option :label="$t('views.login.loginForm.email.label')" value="email" />
|
||||
<el-option :label="$t('views.login.loginForm.username.label')" value="username"/>
|
||||
<el-option :label="$t('views.userManage.userForm.nick_name.label')" value="nick_name"/>
|
||||
<el-option :label="$t('views.login.loginForm.email.label')" value="email"/>
|
||||
<el-option
|
||||
:label="$t('common.status.label')"
|
||||
value="is_active"
|
||||
/>
|
||||
<el-option
|
||||
:label="$t('views.userManage.source.label')"
|
||||
value="source"
|
||||
/>
|
||||
</el-select>
|
||||
<el-input
|
||||
v-if="search_type === 'username'"
|
||||
|
|
@ -44,6 +52,63 @@
|
|||
clearable
|
||||
:placeholder="$t('common.inputPlaceholder')"
|
||||
/>
|
||||
<el-select
|
||||
v-else-if="search_type === 'is_active'"
|
||||
v-model="search_form.is_active"
|
||||
@change="getList"
|
||||
style="width: 220px"
|
||||
>
|
||||
<el-option
|
||||
:label="$t('common.status.enabled')"
|
||||
:value="true"
|
||||
/>
|
||||
<el-option
|
||||
:label="$t('common.status.disabled')"
|
||||
:value="false"
|
||||
/>
|
||||
</el-select>
|
||||
<el-select
|
||||
v-else-if="search_type === 'source'"
|
||||
v-model="search_form.source"
|
||||
@change="getList"
|
||||
style="width: 220px"
|
||||
clearable
|
||||
:placeholder="$t('common.inputPlaceholder')"
|
||||
>
|
||||
<el-option
|
||||
:label="$t('views.userManage.source.local')"
|
||||
value="LOCAL"
|
||||
/>
|
||||
<el-option
|
||||
label="CAS"
|
||||
value="CAS"
|
||||
/>
|
||||
<el-option
|
||||
label="LDAP"
|
||||
value="LDAP"
|
||||
/>
|
||||
<el-option
|
||||
label="OIDC"
|
||||
value="OIDC"
|
||||
/>
|
||||
<el-option
|
||||
label="OAuth2"
|
||||
value="OAuth2"
|
||||
/>
|
||||
<el-option
|
||||
:label="$t('views.userManage.source.wecom')"
|
||||
value="wecom"
|
||||
/>
|
||||
<el-option
|
||||
:label="$t('views.userManage.source.lark')"
|
||||
value="lark"
|
||||
/>
|
||||
<el-option
|
||||
:label="$t('views.userManage.source.dingtalk')"
|
||||
value="dingtalk"
|
||||
/>
|
||||
</el-select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<app-table
|
||||
|
|
@ -71,7 +136,7 @@
|
|||
<template #default="{ row }">
|
||||
<div v-if="row.is_active" class="flex align-center">
|
||||
<el-icon class="color-success mr-8" style="font-size: 16px">
|
||||
<SuccessFilled />
|
||||
<SuccessFilled/>
|
||||
</el-icon>
|
||||
<span class="color-secondary">
|
||||
{{ $t('common.status.enabled') }}
|
||||
|
|
@ -167,7 +232,7 @@
|
|||
v-if="hasPermission([RoleConst.ADMIN, PermissionConst.USER_EDIT], 'OR')"
|
||||
/>
|
||||
</span>
|
||||
<el-divider direction="vertical" />
|
||||
<el-divider direction="vertical"/>
|
||||
<el-tooltip effect="dark" :content="$t('common.edit')" placement="top">
|
||||
<span class="mr-8">
|
||||
<el-button
|
||||
|
|
@ -177,7 +242,7 @@
|
|||
:title="$t('common.edit')"
|
||||
v-if="hasPermission([RoleConst.ADMIN, PermissionConst.USER_EDIT], 'OR')"
|
||||
>
|
||||
<el-icon><EditPen /></el-icon>
|
||||
<el-icon><EditPen/></el-icon>
|
||||
</el-button>
|
||||
</span>
|
||||
</el-tooltip>
|
||||
|
|
@ -194,7 +259,7 @@
|
|||
:title="$t('views.userManage.setting.updatePwd')"
|
||||
v-if="hasPermission([RoleConst.ADMIN, PermissionConst.USER_EDIT], 'OR')"
|
||||
>
|
||||
<el-icon><Lock /></el-icon>
|
||||
<el-icon><Lock/></el-icon>
|
||||
</el-button>
|
||||
</span>
|
||||
</el-tooltip>
|
||||
|
|
@ -207,41 +272,47 @@
|
|||
:title="$t('common.delete')"
|
||||
v-if="hasPermission([RoleConst.ADMIN, PermissionConst.USER_DELETE], 'OR')"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
<el-icon>
|
||||
<Delete/>
|
||||
</el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</app-table>
|
||||
</el-card>
|
||||
<UserDrawer :title="title" ref="UserDrawerRef" @refresh="refresh" />
|
||||
<UserPwdDialog ref="UserPwdDialogRef" @refresh="refresh" />
|
||||
<UserDrawer :title="title" ref="UserDrawerRef" @refresh="refresh"/>
|
||||
<UserPwdDialog ref="UserPwdDialogRef" @refresh="refresh"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, ref, reactive, watch } from 'vue'
|
||||
import {onMounted, ref, reactive, watch} from 'vue'
|
||||
import UserDrawer from './component/UserDrawer.vue'
|
||||
import UserPwdDialog from './component/UserPwdDialog.vue'
|
||||
import userManageApi from '@/api/system/user-manage'
|
||||
import { datetimeFormat } from '@/utils/time'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
import { t } from '@/locales'
|
||||
import { ValidCount, ValidType } from '@/enums/common.ts'
|
||||
import {datetimeFormat} from '@/utils/time'
|
||||
import {MsgSuccess, MsgConfirm} from '@/utils/message'
|
||||
import {t} from '@/locales'
|
||||
import {ValidCount, ValidType} from '@/enums/common.ts'
|
||||
import useStore from '@/stores'
|
||||
import { PermissionConst, RoleConst } from '@/utils/permission/data'
|
||||
import { hasPermission } from '@/utils/permission/index'
|
||||
import {PermissionConst, RoleConst} from '@/utils/permission/data'
|
||||
import {hasPermission} from '@/utils/permission/index'
|
||||
|
||||
const { user, common } = useStore()
|
||||
const {user, common} = useStore()
|
||||
const search_type = ref('username')
|
||||
const search_form = ref<{
|
||||
username: string
|
||||
nick_name?: string
|
||||
email?: string
|
||||
is_active?: boolean | null
|
||||
source?: string | null
|
||||
}>({
|
||||
username: '',
|
||||
nick_name: '',
|
||||
email: '',
|
||||
is_active: true,
|
||||
source: '',
|
||||
})
|
||||
|
||||
const UserDrawerRef = ref()
|
||||
|
|
@ -257,7 +328,7 @@ const paginationConfig = reactive({
|
|||
const userTableData = ref<any[]>([])
|
||||
|
||||
const search_type_change = () => {
|
||||
search_form.value = { username: '', nick_name: '', email: '' }
|
||||
search_form.value = {username: '', nick_name: '', email: '', is_active: null}
|
||||
}
|
||||
|
||||
function handleSizeChange() {
|
||||
|
|
@ -267,9 +338,9 @@ function handleSizeChange() {
|
|||
|
||||
function getList() {
|
||||
const params: any = {}
|
||||
if (search_form.value[search_type.value as keyof typeof search_form.value]) {
|
||||
params[search_type.value] =
|
||||
search_form.value[search_type.value as keyof typeof search_form.value]
|
||||
const searchValue = search_form.value[search_type.value as keyof typeof search_form.value];
|
||||
if (searchValue !== undefined && searchValue !== null && searchValue !== '') {
|
||||
params[search_type.value] = searchValue;
|
||||
}
|
||||
return userManageApi.getUserManage(paginationConfig, params, loading).then((res) => {
|
||||
userTableData.value = res.data.records.map((item: any) => ({
|
||||
|
|
@ -329,7 +400,8 @@ function deleteUserManage(row: any) {
|
|||
getList()
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
.catch(() => {
|
||||
})
|
||||
}
|
||||
|
||||
function editPwdUser(row: any) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue