Commit b2be6ec5604d2bb5c829c0ae4db0575d19a99fcc

Authored by ww
1 parent 8974ba53

perf: 优化数据看板选择组织使用组织树

1   -import { getOrganizationList } from '/@/api/system/system';
2 1 import { FormSchema } from '/@/components/Form';
3 2 import { ColEx } from '/@/components/Form/src/types';
4 3 import { useGridLayout } from '/@/hooks/component/useGridLayout';
5   -import { copyTransFun } from '/@/utils/fnUtils';
6 4
7 5 export const formSchema: FormSchema[] = [
8 6 {
... ... @@ -15,22 +13,4 @@ export const formSchema: FormSchema[] = [
15 13 placeholder: '请输入看板名称',
16 14 },
17 15 },
18   - {
19   - field: 'organizationId',
20   - component: 'ApiTreeSelect',
21   - label: '组织',
22   - // colProps: { span: 10 },
23   - colProps: useGridLayout(2, 3, 4) as unknown as ColEx,
24   - componentProps() {
25   - return {
26   - placeholder: '请选择组织',
27   - api: async () => {
28   - const data = await getOrganizationList();
29   - copyTransFun(data as any as any[]);
30   - return data;
31   - },
32   - getPopupContainer: () => document.body,
33   - };
34   - },
35   - },
36 16 ];
... ...
... ... @@ -23,11 +23,16 @@
23 23 import { DATA_BOARD_SHARE_URL } from '../palette';
24 24 import { BasicCardList, useCardList } from '/@/components/CardList';
25 25 import Authority from '/@/components/Authority/src/Authority.vue';
  26 + import { OrganizationIdTree, useOrganizationTree } from '../../common/organizationIdTree';
26 27
27 28 const router = useRouter();
28 29
29 30 const { createMessage, createConfirm } = useMessage();
30 31
  32 + const [registerOrgTree, { clearSelected, getSelectKey }] = useOrganizationTree({
  33 + onSelect: () => reload(),
  34 + });
  35 +
31 36 const [registerCardList, { reload }] = useCardList({
32 37 title: '数据看板',
33 38 api: getDataBoardList,
... ... @@ -36,6 +41,10 @@
36 41 formConfig: {
37 42 schemas: formSchema,
38 43 labelWidth: 80,
  44 + resetFunc: async () => clearSelected(),
  45 + },
  46 + beforeFetch: async (params: Recordable) => {
  47 + return { ...params, organizationId: getSelectKey() };
39 48 },
40 49 });
41 50
... ... @@ -137,8 +146,9 @@
137 146 </script>
138 147
139 148 <template>
140   - <section>
141   - <BasicCardList @register="registerCardList">
  149 + <section class="flex">
  150 + <OrganizationIdTree @register="registerOrgTree" />
  151 + <BasicCardList class="flex-auto p-4 w-3/4 xl:w-4/5 w-full" @register="registerCardList">
142 152 <template #toolbar>
143 153 <Authority :value="VisualBoardPermission.CREATE">
144 154 <Button type="primary" @click="handleOpenDetailModal">新增看板</Button>
... ...