Commit 685d1e1119f559f44eca416f4c27b3a74f8ae89e

Authored by xp.Huang
2 parents e5152262 331e320f

Merge branch 'fix/data-board-error' into 'main_dev'

fix: 修复数据看板阻塞性报错

See merge request yunteng/thingskit-front!637
@@ -84,6 +84,7 @@ @@ -84,6 +84,7 @@
84 currentRecord.value = record; 84 currentRecord.value = record;
85 if (mode === DataActionModeEnum.UPDATE) { 85 if (mode === DataActionModeEnum.UPDATE) {
86 const config = useGetComponentConfig(record.frontId); 86 const config = useGetComponentConfig(record.frontId);
  87 + if (!config) return;
87 selectWidgetKeys.value = { 88 selectWidgetKeys.value = {
88 componentKey: config.componentConfig.key, 89 componentKey: config.componentConfig.key,
89 categoryKey: config.componentConfig.package, 90 categoryKey: config.componentConfig.package,
@@ -124,8 +125,8 @@ @@ -124,8 +125,8 @@
124 ...item, 125 ...item,
125 componentInfo: { ...unref(getComponentConfig).persetOption, ...item.componentInfo }, 126 componentInfo: { ...unref(getComponentConfig).persetOption, ...item.componentInfo },
126 })); 127 }));
127 - if (window.requestIdleCallback as unknown as boolean) {  
128 - requestIdleCallback( 128 + if ((window as any).requestIdleCallback as unknown as boolean) {
  129 + (window as any).requestIdleCallback(
129 () => { 130 () => {
130 setFormValues({ dataSource: unref(dataSource) } as WidgetDataType); 131 setFormValues({ dataSource: unref(dataSource) } as WidgetDataType);
131 }, 132 },
@@ -7,7 +7,7 @@ import { Component } from 'vue'; @@ -7,7 +7,7 @@ import { Component } from 'vue';
7 */ 7 */
8 export const transformComponentKey = (string: string) => { 8 export const transformComponentKey = (string: string) => {
9 const CONNECTION_SYMBOL = '-'; 9 const CONNECTION_SYMBOL = '-';
10 - const needTransformFlag = string.includes(CONNECTION_SYMBOL); 10 + const needTransformFlag = (string || '').includes(CONNECTION_SYMBOL);
11 11
12 if (needTransformFlag) { 12 if (needTransformFlag) {
13 return string 13 return string
@@ -30,7 +30,6 @@ @@ -30,7 +30,6 @@
30 30
31 const getComponentConfig = computed(() => { 31 const getComponentConfig = computed(() => {
32 const { widthPx, heightPx, itemWidthRatio, itemHeightRatio, frontId } = props.sourceInfo; 32 const { widthPx, heightPx, itemWidthRatio, itemHeightRatio, frontId } = props.sourceInfo;
33 -  
34 return useGetComponentConfig(frontId, { 33 return useGetComponentConfig(frontId, {
35 widthPx, 34 widthPx,
36 heightPx, 35 heightPx,
@@ -12,3 +12,9 @@ @@ -12,3 +12,9 @@
12 <slot name="footer"></slot> 12 <slot name="footer"></slot>
13 </section> 13 </section>
14 </template> 14 </template>
  15 +
  16 +<style lang="less" scoped>
  17 + :deep(.ant-spin-spinning) {
  18 + @apply flex justify-center items-center w-full h-full;
  19 + }
  20 +</style>
@@ -60,12 +60,25 @@ export const useDataSource = (propsRef: ComputedRef<Recordable>) => { @@ -60,12 +60,25 @@ export const useDataSource = (propsRef: ComputedRef<Recordable>) => {
60 loading.value = true; 60 loading.value = true;
61 const { data } = await getDataBoradDetail(); 61 const { data } = await getDataBoradDetail();
62 rawDataSource.value = data; 62 rawDataSource.value = data;
  63 + // const result: WidgetDataType[] = (data.componentData || []).map((item) => {
  64 + // const { id } = item;
  65 +
  66 + // const layout =
  67 + // (data.componentLayout || []).find((item) => item.id === id) ||
  68 + // ({} as ComponentLayoutType);
  69 +
  70 + // return {
  71 + // i: buildUUID(),
  72 + // ...layout,
  73 + // ...item,
  74 + // } as WidgetDataType;
  75 + // });
63 const result: WidgetDataType[] = data.componentLayout.map((item) => { 76 const result: WidgetDataType[] = data.componentLayout.map((item) => {
64 const { id } = item; 77 const { id } = item;
65 const dataSource = 78 const dataSource =
66 - data.componentData.find((item) => item.id == id) || ({} as ComponentDataType); 79 + (data.componentData || []).find((item) => item.id == id) || ({} as ComponentDataType);
67 80
68 - dataSource.dataSource = dataSource.dataSource.map((item) => ({ 81 + dataSource.dataSource = (dataSource.dataSource || []).map((item) => ({
69 ...item, 82 ...item,
70 uuid: buildUUID(), 83 uuid: buildUUID(),
71 })); 84 }));