fix(项目设置): 项目编辑插件化兼容旧数据
This commit is contained in:
parent
9a62918734
commit
94b753ed87
|
@ -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'],
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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'],
|
||||
|
|
|
@ -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) => {
|
||||
|
|
Loading…
Reference in New Issue