添加loading

This commit is contained in:
haifeng414 2020-02-19 12:54:28 +08:00
parent 22d729c169
commit 9c6d4fa7cd
3 changed files with 15 additions and 14 deletions

View File

@ -1,5 +1,5 @@
<template>
<div class="testplan-container" v-loading="loading">
<div class="testplan-container" v-loading="result.loading">
<div class="main-content">
<el-card>
<div slot="header">
@ -82,6 +82,7 @@
export default {
data() {
return {
result: {},
queryPath: "/testplan/list",
deletePath: "/testplan/delete",
condition: "",
@ -98,16 +99,14 @@
},
methods: {
initTableData() {
this.loading = true;
let param = {
name: this.condition
};
this.$post(this.buildPagePath(this.queryPath), param, response => {
this.result = this.$post(this.buildPagePath(this.queryPath), param, response => {
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;
this.loading = false;
})
},
search() {
@ -150,7 +149,7 @@
id: testPlan.id
};
this.$post(this.deletePath, data, () => {
this.result = this.$post(this.deletePath, data, () => {
this.$message({
message: '删除成功!',
type: 'success'

View File

@ -1,5 +1,5 @@
<template>
<div class="edit-testplan-container">
<div class="edit-testplan-container" v-loading="result.loading">
<el-row>
<el-col :span="10">
<el-input placeholder="请输入名称" v-model="testPlan.name" class="input-with-select">
@ -47,6 +47,7 @@
props: ['testPlanObj'],
data() {
return {
result: {},
testPlan: {},
listProjectPath: "/project/listAll",
savePath: "/testplan/save",
@ -77,7 +78,7 @@
},
methods: {
listProjects() {
this.$get(this.listProjectPath, response => {
this.result = this.$get(this.listProjectPath, response => {
this.projects = response.data;
})
},
@ -88,7 +89,7 @@
let options = this.getSaveOption();
this.$request(options, () => {
this.result = this.$request(options, () => {
this.$message({
message: '保存成功!',
type: 'success'
@ -102,13 +103,13 @@
let options = this.getSaveOption();
this.$request(options, () => {
this.result = this.$request(options, () => {
this.$message({
message: '保存成功!',
type: 'success'
});
this.$post(this.runPath, {id: this.testPlan.id}).then(() => {
this.result = this.$post(this.runPath, {id: this.testPlan.id}).then(() => {
this.$message({
message: '正在运行!',
type: 'success'

View File

@ -1,5 +1,5 @@
<template>
<div>
<div v-loading="result.loading">
<el-upload
accept=".jmx"
drag
@ -53,13 +53,14 @@
</template>
<script>
import {Message} from "element-ui";
import Message from "element-ui";
export default {
name: "TestPlanBasicConfig",
props: ["testPlan"],
data() {
return {
result: {},
getFileMetadataPath: "/testplan/file/metadata",
jmxDownloadPath: '/testplan/file/download',
jmxDeletePath: '/testplan/file/delete',
@ -74,7 +75,7 @@
},
methods: {
getFileMetadata(testPlan) {
this.$get(this.getFileMetadataPath + "/" + testPlan.id, response => {
this.result = this.$get(this.getFileMetadataPath + "/" + testPlan.id, response => {
let file = response.data;
if (!file) {
@ -122,7 +123,7 @@
name: file.name
};
this.$post(this.jmxDownloadPath, data, response => {
this.result = this.$post(this.jmxDownloadPath, data, response => {
const content = response.data;
const blob = new Blob([content]);
if ("download" in document.createElement("a")) {