refactor: 优化列表删除时的提示
This commit is contained in:
parent
00d33daaee
commit
de7efd1ee0
|
@ -563,6 +563,7 @@ export default {
|
|||
envGroupId: "",
|
||||
apiscenariofilters: {},
|
||||
runRequest: {},
|
||||
versionEnable: false,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
@ -843,6 +844,7 @@ export default {
|
|||
}
|
||||
if (hasLicense()) {
|
||||
this.$get('/project/version/enable/' + projectId, response => {
|
||||
this.versionEnable = response.data;
|
||||
if (!response.data) {
|
||||
this.fields = this.fields.filter(f => f.id !== 'versionId');
|
||||
}
|
||||
|
@ -1147,20 +1149,22 @@ export default {
|
|||
}
|
||||
}
|
||||
//
|
||||
if (hasLicense()) {
|
||||
// 删除提供列表删除和全部版本删除
|
||||
this.$refs.apiDeleteConfirm.open(row, alertMsg);
|
||||
} else {
|
||||
this.$alert(alertMsg, '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
cancelButtonText: this.$t('commons.cancel'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this._handleDelete(row, false);
|
||||
this.$get('/api/automation/versions/' + row.id, response => {
|
||||
if (hasLicense() && this.versionEnable && response.data.length > 1) {
|
||||
// 删除提供列表删除和全部版本删除
|
||||
this.$refs.apiDeleteConfirm.open(row, alertMsg);
|
||||
} else {
|
||||
this.$alert(alertMsg, '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
cancelButtonText: this.$t('commons.cancel'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this._handleDelete(row, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
@ -430,6 +430,7 @@ export default {
|
|||
environmentId: undefined,
|
||||
selectDataCounts: 0,
|
||||
projectName: "",
|
||||
versionEnable: false,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
|
@ -814,19 +815,22 @@ export default {
|
|||
});
|
||||
return;
|
||||
}
|
||||
if (hasLicense()) {
|
||||
// 删除提供列表删除和全部版本删除
|
||||
this.$refs.apiDeleteConfirm.open(api, this.$t('api_test.definition.request.delete_confirm'));
|
||||
} else {
|
||||
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + api.name + " ?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this._handleDelete(api, false);
|
||||
// 检查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'));
|
||||
} else {
|
||||
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + api.name + " ?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this._handleDelete(api, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
_handleDelete(api, deleteCurrentVersion) {
|
||||
// 删除指定版本
|
||||
|
@ -927,6 +931,7 @@ export default {
|
|||
}
|
||||
if (hasLicense()) {
|
||||
this.$get('/project/version/enable/' + this.projectId, response => {
|
||||
this.versionEnable = response.data;
|
||||
if (!response.data) {
|
||||
this.fields = this.fields.filter(f => f.id !== 'versionId');
|
||||
}
|
||||
|
|
|
@ -256,19 +256,21 @@ export default {
|
|||
});
|
||||
},
|
||||
handleDelete(test) {
|
||||
if (hasLicense()) {
|
||||
// 删除提供列表删除和全部版本删除
|
||||
this.$refs.apiDeleteConfirm.open(test, this.$t('load_test.delete_confirm'));
|
||||
} else {
|
||||
this.$alert(this.$t('load_test.delete_confirm') + test.name + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this._handleDelete(test, false);
|
||||
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'));
|
||||
} else {
|
||||
this.$alert(this.$t('load_test.delete_confirm') + test.name + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this._handleDelete(test, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
_handleDelete(test, deleteCurrentVersion) {
|
||||
if (deleteCurrentVersion) {
|
||||
|
|
|
@ -897,19 +897,21 @@ export default {
|
|||
});
|
||||
},
|
||||
handleDeleteToGc(testCase) {
|
||||
if (hasLicense()) {
|
||||
// 删除提供列表删除和全部版本删除
|
||||
this.$refs.apiDeleteConfirm.open(testCase, this.$t('test_track.case.delete_confirm'));
|
||||
} else {
|
||||
this.$alert(this.$t('test_track.case.delete_confirm') + '\'' + testCase.name + '\'' + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this._handleDeleteVersion(testCase, false);
|
||||
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'));
|
||||
} else {
|
||||
this.$alert(this.$t('test_track.case.delete_confirm') + '\'' + testCase.name + '\'' + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this._handleDeleteVersion(testCase, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
batchReduction() {
|
||||
let param = buildBatchParam(this, this.$refs.table.selectIds);
|
||||
|
|
Loading…
Reference in New Issue