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

View File

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

View File

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