fix(项目管理): 创建项目的时候显示了未集成的缺陷模板

--bug=1010384 --user=李敏 【系统设置】项目管理,没有集成第三方平台,创建项目的时候显示了其他平台的缺陷模板 https://www.tapd.cn/55049933/s/1106037
This commit is contained in:
limin-fit2 2022-02-18 19:32:39 +08:00 committed by 刘瑞斌
parent 3e1ee17457
commit 750d36b7e9
2 changed files with 40 additions and 7 deletions

View File

@ -7,7 +7,8 @@
<el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item>
<el-form-item v-if="platformOptions.length > 1" :label-width="labelWidth" :label="$t('test_track.issue.third_party_integrated')"
<el-form-item v-if="platformOptions.length > 1" :label-width="labelWidth"
:label="$t('test_track.issue.third_party_integrated')"
prop="platform">
<el-select filterable v-model="form.platform">
<el-option v-for="item in platformOptions" :key="item.value" :label="item.text" :value="item.value">
@ -23,9 +24,11 @@
:label="$t('workspace.issue_template_manage')" prop="issueTemplateId">
<template-select :platform="form.platform" :data="form" scene="ISSUE" prop="issueTemplateId"
:disabled="form.platform === 'Jira' && form.thirdPartTemplate"
:platformOptions="issueOptions"
ref="issueTemplate"/>
<el-checkbox @change="thirdPartTemplateChange" v-if="form.platform === 'Jira'" v-model="form.thirdPartTemplate" style="margin-left: 10px">
<el-checkbox @change="thirdPartTemplateChange" v-if="form.platform === 'Jira'"
v-model="form.thirdPartTemplate" style="margin-left: 10px">
{{ $t('test_track.issue.use_third_party') }}
</el-checkbox>
@ -163,7 +166,8 @@ export default {
},
screenHeight: 'calc(100vh - 195px)',
labelWidth: '150px',
platformOptions: []
platformOptions: [],
issueOptions: []
};
},
props: {
@ -212,11 +216,11 @@ export default {
this.form.issueTemplateId = '';
},
edit(row) {
this.title = this.$t('project.edit');
this.getOptions();
this.createVisible = true;
listenGoBack(this.handleClose);
if (row) {
this.title = this.$t('project.edit');
row.issueConfigObj = row.issueConfig ? JSON.parse(row.issueConfig) : {};
this.form = Object.assign({}, row);
} else {
@ -231,6 +235,7 @@ export default {
this.filterPlatformOptions(platforms, JIRA);
this.filterPlatformOptions(platforms, ZEN_TAO);
this.filterPlatformOptions(platforms, AZURE_DEVOPS);
this.issueOptions = this.platformOptions;
});
},
filterPlatformOptions(platforms, platform) {

View File

@ -20,6 +20,7 @@ export default {
scene: String,
prop: String,
platform: String,
platformOptions: Array,
disabled: Boolean,
data: {
type: Object,
@ -80,17 +81,44 @@ export default {
this.templateOptions.forEach(i => {
if (i.platform === this.platform) {
this.templateFilterOptions.push(i);
if (i.id === this.data[this.prop])
if (i.id === this.data[this.prop]) {
hasTemplate = true;
}
}
});
if (!hasTemplate)
if (!hasTemplate) {
this.data[this.prop] = null;
}
} else {
if (this.scene === 'ISSUE') {
let hasTemplate = false;
this.templateFilterOptions = [];
this.templateOptions.forEach(template => {
if (this.platformOptions.length > 0) {
this.platformOptions.forEach(item => {
if (template.platform === item.value) {
this.templateFilterOptions.push(template);
if (template.id === this.data[this.prop]) {
hasTemplate = true;
}
}
});
} else if (template.platform === 'Local') {
this.templateFilterOptions.push(template);
if (template.id === this.data[this.prop]) {
hasTemplate = true;
}
}
});
if (!hasTemplate) {
this.data[this.prop] = null;
}
} else {
this.templateFilterOptions = this.templateOptions;
}
}
}
}
};
</script>