测试跟踪只读

This commit is contained in:
chenjianxing 2020-05-27 16:07:46 +08:00
parent 660035b1a8
commit 06aecf4425
10 changed files with 94 additions and 44 deletions

View File

@ -1,12 +1,20 @@
<template>
<el-button v-permission="['test_manager', 'test_user']" @click="exec()" plain :type="type" :icon="icon" :size="size">
<el-button :disabled="disabled" @click="exec()" plain :type="type" :icon="icon" :size="size">
{{content}}
</el-button>
</template>
<script>
import {hasRoles} from "../../../../common/js/utils";
import {ROLE_TEST_MANAGER, ROLE_TEST_USER} from "../../../../common/js/constants";
export default {
name: "MsTableButton",
data() {
return {
disabled: false
}
},
props: {
content: String,
icon: {
@ -25,11 +33,16 @@
type: String,
default: 'mini'
},
disabled: {
isTesterPermission: {
type: Boolean,
default: false
}
},
mounted() {
if (this.isTesterPermission &&!hasRoles(ROLE_TEST_USER, ROLE_TEST_MANAGER)) {
this.disabled = true;
}
},
methods: {
exec() {
this.$emit('click');

View File

@ -8,7 +8,7 @@
</el-row>
<el-row type="flex" justify="space-between" align="middle">
<span class="operate-button">
<ms-table-button v-if="showCreate" icon="el-icon-circle-plus-outline" :content="createTip" @click="create"/>
<ms-table-button :is-tester-permission="isTesterPermission" v-if="showCreate" icon="el-icon-circle-plus-outline" :content="createTip" @click="create"/>
<slot name="button"></slot>
</span>
<span>
@ -45,6 +45,10 @@
default() {
return this.$t('commons.create');
}
},
isTesterPermission: {
type: Boolean,
default: false
}
},
methods: {

View File

@ -1,9 +1,9 @@
<template>
<span>
<slot name="front"></slot>
<ms-table-operator-button :tip="tip1" icon="el-icon-edit" @exec="editClick" @click.stop="editClickStop"/>
<ms-table-operator-button :isTesterPermission="isTesterPermission" :tip="tip1" icon="el-icon-edit" @exec="editClick" @click.stop="editClickStop"/>
<slot name="middle"></slot>
<ms-table-operator-button :tip="tip2" icon="el-icon-delete" type="danger" @exec="deleteClick" @click.stop="deleteClickStop"/>
<ms-table-operator-button :isTesterPermission="isTesterPermission" :tip="tip2" icon="el-icon-delete" type="danger" @exec="deleteClick" @click.stop="deleteClickStop"/>
<slot name="behind"></slot>
</span>
@ -26,6 +26,10 @@
default() {
return this.$t('commons.delete');
}
},
isTesterPermission: {
type: Boolean,
default: false
}
},
methods: {

View File

@ -1,5 +1,6 @@
<template>
<ms-tip-button v-permission="['test_manager', 'test_user']"
<ms-tip-button
:disabled="disabled"
@click="exec"
@clickStop="clickStop"
:type="type"
@ -10,9 +11,16 @@
<script>
import MsTableButton from "./MsTableButton";
import MsTipButton from "./MsTipButton";
import {hasRoles} from "../../../../common/js/utils";
import {ROLE_TEST_MANAGER, ROLE_TEST_USER} from "../../../../common/js/constants";
export default {
name: "MsTableOperatorButton",
components: {MsTipButton, MsTableButton},
data() {
return{
disabled: false
}
},
props: {
icon: {
type: String,
@ -24,6 +32,15 @@
},
tip: {
type: String
},
isTesterPermission: {
type: Boolean,
default: false
}
},
mounted() {
if (this.isTesterPermission && !hasRoles(ROLE_TEST_USER, ROLE_TEST_MANAGER)) {
this.disabled = true;
}
},
methods: {

View File

@ -1,13 +1,13 @@
<template>
<el-tooltip :disabled="disabled"
:content="tip"
<el-tooltip :content="tip"
placement="bottom"
:effect="effect">
<el-button @click="exec()"
@click.stop="clickStop"
@keydown.enter.native.prevent
circle
:disabled="disabled"
:type="type"
:icon="icon"
:size="size"/>

View File

@ -3,7 +3,7 @@
<ms-main-container>
<el-card class="table-card" v-loading="result.loading">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="search" @create="create"
<ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="search" @create="create"
:create-tip="btnTips" :title="title"/>
</template>
<el-table :data="items" style="width: 100%">
@ -24,9 +24,9 @@
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column>
<el-table-column :label="$t('commons.operating')">
<template v-slot:default="scope">
<ms-table-operator @editClick="edit(scope.row)" @deleteClick="del(scope.row)"/>
<ms-table-operator :is-tester-permission="true" @editClick="edit(scope.row)" @deleteClick="del(scope.row)"/>
</template>
</el-table-column>
</el-table>

View File

@ -4,15 +4,15 @@
<el-card class="card-content" v-loading="result.loading">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="initTableData"
<ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="initTableData"
:create-tip="$t('test_track.case.create')" @create="testCaseCreate">
<template v-slot:title>
<node-breadcrumb class="table-title" :nodes="selectParentNodes" @refresh="refresh"/>
</template>
<template v-slot:button>
<ms-table-button icon="el-icon-upload2" :content="$t('test_track.case.import.import')" @click="importTestCase"/>
<ms-table-button icon="el-icon-right" :content="$t('test_track.case.move')" @click="handleBatch('move')"/>
<ms-table-button icon="el-icon-delete" :content="$t('test_track.case.delete')" @click="handleBatch('delete')"/>
<ms-table-button :is-tester-permission="true" icon="el-icon-upload2" :content="$t('test_track.case.import.import')" @click="importTestCase"/>
<ms-table-button :is-tester-permission="true" icon="el-icon-right" :content="$t('test_track.case.move')" @click="handleBatch('move')"/>
<ms-table-button :is-tester-permission="true" icon="el-icon-delete" :content="$t('test_track.case.delete')" @click="handleBatch('delete')"/>
<!--<test-case-export/>-->
</template>
</ms-table-header>
@ -85,9 +85,9 @@
<el-table-column
:label="$t('commons.operating')">
<template v-slot:default="scope">
<ms-table-operator @editClick="handleEdit(scope.row)" @deleteClick="handleDelete(scope.row)">
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)" @deleteClick="handleDelete(scope.row)">
<template v-slot:middle>
<ms-table-operator-button :tip="$t('commons.copy')" icon="el-icon-document-copy"
<ms-table-operator-button :is-tester-permission="true" :tip="$t('commons.copy')" icon="el-icon-document-copy"
type="success" @exec="handleCopy(scope.row)"/>
</template>
</ms-table-operator>

View File

@ -2,7 +2,7 @@
<div v-loading="result.loading">
<el-input :placeholder="$t('test_track.module.search')" v-model="filterText" size="small">
<template v-if="type == 'edit'" v-slot:append>
<el-button v-permission="['test_manager', 'test_user']" icon="el-icon-folder-add" @click="openEditNodeDialog('add')"></el-button>
<el-button :disabled="disabled" icon="el-icon-folder-add" @click="openEditNodeDialog('add')"></el-button>
</template>
</el-input>
@ -55,6 +55,8 @@
<script>
import NodeEdit from "./NodeEdit";
import {ROLE_TEST_MANAGER, ROLE_TEST_USER} from "../../../../common/js/constants";
import {hasRoles} from "../../../../common/js/utils";
export default {
name: "NodeTree",
@ -66,7 +68,8 @@ export default {
defaultProps: {
children: "children",
label: "label"
}
},
disabled: false
};
},
props: {
@ -93,6 +96,11 @@ export default {
this.$refs.tree.filter(val);
}
},
mounted() {
if (!hasRoles(ROLE_TEST_USER, ROLE_TEST_MANAGER)) {
this.disabled = true;
}
},
methods: {
handleDragEnd(draggingNode, dropNode, dropType, ev) {
let param = {};

View File

@ -1,8 +1,10 @@
<template>
<el-card class="table-card" v-loading="result.loading">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="initTableData" @create="testPlanCreate"
:create-tip="$t('test_track.plan.create_plan')" :title="$t('test_track.plan.test_plan')"/>
<ms-table-header :is-tester-permission="true" :condition.sync="condition"
@search="initTableData" @create="testPlanCreate"
:create-tip="$t('test_track.plan.create_plan')"
:title="$t('test_track.plan.test_plan')"/>
</template>
<el-table
@ -56,7 +58,7 @@
<el-table-column
:label="$t('commons.operating')">
<template v-slot:default="scope">
<ms-table-operator @editClick="handleEdit(scope.row)" @deleteClick="handleDelete(scope.row)"/>
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)" @deleteClick="handleDelete(scope.row)"/>
</template>
</el-table-column>
</el-table>

View File

@ -2,19 +2,19 @@
<div class="card-container">
<el-card class="card-content" v-loading="result.loading">
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="initTableData" :show-create="false">
<ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="initTableData" :show-create="false">
<template v-slot:title>
<node-breadcrumb class="table-title" :nodes="selectParentNodes" @refresh="refresh"/>
</template>
<template v-slot:button>
<ms-table-button v-if="!showMyTestCase" icon="el-icon-s-custom" :content="$t('test_track.plan_view.my_case')" @click="searchMyTestCase"/>
<ms-table-button v-if="showMyTestCase" icon="el-icon-files" :content="$t('test_track.plan_view.all_case')" @click="searchMyTestCase"/>
<ms-table-button icon="el-icon-connection" :content="$t('test_track.plan_view.relevance_test_case')" @click="$emit('openTestCaseRelevanceDialog')"/>
<ms-table-button icon="el-icon-unlock" :content="$t('test_track.plan_view.cancel_relevance')" @click="handleBatch('delete')"/>
<ms-table-button icon="el-icon-edit-outline" :content="$t('test_track.plan_view.change_execution_results')" @click="handleBatch('status')"/>
<ms-table-button icon="el-icon-user" :content="$t('test_track.plan_view.change_executor')" @click="handleBatch('executor')"/>
<ms-table-button v-if="!testPlan.reportId" icon="el-icon-document" :content="$t('test_track.plan_view.create_report')" @click="openTestReport"/>
<ms-table-button v-if="testPlan.reportId" icon="el-icon-document" :content="$t('test_track.plan_view.view_report')" @click="openReport"/>
<ms-table-button :is-tester-permission="true" v-if="!showMyTestCase" icon="el-icon-s-custom" :content="$t('test_track.plan_view.my_case')" @click="searchMyTestCase"/>
<ms-table-button :is-tester-permission="true" v-if="showMyTestCase" icon="el-icon-files" :content="$t('test_track.plan_view.all_case')" @click="searchMyTestCase"/>
<ms-table-button :is-tester-permission="true" icon="el-icon-connection" :content="$t('test_track.plan_view.relevance_test_case')" @click="$emit('openTestCaseRelevanceDialog')"/>
<ms-table-button :is-tester-permission="true" icon="el-icon-unlock" :content="$t('test_track.plan_view.cancel_relevance')" @click="handleBatch('delete')"/>
<ms-table-button :is-tester-permission="true" icon="el-icon-edit-outline" :content="$t('test_track.plan_view.change_execution_results')" @click="handleBatch('status')"/>
<ms-table-button :is-tester-permission="true" icon="el-icon-user" :content="$t('test_track.plan_view.change_executor')" @click="handleBatch('executor')"/>
<ms-table-button :is-tester-permission="true" v-if="!testPlan.reportId" icon="el-icon-document" :content="$t('test_track.plan_view.create_report')" @click="openTestReport"/>
<ms-table-button :is-tester-permission="true" v-if="testPlan.reportId" icon="el-icon-document" :content="$t('test_track.plan_view.view_report')" @click="openReport"/>
</template>
</ms-table-header>
</template>
@ -103,8 +103,8 @@
<el-table-column
:label="$t('commons.operating')">
<template v-slot:default="scope">
<ms-table-operator-button :tip="$t('commons.edit')" icon="el-icon-edit" @exec="handleEdit(scope.row)" />
<ms-table-operator-button :tip="$t('test_track.plan_view.cancel_relevance')" icon="el-icon-unlock" type="danger" @exec="handleDelete(scope.row)"/>
<ms-table-operator-button :is-tester-permission="true" :tip="$t('commons.edit')" icon="el-icon-edit" @exec="handleEdit(scope.row)" />
<ms-table-operator-button :is-tester-permission="true" :tip="$t('test_track.plan_view.cancel_relevance')" icon="el-icon-unlock" type="danger" @exec="handleDelete(scope.row)"/>
</template>
</el-table-column>
</el-table>
@ -135,8 +135,8 @@
import MsTableButton from '../../../../common/components/MsTableButton';
import NodeBreadcrumb from '../../../common/NodeBreadcrumb';
import {TokenKey} from '../../../../../../common/js/constants';
import {_filter, _sort, humpToLine, tableFilter} from '../../../../../../common/js/utils';
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, TokenKey} from '../../../../../../common/js/constants';
import {_filter, _sort, hasRoles, humpToLine, tableFilter} from '../../../../../../common/js/utils';
import PriorityTableItem from "../../../common/tableItems/planview/PriorityTableItem";
import StatusTableItem from "../../../common/tableItems/planview/StatusTableItem";
import TypeTableItem from "../../../common/tableItems/planview/TypeTableItem";
@ -239,10 +239,12 @@
this.initTableData();
},
refreshTestPlanRecent() {
if (hasRoles(ROLE_TEST_USER, ROLE_TEST_MANAGER)) {
let param = {};
param.id = this.planId;
param.updateTime = Date.now();
this.$post('/test/plan/edit', param);
}
},
search() {
this.initTableData();