Skip to content

Commit a19878a

Browse files
committed
fix: beforeSave may not define issue
1 parent 5490e48 commit a19878a

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

frontend/src/components/StdDataDisplay/StdCurd.vue

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function clear_error() {
9393
9494
const ok = async () => {
9595
clear_error()
96-
await props.beforeSave(data)
96+
await props?.beforeSave?.(data)
9797
props.api!.save(data.id, data).then((r: any) => {
9898
message.success($gettext('Save Successfully'))
9999
Object.assign(data, r)
@@ -131,13 +131,13 @@ function edit(id: any) {
131131
</template>
132132

133133
<std-table
134-
ref="table"
135-
v-bind="props"
136-
@clickEdit="edit"
137-
@selected="onSelect"
138-
:key="update"
139-
:get_params="get_params"
140-
:exportCsv="exportCsv"
134+
ref="table"
135+
v-bind="props"
136+
@clickEdit="edit"
137+
@selected="onSelect"
138+
:key="update"
139+
:get_params="get_params"
140+
:exportCsv="exportCsv"
141141
>
142142
<template v-slot:actions="slotProps">
143143
<slot name="actions" :actions="slotProps.record"/>
@@ -146,22 +146,22 @@ function edit(id: any) {
146146
</a-card>
147147

148148
<a-modal
149-
class="std-curd-edit-modal"
150-
:mask="false"
151-
:title="data.id ? $gettext('Modify') : $gettext('Add')"
152-
:visible="visible"
153-
:cancel-text="$gettext('Cancel')"
154-
:ok-text="$gettext('OK')"
155-
@cancel="cancel"
156-
@ok="ok"
157-
:width="600"
158-
destroyOnClose
149+
class="std-curd-edit-modal"
150+
:mask="false"
151+
:title="data.id ? $gettext('Modify') : $gettext('Add')"
152+
:visible="visible"
153+
:cancel-text="$gettext('Cancel')"
154+
:ok-text="$gettext('OK')"
155+
@cancel="cancel"
156+
@ok="ok"
157+
:width="600"
158+
destroyOnClose
159159
>
160160
<std-data-entry
161-
ref="std_data_entry"
162-
:data-list="editableColumns()"
163-
v-model:data-source="data"
164-
:error="error"
161+
ref="std_data_entry"
162+
:data-list="editableColumns()"
163+
v-model:data-source="data"
164+
:error="error"
165165
/>
166166
<slot name="edit" :data="data"/>
167167
</a-modal>

0 commit comments

Comments
 (0)