fix(测试跟踪): 公共用例库自定义字段责任人查看有误

--bug=1024436 --user=宋昌昌 【测试跟踪】公共用例库-查看,责任人为空 https://www.tapd.cn/55049933/s/1350590
This commit is contained in:
song-cc-rock 2023-03-15 16:50:56 +08:00 committed by fit2-zhao
parent 5c7cefe65f
commit 0ee5c593ed
4 changed files with 45 additions and 18 deletions

View File

@ -152,7 +152,7 @@
<script>
import MsTableColumn from "../table/MsTableColumn";
import MsInputTag from "../MsInputTag";
import {getProjectMemberOption} from "../../api/user";
import {getProjectMemberById, getProjectMemberOption} from "../../api/user";
import MsMarkDownText from "metersphere-frontend/src/components/MsMarkDownText";
export default {
@ -164,7 +164,8 @@ export default {
'form',
'disabled',
'defaultOpen',
'isTemplateEdit'
'isTemplateEdit',
'projectId'
],
data() {
return {
@ -199,13 +200,22 @@ export default {
if (['member', 'multipleMember'].indexOf(this.data.type) < 0) {
return;
}
getProjectMemberOption()
.then((r) => {
if (this.projectId) {
getProjectMemberById(this.projectId).then((r) => {
this.memberOptions = r.data;
if (this.data.name === '责任人' && this.data.system && this.isTemplateEdit) {
this.memberOptions.unshift({id: 'CURRENT_USER', name: '创建人', email: ''});
}
});
})
} else {
getProjectMemberOption()
.then((r) => {
this.memberOptions = r.data;
if (this.data.name === '责任人' && this.data.system && this.isTemplateEdit) {
this.memberOptions.unshift({id: 'CURRENT_USER', name: '创建人', email: ''});
}
});
}
},
watch: {
form() {

View File

@ -171,7 +171,8 @@ export default {
contentClickEvent: {
type: Boolean,
default: true,
}
},
projectId: String
},
computed: {
edit() {
@ -218,17 +219,31 @@ export default {
},
methods: {
getMemberOptions() {
getProjectMemberOption().then((r) => {
let tempMemberOptions = r.data || [];
let tempArr = [];
tempMemberOptions.forEach((e) => {
tempArr.push({
value: e.id,
text: e.name,
if (this.projectId) {
getProjectMemberById(this.projectId).then((r) => {
let tempMemberOptions = r.data || [];
let tempArr = [];
tempMemberOptions.forEach((e) => {
tempArr.push({
value: e.id,
text: e.name,
});
});
this.memberOptions = tempArr;
});
this.memberOptions = tempArr;
});
} else {
getProjectMemberOption().then((r) => {
let tempMemberOptions = r.data || [];
let tempArr = [];
tempMemberOptions.forEach((e) => {
tempArr.push({
value: e.id,
text: e.name,
});
});
this.memberOptions = tempArr;
});
}
},
getTranslateOption(item) {
if (!item) {

View File

@ -148,6 +148,7 @@
:default-open="defaultOpen"
:issue-template="testCaseTemplate"
:editable="editable"
:project-id="form.projectId"
/>
</el-form>
<el-form ref="baseCaseFrom" :rules="rules" :model="form" class="case-padding">

View File

@ -23,6 +23,7 @@
:content-click-event="!disabled"
:model="form"
:rules="rules"
:project-id="projectId"
>
<template v-slot:content="{ onClick, hoverEditable }">
<div :class="hoverEditable ? 'selectHover' : ''">
@ -31,10 +32,9 @@
:data="item"
:form="form"
prop="defaultValue"
:disabled="
(item.type !== 'richText' && isPublic) || disabled
"
:disabled="(item.type !== 'richText' && isPublic) || disabled"
:default-open="defaultOpen"
:project-id="projectId"
@onClick="onClick"
/>
</el-form-item>
@ -87,6 +87,7 @@ export default {
return "preview";
},
},
projectId: String
},
computed: {
customFieldRowNums() {