diff --git a/frontend/src/business/components/settings/workspace/template/IssueTemplateEdit.vue b/frontend/src/business/components/settings/workspace/template/IssueTemplateEdit.vue index d4e6b7a0f7..dd094eb5bd 100644 --- a/frontend/src/business/components/settings/workspace/template/IssueTemplateEdit.vue +++ b/frontend/src/business/components/settings/workspace/template/IssueTemplateEdit.vue @@ -89,17 +89,16 @@ export default { } }, methods: { - open(data) { + open(data, isCopy) { if (data) { Object.assign(this.form, data); if (!(data.options instanceof Array)) { this.form.options = data.options ? JSON.parse(data.options) : []; } - if (data.id) { - this.url = 'field/template/issue/update'; - } else { - //copy + if (isCopy) { this.url = 'field/template/issue/add'; + } else { + this.url = 'field/template/issue/update'; } } else { this.form = { diff --git a/frontend/src/business/components/settings/workspace/template/IssuesTemplateList.vue b/frontend/src/business/components/settings/workspace/template/IssuesTemplateList.vue index d415c35bf9..ab1c7ad595 100644 --- a/frontend/src/business/components/settings/workspace/template/IssuesTemplateList.vue +++ b/frontend/src/business/components/settings/workspace/template/IssuesTemplateList.vue @@ -152,9 +152,8 @@ export default { handleCopy(data) { let copyData = {}; Object.assign(copyData, data); - copyData.id = null; copyData.name = data.name + '_copy'; - this.$refs.templateEdit.open(copyData); + this.$refs.templateEdit.open(copyData, true); }, handleDelete(data) { this.result = this.$get('field/template/issue/delete/' + data.id, () => { diff --git a/frontend/src/business/components/settings/workspace/template/TestCaseTemplateEdit.vue b/frontend/src/business/components/settings/workspace/template/TestCaseTemplateEdit.vue index a0c124ef19..71af6e5c84 100644 --- a/frontend/src/business/components/settings/workspace/template/TestCaseTemplateEdit.vue +++ b/frontend/src/business/components/settings/workspace/template/TestCaseTemplateEdit.vue @@ -93,17 +93,16 @@ export default { } }, methods: { - open(data) { + open(data, isCopy) { if (data) { Object.assign(this.form, data); if (!(data.options instanceof Array)) { this.form.options = data.options ? JSON.parse(data.options) : []; } - if (data.id) { - this.url = 'field/template/case/update'; - } else { - //copy + if (isCopy) { this.url = 'field/template/case/add'; + } else { + this.url = 'field/template/case/update'; } } else { this.form = { diff --git a/frontend/src/business/components/settings/workspace/template/TestCaseTemplateList.vue b/frontend/src/business/components/settings/workspace/template/TestCaseTemplateList.vue index 635aa8ba9d..5a6e4c352a 100644 --- a/frontend/src/business/components/settings/workspace/template/TestCaseTemplateList.vue +++ b/frontend/src/business/components/settings/workspace/template/TestCaseTemplateList.vue @@ -161,9 +161,8 @@ export default { handleCopy(data) { let copyData = {}; Object.assign(copyData, data); - copyData.id = null; copyData.name = data.name + '_copy'; - this.$refs.templateEdit.open(copyData); + this.$refs.templateEdit.open(copyData, true); }, handleDelete(data) { this.result = this.$get('field/template/case/delete/' + data.id, () => {