feat: 删除按钮增加确认弹框

This commit is contained in:
wenyann 2021-01-04 14:13:11 +08:00
parent 670fcfbae4
commit b9b95d63d8
2 changed files with 24 additions and 9 deletions

View File

@ -623,6 +623,10 @@
this.$refs.tag.open(); this.$refs.tag.open();
}, },
remove(row, node) { remove(row, node) {
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + row.name + " ", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
const parent = node.parent const parent = node.parent
const hashTree = parent.data.hashTree || parent.data; const hashTree = parent.data.hashTree || parent.data;
const index = hashTree.findIndex(d => d.resourceId != undefined && row.resourceId != undefined && d.resourceId === row.resourceId) const index = hashTree.findIndex(d => d.resourceId != undefined && row.resourceId != undefined && d.resourceId === row.resourceId)
@ -630,6 +634,9 @@
this.sort(); this.sort();
this.reload(); this.reload();
} }
}
});
}
, ,
copyRow(row, node) { copyRow(row, node) {
const parent = node.parent const parent = node.parent

View File

@ -140,10 +140,18 @@
methods: { methods: {
deleteCase(index, row) { deleteCase(index, row) {
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + row.name + " ", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
this.$get('/api/testcase/delete/' + row.id, () => { this.$get('/api/testcase/delete/' + row.id, () => {
this.$success(this.$t('commons.delete_success')); this.$success(this.$t('commons.delete_success'));
this.$emit('refresh'); this.$emit('refresh');
}); });
}
}
});
}, },
singleRun(data) { singleRun(data) {
this.$emit('singleRun', data); this.$emit('singleRun', data);