fix(测试跟踪): 测试计划关联其他项目用例,编辑时自定义字段显示错误

--bug=1018296 --user=陈建星 【测试跟踪】测试计划-执行功能用例-用例字段显示的是其他项目的 https://www.tapd.cn/55049933/s/1274615
This commit is contained in:
chenjianxing 2022-10-24 16:56:42 +08:00 committed by jianxing
parent d1a10e4874
commit b9bde97a5d
4 changed files with 11 additions and 13 deletions

View File

@ -5,7 +5,7 @@
</template> </template>
<script> <script>
import MsMarkDownText from "metersphere-frontend/src/components/MsMarkDownText"; import MsMarkDownText from "./MsMarkDownText";
export default { export default {
name: "FormRichTextItem", name: "FormRichTextItem",
components: {MsMarkDownText}, components: {MsMarkDownText},

View File

@ -1,10 +1,10 @@
import {post, get} from "metersphere-frontend/src/plugins/request"; import {post, get} from "metersphere-frontend/src/plugins/request";
import {getCurrentProjectID} from "metersphere-frontend/src/utils/token"; import {getCurrentProjectID} from "metersphere-frontend/src/utils/token";
export function getTemplate(baseUrl) { export function getTemplate(baseUrl, projectId) {
return new Promise((resolve) => { return new Promise((resolve) => {
let template = {}; let template = {};
get(baseUrl + getCurrentProjectID()) get(baseUrl + (projectId ? projectId : getCurrentProjectID()))
.then(response => { .then(response => {
template = response.data; template = response.data;
if (template.customFields) { if (template.customFields) {
@ -23,8 +23,8 @@ export function getIssueTemplate() {
return getTemplate('field/template/issue/get/relate/'); return getTemplate('field/template/issue/get/relate/');
} }
export function getTestTemplate() { export function getTestTemplate(projectId) {
return getTemplate('field/template/case/get/relate/'); return getTemplate('field/template/case/get/relate/', projectId);
} }
export function updateCustomFieldTemplate(request) { export function updateCustomFieldTemplate(request) {

View File

@ -145,7 +145,6 @@
<script> <script>
import TestPlanTestCaseStatusButton from '../../../common/TestPlanTestCaseStatusButton'; import TestPlanTestCaseStatusButton from '../../../common/TestPlanTestCaseStatusButton';
import ClassicEditor from '@ckeditor/ckeditor5-build-classic'; import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
import {getCurrentProjectID} from "metersphere-frontend/src/utils/token";
import {getUUID, listenGoBack, removeGoBackListener} from "metersphere-frontend/src/utils" import {getUUID, listenGoBack, removeGoBackListener} from "metersphere-frontend/src/utils"
import {hasPermission} from "metersphere-frontend/src/utils/permission"; import {hasPermission} from "metersphere-frontend/src/utils/permission";
import TestCaseAttachment from "@/business/case/components/TestCaseAttachment"; import TestCaseAttachment from "@/business/case/components/TestCaseAttachment";
@ -231,9 +230,6 @@ export default {
prePageData: Object prePageData: Object
}, },
computed: { computed: {
projectId() {
return getCurrentProjectID();
},
systemNameMap() { systemNameMap() {
return SYSTEM_FIELD_NAME_MAP; return SYSTEM_FIELD_NAME_MAP;
}, },
@ -456,7 +452,7 @@ export default {
listenGoBack(this.handleClose); listenGoBack(this.handleClose);
let initFuc = this.getTestCase; let initFuc = this.getTestCase;
getTestTemplate() getTestTemplate(testCase.projectId)
.then((template) => { .then((template) => {
this.testCaseTemplate = template; this.testCaseTemplate = template;
initFuc(testCase.id); initFuc(testCase.id);

View File

@ -7,7 +7,7 @@
:modal-append-to-body="false" :modal-append-to-body="false"
size="100%" size="100%"
ref="drawer" ref="drawer"
v-loading="result.loading"> v-loading="loading">
<template> <template>
<el-row :gutter="10"> <el-row :gutter="10">
@ -188,7 +188,7 @@ export default {
}, },
data() { data() {
return { return {
result: {}, loading: false,
showDialog: false, showDialog: false,
testCase: {}, testCase: {},
index: 0, index: 0,
@ -367,8 +367,10 @@ export default {
this.getTestCase(this.testCases[this.index].id); this.getTestCase(this.testCases[this.index].id);
}, },
getTestCase(id) { getTestCase(id) {
this.loading = true;
getTestReviewTestCase(id) getTestReviewTestCase(id)
.then((response) => { .then((response) => {
this.loading = false;
let item = {}; let item = {};
let data = response.data; let data = response.data;
Object.assign(item, data); Object.assign(item, data);
@ -423,7 +425,7 @@ export default {
} }
} }
getTestTemplate() getTestTemplate(testCase.projectId)
.then((response) => { .then((response) => {
this.testCaseTemplate = response; this.testCaseTemplate = response;
initFuc(testCase.id); initFuc(testCase.id);