From dbdc95098953f097e04a9183a42160ff7987c493 Mon Sep 17 00:00:00 2001 From: Seth Ladygo Date: Fri, 31 May 2019 03:53:05 -0700 Subject: [PATCH] cateditor: fix setting model name --- cateditor/src/components/ModelInfoDialog.vue | 4 +++- cateditor/src/pages/editor/store/index.js | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/cateditor/src/components/ModelInfoDialog.vue b/cateditor/src/components/ModelInfoDialog.vue index 91176ec..8c714ba 100644 --- a/cateditor/src/components/ModelInfoDialog.vue +++ b/cateditor/src/components/ModelInfoDialog.vue @@ -52,8 +52,9 @@ export default { return model ? model.name : '(none)' }, set(value) { + var section = this.selectedSection() var model = this.selectedModel() - this.setModelName({ model: model, name: value }) + this.setModelName({ section: section, model: model, name: value }) } }, @@ -68,6 +69,7 @@ export default { methods: { ...mapGetters([ + 'selectedSection', 'selectedModel', ]), ...mapActions([ diff --git a/cateditor/src/pages/editor/store/index.js b/cateditor/src/pages/editor/store/index.js index 9db3131..0d6b065 100644 --- a/cateditor/src/pages/editor/store/index.js +++ b/cateditor/src/pages/editor/store/index.js @@ -158,8 +158,15 @@ export const store = new Vuex.Store({ } }, - setModelName(state, { model, name }) { - model.name = name + setModelName(state, { section, model, name }) { + let catSection = state.catalog.sections.find(s => s.id === section.id) + for (let catPage of catSection.pages) { + for (let catModel of catPage) { + if (catModel.model === model.model) { + catModel.name = name + } + } + } }, addMaterialsToLibrary(state, materials) {