优化游戏用户信息展示-表单所属渠道一栏显示错误
This commit is contained in:
@@ -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::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']);
|
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']);
|
||||||
|
Route::get('/admin/auth.AdminLog/index', [\app\admin\controller\auth\AdminLog::class, 'index']);
|
||||||
|
|
||||||
// admin/user/user
|
// admin/user/user
|
||||||
Route::get('/admin/user/user/index', [\app\admin\controller\user\User::class, 'index']);
|
Route::get('/admin/user/user/index', [\app\admin\controller\user\User::class, 'index']);
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
/>
|
/>
|
||||||
<el-form-item :label="t('game.user.game_channel_id')" prop="admin_id">
|
<el-form-item :label="t('game.user.game_channel_id')" prop="admin_id">
|
||||||
<el-tree-select
|
<el-tree-select
|
||||||
v-model="baTable.form.items!.admin_id"
|
v-model="adminIdForTree"
|
||||||
class="w100"
|
class="w100"
|
||||||
clearable
|
clearable
|
||||||
filterable
|
filterable
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { FormItemRule } from 'element-plus'
|
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 { useI18n } from 'vue-i18n'
|
||||||
import FormItem from '/@/components/formItem/index.vue'
|
import FormItem from '/@/components/formItem/index.vue'
|
||||||
import { useConfig } from '/@/stores/config'
|
import { useConfig } from '/@/stores/config'
|
||||||
@@ -137,6 +137,26 @@ const treeProps = {
|
|||||||
disabled: 'disabled',
|
disabled: 'disabled',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 与 adminTree 叶子 value(字符串)一致,避免 number 与 string 不一致导致 el-tree-select 只显示原始 ID */
|
||||||
|
const adminIdForTree = computed<string | undefined>({
|
||||||
|
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 loadChannelAdminTree = async () => {
|
||||||
const res = await createAxios({
|
const res = await createAxios({
|
||||||
url: '/admin/game.Channel/adminTree',
|
url: '/admin/game.Channel/adminTree',
|
||||||
@@ -163,7 +183,7 @@ const onAdminTreeChange = (val: string | number | null) => {
|
|||||||
if (val === null || val === undefined || val === '') {
|
if (val === null || val === undefined || val === '') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const key = typeof val === 'number' ? String(val) : val
|
const key = typeof val === 'number' ? String(val) : String(val)
|
||||||
const channelId = adminIdToChannelId.value[key]
|
const channelId = adminIdToChannelId.value[key]
|
||||||
if (channelId !== undefined) {
|
if (channelId !== undefined) {
|
||||||
baTable.form.items!.game_channel_id = channelId
|
baTable.form.items!.game_channel_id = channelId
|
||||||
@@ -178,7 +198,7 @@ watch(
|
|||||||
() => baTable.form.items?.admin_id,
|
() => baTable.form.items?.admin_id,
|
||||||
(val) => {
|
(val) => {
|
||||||
if (val === undefined || val === null || val === '') return
|
if (val === undefined || val === null || val === '') return
|
||||||
onAdminTreeChange(val as any)
|
onAdminTreeChange(typeof val === 'number' ? val : Number(val))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user