refactor: 优化列表删除时的提示

This commit is contained in:
CaptainB 2022-01-26 15:14:57 +08:00 committed by 刘瑞斌
parent f92c67fe84
commit 6f4d99323f
4 changed files with 62 additions and 49 deletions

View File

@ -563,6 +563,7 @@ export default {
envGroupId: "", envGroupId: "",
apiscenariofilters: {}, apiscenariofilters: {},
runRequest: {}, runRequest: {},
versionEnable: false,
}; };
}, },
created() { created() {
@ -843,6 +844,7 @@ export default {
} }
if (hasLicense()) { if (hasLicense()) {
this.$get('/project/version/enable/' + projectId, response => { this.$get('/project/version/enable/' + projectId, response => {
this.versionEnable = response.data;
if (!response.data) { if (!response.data) {
this.fields = this.fields.filter(f => f.id !== 'versionId'); this.fields = this.fields.filter(f => f.id !== 'versionId');
} }
@ -1147,7 +1149,8 @@ export default {
} }
} }
// //
if (hasLicense()) { this.$get('/api/automation/versions/' + row.id, response => {
if (hasLicense() && this.versionEnable && response.data.length > 1) {
// //
this.$refs.apiDeleteConfirm.open(row, alertMsg); this.$refs.apiDeleteConfirm.open(row, alertMsg);
} else { } else {
@ -1162,6 +1165,7 @@ export default {
}); });
} }
}); });
});
} }
}, },
_handleDelete(api, deleteCurrentVersion) { _handleDelete(api, deleteCurrentVersion) {

View File

@ -430,6 +430,7 @@ export default {
environmentId: undefined, environmentId: undefined,
selectDataCounts: 0, selectDataCounts: 0,
projectName: "", projectName: "",
versionEnable: false,
}; };
}, },
props: { props: {
@ -814,7 +815,9 @@ export default {
}); });
return; return;
} }
if (hasLicense()) { // api
this.$get('/api/definition/versions/' + api.id, response => {
if (hasLicense() && this.versionEnable && response.data.length > 1) {
// //
this.$refs.apiDeleteConfirm.open(api, this.$t('api_test.definition.request.delete_confirm')); this.$refs.apiDeleteConfirm.open(api, this.$t('api_test.definition.request.delete_confirm'));
} else { } else {
@ -827,6 +830,7 @@ export default {
} }
}); });
} }
});
}, },
_handleDelete(api, deleteCurrentVersion) { _handleDelete(api, deleteCurrentVersion) {
// //
@ -927,6 +931,7 @@ export default {
} }
if (hasLicense()) { if (hasLicense()) {
this.$get('/project/version/enable/' + this.projectId, response => { this.$get('/project/version/enable/' + this.projectId, response => {
this.versionEnable = response.data;
if (!response.data) { if (!response.data) {
this.fields = this.fields.filter(f => f.id !== 'versionId'); this.fields = this.fields.filter(f => f.id !== 'versionId');
} }

View File

@ -256,7 +256,8 @@ export default {
}); });
}, },
handleDelete(test) { handleDelete(test) {
if (hasLicense()) { this.$get('/performance/versions/' + test.id, response => {
if (hasLicense() && this.versionEnable && response.data.length > 1) {
// //
this.$refs.apiDeleteConfirm.open(test, this.$t('load_test.delete_confirm')); this.$refs.apiDeleteConfirm.open(test, this.$t('load_test.delete_confirm'));
} else { } else {
@ -269,6 +270,7 @@ export default {
} }
}); });
} }
});
}, },
_handleDelete(test, deleteCurrentVersion) { _handleDelete(test, deleteCurrentVersion) {
if (deleteCurrentVersion) { if (deleteCurrentVersion) {

View File

@ -897,7 +897,8 @@ export default {
}); });
}, },
handleDeleteToGc(testCase) { handleDeleteToGc(testCase) {
if (hasLicense()) { this.$get('/test/case/versions/' + testCase.id, response => {
if (hasLicense() && this.versionEnable && response.data.length > 1) {
// //
this.$refs.apiDeleteConfirm.open(testCase, this.$t('test_track.case.delete_confirm')); this.$refs.apiDeleteConfirm.open(testCase, this.$t('test_track.case.delete_confirm'));
} else { } else {
@ -910,6 +911,7 @@ export default {
} }
}); });
} }
});
}, },
batchReduction() { batchReduction() {
let param = buildBatchParam(this, this.$refs.table.selectIds); let param = buildBatchParam(this, this.$refs.table.selectIds);