Commit ca09548e780b078870de050e8accea7fa54b434c

Authored by Min
1 parent eab7b494

1.手机端增加选择数据值后,走下拉离开走tmpinfobysql逻辑

src/mobile/common/CommobileComponent.js
@@ -310,6 +310,17 @@ export default class CommonComponent extends Component { @@ -310,6 +310,17 @@ export default class CommonComponent extends Component {
310 } 310 }
311 /* 调用父组件的回带函数 */ 311 /* 调用父组件的回带函数 */
312 this.props.onChange(this.props.name, this.props.showConfig.sName, returnValue, this.props.sId, this.state.dropDownData); 312 this.props.onChange(this.props.name, this.props.showConfig.sName, returnValue, this.props.sId, this.state.dropDownData);
  313 +
  314 + /* 对于表格型下拉(SearchablePicker),值更新后延迟调用 onDropTableBlur
  315 + 确保:1) 使用完整的 returnValue(包含 sAssignField 联动字段)
  316 + 2) 父组件 setState 已完成渲染
  317 + */
  318 + if (this.props.onDropTableBlur && this.props.showConfig.sDropDownType === 'sql') {
  319 + const updatedRecord = { ...this.props.record, ...returnValue };
  320 + setTimeout(() => {
  321 + this.props.onDropTableBlur('master', this.props.showConfig.sName, updatedRecord, this.props.showConfig);
  322 + }, 0);
  323 + }
313 }; 324 };
314 325
315 handleFocus = () => { 326 handleFocus = () => {
@@ -453,7 +464,6 @@ export default class CommonComponent extends Component { @@ -453,7 +464,6 @@ export default class CommonComponent extends Component {
453 record ={this.props.record} 464 record ={this.props.record}
454 tbName = {this.props.name} 465 tbName = {this.props.name}
455 iconSettingShow={this.props.iconSettingShow} 466 iconSettingShow={this.props.iconSettingShow}
456 - onDropTableBlur={this.props.onDropTableBlur}  
457 /> 467 />
458 468
459 ) 469 )
src/mobile/components/searchPicker.jsx
@@ -5,7 +5,7 @@ import styles from "./selectInput.less"; @@ -5,7 +5,7 @@ import styles from "./selectInput.less";
5 import iconSetting from '../../assets/mobile/setting.png'; 5 import iconSetting from '../../assets/mobile/setting.png';
6 6
7 export default function SearchablePicker(props) { 7 export default function SearchablePicker(props) {
8 - const { onConfirm, initialValue, data, sTitle, onChange, value:newValue, onVisibleChange, onDropTableBlur } = props; 8 + const { initialValue, data, sTitle, onChange, value:newValue, onVisibleChange } = props;
9 9
10 const [searchValue, setSearchValue] = useState(''); 10 const [searchValue, setSearchValue] = useState('');
11 const [visible, setVisible] = useState(false) 11 const [visible, setVisible] = useState(false)
@@ -44,24 +44,11 @@ export default function SearchablePicker(props) { @@ -44,24 +44,11 @@ export default function SearchablePicker(props) {
44 }; 44 };
45 45
46 const handleConfirm = () => { 46 const handleConfirm = () => {
47 - const selectedValue = values[0];  
48 onChange(values); 47 onChange(values);
49 setVisible(false); 48 setVisible(false);
50 - // 调用onVisibleChange回调  
51 if (onVisibleChange) { 49 if (onVisibleChange) {
52 onVisibleChange(false); 50 onVisibleChange(false);
53 } 51 }
54 - const {showConfig:tableConfig, tbName, record} = props;  
55 - const sName = tableConfig.sName;  
56 - // 构造包含新选中值的 record,避免闭包里捕获的旧 record2222  
57 - const updatedRecord = { ...record, [sName]: selectedValue };  
58 - // 延迟调用:确保 React 先完成渲染,父组件拿到最新的 record 值  
59 - setTimeout(() => {  
60 - if(onDropTableBlur){  
61 - onDropTableBlur('master', sName, updatedRecord, tableConfig);  
62 - }  
63 -  
64 - }, 100);  
65 }; 52 };
66 53
67 const handleCancel = () => { 54 const handleCancel = () => {