feat: add nick_name field to user search and update authentication forms

This commit is contained in:
wxg0103 2025-07-29 18:00:24 +08:00
parent 7205c7fda7
commit caa08e136f
9 changed files with 68 additions and 44 deletions

View File

@ -103,4 +103,5 @@ export default {
collapse: 'Collapse',
copyTitle: 'Copy',
professional: 'Purchase the Professional Edition',
sync: 'Sync',
}

View File

@ -107,4 +107,5 @@ export default {
collapse: '收起',
copyTitle: '副本',
professional: '购买专业版',
sync: '同步',
}

View File

@ -103,4 +103,5 @@ export default {
collapse: '收起',
copyTitle: '副本',
professional: '購買專業版',
sync: '同步',
}

View File

@ -22,7 +22,7 @@
<span class="dialog-footer">
<el-button @click.prevent="dialogVisible = false"> {{ $t('common.cancel') }} </el-button>
<el-button type="primary" @click="submit(formRef)" :loading="loading">
{{ $t('common.save') }}
{{ $t('common.sync') }}
</el-button>
</span>
</template>

View File

@ -38,14 +38,14 @@
</el-form-item>
<el-form-item>
<el-checkbox v-model="form.is_active"
>{{ $t('views.system.authentication.cas.enableAuthentication') }}
>{{ $t('views.system.authentication.cas.enableAuthentication') }}
</el-checkbox>
</el-form-item>
</el-form>
<div class="text-right">
<el-button @click="submit(authFormRef)" type="primary" :disabled="loading"
v-hasPermission="
v-hasPermission="
new ComplexPermission(
[RoleConst.ADMIN],
[PermissionConst.LOGIN_AUTH_EDIT],
@ -59,13 +59,13 @@
</div>
</template>
<script setup lang="ts">
import { reactive, ref, watch, onMounted } from 'vue'
import {reactive, ref, watch, onMounted} from 'vue'
import authApi from '@/api/system-settings/auth-setting'
import type { FormInstance, FormRules } from 'element-plus'
import { t } from '@/locales'
import { MsgSuccess } from '@/utils/message'
import { PermissionConst, RoleConst } from '@/utils/permission/data'
import { ComplexPermission } from '@/utils/permission/type'
import type {FormInstance, FormRules} from 'element-plus'
import {t} from '@/locales'
import {MsgSuccess} from '@/utils/message'
import {PermissionConst, RoleConst} from '@/utils/permission/data'
import {ComplexPermission} from '@/utils/permission/type'
const form = ref<any>({
id: '',
@ -124,7 +124,7 @@ function getDetail() {
res.data.config.validateUrl = res.data.config.ldpUri
}
form.value = res.data
if (!form.value.config.redirectUrl){
if (!form.value.config.redirectUrl) {
form.value.config.redirectUrl = window.location.origin + window.MaxKB.prefix + 'api/cas'
}
}

View File

@ -84,14 +84,14 @@
</el-form-item>
<el-form-item>
<el-checkbox v-model="form.is_active"
>{{ $t('views.system.authentication.oauth2.enableAuthentication') }}
>{{ $t('views.system.authentication.oauth2.enableAuthentication') }}
</el-checkbox>
</el-form-item>
</el-form>
<div class="text-right">
<el-button @click="submit(authFormRef)" type="primary" :disabled="loading"
v-hasPermission="
v-hasPermission="
new ComplexPermission(
[RoleConst.ADMIN],
[PermissionConst.LOGIN_AUTH_EDIT],
@ -105,13 +105,13 @@
</div>
</template>
<script setup lang="ts">
import { reactive, ref, onMounted } from 'vue'
import {reactive, ref, onMounted} from 'vue'
import authApi from '@/api/system-settings/auth-setting'
import type { FormInstance, FormRules } from 'element-plus'
import { t } from '@/locales'
import { MsgSuccess } from '@/utils/message'
import { PermissionConst, RoleConst } from '@/utils/permission/data'
import { ComplexPermission } from '@/utils/permission/type'
import type {FormInstance, FormRules} from 'element-plus'
import {t} from '@/locales'
import {MsgSuccess} from '@/utils/message'
import {PermissionConst, RoleConst} from '@/utils/permission/data'
import {ComplexPermission} from '@/utils/permission/type'
const form = ref<any>({
id: '',
@ -208,9 +208,9 @@ function getDetail() {
if (res.data && JSON.stringify(res.data) !== '{}') {
form.value = res.data
}
if (!form.value.config.redirectUrl){
form.value.config.redirectUrl = window.location.origin + window.MaxKB.prefix + 'api/oauth2'
}
if (!form.value.config.redirectUrl) {
form.value.config.redirectUrl = window.location.origin + window.MaxKB.prefix + 'api/oauth2'
}
})
}

View File

@ -37,10 +37,10 @@
/>
</el-form-item>
<el-form-item label="Scope" prop="config.scope">
<el-input v-model="form.config.scope" placeholder="openid+profile+email " />
<el-input v-model="form.config.scope" placeholder="openid+profile+email "/>
</el-form-item>
<el-form-item label="State" prop="config.state">
<el-input v-model="form.config.state" placeholder="" />
<el-input v-model="form.config.state" placeholder=""/>
</el-form-item>
<el-form-item
:label="$t('views.system.authentication.oidc.clientId')"
@ -81,14 +81,14 @@
</el-form-item>
<el-form-item>
<el-checkbox v-model="form.is_active"
>{{ $t('views.system.authentication.oidc.enableAuthentication') }}
>{{ $t('views.system.authentication.oidc.enableAuthentication') }}
</el-checkbox>
</el-form-item>
</el-form>
<div class="text-right">
<el-button @click="submit(authFormRef)" type="primary" :disabled="loading"
v-hasPermission="
v-hasPermission="
new ComplexPermission(
[RoleConst.ADMIN],
[PermissionConst.LOGIN_AUTH_EDIT],
@ -102,13 +102,13 @@
</div>
</template>
<script setup lang="ts">
import { reactive, ref, watch, onMounted } from 'vue'
import {reactive, ref, watch, onMounted} from 'vue'
import authApi from '@/api/system-settings/auth-setting'
import type { FormInstance, FormRules } from 'element-plus'
import { t } from '@/locales'
import { MsgSuccess } from '@/utils/message'
import { PermissionConst, RoleConst } from '@/utils/permission/data'
import { ComplexPermission } from '@/utils/permission/type'
import type {FormInstance, FormRules} from 'element-plus'
import {t} from '@/locales'
import {MsgSuccess} from '@/utils/message'
import {PermissionConst, RoleConst} from '@/utils/permission/data'
import {ComplexPermission} from '@/utils/permission/type'
const form = ref<any>({
id: '',
@ -218,7 +218,7 @@ function getDetail() {
) {
form.value.config.fieldMapping = '{"username": "preferred_username", "email": "email"}'
}
if (!form.value.config.redirectUrl){
if (!form.value.config.redirectUrl) {
form.value.config.redirectUrl = window.location.origin + window.MaxKB.prefix + 'api/oidc'
}
}

View File

@ -18,6 +18,7 @@
<div class="flex complex-search">
<el-select class="complex-search__left" v-model="searchType" style="width: 120px">
<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-select>
<el-input
v-if="searchType === 'username'"
@ -27,6 +28,14 @@
style="width: 220px"
clearable
/>
<el-input
v-else-if="searchType === 'nick_name'"
v-model="searchForm.nick_name"
@change="getList"
:placeholder="$t('common.inputPlaceholder')"
style="width: 220px"
clearable
/>
</div>
</div>
<app-table
@ -98,6 +107,7 @@ const loading = ref(false)
const searchType = ref('username')
const searchForm = ref<Record<string, any>>({
username: '',
nick_name: '',
})
const paginationConfig = reactive({
current_page: 1,

View File

@ -14,7 +14,8 @@
</el-button>
<div class="flex complex-search">
<el-select class="complex-search__left" v-model="searchType" style="width: 120px">
<el-option :label="$t('views.login.loginForm.username.label')" value="username" />
<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-select>
<el-input
v-if="searchType === 'username'"
@ -24,6 +25,13 @@
style="width: 220px"
clearable
/>
<el-input
v-else-if="searchType === 'nick_name'"
v-model="searchForm.nick_name"
@change="getList"
:placeholder="$t('common.inputPlaceholder')"
style="width: 220px"
clearable/>
</div>
</div>
<app-table
@ -36,9 +44,9 @@
:span-method="objectSpanMethod"
:maxTableHeight="320"
>
<el-table-column prop="nick_name" :label="$t('views.userManage.userForm.nick_name.label')" />
<el-table-column prop="username" :label="$t('views.login.loginForm.username.label')" />
<el-table-column prop="role_name" :label="$t('views.role.member.role')" />
<el-table-column prop="nick_name" :label="$t('views.userManage.userForm.nick_name.label')"/>
<el-table-column prop="username" :label="$t('views.login.loginForm.username.label')"/>
<el-table-column prop="role_name" :label="$t('views.role.member.role')"/>
<el-table-column :label="$t('common.operation')" width="100" fixed="right">
<template #default="{ row }">
<el-tooltip
@ -71,13 +79,13 @@
</template>
<script setup lang="ts">
import { onMounted, ref, reactive, watch } from 'vue'
import { MsgSuccess, MsgConfirm } from '@/utils/message'
import { t } from '@/locales'
import {onMounted, ref, reactive, watch} from 'vue'
import {MsgSuccess, MsgConfirm} from '@/utils/message'
import {t} from '@/locales'
import AddMemberDrawer from './AddMemberDrawer.vue'
import type { WorkspaceMemberItem, WorkspaceItem } from '@/api/type/workspace'
import { PermissionConst, RoleConst } from '@/utils/permission/data'
import { ComplexPermission } from '@/utils/permission/type'
import type {WorkspaceMemberItem, WorkspaceItem} from '@/api/type/workspace'
import {PermissionConst, RoleConst} from '@/utils/permission/data'
import {ComplexPermission} from '@/utils/permission/type'
import {loadPermissionApi} from "@/utils/dynamics-api/permission-api.ts";
@ -90,6 +98,7 @@ const loading = ref(false)
const searchType = ref('username')
const searchForm = ref<Record<string, any>>({
username: '',
nick_name: '',
})
const paginationConfig = reactive({
current_page: 1,
@ -134,7 +143,7 @@ watch(
},
)
const objectSpanMethod = ({ row, column, rowIndex, columnIndex }: any) => {
const objectSpanMethod = ({row, column, rowIndex, columnIndex}: any) => {
if (column.property === 'nick_name' || column.property === 'username') {
const sameUserRows = tableData.value.filter(item => item.user_id === row.user_id);
if (rowIndex === tableData.value.findIndex(item => item.user_id === row.user_id)) {
@ -152,6 +161,7 @@ const objectSpanMethod = ({ row, column, rowIndex, columnIndex }: any) => {
};
const addMemberDrawerRef = ref<InstanceType<typeof AddMemberDrawer>>()
function handleAdd() {
addMemberDrawerRef.value?.open()
}
@ -172,7 +182,8 @@ function handleDelete(row: WorkspaceMemberItem) {
getList()
})
})
.catch(() => {})
.catch(() => {
})
}
</script>