Commit a011fab46640c36c49a4cab3f62493907c17e6b2
1 parent
0834f470
1.处理界面加载时,因为主表从表查询异步的,导致从表无法拿到主表数据作数据传参
Showing
1 changed file
with
7 additions
and
5 deletions
src/components/Common/CommonNewTabBillEvent.js
| ... | ... | @@ -713,18 +713,20 @@ export default (ChildComponent) => { |
| 713 | 713 | |
| 714 | 714 | const masterConfig = configArr[0][1]; |
| 715 | 715 | const conditonValues = this.handleGetSqlConditionValues(masterConfig) |
| 716 | - await this.props.handleGetDataOne({ | |
| 716 | + const masterDataReturn = await this.props.handleGetDataOne({ | |
| 717 | 717 | name: 'master', |
| 718 | 718 | configData: masterConfig, |
| 719 | 719 | condition: { sSqlCondition: { ...conditonValues }, sId, pageSize: '', pageNum: '' }, |
| 720 | 720 | bEditClick, |
| 721 | + isWait: true, | |
| 721 | 722 | }); |
| 722 | - | |
| 723 | + const masterData= masterDataReturn?.masterData; | |
| 724 | + addState.masterData = masterData; | |
| 723 | 725 | for (let i = 1; i < configArr.length; i++) { |
| 724 | 726 | const item = configArr[i]; |
| 725 | 727 | const [name, config] = item; |
| 726 | 728 | if (commonUtils.isNotEmptyObject(config) && config.sSqlStr !== "noQuery") { |
| 727 | - const conditonValues = this.handleGetSqlConditionValues(config); | |
| 729 | + const conditonValues = this.handleGetSqlConditionValues(config, masterData); | |
| 728 | 730 | let returnData = await this.props.handleGetDataSet({ |
| 729 | 731 | name, |
| 730 | 732 | configData: config, |
| ... | ... | @@ -816,13 +818,13 @@ export default (ChildComponent) => { |
| 816 | 818 | |
| 817 | 819 | |
| 818 | 820 | // 获取sqlCondition值 |
| 819 | - handleGetSqlConditionValues = (config) => { | |
| 821 | + handleGetSqlConditionValues = (config, record) => { | |
| 820 | 822 | let conditonValues = {}; |
| 821 | 823 | const { sSqlCondition } = config; |
| 822 | 824 | if (commonUtils.isNotEmptyObject(sSqlCondition)) { |
| 823 | 825 | const tableName = sSqlCondition.split('.')[0]; |
| 824 | 826 | if (tableName === 'master') { |
| 825 | - conditonValues = this.props.getSqlCondition(config, 'master', this.props.masterData); | |
| 827 | + conditonValues = this.props.getSqlCondition(config, 'master', this.props.masterData || record); | |
| 826 | 828 | } else { |
| 827 | 829 | let tableDataRow = {}; |
| 828 | 830 | const selectedRowKeys = this.props[`${tableName}SelectedRowKeys`]; | ... | ... |