From d9c1df05b8f02b5d31e571eba68e6d309e3f3b4f Mon Sep 17 00:00:00 2001 From: pengm <674192343@qq.com> Date: Tue, 25 Nov 2025 17:11:24 +0800 Subject: [PATCH] 1.处理通用搜索方案,每次切换方案,调用2次接口的bug --- src/components/Common/SearchComponent/index.js | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/components/Common/SearchComponent/index.js b/src/components/Common/SearchComponent/index.js index 1c4b6c8..e24bede 100644 --- a/src/components/Common/SearchComponent/index.js +++ b/src/components/Common/SearchComponent/index.js @@ -593,7 +593,7 @@ export default class SearchComponent extends Component { /** 修改主表数据 */ handleMasterChange = async (name, sFieldName, changeValue, sId, dropDownData) => { // let { expand } = false; - if (sFieldName === 'sSearchSolutionId') { + if (sFieldName === 'sSearchSolutionId' && false && !location.pathname.toLowerCase().includes('productionmainplan')) { const { searchSolution, slaveConfig, slaveInfoConfig, setSearchSlaveInfo, } = this.props; @@ -639,6 +639,35 @@ export default class SearchComponent extends Component { // expand = true; // } // this.props.onSaveState({ expand }); + } else if (sFieldName === 'sSearchSolutionId' ) { + const { + searchSolution, slaveConfig, slaveInfoConfig, setSearchSlaveInfo, + } = this.props; + const iIndex = searchSolution.findIndex(item => item.sId === changeValue[sFieldName]); + const addState = await this.defaultSearchSolution(searchSolution[iIndex]); + const filterCondition = JSON.parse(searchSolution[iIndex].sCondition); + + this.props.onSaveState({ ...addState }, () => { + this.props.onGetData(slaveConfig, JSON.parse(searchSolution[iIndex].sCondition), '', '', '', '', addState.sGroupByList); + }); + /* 判断是否要加载过滤树数据 */ + const filterTreeConfigArr = slaveConfig.gdsconfigformslave.filter(item => item.bTree); + if (commonUtils.isNotEmptyArr(filterTreeConfigArr)) { + const filterTreeConfig = filterTreeConfigArr[0]; + this.props.onGetFilterTreeData(filterTreeConfig, filterCondition, 1); + let { treeSelectedKeys } = this.props; + if (commonUtils.isNotEmptyArr(treeSelectedKeys)) { /* 清除原来选中树节点 */ + treeSelectedKeys = []; + this.props.onSaveState({ + treeSelectedKeys, treeFilterCondition: [], + }); + } + } + if (setSearchSlaveInfo === 'Y') { + if (commonUtils.isNotEmptyObject(slaveInfoConfig)) { + this.props.onGetDataInfo(slaveInfoConfig, JSON.parse(searchSolution[iIndex].sCondition)); + } + } } else if (sFieldName.includes('sFirst-')) { const { slaveConfig } = this.props; const { masterData } = this.props.onChange(name, sFieldName, changeValue, sId, dropDownData, true); -- libgit2 0.22.2