fix(测试跟踪): 查看用例缺陷关联TAB权限校验问题

--bug=1029752 --user=宋昌昌 【测试跟踪】github#26486,当授权项目成员角色,并且没有查看缺陷权限的时候,点击查看用例,会跳转到系统设置的页面。 https://www.tapd.cn/55049933/s/1413606
This commit is contained in:
song-cc-rock 2023-09-07 11:33:07 +08:00 committed by 刘瑞斌
parent 54fd4446bf
commit bab97d7794
2 changed files with 240 additions and 216 deletions

View File

@ -6,27 +6,27 @@
<!-- 用例详情 --> <!-- 用例详情 -->
<el-tab-pane :label="$t('case.use_case_detail')" name="detail"> <el-tab-pane :label="$t('case.use_case_detail')" name="detail">
<div <div
class="tab-container" class="tab-container"
:class="{ 'comment-edit-tab-container': isCommentEdit }" :class="{ 'comment-edit-tab-container': isCommentEdit }"
> >
<el-scrollbar> <el-scrollbar>
<div class="content-container"> <div class="content-container">
<case-detail-component <case-detail-component
:type="type" :type="type"
:case-id="caseId" :case-id="caseId"
:editable-state="editableState" :editable-state="editableState"
:read-only="readOnly || !editable" :read-only="readOnly || !editable"
:project-id="projectId" :project-id="projectId"
:is-copy="isCopy" :is-copy="isCopy"
:is-public-show="isPublicShow" :is-public-show="isPublicShow"
:is-readonly-user="isReadonlyUser" :is-readonly-user="isReadonlyUser"
:copy-case-id="copyCaseId" :copy-case-id="copyCaseId"
:isClickAttachmentTab="isClickAttachmentTab" :isClickAttachmentTab="isClickAttachmentTab"
:isTestPlan="isTestPlan" :isTestPlan="isTestPlan"
:editable="editable" :editable="editable"
:form="form" :form="form"
:richTextDefaultOpen="richTextDefaultOpen" :richTextDefaultOpen="richTextDefaultOpen"
:formLabelWidth="formLabelWidth" :formLabelWidth="formLabelWidth"
></case-detail-component> ></case-detail-component>
</div> </div>
</el-scrollbar> </el-scrollbar>
@ -34,8 +34,8 @@
</el-tab-pane> </el-tab-pane>
<!-- 关联用例 --> <!-- 关联用例 -->
<el-tab-pane <el-tab-pane
:label="$t('case.associate_test_cases')" :label="$t('case.associate_test_cases')"
name="associateTestCases" name="associateTestCases"
> >
<span slot="label"> <span slot="label">
{{ $t('case.associate_test_cases') }} {{ $t('case.associate_test_cases') }}
@ -44,17 +44,17 @@
</div> </div>
</span> </span>
<div <div
class="tab-container" class="tab-container"
:class="{ 'comment-edit-tab-container': isCommentEdit }" :class="{ 'comment-edit-tab-container': isCommentEdit }"
> >
<el-scrollbar> <el-scrollbar>
<div class="content-container"> <div class="content-container">
<case-test-relate <case-test-relate
@setCount="setRelateCaseCount" @setCount="setRelateCaseCount"
ref="relateTest" ref="relateTest"
:case-id="caseId" :case-id="caseId"
:read-only="readOnly" :read-only="readOnly"
:version-enable="versionEnable" :version-enable="versionEnable"
></case-test-relate> ></case-test-relate>
</div> </div>
</el-scrollbar> </el-scrollbar>
@ -62,8 +62,9 @@
</el-tab-pane> </el-tab-pane>
<!-- 关联缺陷 --> <!-- 关联缺陷 -->
<el-tab-pane <el-tab-pane
:label="$t('test_track.case.relate_issue')" :label="$t('test_track.case.relate_issue')"
name="associatedDefects" name="associatedDefects"
v-if="hasPermissions('PROJECT_TRACK_ISSUE:READ')"
> >
<span slot="label"> <span slot="label">
{{ $t('test_track.case.relate_issue') }} {{ $t('test_track.case.relate_issue') }}
@ -72,20 +73,20 @@
</div> </div>
</span> </span>
<div <div
class="tab-container" class="tab-container"
:class="{ 'comment-edit-tab-container': isCommentEdit }" :class="{ 'comment-edit-tab-container': isCommentEdit }"
> >
<el-scrollbar> <el-scrollbar>
<div class="content-container"> <div class="content-container">
<case-issue-relate <case-issue-relate
@setCount="setRelateIssueCount" @setCount="setRelateIssueCount"
:plan-id="planId" :plan-id="planId"
:is-copy="isCopy" :is-copy="isCopy"
:copy-case-id="copyCaseId" :copy-case-id="copyCaseId"
:read-only="readOnly && !isTestPlan" :read-only="(readOnly && !isTestPlan)"
:plan-case-id="planId ? this.form.id : null" :plan-case-id="planId ? this.form.id : null"
:case-id="caseId" :case-id="caseId"
ref="issue" ref="issue"
/> />
</div> </div>
</el-scrollbar> </el-scrollbar>
@ -100,19 +101,19 @@
</div> </div>
</span> </span>
<div <div
class="tab-container" class="tab-container"
:class="{ 'comment-edit-tab-container': isCommentEdit }" :class="{ 'comment-edit-tab-container': isCommentEdit }"
> >
<el-scrollbar> <el-scrollbar>
<div class="content-container"> <div class="content-container">
<case-relationship-viewer <case-relationship-viewer
@setCount="setRelationshipCount" @setCount="setRelationshipCount"
:read-only="readOnly" :read-only="readOnly"
:resource-id="caseId" :resource-id="caseId"
@openDependGraphDrawer="setRelationshipGraph" @openDependGraphDrawer="setRelationshipGraph"
:version-enable="versionEnable" :version-enable="versionEnable"
resource-type="TEST_CASE" resource-type="TEST_CASE"
ref="relationship" ref="relationship"
></case-relationship-viewer> ></case-relationship-viewer>
</div> </div>
</el-scrollbar> </el-scrollbar>
@ -127,16 +128,16 @@
</div> </div>
</span> </span>
<div <div
class="tab-container" class="tab-container"
:class="{ 'comment-edit-tab-container': isCommentEdit }" :class="{ 'comment-edit-tab-container': isCommentEdit }"
> >
<el-scrollbar> <el-scrollbar>
<div class="content-container"> <div class="content-container">
<case-comment-viewer <case-comment-viewer
:is-public-show="isPublicShow || isReadonlyUser" :is-public-show="isPublicShow || isReadonlyUser"
@getComments="getComments" @getComments="getComments"
:comments="comments" :comments="comments"
ref="commentRef" ref="commentRef"
></case-comment-viewer> ></case-comment-viewer>
</div> </div>
</el-scrollbar> </el-scrollbar>
@ -145,14 +146,14 @@
<!-- 变更记录 --> <!-- 变更记录 -->
<el-tab-pane :label="$t('case.change_record')" name="changeRecord"> <el-tab-pane :label="$t('case.change_record')" name="changeRecord">
<div <div
class="tab-container" class="tab-container"
:class="{ 'comment-edit-tab-container': isCommentEdit }" :class="{ 'comment-edit-tab-container': isCommentEdit }"
> >
<el-scrollbar> <el-scrollbar>
<div class="content-container"> <div class="content-container">
<case-change-history <case-change-history
:case-id="caseId" :case-id="caseId"
ref="caseChangeHistoryRef" ref="caseChangeHistoryRef"
></case-change-history> ></case-change-history>
</div> </div>
</el-scrollbar> </el-scrollbar>
@ -161,34 +162,34 @@
</el-tabs> </el-tabs>
<div class="comment-common" v-if="!isPublicShow"> <div class="comment-common" v-if="!isPublicShow">
<case-comment-component <case-comment-component
:case-id="caseId" :case-id="caseId"
:read-only="readOnly" :read-only="readOnly"
@stateChange="handleCommentStateChange" @stateChange="handleCommentStateChange"
@toggleCommentTab="toggleCommentTab" @toggleCommentTab="toggleCommentTab"
@getComments="getComments" @getComments="getComments"
/> />
</div> </div>
</div> </div>
<el-scrollbar> <el-scrollbar>
<div class="content-container editable-container" v-if="editable"> <div class="content-container editable-container" v-if="editable">
<case-detail-component <case-detail-component
:class="{ 'edit-component' : (editableState || editable) }" :class="{ 'edit-component' : (editableState || editable) }"
:type="type" :type="type"
:case-id="caseId" :case-id="caseId"
:read-only="readOnly" :read-only="readOnly"
:project-id="projectId" :project-id="projectId"
:is-copy="isCopy" :is-copy="isCopy"
:copy-case-id="copyCaseId" :copy-case-id="copyCaseId"
:isClickAttachmentTab="isClickAttachmentTab" :isClickAttachmentTab="isClickAttachmentTab"
:isTestPlan="isTestPlan" :isTestPlan="isTestPlan"
:is-public-show="isPublicShow" :is-public-show="isPublicShow"
:is-readonly-user="isReadonlyUser" :is-readonly-user="isReadonlyUser"
:editable="editable" :editable="editable"
:editable-state="editableState" :editable-state="editableState"
:form="form" :form="form"
:richTextDefaultOpen="richTextDefaultOpen" :richTextDefaultOpen="richTextDefaultOpen"
:formLabelWidth="formLabelWidth" :formLabelWidth="formLabelWidth"
ref="testCaseBaseInfo" ref="testCaseBaseInfo"
></case-detail-component> ></case-detail-component>
</div> </div>
</el-scrollbar> </el-scrollbar>
@ -205,8 +206,10 @@ import CaseChangeHistory from "./CaseChangeHistory";
import CaseIssueRelate from "./CaseIssueRelate"; import CaseIssueRelate from "./CaseIssueRelate";
import CaseCommentComponent from "./CaseCommentComponent"; import CaseCommentComponent from "./CaseCommentComponent";
import CaseCommentViewer from "./CaseCommentViewer"; import CaseCommentViewer from "./CaseCommentViewer";
import { getRelationshipCountCase } from "@/api/testCase"; import {getRelationshipCountCase} from "@/api/testCase";
import TabPaneCount from "@/business/plan/view/comonents/report/detail/component/TabPaneCount"; import TabPaneCount from "@/business/plan/view/comonents/report/detail/component/TabPaneCount";
import {hasPermissions} from 'metersphere-frontend/src/utils/permission';
export default { export default {
name: "CaseEditInfoComponent", name: "CaseEditInfoComponent",
components: { components: {
@ -297,6 +300,9 @@ export default {
}, },
}, },
methods: { methods: {
hasPermissions(permission) {
return hasPermissions(permission);
},
getUploadFiles() { getUploadFiles() {
if (this.$refs.testCaseBaseInfo) { if (this.$refs.testCaseBaseInfo) {
return this.$refs.testCaseBaseInfo.getUploadFiles(); return this.$refs.testCaseBaseInfo.getUploadFiles();
@ -384,19 +390,19 @@ export default {
} }
}, },
getDemandOptions() { getDemandOptions() {
this.result = { loading: true }; this.result = {loading: true};
this.demandLabel = ""; this.demandLabel = "";
issueDemandList(this.projectId) issueDemandList(this.projectId)
.then((r) => { .then((r) => {
this.demandOptions = []; this.demandOptions = [];
if (r.data && r.data.length > 0) { if (r.data && r.data.length > 0) {
this.buildDemandCascaderOptions(r.data, this.demandOptions, []); this.buildDemandCascaderOptions(r.data, this.demandOptions, []);
} }
this.addOtherOption(); this.addOtherOption();
}) })
.catch(() => { .catch(() => {
this.addOtherOption(); this.addOtherOption();
}); });
}, },
addOtherOption() { addOtherOption() {
this.demandOptions.unshift({ this.demandOptions.unshift({
@ -408,7 +414,7 @@ export default {
this.demandValue = ["other"]; this.demandValue = ["other"];
this.demandLabel = "Other: " + this.$t("test_track.case.other"); this.demandLabel = "Other: " + this.$t("test_track.case.other");
} }
this.result = { loading: false }; this.result = {loading: false};
}, },
buildDemandCascaderOptions(data, options, pathArray) { buildDemandCascaderOptions(data, options, pathArray) {
this.demandValue = []; this.demandValue = [];
@ -428,9 +434,9 @@ export default {
if (item.children && item.children.length > 0) { if (item.children && item.children.length > 0) {
option.children = []; option.children = [];
this.buildDemandCascaderOptions( this.buildDemandCascaderOptions(
item.children, item.children,
option.children, option.children,
pathArray pathArray
); );
} }
pathArray.pop(); pathArray.pop();
@ -438,8 +444,8 @@ export default {
}, },
filterDemand(node, keyword) { filterDemand(node, keyword) {
if ( if (
keyword && keyword &&
node.text.toLowerCase().indexOf(keyword.toLowerCase()) !== -1 node.text.toLowerCase().indexOf(keyword.toLowerCase()) !== -1
) { ) {
return true; return true;
} }
@ -554,23 +560,28 @@ export default {
:deep(.el-form-item__content) { :deep(.el-form-item__content) {
line-height: px2rem(32); line-height: px2rem(32);
} }
.case-edit-box { .case-edit-box {
width: px2rem(1328); width: px2rem(1328);
min-height: px2rem(1001); min-height: px2rem(1001);
/* margin-left: px2rem(34); */ /* margin-left: px2rem(34); */
background-color: #fff; background-color: #fff;
.edit-header-container { .edit-header-container {
height: px2rem(56); height: px2rem(56);
width: 100%; width: 100%;
border-bottom: 1px solid rgba(31, 35, 41, 0.15); border-bottom: 1px solid rgba(31, 35, 41, 0.15);
display: flex; display: flex;
align-items: center; align-items: center;
.header-content-row { .header-content-row {
display: flex; display: flex;
.back { .back {
margin-left: px2rem(24); margin-left: px2rem(24);
width: px2rem(20); width: px2rem(20);
height: px2rem(20); height: px2rem(20);
img { img {
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -611,6 +622,7 @@ export default {
height: 100%; height: 100%;
display: flex; display: flex;
background-color: #fff; background-color: #fff;
.required-item:after { .required-item:after {
content: "*"; content: "*";
color: #f54a45; color: #f54a45;
@ -621,14 +633,17 @@ export default {
font-size: 14px; font-size: 14px;
line-height: 22px; line-height: 22px;
} }
.content-body-wrap { .content-body-wrap {
// 1024 padding 24 1px // 1024 padding 24 1px
width: 100%; width: 100%;
height: 100%; height: 100%;
.case-title-wrap { .case-title-wrap {
display: flex; display: flex;
margin-top: px2rem(24); margin-top: px2rem(24);
margin-bottom: px2rem(8); margin-bottom: px2rem(8);
.title-wrap { .title-wrap {
font-family: "PingFang SC"; font-family: "PingFang SC";
font-style: normal; font-style: normal;
@ -637,28 +652,34 @@ export default {
color: #1f2329; color: #1f2329;
} }
} }
.content-container { .content-container {
padding-left: px2rem(24); padding-left: px2rem(24);
padding-right: px2rem(24); padding-right: px2rem(24);
} }
.comment-common { .comment-common {
bottom: 0px; bottom: 0px;
width: 100%; width: 100%;
} }
// //
.content-wrap { .content-wrap {
:deep(.v-note-op) { :deep(.v-note-op) {
background-color: #f8f9fa !important; background-color: #f8f9fa !important;
border-bottom: 1px solid #bbbfc4; border-bottom: 1px solid #bbbfc4;
} }
:deep(.v-note-wrapper) { :deep(.v-note-wrapper) {
box-sizing: border-box; box-sizing: border-box;
border-radius: 4px; border-radius: 4px;
box-shadow: none !important; box-shadow: none !important;
} }
:deep(.v-note-show) { :deep(.v-note-show) {
min-height: 65px; min-height: 65px;
} }
:deep(.v-left-item) { :deep(.v-left-item) {
flex: none !important; flex: none !important;
} }
@ -669,40 +690,48 @@ export default {
display: flex; display: flex;
justify-content: center; justify-content: center;
width: 100%; width: 100%;
.opt-row { .opt-row {
width: 100%; width: 100%;
height: 32px; height: 32px;
} }
} }
} }
.pre-condition-row { .pre-condition-row {
.content-wrap { .content-wrap {
display: flex; display: flex;
justify-content: center; justify-content: center;
width: 100%; width: 100%;
min-height: 100px; min-height: 100px;
.opt-row { .opt-row {
:deep(.el-form-item) { :deep(.el-form-item) {
margin: 0; margin: 0;
} }
width: 100%; width: 100%;
} }
} }
} }
.remark-row { .remark-row {
.content-wrap { .content-wrap {
display: flex; display: flex;
justify-content: center; justify-content: center;
width: 100%; width: 100%;
min-height: 100px; min-height: 100px;
.opt-row { .opt-row {
width: 100%; width: 100%;
:deep(.el-form-item) { :deep(.el-form-item) {
margin: 0; margin: 0;
} }
} }
} }
} }
.attachment-row { .attachment-row {
.attachment-name.case-title-wrap { .attachment-name.case-title-wrap {
.name.title-wrap { .name.title-wrap {
@ -731,12 +760,15 @@ export default {
width: px2rem(304); width: px2rem(304);
min-height: px2rem(864); min-height: px2rem(864);
border-left: 1px solid rgba(31, 35, 41, 0.15); border-left: 1px solid rgba(31, 35, 41, 0.15);
.case-wrap { .case-wrap {
margin-left: px2rem(24); margin-left: px2rem(24);
margin-top: px2rem(24); margin-top: px2rem(24);
} }
.case-title-wrap { .case-title-wrap {
display: flex; display: flex;
.title-wrap { .title-wrap {
font-weight: 500; font-weight: 500;
height: 22px; height: 22px;
@ -744,11 +776,14 @@ export default {
line-height: 22px; line-height: 22px;
color: #1f2329; color: #1f2329;
} }
margin-bottom: px2rem(8); margin-bottom: px2rem(8);
} }
.side-content { .side-content {
width: px2rem(256); width: px2rem(256);
height: 32px; height: 32px;
:deep(.el-select) { :deep(.el-select) {
width: 100%; width: 100%;
} }
@ -774,14 +809,17 @@ export default {
background: #783887; background: #783887;
color: #ffffff; color: #ffffff;
} }
.opt-disable-primary { .opt-disable-primary {
background: #bbbfc4; background: #bbbfc4;
color: #ffffff; color: #ffffff;
} }
.opt-active { .opt-active {
background: #ffffff; background: #ffffff;
color: #1f2329; color: #1f2329;
} }
.opt-disable { .opt-disable {
background: #ffffff; background: #ffffff;
color: #bbbfc4; color: #bbbfc4;
@ -789,18 +827,21 @@ export default {
.save-btn-row { .save-btn-row {
margin-left: px2rem(24); margin-left: px2rem(24);
el-button { el-button {
} }
} }
.save-add-pub-row { .save-add-pub-row {
margin-left: px2rem(12); margin-left: px2rem(12);
el-button { el-button {
} }
} }
.save-create-row { .save-create-row {
margin-left: px2rem(12); margin-left: px2rem(12);
el-button { el-button {
} }
} }

View File

@ -8,25 +8,13 @@
>{{ $t("case.associated_defect") }} >{{ $t("case.associated_defect") }}
</div> </div>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item> <el-dropdown-item :disabled="!hasPermissions('PROJECT_TRACK_ISSUE:READ+CREATE')">
<div <div class="add-btn" type="primary" @click="addIssue">
class="add-btn"
v-permission="['PROJECT_TRACK_PLAN:READ+RELEVANCE_OR_CANCEL']"
:disabled="readOnly"
type="primary"
size="mini"
@click="addIssue"
>
{{ $t("case.create_defect") }} {{ $t("case.create_defect") }}
</div> </div>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item> <el-dropdown-item :disabled="!hasPermissions('PROJECT_TRACK_ISSUE:READ+EDIT')">
<div <div class="add-btn" @click="relateIssue">
class="add-btn"
v-permission="['PROJECT_TRACK_PLAN:READ+RELEVANCE_OR_CANCEL']"
:disabled="readOnly"
@click="relateIssue"
>
{{ $t("case.associate_existing_defects") }} {{ $t("case.associate_existing_defects") }}
</div> </div>
</el-dropdown-item> </el-dropdown-item>
@ -35,69 +23,69 @@
</div> </div>
<div class="search-right-row"> <div class="search-right-row">
<ms-new-ui-search <ms-new-ui-search
:condition.sync="condition" :condition.sync="condition"
@search="search" @search="search"
:baseSearchTip="$t('case.search_by_id')" :baseSearchTip="$t('case.search_by_id')"
/> />
</div> </div>
</div> </div>
<div class="table-data"> <div class="table-data">
<ms-table <ms-table
v-loading="page.result.loading" v-loading="page.result.loading"
:show-select-all="false" :show-select-all="false"
:data="page.data" :data="page.data"
:fields.sync="fields" :fields.sync="fields"
:operators="operators" :operators="operators"
:enable-selection="false" :enable-selection="false"
:enable-max-height="false" :enable-max-height="false"
:max-height="'calc(100vh)'" :max-height="'calc(100vh)'"
ref="table" ref="table"
@refresh="getIssues" @refresh="getIssues"
> >
<span v-for="item in fields" :key="item.key"> <span v-for="item in fields" :key="item.key">
<ms-table-column <ms-table-column
:label="$t('test_track.issue.id')" :label="$t('test_track.issue.id')"
:field="item" :field="item"
prop="id" prop="id"
v-if="false" v-if="false"
> >
</ms-table-column> </ms-table-column>
<ms-table-column <ms-table-column
:field="item" :field="item"
:label="$t('ID')" :label="$t('ID')"
:sortable="true" :sortable="true"
prop="num" prop="num"
> >
</ms-table-column> </ms-table-column>
<ms-table-column <ms-table-column
:field="item" :field="item"
:sortable="true" :sortable="true"
:label="$t('test_track.issue.title')" :label="$t('test_track.issue.title')"
prop="title" prop="title"
> >
</ms-table-column> </ms-table-column>
<ms-table-column <ms-table-column
:label="$t('test_track.issue.platform_status')" :label="$t('test_track.issue.platform_status')"
:field="item" :field="item"
v-if="isThirdPart" v-if="isThirdPart"
prop="platformStatus" prop="platformStatus"
> >
<template v-slot="scope"> <template v-slot="scope">
<span v-if="item.id === 'platformStatus'"> <span v-if="item.id === 'platformStatus'">
<span v-if="scope.row.platform === 'Tapd'"> <span v-if="scope.row.platform === 'Tapd'">
{{ {{
scope.row.platformStatus scope.row.platformStatus
? tapdIssueStatusMap[scope.row.platformStatus] ? tapdIssueStatusMap[scope.row.platformStatus]
: "--" : "--"
}} }}
</span> </span>
<span v-else-if="scope.row.platform === 'Local'"> <span v-else-if="scope.row.platform === 'Local'">
{{ "--" }} {{ "--" }}
</span> </span>
<span <span
v-else-if=" v-else-if="
platformStatusMap && platformStatusMap &&
platformStatusMap.get(scope.row.platformStatus) platformStatusMap.get(scope.row.platformStatus)
" "
@ -115,29 +103,29 @@
<span v-for="field in issueTemplate.customFields" :key="field.id"> <span v-for="field in issueTemplate.customFields" :key="field.id">
<ms-table-column <ms-table-column
:field="item" :field="item"
:label="field.name" :label="field.name"
:prop="field.name" :prop="field.name"
v-if="field.name === '状态'" v-if="field.name === '状态'"
> >
<template v-slot="scope"> <template v-slot="scope">
<el-dropdown <el-dropdown
class="test-case-status" class="test-case-status"
@command="statusChange" @command="statusChange"
placement="bottom" placement="bottom"
trigger="click" trigger="click"
> >
<span class="el-dropdown-link"> <span class="el-dropdown-link">
{{ {{
getCustomFieldValue(scope.row, field) getCustomFieldValue(scope.row, field)
? getCustomFieldValue(scope.row, field) ? getCustomFieldValue(scope.row, field)
: issueStatusMap[scope.row.status] : issueStatusMap[scope.row.status]
}} }}
</span> </span>
<el-dropdown-menu slot="dropdown" chang> <el-dropdown-menu slot="dropdown" chang>
<span v-for="(item, index) in status" :key="index"> <span v-for="(item, index) in status" :key="index">
<el-dropdown-item <el-dropdown-item
:command="{ id: scope.row.id, status: item.value }" :command="{ id: scope.row.id, status: item.value }"
> >
{{ item.system ? $t(item.text) : item.text }} {{ item.system ? $t(item.text) : item.text }}
</el-dropdown-item> </el-dropdown-item>
@ -149,38 +137,38 @@
</span> </span>
<ms-table-column <ms-table-column
:field="item" :field="item"
:label="$t('test_track.issue.platform')" :label="$t('test_track.issue.platform')"
prop="platform" prop="platform"
> >
</ms-table-column> </ms-table-column>
<ms-table-column <ms-table-column
:field="item" :field="item"
:label="$t('test_track.review.creator')" :label="$t('test_track.review.creator')"
prop="creatorName" prop="creatorName"
> >
</ms-table-column> </ms-table-column>
<issue-description-table-item :field="item" /> <issue-description-table-item :field="item"/>
</span> </span>
</ms-table> </ms-table>
</div> </div>
<test-plan-issue-edit <test-plan-issue-edit
:plan-case-id="planCaseId" :plan-case-id="planCaseId"
:plan-id="planId" :plan-id="planId"
:case-id="caseId" :case-id="caseId"
@refresh="getIssues" @refresh="getIssues"
ref="issueEdit" ref="issueEdit"
/> />
<IssueRelateList <IssueRelateList
:plan-case-id="planCaseId" :plan-case-id="planCaseId"
:case-id="caseId" :case-id="caseId"
:not-in-ids="notInIds" :not-in-ids="notInIds"
@refresh="getIssues" @refresh="getIssues"
ref="issueRelate" ref="issueRelate"
/> />
</div> </div>
</template> </template>
@ -191,10 +179,7 @@ import MsTable from "metersphere-frontend/src/components/new-ui/MsTable";
import HomePagination from "@/business/home/components/pagination/HomePagination"; import HomePagination from "@/business/home/components/pagination/HomePagination";
import MsTableColumn from "metersphere-frontend/src/components/table/MsTableColumn"; import MsTableColumn from "metersphere-frontend/src/components/table/MsTableColumn";
import IssueDescriptionTableItem from "@/business/issue/IssueDescriptionTableItem"; import IssueDescriptionTableItem from "@/business/issue/IssueDescriptionTableItem";
import { import {ISSUE_STATUS_MAP, TAPD_ISSUE_STATUS_MAP,} from "metersphere-frontend/src/utils/table-constants";
ISSUE_STATUS_MAP,
TAPD_ISSUE_STATUS_MAP,
} from "metersphere-frontend/src/utils/table-constants";
import IssueRelateList from "./CaseIssueRelateList"; import IssueRelateList from "./CaseIssueRelateList";
import { import {
buildIssues, buildIssues,
@ -207,16 +192,11 @@ import {
like, like,
parseFields, parseFields,
} from "@/api/issue"; } from "@/api/issue";
import { import {getCustomFieldValue, getTableHeaderWithCustomFields,} from "metersphere-frontend/src/utils/tableUtils";
getCustomFieldValue, import {LOCAL} from "metersphere-frontend/src/utils/constants";
getTableHeaderWithCustomFields, import {getCurrentProjectID, getCurrentWorkspaceId,} from "metersphere-frontend/src/utils/token";
} from "metersphere-frontend/src/utils/tableUtils";
import { LOCAL } from "metersphere-frontend/src/utils/constants";
import {
getCurrentProjectID,
getCurrentWorkspaceId,
} from "metersphere-frontend/src/utils/token";
import MsNewUiSearch from "metersphere-frontend/src/components/new-ui/MsSearch"; import MsNewUiSearch from "metersphere-frontend/src/components/new-ui/MsSearch";
import {hasPermissions} from 'metersphere-frontend/src/utils/permission';
export default { export default {
name: "CaseIssueRelate", name: "CaseIssueRelate",
@ -294,8 +274,8 @@ export default {
} }
} }
this.fields = getTableHeaderWithCustomFields( this.fields = getTableHeaderWithCustomFields(
"ISSUE_LIST", "ISSUE_LIST",
this.issueTemplate.customFields this.issueTemplate.customFields
); );
if (!this.isThirdPart) { if (!this.isThirdPart) {
for (let i = 0; i < this.fields.length; i++) { for (let i = 0; i < this.fields.length; i++) {
@ -326,6 +306,9 @@ export default {
}); });
}, },
methods: { methods: {
hasPermissions(permission) {
return hasPermissions(permission);
},
search() { search() {
this.getIssues(); this.getIssues();
}, },
@ -342,14 +325,14 @@ export default {
if (!this.isCopy) { if (!this.isCopy) {
this.page.result = true; this.page.result = true;
let result = getIssuesByCaseIdWithSearch( let result = getIssuesByCaseIdWithSearch(
this.planId ? "PLAN_FUNCTIONAL" : "FUNCTIONAL", this.planId ? "PLAN_FUNCTIONAL" : "FUNCTIONAL",
this.getCaseResourceId() this.getCaseResourceId()
).then((response) => { ).then((response) => {
if (this.condition && this.condition.name && response.data) { if (this.condition && this.condition.name && response.data) {
// //
this.page.data = response.data.filter((v) => { this.page.data = response.data.filter((v) => {
return ( return (
like(condition.name, v.title) || like(condition.name, v.num) like(condition.name, v.title) || like(condition.name, v.num)
); );
}); });
} else { } else {
@ -401,31 +384,31 @@ export default {
}, },
deleteIssue(row) { deleteIssue(row) {
this.$confirm( this.$confirm(
this.$t("test_track.issue.delete_warning"), this.$t("test_track.issue.delete_warning"),
this.$t("case.cancel_relate_case_tips_title"), this.$t("case.cancel_relate_case_tips_title"),
{ {
cancelButtonText: this.$t("commons.cancel"), cancelButtonText: this.$t("commons.cancel"),
confirmButtonText: this.$t("commons.confirm"), confirmButtonText: this.$t("commons.confirm"),
callback: (action) => { callback: (action) => {
if (action === "confirm") { if (action === "confirm") {
this.page.result.loading = true; this.page.result.loading = true;
deleteIssueRelate({ deleteIssueRelate({
id: row.id, id: row.id,
caseResourceId: this.getCaseResourceId(), caseResourceId: this.getCaseResourceId(),
isPlanEdit: this.planId ? true : false, isPlanEdit: this.planId ? true : false,
projectId: this.projectId, projectId: this.projectId,
workspaceId: getCurrentWorkspaceId(), workspaceId: getCurrentWorkspaceId(),
}).then(() => { }).then(() => {
this.page.result.loading = false; this.page.result.loading = false;
this.getIssues(); this.getIssues();
this.$success( this.$success(
this.$t("test_track.cancel_relevance_success"), this.$t("test_track.cancel_relevance_success"),
false false
); );
}); });
} }
}, },
} }
); );
}, },
}, },