测试跟踪只读

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> <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}} {{content}}
</el-button> </el-button>
</template> </template>
<script> <script>
import {hasRoles} from "../../../../common/js/utils";
import {ROLE_TEST_MANAGER, ROLE_TEST_USER} from "../../../../common/js/constants";
export default { export default {
name: "MsTableButton", name: "MsTableButton",
data() {
return {
disabled: false
}
},
props: { props: {
content: String, content: String,
icon: { icon: {
@ -25,11 +33,16 @@
type: String, type: String,
default: 'mini' default: 'mini'
}, },
disabled: { isTesterPermission: {
type: Boolean, type: Boolean,
default: false default: false
} }
}, },
mounted() {
if (this.isTesterPermission &&!hasRoles(ROLE_TEST_USER, ROLE_TEST_MANAGER)) {
this.disabled = true;
}
},
methods: { methods: {
exec() { exec() {
this.$emit('click'); this.$emit('click');

View File

@ -8,7 +8,7 @@
</el-row> </el-row>
<el-row type="flex" justify="space-between" align="middle"> <el-row type="flex" justify="space-between" align="middle">
<span class="operate-button"> <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> <slot name="button"></slot>
</span> </span>
<span> <span>
@ -45,6 +45,10 @@
default() { default() {
return this.$t('commons.create'); return this.$t('commons.create');
} }
},
isTesterPermission: {
type: Boolean,
default: false
} }
}, },
methods: { methods: {

View File

@ -1,9 +1,9 @@
<template> <template>
<span> <span>
<slot name="front"></slot> <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> <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> <slot name="behind"></slot>
</span> </span>
@ -26,6 +26,10 @@
default() { default() {
return this.$t('commons.delete'); return this.$t('commons.delete');
} }
},
isTesterPermission: {
type: Boolean,
default: false
} }
}, },
methods: { methods: {

View File

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

View File

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

View File

@ -3,7 +3,7 @@
<ms-main-container> <ms-main-container>
<el-card class="table-card" v-loading="result.loading"> <el-card class="table-card" v-loading="result.loading">
<template v-slot:header> <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"/> :create-tip="btnTips" :title="title"/>
</template> </template>
<el-table :data="items" style="width: 100%"> <el-table :data="items" style="width: 100%">
@ -24,9 +24,9 @@
<span>{{ scope.row.updateTime | timestampFormatDate }}</span> <span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column> <el-table-column :label="$t('commons.operating')">
<template v-slot:default="scope"> <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> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>

View File

@ -4,15 +4,15 @@
<el-card class="card-content" v-loading="result.loading"> <el-card class="card-content" v-loading="result.loading">
<template v-slot:header> <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"> :create-tip="$t('test_track.case.create')" @create="testCaseCreate">
<template v-slot:title> <template v-slot:title>
<node-breadcrumb class="table-title" :nodes="selectParentNodes" @refresh="refresh"/> <node-breadcrumb class="table-title" :nodes="selectParentNodes" @refresh="refresh"/>
</template> </template>
<template v-slot:button> <template v-slot:button>
<ms-table-button icon="el-icon-upload2" :content="$t('test_track.case.import.import')" @click="importTestCase"/> <ms-table-button :is-tester-permission="true" 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 :is-tester-permission="true" 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-delete" :content="$t('test_track.case.delete')" @click="handleBatch('delete')"/>
<!--<test-case-export/>--> <!--<test-case-export/>-->
</template> </template>
</ms-table-header> </ms-table-header>
@ -85,9 +85,9 @@
<el-table-column <el-table-column
:label="$t('commons.operating')"> :label="$t('commons.operating')">
<template v-slot:default="scope"> <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> <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)"/> type="success" @exec="handleCopy(scope.row)"/>
</template> </template>
</ms-table-operator> </ms-table-operator>

View File

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

View File

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

View File

@ -2,19 +2,19 @@
<div class="card-container"> <div class="card-container">
<el-card class="card-content" v-loading="result.loading"> <el-card class="card-content" v-loading="result.loading">
<template v-slot:header> <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> <template v-slot:title>
<node-breadcrumb class="table-title" :nodes="selectParentNodes" @refresh="refresh"/> <node-breadcrumb class="table-title" :nodes="selectParentNodes" @refresh="refresh"/>
</template> </template>
<template v-slot:button> <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 :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 v-if="showMyTestCase" icon="el-icon-files" :content="$t('test_track.plan_view.all_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 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-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 :is-tester-permission="true" 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 :is-tester-permission="true" 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 :is-tester-permission="true" 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 :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 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="testPlan.reportId" icon="el-icon-document" :content="$t('test_track.plan_view.view_report')" @click="openReport"/>
</template> </template>
</ms-table-header> </ms-table-header>
</template> </template>
@ -103,8 +103,8 @@
<el-table-column <el-table-column
:label="$t('commons.operating')"> :label="$t('commons.operating')">
<template v-slot:default="scope"> <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 :is-tester-permission="true" :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('test_track.plan_view.cancel_relevance')" icon="el-icon-unlock" type="danger" @exec="handleDelete(scope.row)"/>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -135,8 +135,8 @@
import MsTableButton from '../../../../common/components/MsTableButton'; import MsTableButton from '../../../../common/components/MsTableButton';
import NodeBreadcrumb from '../../../common/NodeBreadcrumb'; import NodeBreadcrumb from '../../../common/NodeBreadcrumb';
import {TokenKey} from '../../../../../../common/js/constants'; import {ROLE_TEST_MANAGER, ROLE_TEST_USER, TokenKey} from '../../../../../../common/js/constants';
import {_filter, _sort, humpToLine, tableFilter} from '../../../../../../common/js/utils'; import {_filter, _sort, hasRoles, humpToLine, tableFilter} from '../../../../../../common/js/utils';
import PriorityTableItem from "../../../common/tableItems/planview/PriorityTableItem"; import PriorityTableItem from "../../../common/tableItems/planview/PriorityTableItem";
import StatusTableItem from "../../../common/tableItems/planview/StatusTableItem"; import StatusTableItem from "../../../common/tableItems/planview/StatusTableItem";
import TypeTableItem from "../../../common/tableItems/planview/TypeTableItem"; import TypeTableItem from "../../../common/tableItems/planview/TypeTableItem";
@ -239,10 +239,12 @@
this.initTableData(); this.initTableData();
}, },
refreshTestPlanRecent() { refreshTestPlanRecent() {
let param = {}; if (hasRoles(ROLE_TEST_USER, ROLE_TEST_MANAGER)) {
param.id = this.planId; let param = {};
param.updateTime = Date.now(); param.id = this.planId;
this.$post('/test/plan/edit', param); param.updateTime = Date.now();
this.$post('/test/plan/edit', param);
}
}, },
search() { search() {
this.initTableData(); this.initTableData();