fix(项目设置): 项目编辑插件化兼容旧数据

This commit is contained in:
chenjianxing 2022-11-23 19:59:47 +08:00 committed by jianxing
parent 9a62918734
commit 94b753ed87
4 changed files with 50 additions and 2 deletions

View File

@ -52,8 +52,9 @@
</el-form-item>
<project-platform-config
v-if="form.platform === 'Jira'"
v-if="showPlatformConfig"
:result="jiraResult"
:project="form"
:platform-key="form.platform"
:label-width="labelWidth"
:project-config="platformConfig"
@ -205,6 +206,9 @@ export default {
},
thirdPartTemplateSupport() {
return this.thirdPartTemplateSupportPlatforms.indexOf(this.form.platform) > -1;
},
showPlatformConfig() {
return ISSUE_PLATFORM_OPTION.map(item => item.value).indexOf(this.form.platform) < 0;
}
},
inject: ['reload'],

View File

@ -59,6 +59,12 @@ export default {
default() {
return {}
},
},
project: {
type: Object,
default() {
return {}
}
}
},
data() {
@ -83,6 +89,8 @@ export default {
.then(r => {
if (r.data) {
Object.assign(this.form, this.projectConfig);
this.handleProjectConfigCompatible();
r.data.formItems.forEach(item => {
if (!item.options) {
item.options = [];
@ -112,6 +120,18 @@ export default {
this.$success(this.$t("pj.check_third_project_success"));
});
},
handleProjectConfigCompatible() {
this._handleProjectConfigCompatible("jiraKey");
this._handleProjectConfigCompatible("tapdId");
this._handleProjectConfigCompatible("azureDevopsId");
this._handleProjectConfigCompatible("zentaoId");
},
_handleProjectConfigCompatible(prop) {
if (!this.form[prop] && this.project[prop]) {
//
this.form[prop] = this.project[prop];
}
},
validate() {
return new Promise((resolve, reject) => {
this.$refs['form'].validate((valid) => {

View File

@ -52,8 +52,9 @@
</el-form-item>
<project-platform-config
v-if="form.platform === 'Jira'"
v-if="showPlatformConfig"
:result="jiraResult"
:project="form"
:platform-key="form.platform"
:label-width="labelWidth"
:project-config="platformConfig"
@ -201,6 +202,9 @@ export default {
},
thirdPartTemplateSupport() {
return this.thirdPartTemplateSupportPlatforms.indexOf(this.form.platform) > -1;
},
showPlatformConfig() {
return ISSUE_PLATFORM_OPTION.map(item => item.value).indexOf(this.form.platform) < 0;
}
},
inject: ['reload'],

View File

@ -59,6 +59,12 @@ export default {
default() {
return {}
},
},
project: {
type: Object,
default() {
return {}
}
}
},
data() {
@ -82,6 +88,8 @@ export default {
.then(r => {
if (r.data) {
Object.assign(this.form, this.projectConfig);
this.handleProjectConfigCompatible();
r.data.formItems.forEach(item => {
if (!item.options) {
item.options = [];
@ -111,6 +119,18 @@ export default {
this.$success(this.$t("system.check_third_project_success"));
});
},
handleProjectConfigCompatible() {
this._handleProjectConfigCompatible("jiraKey");
this._handleProjectConfigCompatible("tapdId");
this._handleProjectConfigCompatible("azureDevopsId");
this._handleProjectConfigCompatible("zentaoId");
},
_handleProjectConfigCompatible(prop) {
if (!this.form[prop] && this.project[prop]) {
//
this.form[prop] = this.project[prop];
}
},
validate() {
return new Promise((resolve, reject) => {
this.$refs['form'].validate((valid) => {