Commit 58c0232ce1dff22e86c2359a0f4bb62160551cdc
1 parent
9851e951
1.补充keyup事件,从表筛选子从表
Showing
1 changed file
with
29 additions
and
0 deletions
src/components/Common/commonFunc.js
| @@ -808,6 +808,35 @@ export function getAllTableConfig(props) { | @@ -808,6 +808,35 @@ export function getAllTableConfig(props) { | ||
| 808 | return allTableConfig; | 808 | return allTableConfig; |
| 809 | } | 809 | } |
| 810 | 810 | ||
| 811 | +/* 找到触发行 所关联的所有子表数据 */ | ||
| 812 | +export function getChildData(sParentId, tableData) { | ||
| 813 | + let children = []; | ||
| 814 | + | ||
| 815 | + const filterData = tableData.filter(item => item.sFatherSlaveId === sParentId); | ||
| 816 | + if (commonUtils.isNotEmptyArr(filterData)) { | ||
| 817 | + filterData.forEach((rowData) => { | ||
| 818 | + const sFatherSlaveId = rowData.sId; | ||
| 819 | + if (commonUtils.isNotEmptyObject(sParentId) && commonUtils.isNotEmptyArr(tableData)) { | ||
| 820 | + const childData = commonUtils.isNotEmptyArr(tableData) ? tableData.filter(item => item.sFatherSlaveId === sFatherSlaveId) : []; | ||
| 821 | + if (commonUtils.isNotEmptyArr(childData)) { | ||
| 822 | + childData.forEach((child) => { | ||
| 823 | + const { sId } = child; | ||
| 824 | + children.push(child); | ||
| 825 | + const data = this.getChildData(sId, tableData); | ||
| 826 | + if (commonUtils.isNotEmptyArr(data)) { | ||
| 827 | + children = children.concat(data); | ||
| 828 | + } | ||
| 829 | + }); | ||
| 830 | + } else { | ||
| 831 | + children.push(rowData); | ||
| 832 | + } | ||
| 833 | + } | ||
| 834 | + }); | ||
| 835 | + } | ||
| 836 | + | ||
| 837 | + return children; | ||
| 838 | +} | ||
| 839 | + | ||
| 811 | export function getEvalResult(params) { | 840 | export function getEvalResult(params) { |
| 812 | const { | 841 | const { |
| 813 | props, | 842 | props, |