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