From a0fb7301a4c72b5dbc171447a44183811e903c74 Mon Sep 17 00:00:00 2001 From: v_xugzhou <941071842@qq.com> Date: Fri, 20 Dec 2024 11:56:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=B1=E4=BA=AB=E5=88=B0=E5=95=86?= =?UTF-8?q?=E5=BA=97=E4=BE=A7=E6=A0=8F=E4=BF=9D=E5=AD=98=E4=BC=A0=E5=8F=82?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D=20--stor?= =?UTF-8?q?y=3D121000017=20#=20Reviewed,=20transaction=20id:=2027364?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SharedTemplate/SharedTplSlider.vue | 30 ++++++++++++++----- .../SharedTemplate/markdownEditor/editor.vue | 6 +++- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/frontend/desktop/src/pages/template/TemplateList/SharedTemplate/SharedTplSlider.vue b/frontend/desktop/src/pages/template/TemplateList/SharedTemplate/SharedTplSlider.vue index 1b09dba3c..a05869c49 100644 --- a/frontend/desktop/src/pages/template/TemplateList/SharedTemplate/SharedTplSlider.vue +++ b/frontend/desktop/src/pages/template/TemplateList/SharedTemplate/SharedTplSlider.vue @@ -45,7 +45,7 @@ - + item.id === val) || {} + const { risk_level: riskLevel, usage_content: content } = selectInfo Object.assign(this.formData, selectInfo, { - name: val, - usage_content: { content: selectInfo.usage_content } + risk_level: String(riskLevel), + usage_content: { content } }) }, onCategorySelect (node) { @@ -304,12 +311,21 @@ try { if (!result) return this.saveLoading = true - await this.sharedTemplateRecord({ + const params = { ...this.formData, project_code: this.project_id, - template_ids: this.selected.map(item => item.id), creator: this.username - }) + } + + const selectedTplIds = this.selected.map(item => item.id) + // 更新 + if (params.id) { + const existTplIds = params.templates.map(item => item.id) + selectedTplIds.push(...existTplIds) + } + params.template_ids = [...new Set(selectedTplIds)] + + await this.sharedTemplateRecord(params) this.showSuccessMessage() this.$emit('close') } catch (error) { diff --git a/frontend/desktop/src/pages/template/TemplateList/SharedTemplate/markdownEditor/editor.vue b/frontend/desktop/src/pages/template/TemplateList/SharedTemplate/markdownEditor/editor.vue index 04ceb4771..c73ce3fd3 100644 --- a/frontend/desktop/src/pages/template/TemplateList/SharedTemplate/markdownEditor/editor.vue +++ b/frontend/desktop/src/pages/template/TemplateList/SharedTemplate/markdownEditor/editor.vue @@ -9,6 +9,10 @@ import axios from 'axios' export default { + model: { + prop: 'value', + event: 'change' + }, props: { code: { type: String, @@ -57,7 +61,7 @@ }) this.editor.addHook('addImageBlobHook', this.handleFileUpload) this.editor.on('change', () => { - this.$emit('update:value', this.editor.getMarkdown()) + this.$emit('change', this.editor.getMarkdown()) }) this.editor.removeToolbarItem('codeblock') }, 500)