|
68 | 68 | <a-divider type="vertical"/> |
69 | 69 | <a-popconfirm |
70 | 70 | v-if="soft_delete&¶ms.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> |
76 | 76 | </a-popconfirm> |
77 | 77 | <a-popconfirm |
78 | 78 | 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> |
84 | 84 | </a-popconfirm> |
85 | 85 | </template> |
86 | 86 | </div> |
@@ -129,75 +129,41 @@ export default { |
129 | 129 | return this.$gettext('Edit') |
130 | 130 | } |
131 | 131 | }, |
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 | + } |
166 | 137 | }, |
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 | + } |
201 | 167 | }, |
202 | 168 | deletable: { |
203 | 169 | type: Boolean, |
@@ -252,6 +218,24 @@ export default { |
252 | 218 | this.get_list() |
253 | 219 | }, |
254 | 220 | 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 | + }, |
255 | 239 | get_list(page_num = null) { |
256 | 240 | this.loading = true |
257 | 241 | if (page_num) { |
|
0 commit comments