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,18 +713,20 @@ export default (ChildComponent) => { | ||
| 713 | 713 | ||
| 714 | const masterConfig = configArr[0][1]; | 714 | const masterConfig = configArr[0][1]; |
| 715 | const conditonValues = this.handleGetSqlConditionValues(masterConfig) | 715 | const conditonValues = this.handleGetSqlConditionValues(masterConfig) |
| 716 | - await this.props.handleGetDataOne({ | 716 | + const masterDataReturn = await this.props.handleGetDataOne({ |
| 717 | name: 'master', | 717 | name: 'master', |
| 718 | configData: masterConfig, | 718 | configData: masterConfig, |
| 719 | condition: { sSqlCondition: { ...conditonValues }, sId, pageSize: '', pageNum: '' }, | 719 | condition: { sSqlCondition: { ...conditonValues }, sId, pageSize: '', pageNum: '' }, |
| 720 | bEditClick, | 720 | bEditClick, |
| 721 | + isWait: true, | ||
| 721 | }); | 722 | }); |
| 722 | - | 723 | + const masterData= masterDataReturn?.masterData; |
| 724 | + addState.masterData = masterData; | ||
| 723 | for (let i = 1; i < configArr.length; i++) { | 725 | for (let i = 1; i < configArr.length; i++) { |
| 724 | const item = configArr[i]; | 726 | const item = configArr[i]; |
| 725 | const [name, config] = item; | 727 | const [name, config] = item; |
| 726 | if (commonUtils.isNotEmptyObject(config) && config.sSqlStr !== "noQuery") { | 728 | if (commonUtils.isNotEmptyObject(config) && config.sSqlStr !== "noQuery") { |
| 727 | - const conditonValues = this.handleGetSqlConditionValues(config); | 729 | + const conditonValues = this.handleGetSqlConditionValues(config, masterData); |
| 728 | let returnData = await this.props.handleGetDataSet({ | 730 | let returnData = await this.props.handleGetDataSet({ |
| 729 | name, | 731 | name, |
| 730 | configData: config, | 732 | configData: config, |
| @@ -816,13 +818,13 @@ export default (ChildComponent) => { | @@ -816,13 +818,13 @@ export default (ChildComponent) => { | ||
| 816 | 818 | ||
| 817 | 819 | ||
| 818 | // 获取sqlCondition值 | 820 | // 获取sqlCondition值 |
| 819 | - handleGetSqlConditionValues = (config) => { | 821 | + handleGetSqlConditionValues = (config, record) => { |
| 820 | let conditonValues = {}; | 822 | let conditonValues = {}; |
| 821 | const { sSqlCondition } = config; | 823 | const { sSqlCondition } = config; |
| 822 | if (commonUtils.isNotEmptyObject(sSqlCondition)) { | 824 | if (commonUtils.isNotEmptyObject(sSqlCondition)) { |
| 823 | const tableName = sSqlCondition.split('.')[0]; | 825 | const tableName = sSqlCondition.split('.')[0]; |
| 824 | if (tableName === 'master') { | 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 | } else { | 828 | } else { |
| 827 | let tableDataRow = {}; | 829 | let tableDataRow = {}; |
| 828 | const selectedRowKeys = this.props[`${tableName}SelectedRowKeys`]; | 830 | const selectedRowKeys = this.props[`${tableName}SelectedRowKeys`]; |