fix(缺陷管理): 缺陷模板默认项目 添加自定义字段后,没有直接同步到自定义表头

--bug=1011613 --user=李玉号 【测试跟踪】-缺陷模板默认项目 添加自定义字段后,没有直接同步到自定义表头,需要手动加入下
https://www.tapd.cn/55049933/s/1126688
This commit is contained in:
shiziyuan9527 2022-03-28 17:23:41 +08:00 committed by shiziyuan9527
parent 34332f6f43
commit d3f5c6faae
3 changed files with 22 additions and 3 deletions

View File

@ -52,19 +52,29 @@ export default {
it.label = SYSTEM_FIELD_NAME_MAP[it.id] ? this.$t(SYSTEM_FIELD_NAME_MAP[it.id]) : it.label;
}
})
let hasRemoveField = undefined;
if (this.customFields) {
let index = this.customFields.findIndex(c => c.remove === true);
if (index > -1) {
hasRemoveField = this.customFields[index];
}
}
let fields = getAllFieldWithCustomFields(this.type, this.customFields);
this.selectedKeys = [];
this.fromFields = [];
this.selectedKeys = items.map(item => item.key);
this.selectedFields = items;
fields.forEach(field => {
for (let field of fields) {
if (this.selectedKeys.indexOf(field.key) < 0) {
if (field.isCustom) {
field.label = SYSTEM_FIELD_NAME_MAP[field.id] ? this.$t(SYSTEM_FIELD_NAME_MAP[field.id]) : field.label
}
if (hasRemoveField && field.id === hasRemoveField.id) {
continue;
}
this.fromFields.push(field);
}
});
}
this.visible = true;
},
saveHeader() {

View File

@ -155,7 +155,8 @@ export default {
screenHeight: 'calc(100vh - 195px)',
labelWidth: '150px',
platformOptions: [],
issueOptions: []
issueOptions: [],
issueTemplateId: ""
};
},
props: {
@ -220,6 +221,7 @@ export default {
this.title = this.$t('project.edit');
row.issueConfigObj = row.issueConfig ? JSON.parse(row.issueConfig) : {};
this.form = Object.assign({}, row);
this.issueTemplateId = row.issueTemplateId;
} else {
this.form = {issueConfigObj: {}};
}
@ -258,6 +260,10 @@ export default {
this.form.workspaceId = getCurrentWorkspaceId();
this.form.createUser = getCurrentUserId();
this.form.issueConfig = JSON.stringify(this.form.issueConfigObj);
if (this.issueTemplateId !== this.form.issueTemplateId) {
//
localStorage.removeItem("ISSUE_LIST");
}
this.result = this.$post("/project/" + saveType, this.form, () => {
this.createVisible = false;
this.reload();

View File

@ -280,6 +280,9 @@ export default {
break;
}
}
//
let removeField = {id: 'platformStatus', name: 'platformStatus', remove: true};
this.issueTemplate.customFields.push(removeField);
}
if (this.$refs.table) this.$refs.table.reloadTable();
},