From a654db5520c7e7530861a0baac6c7abed63a7f9f Mon Sep 17 00:00:00 2001 From: wangxiang <1827945911@qq.com> Date: Sun, 1 May 2022 04:02:16 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=A3=20=E5=88=B6=E5=AE=9A=E5=9B=A2?= =?UTF-8?q?=E9=98=9F=E8=A7=84=E5=88=99,=E6=8F=90=E4=BE=9B=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=8F=82=E8=80=83=E4=BB=A3=E7=A0=81=E8=A7=84=E8=8C=83?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kicc-ui/src/utils/index.ts | 4 +++- kicc-ui/src/views/system/user/UserModal.vue | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/kicc-ui/src/utils/index.ts b/kicc-ui/src/utils/index.ts index ea3e15f0..6a50dfdd 100644 --- a/kicc-ui/src/utils/index.ts +++ b/kicc-ui/src/utils/index.ts @@ -10,6 +10,7 @@ import type { RouteLocationNormalized, RouteRecordNormalized } from 'vue-router' import type { App, Plugin } from 'vue'; import { unref } from 'vue'; import { isObject } from '/@/utils/is'; +import { isEmpty } from 'lodash-es'; export const noop = () => {}; @@ -102,11 +103,12 @@ export const withInstall = (component: T, alias?: string) => { export const findListNameById = (id: string, list: any[], options: Partial<{ idField: string, nameField: string, childrenField: string }> = {}) => { // 设置默认配置 options = Object.assign({ idField: 'id', nameField: 'name', childrenField: 'children' }, options); + console.log(id, list, options); for (let i = 0; i < list.length; i++) { if (list[i][options.idField!] === id) { return list[i][options.nameField!]; } - if (list[i][options.childrenField!]) { + if (!isEmpty(list[i][options.childrenField!])) { return findListNameById(id, list[i][options.childrenField!],options); } } diff --git a/kicc-ui/src/views/system/user/UserModal.vue b/kicc-ui/src/views/system/user/UserModal.vue index 9a0f7314..a341ef45 100644 --- a/kicc-ui/src/views/system/user/UserModal.vue +++ b/kicc-ui/src/views/system/user/UserModal.vue @@ -14,7 +14,7 @@ * Copyright © 2020-2022 entfrm All rights reserved. * author entfrm开发团队-王翔 */ - import {defineComponent, reactive, ref, toRaw, unref} from 'vue'; + import {defineComponent, reactive, toRaw } from 'vue'; import { BasicModal, useModalInner } from '/@/components/Modal'; import { BasicForm, useForm } from '/@/components/Form/index'; import { userFormSchema } from './user.data';