refactor: 优化列表删除时的提示
This commit is contained in:
parent
f92c67fe84
commit
6f4d99323f
|
@ -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,20 +1149,22 @@ 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);
|
// 删除提供列表删除和全部版本删除
|
||||||
} else {
|
this.$refs.apiDeleteConfirm.open(row, alertMsg);
|
||||||
this.$alert(alertMsg, '', {
|
} else {
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
this.$alert(alertMsg, '', {
|
||||||
cancelButtonText: this.$t('commons.cancel'),
|
confirmButtonText: this.$t('commons.confirm'),
|
||||||
callback: (action) => {
|
cancelButtonText: this.$t('commons.cancel'),
|
||||||
if (action === 'confirm') {
|
callback: (action) => {
|
||||||
this._handleDelete(row, false);
|
if (action === 'confirm') {
|
||||||
|
this._handleDelete(row, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -430,6 +430,7 @@ export default {
|
||||||
environmentId: undefined,
|
environmentId: undefined,
|
||||||
selectDataCounts: 0,
|
selectDataCounts: 0,
|
||||||
projectName: "",
|
projectName: "",
|
||||||
|
versionEnable: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@ -814,19 +815,22 @@ export default {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (hasLicense()) {
|
// 检查api有几个版本
|
||||||
// 删除提供列表删除和全部版本删除
|
this.$get('/api/definition/versions/' + api.id, response => {
|
||||||
this.$refs.apiDeleteConfirm.open(api, this.$t('api_test.definition.request.delete_confirm'));
|
if (hasLicense() && this.versionEnable && response.data.length > 1) {
|
||||||
} else {
|
// 删除提供列表删除和全部版本删除
|
||||||
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + api.name + " ?", '', {
|
this.$refs.apiDeleteConfirm.open(api, this.$t('api_test.definition.request.delete_confirm'));
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
} else {
|
||||||
callback: (action) => {
|
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + api.name + " ?", '', {
|
||||||
if (action === 'confirm') {
|
confirmButtonText: this.$t('commons.confirm'),
|
||||||
this._handleDelete(api, false);
|
callback: (action) => {
|
||||||
|
if (action === 'confirm') {
|
||||||
|
this._handleDelete(api, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
},
|
},
|
||||||
_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');
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,19 +256,21 @@ 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'));
|
// 删除提供列表删除和全部版本删除
|
||||||
} else {
|
this.$refs.apiDeleteConfirm.open(test, this.$t('load_test.delete_confirm'));
|
||||||
this.$alert(this.$t('load_test.delete_confirm') + test.name + "?", '', {
|
} else {
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
this.$alert(this.$t('load_test.delete_confirm') + test.name + "?", '', {
|
||||||
callback: (action) => {
|
confirmButtonText: this.$t('commons.confirm'),
|
||||||
if (action === 'confirm') {
|
callback: (action) => {
|
||||||
this._handleDelete(test, false);
|
if (action === 'confirm') {
|
||||||
|
this._handleDelete(test, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
},
|
},
|
||||||
_handleDelete(test, deleteCurrentVersion) {
|
_handleDelete(test, deleteCurrentVersion) {
|
||||||
if (deleteCurrentVersion) {
|
if (deleteCurrentVersion) {
|
||||||
|
|
|
@ -897,19 +897,21 @@ 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'));
|
// 删除提供列表删除和全部版本删除
|
||||||
} else {
|
this.$refs.apiDeleteConfirm.open(testCase, this.$t('test_track.case.delete_confirm'));
|
||||||
this.$alert(this.$t('test_track.case.delete_confirm') + '\'' + testCase.name + '\'' + "?", '', {
|
} else {
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
this.$alert(this.$t('test_track.case.delete_confirm') + '\'' + testCase.name + '\'' + "?", '', {
|
||||||
callback: (action) => {
|
confirmButtonText: this.$t('commons.confirm'),
|
||||||
if (action === 'confirm') {
|
callback: (action) => {
|
||||||
this._handleDeleteVersion(testCase, false);
|
if (action === 'confirm') {
|
||||||
|
this._handleDeleteVersion(testCase, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
},
|
},
|
||||||
batchReduction() {
|
batchReduction() {
|
||||||
let param = buildBatchParam(this, this.$refs.table.selectIds);
|
let param = buildBatchParam(this, this.$refs.table.selectIds);
|
||||||
|
|
Loading…
Reference in New Issue