diff --git a/src/components/Sidebar.vue b/src/components/Sidebar.vue index a46ea62..832e786 100644 --- a/src/components/Sidebar.vue +++ b/src/components/Sidebar.vue @@ -119,7 +119,6 @@ export default { initMenu() { if (Setting.dynamicRoute) { const routes = this.$store.state.routes - console.log("🚀 ~ file: Sidebar.vue ~ line 122 ~ initMenu ~ routes", routes) const menus = [] this.menuList.map(e => { routes.find(n => n.path === e.index) && menus.push(e) diff --git a/src/utils/api.js b/src/utils/api.js index 9c771b0..7656723 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -1,7 +1,6 @@ import Setting from "@/setting"; const uploadURL = Setting.uploadURL -const host1 = 'http://39.108.250.202:9000/' export default { @@ -218,17 +217,17 @@ export default { getKeywordByCategoryId: `data/keyword/getKeywordByCategoryId`, // 后台账号 - deleteArch: `${host1}nakadai/staffAccountArchitecture/delete`, - saveArch: `${host1}nakadai/staffAccountArchitecture/save`, - treeListArch: `${host1}nakadai/staffAccountArchitecture/treeList`, - updateArch: `${host1}nakadai/staffAccountArchitecture/update`, - delStaff: `${host1}nakadai/backstageStaff/delStaff`, - modifyStaff: `${host1}nakadai/backstageStaff/modifyStaff`, - saveStaff: `${host1}nakadai/backstageStaff/saveStaff`, - staffDetail: `${host1}nakadai/backstageStaff/staffDetail`, - staffList: `${host1}nakadai/backstageStaff/staffList`, - importStaff: `${host1}nakadai/backstageStaff/importStaff`, - exportFailure: `${host1}nakadai/backstageStaff/exportFailure`, + deleteArch: `nakadai/staffAccountArchitecture/delete`, + saveArch: `nakadai/staffAccountArchitecture/save`, + treeListArch: `nakadai/staffAccountArchitecture/treeList`, + updateArch: `nakadai/staffAccountArchitecture/update`, + delStaff: `nakadai/backstageStaff/delStaff`, + modifyStaff: `nakadai/backstageStaff/modifyStaff`, + saveStaff: `nakadai/backstageStaff/saveStaff`, + staffDetail: `nakadai/backstageStaff/staffDetail`, + staffList: `nakadai/backstageStaff/staffList`, + importStaff: `nakadai/backstageStaff/importStaff`, + exportFailure: `nakadai/backstageStaff/exportFailure`, // 角色管理 batchRemove: `users/role/batchRemove`, //批量删除角色 diff --git a/src/views/serve/backstage/model.vue b/src/views/serve/backstage/model.vue index 678be8c..fef7277 100644 --- a/src/views/serve/backstage/model.vue +++ b/src/views/serve/backstage/model.vue @@ -43,7 +43,8 @@
- +
暂无可导入的模型
取 消 @@ -137,10 +139,10 @@ export default { // 查询源模型分类 this.$post(this.api.sourceModelClassification).then(res => { - const { data } = res + let { data } = res const promises = [] const addType = list => { - list.map(e => { + list.map((e, i) => { // 用promise储存以添加完后更新数据 promises.push(new Promise((resolve,reject) => { // 获取源模型列表 @@ -158,7 +160,12 @@ export default { modelChildren.push(n) } }) - e.children = [...e.children, ...modelChildren] + // 如果有未导入的模型,则添加到子级,否则设置为disabled + if (modelChildren.length) { + e.children = [...e.children, ...modelChildren] + } else { + e.disabled = true + } resolve() }).catch(res => { reject() @@ -168,13 +175,27 @@ export default { }) } addType(data) + // 筛选出disabled不为true的分类,因为没有模型的分类不需要展示 + const handleType = list => { + return list.filter((e, i) => { + return !e.disabled + }).map(e => { + if (e.children) { + e.children = handleType(e.children) + } + return e + }) + } Promise.all(promises).then(_ => { - this.modelData = data - this.modelLoading = false + data = handleType(data) + this.modelData = data + this.modelLoading = false }).catch(res => {}) }).catch(res => {}) }).catch(res => {}) }, + // 把删除了的分类去除 + // 查看模型 show(row) { this.$router.push(`/addModel?categoryId=${this.$refs.tree.$refs.tree.getCurrentKey()}&id=${row.id}&show=1&model=1`) @@ -219,27 +240,32 @@ export default { if (this.submiting) return false const data = [] const systemId = this.systemId - const list = this.$refs.model.getCheckedNodes() // 获取选择的分类模型 - const categoryId = this.$refs.tree.$refs.tree.getCurrentKey() // 获取当前分类 - if (!list.length) return this.$message.error('请选择模型') - this.submiting = true - list.map(e => { - // 有categoryId的才是模型,只导入模型,不导入分类 - e.categoryId && data.push({ - systemId, - categoryId, - copyId: e.id + if (this.$refs.model) { + const list = this.$refs.model.getCheckedNodes() // 获取选择的分类模型 + const categoryId = this.$refs.tree.$refs.tree.getCurrentKey() // 获取当前分类 + if (!list.length) return this.$message.error('请选择模型') + this.submiting = true + list.map(e => { + // 有categoryId的才是模型,只导入模型,不导入分类 + e.categoryId && data.push({ + systemId, + categoryId, + copyId: e.id + }) }) - }) - this.$post(this.api.saveReferenceDemo, data).then(res => { - this.modelVisible = false - this.initData() - setTimeout(() => { - this.submiting = false - }, 2000) - }).catch(res => { - this.submiting = false - }) + this.$post(this.api.saveReferenceDemo, data).then(res => { + this.modelVisible = false + this.initData() + setTimeout(() => { + this.submiting = false + }, 2000) + }).catch(res => { + this.submiting = false + }) + } else { + this.submiting = false + this.modelVisible = false + } } } }; @@ -266,5 +292,9 @@ export default { .model-wrap { max-height: 400px; overflow: auto; + .none { + text-align: center; + color: #8b8b8b; + } } \ No newline at end of file