|
@@ -743,8 +743,9 @@ export default {
|
|
|
async LoadData(currentData){
|
|
|
if(currentData.MindType == 1){//产品类别
|
|
|
var data1 = currentData
|
|
|
- //装载产品
|
|
|
- const [products] = await Promise.allSettled([this.initData(data1)])
|
|
|
+ //装载产品和架构
|
|
|
+ const [products,classificationNode] = await Promise.allSettled([this.initData(data1),this.initData(data1,2)])
|
|
|
+ //产品的装载
|
|
|
var productList = products.status =='fulfilled'?products.value:[]
|
|
|
if(productList.length>0){
|
|
|
data1.hasChildren = true
|
|
@@ -756,10 +757,25 @@ export default {
|
|
|
item.topic = this.getModelCardDom(item)
|
|
|
return item
|
|
|
})
|
|
|
+ }else{
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
+ // 产品类别架构的装载
|
|
|
+ var classificationNodes = classificationNode.status =='fulfilled'?classificationNode.value:[]
|
|
|
+ if(classificationNodes && classificationNodes.length){
|
|
|
+ data1.hasChildren = true
|
|
|
+ if(!data1.children){
|
|
|
+ data1.children = []
|
|
|
+ }
|
|
|
+ this.deepChildren(classificationNodes,data1)
|
|
|
+ data1.children.push(...classificationNodes)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
data1.topic = this.getModelCardDom(data1)
|
|
|
|
|
|
- //装载架构
|
|
|
+ //判断产品类别是否有产品
|
|
|
var data2 = data1.children
|
|
|
if(!data2){
|
|
|
return
|
|
@@ -767,11 +783,20 @@ export default {
|
|
|
// 获取需要返回的架构数组以及funList
|
|
|
var treeList = [], funList = []
|
|
|
for(var i = 0;i<data2.length;i++){
|
|
|
+ if(data2[i].MindType!=2){
|
|
|
+ continue
|
|
|
+ }
|
|
|
treeList.push(`tree${i+1}`)
|
|
|
funList.push(this.initData(data2[i]))
|
|
|
}
|
|
|
+ if(treeList.length == 0){
|
|
|
+ return
|
|
|
+ }
|
|
|
treeList = await Promise.allSettled(funList)
|
|
|
for(var i = 0;i<data2.length;i++){
|
|
|
+ if(data2[i].MindType!=2){
|
|
|
+ continue
|
|
|
+ }
|
|
|
var trees = treeList[i].status =='fulfilled'?treeList[i].value:[]
|
|
|
if(trees.length>0){
|
|
|
data2[i].hasChildren = true
|
|
@@ -792,7 +817,7 @@ export default {
|
|
|
}
|
|
|
data1.topic = this.getModelCardDom(data1)
|
|
|
data1.children = trees
|
|
|
- }else if(currentData.MindType == 0){//全部
|
|
|
+ }else if(currentData.MindType == 0){//全部,有错误
|
|
|
var data1 = currentData
|
|
|
//装载产品类别
|
|
|
const [category] = await Promise.allSettled([this.initData(data1)])
|
|
@@ -859,19 +884,19 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
//初始化JsMind数据
|
|
|
- async initData(currentData){
|
|
|
- if(currentData.MindType == 1){
|
|
|
+ async initData(currentData,type){
|
|
|
+ if(currentData.MindType == 1 && type!=2){//查询产品
|
|
|
let params = {
|
|
|
searchQuery:`category_id=${currentData.MindId}`,//检索条件
|
|
|
}
|
|
|
return await this.$api.queryProduct(params).then(response=> response.data.data)
|
|
|
- }else if(currentData.MindType == 2){//产品
|
|
|
+ }else if(currentData.MindType == 2 || type == 2){//查询产品架构
|
|
|
var params = {
|
|
|
type: currentData.MindType,
|
|
|
typeId: currentData.MindId
|
|
|
}
|
|
|
return await this.$api.queryTreeNodeTree(params).then(response=> response.data.data)
|
|
|
- }else if(currentData.MindType == 0){
|
|
|
+ }else if(currentData.MindType == 0){//查询产品类别
|
|
|
let params = {
|
|
|
searchQuery:'',//检索条件
|
|
|
}
|