Browse Source

👣 制定团队规则,提供用户参考代码规范模板

master
wangxiang 3 years ago
parent
commit
a654db5520
  1. 4
      kicc-ui/src/utils/index.ts
  2. 2
      kicc-ui/src/views/system/user/UserModal.vue

4
kicc-ui/src/utils/index.ts

@ -10,6 +10,7 @@ import type { RouteLocationNormalized, RouteRecordNormalized } from 'vue-router' @@ -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 = <T>(component: T, alias?: string) => { @@ -102,11 +103,12 @@ export const withInstall = <T>(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);
}
}

2
kicc-ui/src/views/system/user/UserModal.vue

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> 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';

Loading…
Cancel
Save