导入模型修复

dev_2022-03-03
yujialong 3 years ago
parent 50e789bfd2
commit a2a546099b
  1. 1
      src/components/Sidebar.vue
  2. 23
      src/utils/api.js
  3. 80
      src/views/serve/backstage/model.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)

@ -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`, //批量删除角色

@ -44,6 +44,7 @@
<el-dialog title="请选择需要导入的模型" :visible.sync="modelVisible" width="500px" class="dialog" :close-on-click-modal="false">
<div class="model-wrap">
<el-tree
v-if="modelData.length"
:data="modelData" v-loading="modelLoading"
ref="model"
default-expand-all
@ -51,6 +52,7 @@
node-key="id"
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}">
</el-tree>
<div class="none" v-else>暂无可导入的模型</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="modelVisible = false"> </el-button>
@ -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)
// disabledtrue
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;
}
}
</style>
Loading…
Cancel
Save