diff --git a/src/components/Common/commonFunc.js b/src/components/Common/commonFunc.js index 35a0132..a3b15d0 100644 --- a/src/components/Common/commonFunc.js +++ b/src/components/Common/commonFunc.js @@ -808,6 +808,35 @@ export function getAllTableConfig(props) { return allTableConfig; } +/* 找到触发行 所关联的所有子表数据 */ +export function getChildData(sParentId, tableData) { + let children = []; + + const filterData = tableData.filter(item => item.sFatherSlaveId === sParentId); + if (commonUtils.isNotEmptyArr(filterData)) { + filterData.forEach((rowData) => { + const sFatherSlaveId = rowData.sId; + if (commonUtils.isNotEmptyObject(sParentId) && commonUtils.isNotEmptyArr(tableData)) { + const childData = commonUtils.isNotEmptyArr(tableData) ? tableData.filter(item => item.sFatherSlaveId === sFatherSlaveId) : []; + if (commonUtils.isNotEmptyArr(childData)) { + childData.forEach((child) => { + const { sId } = child; + children.push(child); + const data = this.getChildData(sId, tableData); + if (commonUtils.isNotEmptyArr(data)) { + children = children.concat(data); + } + }); + } else { + children.push(rowData); + } + } + }); + } + + return children; +} + export function getEvalResult(params) { const { props,