Skip to content

Commit 517d834

Browse files
committed
fix my own fault (previous version of bindings did not work)
1 parent 3b63225 commit 517d834

File tree

1 file changed

+62
-78
lines changed

1 file changed

+62
-78
lines changed

frontend/src/components/StdDataDisplay/StdTable.vue

Lines changed: 62 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,19 @@
6868
<a-divider type="vertical"/>
6969
<a-popconfirm
7070
v-if="soft_delete&&params.trashed"
71-
cancelText="{{restore.cancel_text}}"
72-
okText="{{restore.ok_text}}"
73-
title="{{restore.title_text}}"
74-
@confirm="restore.exec(record[rowKey])">
75-
<a href="javascript:;">{{restore.action_text}}</a>
71+
:cancelText="cancel_text"
72+
:okText="ok_text"
73+
:title="restore_title_text"
74+
@confirm="restore(record[rowKey])">
75+
<a href="javascript:;">{{restore_action_text}}</a>
7676
</a-popconfirm>
7777
<a-popconfirm
7878
v-else
79-
cancelText="{{destroy.cancel_text}}"
80-
okText="{{destroy.ok_text}}"
81-
title="{{destroy.title_text}}"
82-
@confirm="destroy.exec(record[rowKey])">
83-
<a href="javascript:;">{{destroy.action_text}}</a>
79+
:cancelText="cancel_text"
80+
:okText="ok_text"
81+
:title="destroy_title_text"
82+
@confirm="destroy(record[rowKey])">
83+
<a href="javascript:;">{{destroy_action_text}}</a>
8484
</a-popconfirm>
8585
</template>
8686
</div>
@@ -129,75 +129,41 @@ export default {
129129
return this.$gettext('Edit')
130130
}
131131
},
132-
restore: {
133-
title_text: {
134-
type: String,
135-
default() {
136-
return this.$gettext('Are you sure you want to restore?')
137-
}
138-
},
139-
action_text: {
140-
type: String,
141-
default() {
142-
return this.$gettext('Restore')
143-
}
144-
},
145-
ok_text: {
146-
type: String,
147-
default() {
148-
return this.$gettext('Yes, I\'m sure')
149-
}
150-
},
151-
cancel_text: {
152-
type: String,
153-
default() {
154-
return this.$gettext('No, I\'m rethink')
155-
}
156-
},
157-
exec(id) {
158-
this.api.restore(id).then(() => {
159-
this.get_list()
160-
this.$message.success('反删除 ID: ' + id + ' 成功')
161-
}).catch(e => {
162-
console.log(e)
163-
this.$message.error(e?.message ?? '系统错误')
164-
})
165-
},
132+
restore_title_text: {
133+
type: String,
134+
default() {
135+
return this.$gettext('Are you sure you want to restore?')
136+
}
166137
},
167-
destroy: {
168-
title_text: {
169-
type: String,
170-
default() {
171-
return this.$gettext('Are you sure you want to destroy?')
172-
}
173-
},
174-
action_text: {
175-
type: String,
176-
default() {
177-
return this.$gettext('Destroy')
178-
}
179-
},
180-
ok_text: {
181-
type: String,
182-
default() {
183-
return this.$gettext('Yes, I\'m sure')
184-
}
185-
},
186-
cancel_text: {
187-
type: String,
188-
default() {
189-
return this.$gettext('No, I\'m rethink')
190-
}
191-
},
192-
exec(id) {
193-
this.api.destroy(id).then(() => {
194-
this.get_list()
195-
this.$message.success('删除 ID: ' + id + ' 成功')
196-
}).catch(e => {
197-
console.log(e)
198-
this.$message.error(e?.message ?? '系统错误')
199-
})
200-
},
138+
restore_action_text: {
139+
type: String,
140+
default() {
141+
return this.$gettext('Restore')
142+
}
143+
},
144+
ok_text: {
145+
type: String,
146+
default() {
147+
return this.$gettext('Yes, I\'m sure')
148+
}
149+
},
150+
cancel_text: {
151+
type: String,
152+
default() {
153+
return this.$gettext('No, I\'m rethink')
154+
}
155+
},
156+
destroy_title_text: {
157+
type: String,
158+
default() {
159+
return this.$gettext('Are you sure you want to destroy?')
160+
}
161+
},
162+
destroy_action_text: {
163+
type: String,
164+
default() {
165+
return this.$gettext('Destroy')
166+
}
201167
},
202168
deletable: {
203169
type: Boolean,
@@ -252,6 +218,24 @@ export default {
252218
this.get_list()
253219
},
254220
methods: {
221+
restore(id) {
222+
this.api.restore(id).then(() => {
223+
this.get_list()
224+
this.$message.success('反删除 ID: ' + id + ' 成功')
225+
}).catch(e => {
226+
console.log(e)
227+
this.$message.error(e?.message ?? '系统错误')
228+
})
229+
},
230+
destroy(id) {
231+
this.api.destroy(id).then(() => {
232+
this.get_list()
233+
this.$message.success('删除 ID: ' + id + ' 成功')
234+
}).catch(e => {
235+
console.log(e)
236+
this.$message.error(e?.message ?? '系统错误')
237+
})
238+
},
255239
get_list(page_num = null) {
256240
this.loading = true
257241
if (page_num) {

0 commit comments

Comments
 (0)