性能测试点击一行只读

This commit is contained in:
chenjianxing 2020-06-05 11:20:40 +08:00
parent 8af9a73d9a
commit b4e5dbc382
3 changed files with 32 additions and 10 deletions

View File

@ -165,6 +165,18 @@ const router = new VueRouter({
}
}
},
{
path: "test/view/:testId",
name: "viewPerTest",
component: EditPerformanceTestPlan,
props: {
content: (route) => {
return {
...route.params
}
}
}
},
{
path: "test/:projectId",
name: "perPlan",

View File

@ -4,11 +4,11 @@
<el-card v-loading="result.loading">
<el-row>
<el-col :span="10">
<el-input :placeholder="$t('load_test.input_name')" v-model="testPlan.name" class="input-with-select"
<el-input :disabled="isReadOnly" :placeholder="$t('load_test.input_name')" v-model="testPlan.name" class="input-with-select"
maxlength="30"
>
<template v-slot:prepend>
<el-select v-model="testPlan.projectId" :placeholder="$t('load_test.select_project')">
<el-select :disabled="isReadOnly" v-model="testPlan.projectId" :placeholder="$t('load_test.select_project')">
<el-option
v-for="item in projects"
:key="item.id"
@ -20,22 +20,22 @@
</el-input>
</el-col>
<el-col :span="12" :offset="2">
<el-button type="primary" plain @click="save">{{$t('commons.save')}}</el-button>
<el-button type="primary" plain @click="saveAndRun">{{$t('load_test.save_and_run')}}</el-button>
<el-button type="warning" plain @click="cancel">{{$t('commons.cancel')}}</el-button>
<el-button :disabled="isReadOnly" type="primary" plain @click="save">{{$t('commons.save')}}</el-button>
<el-button :disabled="isReadOnly" type="primary" plain @click="saveAndRun">{{$t('load_test.save_and_run')}}</el-button>
<el-button :disabled="isReadOnly" type="warning" plain @click="cancel">{{$t('commons.cancel')}}</el-button>
</el-col>
</el-row>
<el-tabs class="testplan-config" v-model="active" type="border-card" :stretch="true">
<el-tab-pane :label="$t('load_test.basic_config')">
<performance-basic-config :test-plan="testPlan" ref="basicConfig"/>
<performance-basic-config :is-read-only="isReadOnly" :test-plan="testPlan" ref="basicConfig"/>
</el-tab-pane>
<el-tab-pane :label="$t('load_test.pressure_config')">
<performance-pressure-config :test-plan="testPlan" :test-id="testId" ref="pressureConfig" @changeActive="changeTabActive"/>
<performance-pressure-config :is-read-only="isReadOnly" :test-plan="testPlan" :test-id="testId" ref="pressureConfig" @changeActive="changeTabActive"/>
</el-tab-pane>
<el-tab-pane :label="$t('load_test.advanced_config')" class="advanced-config">
<performance-advanced-config :test-id="testId" ref="advancedConfig"/>
<performance-advanced-config :read-only="isReadOnly" :test-id="testId" ref="advancedConfig"/>
</el-tab-pane>
</el-tabs>
</el-card>
@ -70,6 +70,7 @@
projects: [],
active: '0',
testId: '',
isReadOnly: false,
tabs: [{
title: this.$t('load_test.basic_config'),
id: '0',
@ -93,10 +94,15 @@
return;
}
if (to.name !== 'editPerTest') {
if (to.name !== 'editPerTest' && to.name !== 'viewPerTest') {
return;
}
this.isReadOnly = false;
if (to.name === 'viewPerTest') {
this.isReadOnly = true;
}
let testId = to.params.testId;
if (testId) {
this.testId = testId;
@ -111,6 +117,10 @@
},
created() {
let testId = this.$route.params.testId;
this.isReadOnly = false;
if (this.$route.name === 'viewPerTest') {
this.isReadOnly = true;
}
if (testId) {
this.testId = testId;
this.result = this.$get('/performance/get/' + testId, response => {

View File

@ -208,7 +208,7 @@
},
link(row) {
this.$router.push({
path: '/performance/test/edit/' + row.id,
path: '/performance/test/view/' + row.id,
})
}
}