3.22 供应商关联关系3.15版

This commit is contained in:
jl-zhoujl2
2023-03-22 14:01:58 +08:00
parent 448fd1edd6
commit 6f4bbd0f8a
4 changed files with 299 additions and 111 deletions

View File

@ -79,13 +79,93 @@ const EquityRelation: React.FC<{ result: any, suppCodeList: any[] }> = (props) =
}
//数据处理
function dataHandle(nodes: any[] | undefined, links: any[] | undefined) {
// //处理右侧数据
// const valueList = nodes ? nodes : []
// valueList.map((item) => {
// Object.assign(item, {
// name: item.name ? item.name : item.properties?.samevalue ? item.properties?.samevalue : '暂无信息',
// // category: item.isProvider == 1 ? 1 : 2,
// category: suppCodeList.findIndex(ite => ite.companyName == item.name) !== -1 ? 3 : (item.type == 1 ? 1 : 2),//从珊珊拿全部供应商
// id: item.id,
// })
// return item
// })
// setSuppListTrans([...valueList])
// let mapList = links ? links : []
// let copeLink1 = JSON.parse(JSON.stringify(mapList))
// if (copeLink1.length > 0) {
// for (let i = 0; i < copeLink1.length; i++) {
// if (copeLink1[i].type == 2) {
// copeLink1[i].type = copeLink1[i].properties.position_desc
// } else {
// if (copeLink1[i].type == 1) {
// copeLink1[i].type = '投资' + multiply(copeLink1[i].properties.conprop, 100) + '%'
// } else {
// copeLink1[i].type = doType(copeLink1[i].type)
// }
// }
// //手动去重
// for (let j = i + 1; j < copeLink1.length; j++) {
// if (copeLink1[i].from == copeLink1[j].from && copeLink1[i].to == copeLink1[j].to && copeLink1[j].type) {
// //type=2 需提前处理
// if (copeLink1[j].type == 1) {
// copeLink1[j].type = '投资' + multiply(copeLink1[j].properties.conprop, 100) + '%'
// } else if (copeLink1[j].type == 2) {
// copeLink1[i].type = copeLink1[i].type + ',' + copeLink1[j].properties.position_desc
// copeLink1[j].type = ''
// } else {
// if (copeLink1[j].type != 2) {
// copeLink1[j].type = doType(copeLink1[j].type)
// }
// }
// //拼接相同类型的type
// if (copeLink1[i].type.substring(copeLink1[i].type.length - 1, copeLink1[i].type.length) == ',') {
// copeLink1[i].type = copeLink1[i].type + copeLink1[j].type
// } else {
// copeLink1[i].type = copeLink1[i].type + ',' + copeLink1[j].type
// }
// copeLink1[j].type = ''
// } else {
// //type=1 需提前处理
// if (copeLink1[j].type == 1) {
// copeLink1[j].type = '投资' + multiply(copeLink1[j].properties.conprop, 100) + '%,'
// } else if (copeLink1[j].type == 2) {
// copeLink1[j].type = copeLink1[j].properties.position_desc
// } else {
// if (copeLink1[j].type != 2) {
// copeLink1[j].type = doType(copeLink1[j].type)
// }
// }
// continue;
// }
// }
// }
// }
// copeLink1.map((item: any) => {
// Object.assign(item, {
// source: item.from,
// target: item.to,
// label: {
// show: true,
// fontSize: 12,
// verticalAlign: 'bottom',
// formatter: () => {
// return item.type
// },
// },
// id: item.id,
// flag: false
// })
// return item
// })
// setLinkData(copeLink1)
//处理右侧数据
const valueList = nodes ? nodes : []
valueList.map((item) => {
Object.assign(item, {
name: item.name ? item.name : item.properties?.samevalue ? item.properties?.samevalue : '暂无信息',
name: item.name ? item.name : item.properties.samevalue ? item.properties.samevalue : '暂无信息',
// category: item.isProvider == 1 ? 1 : 2,
category: suppCodeList.findIndex(ite => ite.companyName == item.name) !== -1 ? 3 : (item.type == 1 ? 1 : 2),//从珊珊拿全部供应商
category: suppCodeList.indexOf(item.name) !== -1 ? 3 : (item.type == 1 ? 1 : 2),
id: item.id,
})
return item
@ -99,24 +179,35 @@ const EquityRelation: React.FC<{ result: any, suppCodeList: any[] }> = (props) =
copeLink1[i].type = copeLink1[i].properties.position_desc
} else {
if (copeLink1[i].type == 1) {
copeLink1[i].type = '投资' + multiply(copeLink1[i].properties.conprop, 100) + '%'
if (copeLink1[i].properties.conprop) {
copeLink1[i].type = '投资' + multiply(copeLink1[i].properties.conprop, 100) + '%'
} else if (copeLink1[i].properties.holderrto) {
copeLink1[i].type = '投资' + copeLink1[i].properties.holderrto + '%'
}
} else {
copeLink1[i].type = doType(copeLink1[i].type)
}
}
//手动去重
//手动拼接
/* eslint-disable */
for (let j = i + 1; j < copeLink1.length; j++) {
if (copeLink1[i].from == copeLink1[j].from && copeLink1[i].to == copeLink1[j].to && copeLink1[j].type) {
//type=2 需提前处理
if (copeLink1[j].type == 1) {
copeLink1[j].type = '投资' + multiply(copeLink1[j].properties.conprop, 100) + '%'
} else if (copeLink1[j].type == 2) {
copeLink1[i].type = copeLink1[i].type + ',' + copeLink1[j].properties.position_desc
copeLink1[j].type = ''
} else {
if (copeLink1[j].type != 2) {
copeLink1[j].type = doType(copeLink1[j].type)
if (copeLink1[j].properties.conprop) {
copeLink1[j].type = '投资' + multiply(copeLink1[j].properties.conprop, 100) + '%'
} else if (copeLink1[j].properties.holderrto) {
copeLink1[j].type = '投资' + copeLink1[j].properties.holderrto + '%'
}
} else if (copeLink1[j].type == 2) {
copeLink1[j].type = copeLink1[j].properties.position_desc
// copeLink1[i].type=copeLink1[i].type+','+copeLink1[j].properties.position_desc
// copeLink1[j].type=''
} else {
// if(copeLink1[j].type !=2){
copeLink1[j].type = doType(copeLink1[j].type)
// }
}
//拼接相同类型的type
if (copeLink1[i].type.substring(copeLink1[i].type.length - 1, copeLink1[i].type.length) == ',') {
@ -125,21 +216,29 @@ const EquityRelation: React.FC<{ result: any, suppCodeList: any[] }> = (props) =
copeLink1[i].type = copeLink1[i].type + ',' + copeLink1[j].type
}
copeLink1[j].type = ''
} else {
//type=1 需提前处理
if (copeLink1[j].type == 1) {
copeLink1[j].type = '投资' + multiply(copeLink1[j].properties.conprop, 100) + '%,'
} else if (copeLink1[j].type == 2) {
copeLink1[j].type = copeLink1[j].properties.position_desc
} else {
if (copeLink1[j].type != 2) {
copeLink1[j].type = doType(copeLink1[j].type)
}
}
continue;
}
// else{
// // //type=1 需提前处理
// // if(copeLink1[j].type==1){
// // if(copeLink1[j].properties.conprop){
// // copeLink1[j].type='投资'+ multiply(copeLink1[j].properties.conprop,100) +'%'
// // }else if(copeLink1[j].properties.holderrto){
// // copeLink1[j].type='投资'+ copeLink1[j].properties.holderrto +'%'
// // }
// // }else if(copeLink1[j].type==2){
// // copeLink1[j].type=copeLink1[j].properties.position_desc
// // }else{
// // if(copeLink1[j].type !=2){
// // copeLink1[j].type=doType(copeLink1[j].type)
// // }
// // }
// // continue;
// }
}
}
}
copeLink1.map((item: any) => {
Object.assign(item, {