Commit a12f394a4098fe1912715eb721f63af32585bc8b
1 parent
db46ea1c
fix: click update data component modal will happend data can not echo
Showing
2 changed files
with
12 additions
and
5 deletions
@@ -46,12 +46,18 @@ | @@ -46,12 +46,18 @@ | ||
46 | getAllDataSourceFieldValue: Fn<any, Recordable>; | 46 | getAllDataSourceFieldValue: Fn<any, Recordable>; |
47 | }>(); | 47 | }>(); |
48 | 48 | ||
49 | + const resetForm = () => { | ||
50 | + isEdit.value = false; | ||
51 | + frontId.value = ''; | ||
52 | + componentRecord.value = {} as unknown as DataBoardLayoutInfo; | ||
53 | + componentDefaultConfig.value = {}; | ||
54 | + }; | ||
55 | + | ||
49 | const handleSubmit = () => { | 56 | const handleSubmit = () => { |
50 | const { getAllDataSourceFieldValue } = unref(basicConfigurationEl)!; | 57 | const { getAllDataSourceFieldValue } = unref(basicConfigurationEl)!; |
51 | const value = getAllDataSourceFieldValue(); | 58 | const value = getAllDataSourceFieldValue(); |
52 | unref(isEdit) ? handleUpdateComponent(value) : handleAddComponent(value); | 59 | unref(isEdit) ? handleUpdateComponent(value) : handleAddComponent(value); |
53 | - isEdit.value = false; | ||
54 | - frontId.value = ''; | 60 | + resetForm(); |
55 | }; | 61 | }; |
56 | 62 | ||
57 | const handleAddComponent = async (value: Recordable) => { | 63 | const handleAddComponent = async (value: Recordable) => { |
@@ -111,6 +117,7 @@ | @@ -111,6 +117,7 @@ | ||
111 | width="70%" | 117 | width="70%" |
112 | :destroy-on-close="true" | 118 | :destroy-on-close="true" |
113 | @ok="handleSubmit" | 119 | @ok="handleSubmit" |
120 | + @cancel="resetForm" | ||
114 | > | 121 | > |
115 | <section> | 122 | <section> |
116 | <Tabs type="card"> | 123 | <Tabs type="card"> |
@@ -350,9 +350,9 @@ | @@ -350,9 +350,9 @@ | ||
350 | </template> | 350 | </template> |
351 | <template #extra> | 351 | <template #extra> |
352 | <Authority value="api:yt:data_component:add:post"> | 352 | <Authority value="api:yt:data_component:add:post"> |
353 | - <Button v-if="!getIsSharePage" type="primary" @click="handleOpenCreatePanel" | ||
354 | - >创建组件</Button | ||
355 | - > | 353 | + <Button v-if="!getIsSharePage" type="primary" @click="handleOpenCreatePanel"> |
354 | + 创建组件 | ||
355 | + </Button> | ||
356 | </Authority> | 356 | </Authority> |
357 | </template> | 357 | </template> |
358 | <div> | 358 | <div> |