3939 @click =" showCopyTemplate(record)" />
4040 </span >
4141 <span style =" margin-right : 5px " >
42- <a-popconfirm
43- v-if =" 'deleteTemplate' in $store.getters.apis"
44- placement =" topRight"
45- :title =" $t('message.action.delete.template')"
46- :ok-text =" $t('label.yes')"
47- :cancel-text =" $t('label.no')"
48- :loading =" deleteLoading"
49- @confirm =" deleteTemplate(record)"
50- >
51- <a-button
52- type =" danger"
53- icon =" delete"
54- shape =" circle" />
55- </a-popconfirm >
42+ <a-button
43+ :disabled =" !('deleteTemplate' in $store.getters.apis)"
44+ type =" danger"
45+ icon =" delete"
46+ shape =" circle"
47+ @click =" onShowDeleteModal(record)" />
5648 </span >
5749 </template >
5850 </a-table >
7567 :visible =" showCopyActionForm"
7668 :closable =" true"
7769 @ok =" handleCopyTemplateSubmit"
78- @cancel =" onCloseCopyForm "
70+ @cancel =" onCloseModal "
7971 :confirmLoading =" copyLoading"
8072 centered >
8173 <a-spin :spinning =" copyLoading" >
110102 </a-form >
111103 </a-spin >
112104 </a-modal >
105+
106+ <a-modal
107+ :title =" $t('label.action.delete.template')"
108+ :visible =" showDeleteTemplate"
109+ :closable =" true"
110+ @ok =" deleteTemplate"
111+ @cancel =" onCloseModal"
112+ :confirmLoading =" deleteLoading"
113+ centered >
114+ <a-spin :spinning =" deleteLoading" >
115+ <a-alert :message =" $t('message.action.delete.template')" type =" warning" />
116+ <a-form-item :label =" $t('label.isforced')" style =" margin-bottom : 0 ;" >
117+ <a-switch v-model =" forcedDelete" ></a-switch >
118+ </a-form-item >
119+ </a-spin >
120+ </a-modal >
113121 </div >
114122</template >
115123
@@ -141,7 +149,9 @@ export default {
141149 zones: [],
142150 zoneLoading: false ,
143151 copyLoading: false ,
144- deleteLoading: false
152+ deleteLoading: false ,
153+ showDeleteTemplate: false ,
154+ forcedDelete: false
145155 }
146156 },
147157 beforeCreate () {
@@ -217,10 +227,11 @@ export default {
217227 this .pageSize = pageSize
218228 this .fetchData ()
219229 },
220- deleteTemplate (record ) {
230+ deleteTemplate () {
221231 const params = {
222- id: record .id ,
223- zoneid: record .zoneid
232+ id: this .currentRecord .id ,
233+ forced: this .forcedDelete ,
234+ zoneid: this .currentRecord .zoneid
224235 }
225236 this .deleteLoading = true
226237 api (' deleteTemplate' , params).then (json => {
@@ -249,6 +260,7 @@ export default {
249260 this .$notifyError (error)
250261 }).finally (() => {
251262 this .deleteLoading = false
263+ this .onCloseModal ()
252264 this .fetchData ()
253265 })
254266 },
@@ -270,9 +282,15 @@ export default {
270282 this .fetchZoneData ()
271283 this .showCopyActionForm = true
272284 },
273- onCloseCopyForm () {
285+ onShowDeleteModal (record ) {
286+ this .forcedDelete = false
287+ this .currentRecord = record
288+ this .showDeleteTemplate = true
289+ },
290+ onCloseModal () {
274291 this .currentRecord = {}
275292 this .showCopyActionForm = false
293+ this .showDeleteTemplate = false
276294 },
277295 handleCopyTemplateSubmit (e ) {
278296 e .preventDefault ()
@@ -311,7 +329,7 @@ export default {
311329 }).finally (() => {
312330 this .copyLoading = false
313331 this .$emit (' refresh-data' )
314- this .onCloseCopyForm ()
332+ this .onCloseModal ()
315333 this .fetchData ()
316334 })
317335 })
0 commit comments