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 84 currentRecord.value = record;
85 85 if (mode === DataActionModeEnum.UPDATE) {
86 86 const config = useGetComponentConfig(record.frontId);
  87 + if (!config) return;
87 88 selectWidgetKeys.value = {
88 89 componentKey: config.componentConfig.key,
89 90 categoryKey: config.componentConfig.package,
... ... @@ -124,8 +125,8 @@
124 125 ...item,
125 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 131 setFormValues({ dataSource: unref(dataSource) } as WidgetDataType);
131 132 },
... ...
... ... @@ -7,7 +7,7 @@ import { Component } from 'vue';
7 7 */
8 8 export const transformComponentKey = (string: string) => {
9 9 const CONNECTION_SYMBOL = '-';
10   - const needTransformFlag = string.includes(CONNECTION_SYMBOL);
  10 + const needTransformFlag = (string || '').includes(CONNECTION_SYMBOL);
11 11
12 12 if (needTransformFlag) {
13 13 return string
... ...
... ... @@ -30,7 +30,6 @@
30 30
31 31 const getComponentConfig = computed(() => {
32 32 const { widthPx, heightPx, itemWidthRatio, itemHeightRatio, frontId } = props.sourceInfo;
33   -
34 33 return useGetComponentConfig(frontId, {
35 34 widthPx,
36 35 heightPx,
... ...
... ... @@ -12,3 +12,9 @@
12 12 <slot name="footer"></slot>
13 13 </section>
14 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 60 loading.value = true;
61 61 const { data } = await getDataBoradDetail();
62 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 76 const result: WidgetDataType[] = data.componentLayout.map((item) => {
64 77 const { id } = item;
65 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 82 ...item,
70 83 uuid: buildUUID(),
71 84 }));
... ...