Commit d9c1df05b8f02b5d31e571eba68e6d309e3f3b4f
1 parent
867bd8eb
1.处理通用搜索方案,每次切换方案,调用2次接口的bug
Showing
1 changed file
with
30 additions
and
1 deletions
src/components/Common/SearchComponent/index.js
| ... | ... | @@ -593,7 +593,7 @@ export default class SearchComponent extends Component { |
| 593 | 593 | /** 修改主表数据 */ |
| 594 | 594 | handleMasterChange = async (name, sFieldName, changeValue, sId, dropDownData) => { |
| 595 | 595 | // let { expand } = false; |
| 596 | - if (sFieldName === 'sSearchSolutionId') { | |
| 596 | + if (sFieldName === 'sSearchSolutionId' && false && !location.pathname.toLowerCase().includes('productionmainplan')) { | |
| 597 | 597 | const { |
| 598 | 598 | searchSolution, slaveConfig, slaveInfoConfig, setSearchSlaveInfo, |
| 599 | 599 | } = this.props; |
| ... | ... | @@ -639,6 +639,35 @@ export default class SearchComponent extends Component { |
| 639 | 639 | // expand = true; |
| 640 | 640 | // } |
| 641 | 641 | // this.props.onSaveState({ expand }); |
| 642 | + } else if (sFieldName === 'sSearchSolutionId' ) { | |
| 643 | + const { | |
| 644 | + searchSolution, slaveConfig, slaveInfoConfig, setSearchSlaveInfo, | |
| 645 | + } = this.props; | |
| 646 | + const iIndex = searchSolution.findIndex(item => item.sId === changeValue[sFieldName]); | |
| 647 | + const addState = await this.defaultSearchSolution(searchSolution[iIndex]); | |
| 648 | + const filterCondition = JSON.parse(searchSolution[iIndex].sCondition); | |
| 649 | + | |
| 650 | + this.props.onSaveState({ ...addState }, () => { | |
| 651 | + this.props.onGetData(slaveConfig, JSON.parse(searchSolution[iIndex].sCondition), '', '', '', '', addState.sGroupByList); | |
| 652 | + }); | |
| 653 | + /* 判断是否要加载过滤树数据 */ | |
| 654 | + const filterTreeConfigArr = slaveConfig.gdsconfigformslave.filter(item => item.bTree); | |
| 655 | + if (commonUtils.isNotEmptyArr(filterTreeConfigArr)) { | |
| 656 | + const filterTreeConfig = filterTreeConfigArr[0]; | |
| 657 | + this.props.onGetFilterTreeData(filterTreeConfig, filterCondition, 1); | |
| 658 | + let { treeSelectedKeys } = this.props; | |
| 659 | + if (commonUtils.isNotEmptyArr(treeSelectedKeys)) { /* 清除原来选中树节点 */ | |
| 660 | + treeSelectedKeys = []; | |
| 661 | + this.props.onSaveState({ | |
| 662 | + treeSelectedKeys, treeFilterCondition: [], | |
| 663 | + }); | |
| 664 | + } | |
| 665 | + } | |
| 666 | + if (setSearchSlaveInfo === 'Y') { | |
| 667 | + if (commonUtils.isNotEmptyObject(slaveInfoConfig)) { | |
| 668 | + this.props.onGetDataInfo(slaveInfoConfig, JSON.parse(searchSolution[iIndex].sCondition)); | |
| 669 | + } | |
| 670 | + } | |
| 642 | 671 | } else if (sFieldName.includes('sFirst-')) { |
| 643 | 672 | const { slaveConfig } = this.props; |
| 644 | 673 | const { masterData } = this.props.onChange(name, sFieldName, changeValue, sId, dropDownData, true); | ... | ... |