Commit b2be6ec5604d2bb5c829c0ae4db0575d19a99fcc

Authored by ww
1 parent 8974ba53

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

1 -import { getOrganizationList } from '/@/api/system/system';  
2 import { FormSchema } from '/@/components/Form'; 1 import { FormSchema } from '/@/components/Form';
3 import { ColEx } from '/@/components/Form/src/types'; 2 import { ColEx } from '/@/components/Form/src/types';
4 import { useGridLayout } from '/@/hooks/component/useGridLayout'; 3 import { useGridLayout } from '/@/hooks/component/useGridLayout';
5 -import { copyTransFun } from '/@/utils/fnUtils';  
6 4
7 export const formSchema: FormSchema[] = [ 5 export const formSchema: FormSchema[] = [
8 { 6 {
@@ -15,22 +13,4 @@ export const formSchema: FormSchema[] = [ @@ -15,22 +13,4 @@ export const formSchema: FormSchema[] = [
15 placeholder: '请输入看板名称', 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,11 +23,16 @@
23 import { DATA_BOARD_SHARE_URL } from '../palette'; 23 import { DATA_BOARD_SHARE_URL } from '../palette';
24 import { BasicCardList, useCardList } from '/@/components/CardList'; 24 import { BasicCardList, useCardList } from '/@/components/CardList';
25 import Authority from '/@/components/Authority/src/Authority.vue'; 25 import Authority from '/@/components/Authority/src/Authority.vue';
  26 + import { OrganizationIdTree, useOrganizationTree } from '../../common/organizationIdTree';
26 27
27 const router = useRouter(); 28 const router = useRouter();
28 29
29 const { createMessage, createConfirm } = useMessage(); 30 const { createMessage, createConfirm } = useMessage();
30 31
  32 + const [registerOrgTree, { clearSelected, getSelectKey }] = useOrganizationTree({
  33 + onSelect: () => reload(),
  34 + });
  35 +
31 const [registerCardList, { reload }] = useCardList({ 36 const [registerCardList, { reload }] = useCardList({
32 title: '数据看板', 37 title: '数据看板',
33 api: getDataBoardList, 38 api: getDataBoardList,
@@ -36,6 +41,10 @@ @@ -36,6 +41,10 @@
36 formConfig: { 41 formConfig: {
37 schemas: formSchema, 42 schemas: formSchema,
38 labelWidth: 80, 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,8 +146,9 @@
137 </script> 146 </script>
138 147
139 <template> 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 <template #toolbar> 152 <template #toolbar>
143 <Authority :value="VisualBoardPermission.CREATE"> 153 <Authority :value="VisualBoardPermission.CREATE">
144 <Button type="primary" @click="handleOpenDetailModal">新增看板</Button> 154 <Button type="primary" @click="handleOpenDetailModal">新增看板</Button>