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,12 +623,19 @@
this.$refs.tag.open();
},
remove(row, node) {
const parent = node.parent
const hashTree = parent.data.hashTree || parent.data;
const index = hashTree.findIndex(d => d.resourceId != undefined && row.resourceId != undefined && d.resourceId === row.resourceId)
hashTree.splice(index, 1);
this.sort();
this.reload();
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 hashTree = parent.data.hashTree || parent.data;
const index = hashTree.findIndex(d => d.resourceId != undefined && row.resourceId != undefined && d.resourceId === row.resourceId)
hashTree.splice(index, 1);
this.sort();
this.reload();
}
}
});
}
,
copyRow(row, node) {

View File

@ -140,10 +140,18 @@
methods: {
deleteCase(index, row) {
this.$get('/api/testcase/delete/' + row.id, () => {
this.$success(this.$t('commons.delete_success'));
this.$emit('refresh');
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.$success(this.$t('commons.delete_success'));
this.$emit('refresh');
});
}
}
});
},
singleRun(data) {
this.$emit('singleRun', data);