diff --git a/src/renderer/src/components/template-study/container/keyword-dialog.vue b/src/renderer/src/components/template-study/container/keyword-dialog.vue index 4eb1cd2..bdd6c29 100644 --- a/src/renderer/src/components/template-study/container/keyword-dialog.vue +++ b/src/renderer/src/components/template-study/container/keyword-dialog.vue @@ -40,7 +40,7 @@ const props = defineProps({ type: Number, default: 1 }, - item: { // 子模板 + item: { // 当前操作的模板 type: Object, default: () => { return { ex3: '' } @@ -73,23 +73,25 @@ const loading = ref(false) const saveAdd = async () => { loading.value = true if (props.item.ex3 == '1') { - + let id; // id 为主模板id if (props.item.isAdd) { - try { - // 系统预设模板 copy一份 - const { msg } = await addKeyWords({ name: form.name, id: props.item.id }) - emitter.emit('onGetMain') - ElMessage.success(msg) - mode.value = false - } finally { - loading.value = false - } + id = props.item.id } else{ - onAddChildTemp(props.item.parentId) + // 编辑状态下 item 为子模板 主模板则是item.parentId + id = props.item.parentId } + try { + // 系统预设模板 copy一份 + const { msg } = await addKeyWords({ name: form.name, id }) + emitter.emit('onGetMain') + ElMessage.success(msg) + mode.value = false + } finally { + loading.value = false + } + } else { - if (props.item.isAdd) { onAddChildTemp(props.item.id) } diff --git a/src/renderer/src/components/template-study/container/left.vue b/src/renderer/src/components/template-study/container/left.vue index 02db0d4..d2b9285 100644 --- a/src/renderer/src/components/template-study/container/left.vue +++ b/src/renderer/src/components/template-study/container/left.vue @@ -16,12 +16,12 @@ \ No newline at end of file diff --git a/src/renderer/src/views/teachingDesign/container/left.vue b/src/renderer/src/views/teachingDesign/container/left.vue index ab6f38b..7df70fa 100644 --- a/src/renderer/src/views/teachingDesign/container/left.vue +++ b/src/renderer/src/views/teachingDesign/container/left.vue @@ -2,6 +2,7 @@