Commit 5c47bbf282100e1915f98aee14f43e4dcfd6c9b3
1 parent
a3aa9060
fix: DEFECT-1380 修复看板管理控制组件首次进入时属性被重置
Showing
3 changed files
with
11 additions
and
4 deletions
@@ -61,7 +61,7 @@ | @@ -61,7 +61,7 @@ | ||
61 | return isBoolean(componetDesign) ? componetDesign : true; | 61 | return isBoolean(componetDesign) ? componetDesign : true; |
62 | }); | 62 | }); |
63 | 63 | ||
64 | - const setDataSourceFormsEl = (uuid: string, instance: PublicFormInstaceType, index) => { | 64 | + const setDataSourceFormsEl = (uuid: string, instance: PublicFormInstaceType, index: number) => { |
65 | const findIndex = unref(props.dataSource).findIndex((item) => item.uuid === uuid); | 65 | const findIndex = unref(props.dataSource).findIndex((item) => item.uuid === uuid); |
66 | if (~findIndex) { | 66 | if (~findIndex) { |
67 | dataSourceFormsEl.value[index] = { uuid, instance }; | 67 | dataSourceFormsEl.value[index] = { uuid, instance }; |
@@ -49,6 +49,8 @@ | @@ -49,6 +49,8 @@ | ||
49 | 49 | ||
50 | const dataSourceFormSpinning = ref(false); | 50 | const dataSourceFormSpinning = ref(false); |
51 | 51 | ||
52 | + let firstEnter = true; | ||
53 | + | ||
52 | const selectWidgetKeys = ref<SelectedWidgetKeys>({ | 54 | const selectWidgetKeys = ref<SelectedWidgetKeys>({ |
53 | componentKey: TextComponent1Config.key, | 55 | componentKey: TextComponent1Config.key, |
54 | categoryKey: PackagesCategoryEnum.TEXT, | 56 | categoryKey: PackagesCategoryEnum.TEXT, |
@@ -69,7 +71,7 @@ | @@ -69,7 +71,7 @@ | ||
69 | } as DataSourceType; | 71 | } as DataSourceType; |
70 | }; | 72 | }; |
71 | 73 | ||
72 | - const dataSource = ref<DataSourceType[]>(Array.from({ length: 1 }, () => genNewDataSourceItem())); | 74 | + const dataSource = ref<DataSourceType[]>([]); |
73 | 75 | ||
74 | const currentMode = ref<DataActionModeEnum>(DataActionModeEnum.CREATE); | 76 | const currentMode = ref<DataActionModeEnum>(DataActionModeEnum.CREATE); |
75 | 77 | ||
@@ -83,6 +85,7 @@ | @@ -83,6 +85,7 @@ | ||
83 | const { mode, record } = params; | 85 | const { mode, record } = params; |
84 | currentMode.value = mode; | 86 | currentMode.value = mode; |
85 | currentRecord.value = record; | 87 | currentRecord.value = record; |
88 | + firstEnter = false; | ||
86 | if (mode === DataActionModeEnum.UPDATE) { | 89 | if (mode === DataActionModeEnum.UPDATE) { |
87 | const config = useGetComponentConfig(record.frontId); | 90 | const config = useGetComponentConfig(record.frontId); |
88 | if (!config) return; | 91 | if (!config) return; |
@@ -128,12 +131,17 @@ | @@ -128,12 +131,17 @@ | ||
128 | const category = useGetCategoryByComponentKey(value); | 131 | const category = useGetCategoryByComponentKey(value); |
129 | const needReset = | 132 | const needReset = |
130 | [oldCategory, category].some((item) => item === PackagesCategoryEnum.CONTROL) && | 133 | [oldCategory, category].some((item) => item === PackagesCategoryEnum.CONTROL) && |
131 | - oldCategory !== category; | 134 | + oldCategory !== category && |
135 | + firstEnter; | ||
136 | + | ||
137 | + firstEnter = true; | ||
138 | + | ||
132 | dataSource.value = unref(dataSource).map((item) => ({ | 139 | dataSource.value = unref(dataSource).map((item) => ({ |
133 | ...item, | 140 | ...item, |
134 | ...(needReset ? { attribute: null } : {}), | 141 | ...(needReset ? { attribute: null } : {}), |
135 | componentInfo: { ...unref(getComponentConfig).persetOption, ...item.componentInfo }, | 142 | componentInfo: { ...unref(getComponentConfig).persetOption, ...item.componentInfo }, |
136 | })); | 143 | })); |
144 | + | ||
137 | if ((window as any).requestIdleCallback as unknown as boolean) { | 145 | if ((window as any).requestIdleCallback as unknown as boolean) { |
138 | (window as any).requestIdleCallback( | 146 | (window as any).requestIdleCallback( |
139 | () => { | 147 | () => { |