fix: 测试用例只读用户样式

This commit is contained in:
chenjianxing 2021-05-10 14:19:18 +08:00 committed by jianxing
parent a21a53d110
commit 131e0577b5
8 changed files with 29 additions and 26 deletions

View File

@ -18,7 +18,7 @@
{{tag && tag.length>10? tag.substring(0,10)+"...":tag}}
</el-tag>
<input
v-if="!readOnly"
:disabled="readOnly"
class="tag-input el-input"
v-model="newTag"
:placeholder="$t('commons.tag_tip')"

View File

@ -25,7 +25,7 @@
<el-table-column
:label="$t('commons.operating')">
<template v-slot:default="scope">
<el-button @click="preview(scope.row)" :disabled="!scope.row.id || readOnly" type="primary"
<el-button @click="preview(scope.row)" :disabled="!scope.row.id" type="primary"
v-if="isPreview(scope.row)"
icon="el-icon-view"
size="mini" circle/>

View File

@ -42,7 +42,7 @@
<el-col :span="7">
<el-form-item :label="$t('commons.tag')" :label-width="formLabelWidth" prop="tag">
<ms-input-tag :currentScenario="form" v-if="showInputTag" ref="tag" class="ms-case-input"/>
<ms-input-tag :read-only="readOnly" :currentScenario="form" v-if="showInputTag" ref="tag" class="ms-case-input"/>
</el-form-item>
</el-col>
</el-row>
@ -54,7 +54,7 @@
<el-col :span="7" v-for="(item, index) in testCaseTemplate.customFields" :key="index">
<el-form-item :label="item.system ? $t(systemNameMap[item.name]) : item.name" :prop="item.name"
:label-width="formLabelWidth">
<custom-filed-component @reload="reloadForm" :data="item" :form="customFieldForm" prop="defaultValue"/>
<custom-filed-component :disabled="readOnly" @reload="reloadForm" :data="item" :form="customFieldForm" prop="defaultValue"/>
</el-form-item>
</el-col>
</el-row>
@ -71,15 +71,15 @@
<ms-form-divider :title="$t('test_track.case.step_info')"/>
<form-rich-text-item :label-width="formLabelWidth" :title="$t('test_track.case.prerequisite')" :data="form" prop="prerequisite"/>
<form-rich-text-item :disabled="readOnly" :label-width="formLabelWidth" :title="$t('test_track.case.prerequisite')" :data="form" prop="prerequisite"/>
<step-change-item :label-width="formLabelWidth" :form="form"/>
<form-rich-text-item :label-width="formLabelWidth" v-if="form.stepModel === 'TEXT'" :title="$t('test_track.case.step_desc')" :data="form" prop="stepDescription"/>
<form-rich-text-item :label-width="formLabelWidth" v-if="form.stepModel === 'TEXT'" :title="$t('test_track.case.expected_results')" :data="form" prop="expectedResult"/>
<form-rich-text-item :disabled="readOnly" :label-width="formLabelWidth" v-if="form.stepModel === 'TEXT'" :title="$t('test_track.case.step_desc')" :data="form" prop="stepDescription"/>
<form-rich-text-item :disabled="readOnly" :label-width="formLabelWidth" v-if="form.stepModel === 'TEXT'" :title="$t('test_track.case.expected_results')" :data="form" prop="expectedResult"/>
<test-case-step-item :label-width="formLabelWidth" v-if="form.stepModel === 'STEP'" :form="form" :read-only="readOnly"/>
<test-case-edit-other-info :project-id="projectIds" :form="form" :label-width="formLabelWidth" :case-id="form.id" ref="otherInfo"/>
<test-case-edit-other-info :read-only="readOnly" :project-id="projectIds" :form="form" :label-width="formLabelWidth" :case-id="form.id" ref="otherInfo"/>
<el-row style="margin-top: 10px" v-if="type!='add'">
<el-col :span="20" :offset="1">{{ $t('test_track.review.comment') }}:
@ -117,7 +117,14 @@
<script>
import {TokenKey, WORKSPACE_ID} from '@/common/js/constants';
import MsDialogFooter from '../../../common/components/MsDialogFooter'
import {getCurrentUser, getNodePath, handleCtrlSEvent, listenGoBack, removeGoBackListener} from "@/common/js/utils";
import {
checkoutTestManagerOrTestUser,
getCurrentUser,
getNodePath,
handleCtrlSEvent,
listenGoBack,
removeGoBackListener
} from "@/common/js/utils";
import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment";
import CaseComment from "@/business/components/track/case/components/CaseComment";
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
@ -269,6 +276,9 @@ export default {
}
},
mounted() {
if (!checkoutTestManagerOrTestUser()) {
this.readOnly = true;
}
this.getSelectOptions();
if (this.type === 'edit' || this.type === 'copy') {
this.open(this.currentTestCaseInfo)

View File

@ -18,6 +18,7 @@
<el-form-item :label="$t('test_track.case.relate_test')" :label-width="labelWidth">
<el-cascader :options="sysList" filterable :placeholder="$t('test_track.case.please_select_relate_test')" show-all-levels
v-model="form.selected" :props="props"
:disabled="readOnly"
class="ms-case" ref="cascade"></el-cascader>
</el-form-item>
</el-col>
@ -48,6 +49,7 @@
<el-tab-pane :label="$t('test_track.case.relate_issue')" name="bug">
<test-case-issue-relate
:read-only="readOnly"
:case-id="caseId" ref="issue"/>
</el-tab-pane>
@ -63,8 +65,9 @@
:on-exceed="handleExceed"
multiple
:limit="8"
:disabled="readOnly"
:file-list="fileList">
<el-button icon="el-icon-plus" size="mini"></el-button>
<el-button icon="el-icon-plus" :disabled="readOnly" size="mini"></el-button>
<span slot="tip" class="el-upload__tip"> {{ $t('test_track.case.upload_tip') }} </span>
</el-upload>
</el-col>

View File

@ -1,6 +1,6 @@
<template>
<div>
<el-button class="add-btn" type="primary" size="mini" @click="appIssue">{{ $t('test_track.issue.add_issue') }}</el-button>
<el-button class="add-btn" :disabled="readOnly" type="primary" size="mini" @click="appIssue">{{ $t('test_track.issue.add_issue') }}</el-button>
<el-tooltip class="item" effect="dark"
:content="$t('test_track.issue.platform_tip')"
placement="right">
@ -79,7 +79,7 @@ export default {
result: {},
}
},
props: ['caseId'],
props: ['caseId', 'readOnly'],
computed: {
issueStatusMap() {
return ISSUE_STATUS_MAP;

View File

@ -436,16 +436,6 @@ export default {
<style scoped>
.border-hidden >>> .el-textarea__inner {
border-style: hidden;
background-color: white;
color: #060505;
}
.border-hidden >>> *[disabled] {
opacity: 0.7;
}
.cast_label {
color: dimgray;
}

View File

@ -485,10 +485,6 @@ export default {
color: #060505;
}
.tb-edit >>> *[disabled] {
opacity: 0.7;
}
.step-info {
padding-left: 40px;
padding-right: 15px;

View File

@ -217,3 +217,7 @@ textarea {
width: 30px;
}
/* 表格全选样式 --> */
*[disabled] {
opacity: 1 !important;
}