refactor(性能测试): 新建和编辑性能测试上传文件逻辑修改
This commit is contained in:
parent
1b5288756a
commit
b6ec991ce7
|
@ -148,5 +148,6 @@
|
||||||
<if test="request.name!=null">
|
<if test="request.name!=null">
|
||||||
AND file_metadata.name LIKE CONCAT('%', #{request.name}, '%')
|
AND file_metadata.name LIKE CONCAT('%', #{request.name}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
order by update_time DESC
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -221,15 +221,6 @@ export default {
|
||||||
f().then(res => {
|
f().then(res => {
|
||||||
let response = res.data;
|
let response = res.data;
|
||||||
if (response.data.length === 0) {
|
if (response.data.length === 0) {
|
||||||
let type = file.name.substring(file.name.lastIndexOf(".") + 1);
|
|
||||||
|
|
||||||
this.tableData.push({
|
|
||||||
name: file.name,
|
|
||||||
size: (file.size / 1024).toFixed(2) + ' KB',
|
|
||||||
type: type.toUpperCase(),
|
|
||||||
updateTime: file.lastModified,
|
|
||||||
});
|
|
||||||
|
|
||||||
callback();
|
callback();
|
||||||
} else {
|
} else {
|
||||||
this.$error(this.$t('load_test.project_file_exist') + ', name: ' + file.name);
|
this.$error(this.$t('load_test.project_file_exist') + ', name: ' + file.name);
|
||||||
|
@ -241,21 +232,21 @@ export default {
|
||||||
|
|
||||||
let file = uploadResources.file;
|
let file = uploadResources.file;
|
||||||
this.checkFileExist(file, () => {
|
this.checkFileExist(file, () => {
|
||||||
self.uploadList.push(file);
|
let formData = new FormData();
|
||||||
let type = file.name.substring(file.name.lastIndexOf(".") + 1);
|
let url = '/project/upload/files/' + getCurrentProjectID()
|
||||||
if (type.toLowerCase() !== 'jmx') {
|
formData.append("file", file);
|
||||||
return;
|
let options = {
|
||||||
|
method: 'POST',
|
||||||
|
url: url,
|
||||||
|
data: formData,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': undefined
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let jmxReader = new FileReader();
|
self.$request(options, (response) => {
|
||||||
jmxReader.onload = (event) => {
|
self.$success(this.$t('commons.save_success'));
|
||||||
let threadGroups = findThreadGroup(event.target.result, file.name);
|
self.getProjectFiles();
|
||||||
threadGroups.forEach(tg => {
|
});
|
||||||
tg.options = {};
|
|
||||||
self.scenarios.push(tg);
|
|
||||||
});
|
|
||||||
self.$emit('fileChange', self.scenarios);
|
|
||||||
};
|
|
||||||
jmxReader.readAsText(file);
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleExceed() {
|
handleExceed() {
|
||||||
|
|
Loading…
Reference in New Issue