fix(项目设置): 项目编辑插件化兼容旧数据
This commit is contained in:
parent
898cb24d01
commit
109dd8cc27
|
@ -52,8 +52,9 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<project-platform-config
|
<project-platform-config
|
||||||
v-if="form.platform === 'Jira'"
|
v-if="showPlatformConfig"
|
||||||
:result="jiraResult"
|
:result="jiraResult"
|
||||||
|
:project="form"
|
||||||
:platform-key="form.platform"
|
:platform-key="form.platform"
|
||||||
:label-width="labelWidth"
|
:label-width="labelWidth"
|
||||||
:project-config="platformConfig"
|
:project-config="platformConfig"
|
||||||
|
@ -205,6 +206,9 @@ export default {
|
||||||
},
|
},
|
||||||
thirdPartTemplateSupport() {
|
thirdPartTemplateSupport() {
|
||||||
return this.thirdPartTemplateSupportPlatforms.indexOf(this.form.platform) > -1;
|
return this.thirdPartTemplateSupportPlatforms.indexOf(this.form.platform) > -1;
|
||||||
|
},
|
||||||
|
showPlatformConfig() {
|
||||||
|
return ISSUE_PLATFORM_OPTION.map(item => item.value).indexOf(this.form.platform) < 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
inject: ['reload'],
|
inject: ['reload'],
|
||||||
|
|
|
@ -59,6 +59,12 @@ export default {
|
||||||
default() {
|
default() {
|
||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
project: {
|
||||||
|
type: Object,
|
||||||
|
default() {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
@ -83,6 +89,8 @@ export default {
|
||||||
.then(r => {
|
.then(r => {
|
||||||
if (r.data) {
|
if (r.data) {
|
||||||
Object.assign(this.form, this.projectConfig);
|
Object.assign(this.form, this.projectConfig);
|
||||||
|
this.handleProjectConfigCompatible();
|
||||||
|
|
||||||
r.data.formItems.forEach(item => {
|
r.data.formItems.forEach(item => {
|
||||||
if (!item.options) {
|
if (!item.options) {
|
||||||
item.options = [];
|
item.options = [];
|
||||||
|
@ -112,6 +120,18 @@ export default {
|
||||||
this.$success(this.$t("pj.check_third_project_success"));
|
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() {
|
validate() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.$refs['form'].validate((valid) => {
|
this.$refs['form'].validate((valid) => {
|
||||||
|
|
|
@ -52,8 +52,9 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<project-platform-config
|
<project-platform-config
|
||||||
v-if="form.platform === 'Jira'"
|
v-if="showPlatformConfig"
|
||||||
:result="jiraResult"
|
:result="jiraResult"
|
||||||
|
:project="form"
|
||||||
:platform-key="form.platform"
|
:platform-key="form.platform"
|
||||||
:label-width="labelWidth"
|
:label-width="labelWidth"
|
||||||
:project-config="platformConfig"
|
:project-config="platformConfig"
|
||||||
|
@ -201,6 +202,9 @@ export default {
|
||||||
},
|
},
|
||||||
thirdPartTemplateSupport() {
|
thirdPartTemplateSupport() {
|
||||||
return this.thirdPartTemplateSupportPlatforms.indexOf(this.form.platform) > -1;
|
return this.thirdPartTemplateSupportPlatforms.indexOf(this.form.platform) > -1;
|
||||||
|
},
|
||||||
|
showPlatformConfig() {
|
||||||
|
return ISSUE_PLATFORM_OPTION.map(item => item.value).indexOf(this.form.platform) < 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
inject: ['reload'],
|
inject: ['reload'],
|
||||||
|
|
|
@ -59,6 +59,12 @@ export default {
|
||||||
default() {
|
default() {
|
||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
project: {
|
||||||
|
type: Object,
|
||||||
|
default() {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
@ -82,6 +88,8 @@ export default {
|
||||||
.then(r => {
|
.then(r => {
|
||||||
if (r.data) {
|
if (r.data) {
|
||||||
Object.assign(this.form, this.projectConfig);
|
Object.assign(this.form, this.projectConfig);
|
||||||
|
this.handleProjectConfigCompatible();
|
||||||
|
|
||||||
r.data.formItems.forEach(item => {
|
r.data.formItems.forEach(item => {
|
||||||
if (!item.options) {
|
if (!item.options) {
|
||||||
item.options = [];
|
item.options = [];
|
||||||
|
@ -111,6 +119,18 @@ export default {
|
||||||
this.$success(this.$t("system.check_third_project_success"));
|
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() {
|
validate() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.$refs['form'].validate((valid) => {
|
this.$refs['form'].validate((valid) => {
|
||||||
|
|
Loading…
Reference in New Issue