From 73c5c6eb31823efd2c0ea26211de97c358eedf4e Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Mon, 28 Mar 2022 17:23:41 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=BC=BA=E9=99=B7=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E7=BC=BA=E9=99=B7=E6=A8=A1=E6=9D=BF=E9=BB=98=E8=AE=A4=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=20=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=90=8E=EF=BC=8C=E6=B2=A1=E6=9C=89=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E5=90=8C=E6=AD=A5=E5=88=B0=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E8=A1=A8=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1011613 --user=李玉号 【测试跟踪】-缺陷模板默认项目 添加自定义字段后,没有直接同步到自定义表头,需要手动加入下 https://www.tapd.cn/55049933/s/1126688 --- .../components/table/MsCustomTableHeader.vue | 14 ++++++++++++-- .../components/project/menu/EditProject.vue | 8 +++++++- .../business/components/track/issue/IssueList.vue | 3 +++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/frontend/src/business/components/common/components/table/MsCustomTableHeader.vue b/frontend/src/business/components/common/components/table/MsCustomTableHeader.vue index 0d5b3482a1..242c3f1e63 100644 --- a/frontend/src/business/components/common/components/table/MsCustomTableHeader.vue +++ b/frontend/src/business/components/common/components/table/MsCustomTableHeader.vue @@ -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() { diff --git a/frontend/src/business/components/project/menu/EditProject.vue b/frontend/src/business/components/project/menu/EditProject.vue index 0dde882a72..a574870011 100644 --- a/frontend/src/business/components/project/menu/EditProject.vue +++ b/frontend/src/business/components/project/menu/EditProject.vue @@ -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(); diff --git a/frontend/src/business/components/track/issue/IssueList.vue b/frontend/src/business/components/track/issue/IssueList.vue index 5e5c557f1c..cc4ca7fd7b 100644 --- a/frontend/src/business/components/track/issue/IssueList.vue +++ b/frontend/src/business/components/track/issue/IssueList.vue @@ -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(); },