From 6b830f4e2526450450fb693b405f6989d3729380 Mon Sep 17 00:00:00 2001 From: zhenhui <1276357500@qq.com> Date: Thu, 2 Apr 2026 11:39:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B8=B8=E6=88=8F=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AF=E5=B1=95=E7=A4=BA-=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E6=89=80=E5=B1=9E=E6=B8=A0=E9=81=93=E4=B8=80=E6=A0=8F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/route.php | 3 +- web/src/views/backend/game/user/popupForm.vue | 28 ++++++++++++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/config/route.php b/config/route.php index 6ee7b62..6c41d75 100644 --- a/config/route.php +++ b/config/route.php @@ -169,8 +169,9 @@ Route::post('/admin/auth/rule/edit', [\app\admin\controller\auth\Rule::class, 'e Route::post('/admin/auth/rule/del', [\app\admin\controller\auth\Rule::class, 'del']); Route::get('/admin/auth/rule/select', [\app\admin\controller\auth\Rule::class, 'select']); -// admin/auth/adminLog +// admin/auth/adminLog(兼容 ThinkPHP 风格 /admin/auth.AdminLog/index) Route::get('/admin/auth/adminLog/index', [\app\admin\controller\auth\AdminLog::class, 'index']); +Route::get('/admin/auth.AdminLog/index', [\app\admin\controller\auth\AdminLog::class, 'index']); // admin/user/user Route::get('/admin/user/user/index', [\app\admin\controller\user\User::class, 'index']); diff --git a/web/src/views/backend/game/user/popupForm.vue b/web/src/views/backend/game/user/popupForm.vue index 5efd849..16ea532 100644 --- a/web/src/views/backend/game/user/popupForm.vue +++ b/web/src/views/backend/game/user/popupForm.vue @@ -77,7 +77,7 @@ /> import type { FormItemRule } from 'element-plus' -import { inject, onMounted, reactive, ref, useTemplateRef, watch } from 'vue' +import { computed, inject, onMounted, reactive, ref, useTemplateRef, watch } from 'vue' import { useI18n } from 'vue-i18n' import FormItem from '/@/components/formItem/index.vue' import { useConfig } from '/@/stores/config' @@ -137,6 +137,26 @@ const treeProps = { disabled: 'disabled', } +/** 与 adminTree 叶子 value(字符串)一致,避免 number 与 string 不一致导致 el-tree-select 只显示原始 ID */ +const adminIdForTree = computed({ + get() { + const v = baTable.form.items?.admin_id + if (v === undefined || v === null || v === '') return undefined + return String(v) + }, + set(v: string | number | undefined | null) { + if (!baTable.form.items) return + if (v === undefined || v === null || v === '') { + baTable.form.items.admin_id = undefined + return + } + const n = Number(v) + if (Number.isFinite(n)) { + baTable.form.items.admin_id = n + } + }, +}) + const loadChannelAdminTree = async () => { const res = await createAxios({ url: '/admin/game.Channel/adminTree', @@ -163,7 +183,7 @@ const onAdminTreeChange = (val: string | number | null) => { if (val === null || val === undefined || val === '') { return } - const key = typeof val === 'number' ? String(val) : val + const key = typeof val === 'number' ? String(val) : String(val) const channelId = adminIdToChannelId.value[key] if (channelId !== undefined) { baTable.form.items!.game_channel_id = channelId @@ -178,7 +198,7 @@ watch( () => baTable.form.items?.admin_id, (val) => { if (val === undefined || val === null || val === '') return - onAdminTreeChange(val as any) + onAdminTreeChange(typeof val === 'number' ? val : Number(val)) } )