diff --git a/src/mobile/common/CommobileComponent.js b/src/mobile/common/CommobileComponent.js index 5a3ff51..b7367f6 100644 --- a/src/mobile/common/CommobileComponent.js +++ b/src/mobile/common/CommobileComponent.js @@ -310,6 +310,17 @@ export default class CommonComponent extends Component { } /* 调用父组件的回带函数 */ this.props.onChange(this.props.name, this.props.showConfig.sName, returnValue, this.props.sId, this.state.dropDownData); + + /* 对于表格型下拉(SearchablePicker),值更新后延迟调用 onDropTableBlur + 确保:1) 使用完整的 returnValue(包含 sAssignField 联动字段) + 2) 父组件 setState 已完成渲染 + */ + if (this.props.onDropTableBlur && this.props.showConfig.sDropDownType === 'sql') { + const updatedRecord = { ...this.props.record, ...returnValue }; + setTimeout(() => { + this.props.onDropTableBlur('master', this.props.showConfig.sName, updatedRecord, this.props.showConfig); + }, 0); + } }; handleFocus = () => { @@ -453,7 +464,6 @@ export default class CommonComponent extends Component { record ={this.props.record} tbName = {this.props.name} iconSettingShow={this.props.iconSettingShow} - onDropTableBlur={this.props.onDropTableBlur} /> ) diff --git a/src/mobile/components/searchPicker.jsx b/src/mobile/components/searchPicker.jsx index a0ea61f..76ff0c5 100644 --- a/src/mobile/components/searchPicker.jsx +++ b/src/mobile/components/searchPicker.jsx @@ -5,7 +5,7 @@ import styles from "./selectInput.less"; import iconSetting from '../../assets/mobile/setting.png'; export default function SearchablePicker(props) { - const { onConfirm, initialValue, data, sTitle, onChange, value:newValue, onVisibleChange, onDropTableBlur } = props; + const { initialValue, data, sTitle, onChange, value:newValue, onVisibleChange } = props; const [searchValue, setSearchValue] = useState(''); const [visible, setVisible] = useState(false) @@ -44,24 +44,11 @@ export default function SearchablePicker(props) { }; const handleConfirm = () => { - const selectedValue = values[0]; onChange(values); setVisible(false); - // 调用onVisibleChange回调 if (onVisibleChange) { onVisibleChange(false); } - const {showConfig:tableConfig, tbName, record} = props; - const sName = tableConfig.sName; - // 构造包含新选中值的 record,避免闭包里捕获的旧 record2222 - const updatedRecord = { ...record, [sName]: selectedValue }; - // 延迟调用:确保 React 先完成渲染,父组件拿到最新的 record 值 - setTimeout(() => { - if(onDropTableBlur){ - onDropTableBlur('master', sName, updatedRecord, tableConfig); - } - - }, 100); }; const handleCancel = () => {