Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Captain.B 2020-02-19 11:05:08 +08:00
commit 14a6b787e0
3 changed files with 43 additions and 59 deletions

View File

@ -101,14 +101,10 @@
name: this.condition name: this.condition
}; };
this.$post(this.buildPagePath(this.queryPath), param).then(response => { this.$post(this.buildPagePath(this.queryPath), param, response => {
if (response.data.success) { let data = response.data;
let data = response.data.data; this.total = data.itemCount;
this.total = data.itemCount; this.tableData = data.listObject;
this.tableData = data.listObject;
} else {
this.$message.error(response.message);
}
}) })
}, },
search() { search() {
@ -151,16 +147,12 @@
id: testPlan.id id: testPlan.id
}; };
this.$post(this.deletePath, data).then(response => { this.$post(this.deletePath, data, () => {
if (response.data.success) { this.$message({
this.$message({ message: '删除成功!',
message: '删除成功!', type: 'success'
type: 'success' });
}); this.initTableData();
this.initTableData();
} else {
this.$message.error(response.message);
}
}); });
}, },
} }

View File

@ -77,8 +77,8 @@
}, },
methods: { methods: {
listProjects() { listProjects() {
this.$get(this.listProjectPath).then(response => { this.$get(this.listProjectPath, response => {
this.projects = response.data.data; this.projects = response.data;
}) })
}, },
save() { save() {
@ -88,13 +88,11 @@
let options = this.getSaveOption(); let options = this.getSaveOption();
this.$request(options).then(response => { this.$request(options, () => {
if (response) { this.$message({
this.$message({ message: '保存成功!',
message: '保存成功!', type: 'success'
type: 'success' });
});
}
}); });
}, },
saveAndRun() { saveAndRun() {
@ -104,20 +102,18 @@
let options = this.getSaveOption(); let options = this.getSaveOption();
this.$request(options).then(response => { this.$request(options, () => {
if (response) { this.$message({
message: '保存成功!',
type: 'success'
});
this.$post(this.runPath, {id: this.testPlan.id}).then(() => {
this.$message({ this.$message({
message: '保存成功!', message: '正在运行',
type: 'success' type: 'success'
}); });
})
this.$post(this.runPath, {id: this.testPlan.id}).then(() => {
this.$message({
message: '正在运行!',
type: 'success'
});
})
}
}); });
}, },
getSaveOption() { getSaveOption() {
@ -135,7 +131,7 @@
type: "application/json" type: "application/json"
})); }));
return { return {
method: 'POST', method: 'POST',
url: url, url: url,
data: formData, data: formData,

View File

@ -72,8 +72,8 @@
}, },
methods: { methods: {
getFileMetadata(testPlan) { getFileMetadata(testPlan) {
this.$get(this.getFileMetadataPath + "/" + testPlan.id).then(response => { this.$get(this.getFileMetadataPath + "/" + testPlan.id, response => {
let file = response.data.data; let file = response.data;
this.testPlan.file = file; this.testPlan.file = file;
@ -115,25 +115,21 @@
name: file.name name: file.name
}; };
this.$post(this.jmxDownloadPath, data).then(response => { this.$post(this.jmxDownloadPath, data, response => {
if (response) { const content = response.data;
const content = response.data; const blob = new Blob([content]);
const blob = new Blob([content]); if ("download" in document.createElement("a")) {
if ("download" in document.createElement("a")) { // IE
// IE // chrome/firefox
// chrome/firefox let aTag = document.createElement('a');
let aTag = document.createElement('a'); aTag.download = file.name;
aTag.download = file.name; aTag.href = URL.createObjectURL(blob)
aTag.href = URL.createObjectURL(blob) aTag.click();
aTag.click(); URL.revokeObjectURL(aTag.href)
URL.revokeObjectURL(aTag.href) } else {
} else { // IE10+
// IE10+ navigator.msSaveBlob(blob, this.filename)
navigator.msSaveBlob(blob, this.filename)
}
} }
}).catch((response) => {
this.$message.error(response.message);
}); });
}, },
handleDelete(file, index) { handleDelete(file, index) {