refactor(测试跟踪): jira缺陷管理部分问题优化

--bug=1013370 --user=陈建星 【测试跟踪】项目集成jira  缺陷管理 部分问题优化 https://www.tapd.cn/55049933/s/1169845
This commit is contained in:
chenjianxing 2022-05-31 17:25:34 +08:00 committed by f2c-ci-robot[bot]
parent e6f3b8c55f
commit 18dee6b5b9
6 changed files with 50 additions and 11 deletions

View File

@ -1,8 +1,8 @@
<template> <template>
<div v-loading="result.loading"> <div>
<el-dialog :close-on-click-modal="false" :title="title" :visible.sync="createVisible" destroy-on-close <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="createVisible" destroy-on-close
@close="handleClose"> @close="handleClose">
<el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="80px" size="small"> <el-form v-loading="result.loading" :model="form" :rules="rules" ref="form" label-position="right" label-width="80px" size="small">
<el-form-item :label-width="labelWidth" :label="$t('commons.name')" prop="name"> <el-form-item :label-width="labelWidth" :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"></el-input> <el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item> </el-form-item>
@ -42,7 +42,7 @@
<el-button @click="check" type="primary" class="checkButton">{{ $t('test_track.issue.check_id_exist') }}</el-button> <el-button @click="check" type="primary" class="checkButton">{{ $t('test_track.issue.check_id_exist') }}</el-button>
</el-form-item> </el-form-item>
<project-jira-config v-if="jira" :label-width="labelWidth" :form="form"> <project-jira-config :result="result" v-if="jira" :label-width="labelWidth" :form="form" ref="jiraConfig">
<template #checkBtn> <template #checkBtn>
<el-button @click="check" type="primary" class="checkButton">{{ $t('test_track.issue.check_id_exist') }}</el-button> <el-button @click="check" type="primary" class="checkButton">{{ $t('test_track.issue.check_id_exist') }}</el-button>
</template> </template>
@ -225,9 +225,12 @@ export default {
} else { } else {
this.form = {issueConfigObj: {}}; this.form = {issueConfigObj: {}};
} }
if (this.$refs.jiraConfig) {
this.$refs.jiraConfig.getIssueTypeOption(this.form);
}
this.platformOptions = []; this.platformOptions = [];
this.platformOptions.push(...ISSUE_PLATFORM_OPTION); this.platformOptions.push(...ISSUE_PLATFORM_OPTION);
this.$get("/service/integration/all/" + getCurrentUser().lastWorkspaceId, response => { this.result = this.$get("/service/integration/all/" + getCurrentUser().lastWorkspaceId, response => {
let data = response.data; let data = response.data;
let platforms = data.map(d => d.platform); let platforms = data.map(d => d.platform);
this.filterPlatformOptions(platforms, TAPD); this.filterPlatformOptions(platforms, TAPD);

View File

@ -31,7 +31,7 @@ import {getCurrentWorkspaceId} from "@/common/js/utils";
export default { export default {
name: "ProjectJiraConfig", name: "ProjectJiraConfig",
components: {MsInstructionsIcon}, components: {MsInstructionsIcon},
props: ['labelWidth', 'form'], props: ['labelWidth', 'form', 'result'],
data() { data() {
return { return {
issueTypes: [] issueTypes: []
@ -43,12 +43,31 @@ export default {
methods: { methods: {
getIssueTypeOption() { getIssueTypeOption() {
this.issueTypes = []; this.issueTypes = [];
this.result.loading = true;
getJiraIssueType({ getJiraIssueType({
projectId: this.form.id, projectId: this.form.id,
workspaceId: getCurrentWorkspaceId(), workspaceId: getCurrentWorkspaceId(),
jiraKey: this.form.jiraKey jiraKey: this.form.jiraKey
}, (data) => { }, (data) => {
this.issueTypes = data; this.issueTypes = data;
let hasJiraIssueType = false;
let hasJiraStoryType = false;
if (data) {
data.forEach(item => {
if (this.form.issueConfigObj.jiraIssueTypeId === item.id) {
hasJiraIssueType = true;
} else if (this.form.issueConfigObj.jiraStoryTypeId === item.id) {
hasJiraStoryType = true;
}
});
}
if (!hasJiraIssueType) {
this.form.issueConfigObj.jiraIssueTypeId = null;
}
if (!hasJiraStoryType) {
this.form.issueConfigObj.jiraStoryTypeId = null;
}
this.result.loading = false;
}); });
} }
} }

View File

@ -32,14 +32,16 @@ export default {
open(data, type) { open(data, type) {
this.visible = true; this.visible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.issueEditDetail.open(data, type); this.$refs.issueEditDetail.open(data, type);
}) });
}, },
handleClose() { handleClose() {
this.visible = false; this.visible = false;
this.$refs.issueEditDetail.resetForm();
}, },
save() { save() {
this.$refs.issueEditDetail.save(); this.$refs.issueEditDetail.save();
this.$refs.issueEditDetail.resetForm();
}, },
refresh(data) { refresh(data) {
this.$emit('refresh', data); this.$emit('refresh', data);

View File

@ -258,6 +258,23 @@ export default {
}, },
}, },
methods: { methods: {
resetForm() {
this.form = {
title: '',
description: '',
creator: null,
remark: null,
tapdUsers:[],
zentaoBuilds:[],
zentaoAssigned: '',
platformStatus: null
};
this.customFieldForm = null;
this.issueTemplate = {};
if (this.$refs.testCaseIssueList) {
this.$refs.testCaseIssueList.tableData = [];
}
},
open(data, type) { open(data, type) {
this.result.loading = true; this.result.loading = true;
this.type = type; this.type = type;
@ -277,7 +294,7 @@ export default {
break; break;
} }
} }
}) });
getIssuesById(data.id, (data) => { getIssuesById(data.id, (data) => {
this.form.tapdUsers = data.tapdUsers; this.form.tapdUsers = data.tapdUsers;
this.form.zentaoBuilds = data.zentaoBuilds; this.form.zentaoBuilds = data.zentaoBuilds;

View File

@ -5,7 +5,7 @@
</el-col> </el-col>
<el-col :span="12" class="head-right"> <el-col :span="12" class="head-right">
<el-button plain size="mini" @click="handleCancel">{{ $t('test_track.return') }}</el-button> <el-button plain size="mini" @click="handleCancel">{{ $t('test_track.return') }}</el-button>
<el-button type="primary" size="mini" @click="handleSave">{{ $t('test_track.save') }}</el-button> <el-button v-prevent-re-click type="primary" size="mini" @click="handleSave">{{ $t('test_track.save') }}</el-button>
</el-col> </el-col>
</el-row> </el-row>

View File

@ -1,7 +1,5 @@
import {post, get} from "@/common/js/ajax"; import {post, get} from "@/common/js/ajax";
import {getPageDate, parseCustomFilesForList} from "@/common/js/tableUtils"; import {getPageDate, parseCustomFilesForList} from "@/common/js/tableUtils";
import {getCurrentProjectID, hasLicense} from "@/common/js/utils";
import {getPageDate} from "@/common/js/tableUtils";
import {getCurrentProjectID, getCurrentWorkspaceId, hasLicense} from "@/common/js/utils"; import {getCurrentProjectID, getCurrentWorkspaceId, hasLicense} from "@/common/js/utils";
import {baseGet, basePost} from "@/network/base-network"; import {baseGet, basePost} from "@/network/base-network";
import {getCurrentProject} from "@/network/project"; import {getCurrentProject} from "@/network/project";