diff --git a/src/assets/mobile/search.svg b/src/assets/mobile/search.svg new file mode 100644 index 0000000..007b1ec --- /dev/null +++ b/src/assets/mobile/search.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/mobile/common/CommobileComponent.js b/src/mobile/common/CommobileComponent.js index c8d0254..97736d8 100644 --- a/src/mobile/common/CommobileComponent.js +++ b/src/mobile/common/CommobileComponent.js @@ -9,7 +9,7 @@ import * as commonUtils from '../../utils/utils'; import styles from '../mobile.less'; import iconSetting from '../../assets/mobile/setting.png'; import scan from '../../assets/mobile/scanning.svg'; - +import search from '../../assets/mobile/search.svg'; // eslint-disable-next-line prefer-destructuring const CheckboxItem = Checkbox.CheckboxItem; @@ -386,6 +386,12 @@ export default class CommonComponent extends Component { this.props.onMobileScan(this.props.showConfig, this.props.name, this.props.record); } + /* 主表过滤从表 */ + handleMobileFilterTable = () => { + console.log('主表过滤从表', this.props.record); + this.props.onMobileFilterTable(this.props.showConfig, this.props.name, this.props.record); + } + /** 渲染 */ render() { const { sDateFormat: sDateFormatOld, sFieldValidation, bNotEmpty, bOpenKeyboard } = this.props.showConfig; @@ -435,7 +441,7 @@ export default class CommonComponent extends Component { // // // ); - + input = ( { this.inputRef = el; }} clear onChange={debounce(this.handleFieldScan, 1000)} >{sTitle}; const is_Scan = this.props.showConfig.sControlName && this.props.showConfig.sControlName.includes('_scan'); + const is_Search = this.props.showConfig.sControlName && this.props.showConfig.sControlName.toLowerCase().includes('_search'); + if (is_Pda) { input = pdaInput; } else if (is_Scan) { input =
{sTitle}scan
; - } else { + } else if (is_Search) { + input =
{sTitle} this.handleMobileFilterTable(e)}>scan
; + } else { input = ({sTitle}); } } diff --git a/src/mobile/common/CommobileSubBill.js b/src/mobile/common/CommobileSubBill.js index 4fabdcd..7d31edf 100644 --- a/src/mobile/common/CommobileSubBill.js +++ b/src/mobile/common/CommobileSubBill.js @@ -2256,10 +2256,13 @@ const CommobileBillComponent = createForm()(CommobileBill); const TabComponentSlave = (props) => { - const { masterConfig, masterData, slaveData: slaveDataOld, slaveConfig, sModelsId, enabled, app, sUseInfo } = props; + const { masterConfig, masterData, slaveData: slaveDataOld, slaveConfig, sModelsId, enabled, app, sUseInfo, searchSlaveData:searchSlaveDataOld = [] } = props; const slaveDataOld2 = slaveDataOld === undefined ? [] : slaveDataOld; - const slaveData = dataSource.cloneWithRows(slaveDataOld2); + let slaveData = dataSource.cloneWithRows(slaveDataOld2); + if(commonUtils.isNotEmptyArr(searchSlaveDataOld)){ + slaveData = dataSource.cloneWithRows(searchSlaveDataOld); + } const style = { display: 'flex', @@ -2287,6 +2290,7 @@ const TabComponentSlave = (props) => { justifyContent: 'space-between', background: ' #f0f0f0', }; + console.log('aaa', props); const row = (rowData, sectionID, rowID) => { return ( @@ -2578,53 +2582,9 @@ const TabComponentSlaveChild = (props) => { const f8 = commonUtils.isEmptyObject(masterConfig) ? {} : masterConfig.gdsconfigformslave.filter(item => item.bVisible && item.sName !== '' && item.iTag === 1)[7]; const f9 = commonUtils.isEmptyObject(masterConfig) ? {} : masterConfig.gdsconfigformslave.filter(item => item.bVisible && item.sName !== '' && item.iTag === 1)[8]; const f10 = commonUtils.isEmptyObject(masterConfig) ? {} : masterConfig.gdsconfigformslave.filter(item => item.bVisible && item.sName !== '' && item.iTag === 1)[9]; - + console.log('77777222', props); return (
- {/*
*/} - {/**/} - {/* {*/} - {/* f1 ? {f1.showName} : {_this.getViewValue(f1, masterData)} : ''*/} - {/* }*/} - {/* {*/} - {/* f2 ? {f2.showName} : {_this.getViewValue(f2, masterData)} : ''*/} - {/* }*/} - {/**/} - {/**/} - {/* {*/} - {/* f3 ? {f3.showName} : {_this.getViewValue(f3, masterData)} : ''*/} - {/* }*/} - {/**/} - {/**/} - {/* {*/} - {/* f4 ? <>
{f4.showName} :
{_this.getViewValue(f4, masterData)} : ''*/} - {/* }*/} - {/*
*/} - {/**/} - {/* {*/} - {/* f5 ? {f5.showName} : {_this.getViewValue(f5, masterData)} : ''*/} - {/* }*/} - {/* {*/} - {/* f6 ? {f6.showName} : {_this.getViewValue(f6, masterData)} : ''*/} - {/* }*/} - {/**/} - {/**/} - {/* {*/} - {/* f7 ? {f7.showName} : {_this.getViewValue(f7, masterData)} : ''*/} - {/* }*/} - {/* {*/} - {/* f8 ? {f8.showName} : {_this.getViewValue(f8, masterData)} : ''*/} - {/* }*/} - {/**/} - {/**/} - {/* {*/} - {/* f9 ? {f9.showName} : {_this.getViewValue(f9, masterData)} : ''*/} - {/* }*/} - {/* {*/} - {/* f10 ? {f10.showName} : {_this.getViewValue(f10, masterData)} : ''*/} - {/* }*/} - {/**/} - {/*
*/}
diff --git a/src/mobile/common/CommobileSubBillEvent.js b/src/mobile/common/CommobileSubBillEvent.js index 50624f0..ab8f23b 100644 --- a/src/mobile/common/CommobileSubBillEvent.js +++ b/src/mobile/common/CommobileSubBillEvent.js @@ -1957,6 +1957,49 @@ export default (ChildComponent) => { } } + /** + * 子表多字段模糊过滤 + * @param {Object} fieldConfig 列配置对象(包含sActiveKey) + * @param {Array} searchSlaveData 原始列表数据源 + * @param {String} searchVal 输入框搜索值(如222) + * @returns {Array} 过滤后的新数组 + */ + handleFilterData = (fieldConfig, searchSlaveData, searchVal)=> { + // 1. 判空兜底 + if (!fieldConfig?.sActiveKey || !searchSlaveData?.length || !searchVal?.trim()) { + return searchSlaveData || []; + } + + // 2. 分割多搜索字段 sActiveKey:"sProductName,sDefineNo" + const searchKeys = fieldConfig.sActiveKey.split(',').map(key => key.trim()); + const targetVal = searchVal.trim(); + + // 3. 过滤逻辑:任意字段包含搜索值即匹配(模糊查询) + const filterList = searchSlaveData.filter(item => { + return searchKeys.some(key => { + // 当前行该字段的值,转字符串防止数字/空报错 + const cellVal = String(item[key] ?? ''); + // 模糊匹配:包含搜索文本;需要精确匹配改为 cellVal === targetVal + return cellVal.includes(targetVal); + }); + }); + + return filterList; + } + + handleMobileFilterTable = (fieldConfig, tbName, record) => { + const{ slaveData = []}= this.props; + const fieldName = fieldConfig?.sName; + const inputVal = record?.[fieldName]; + // 原始子表数据 + // 执行过滤 + const filterResult = this.handleFilterData(fieldConfig, slaveData, inputVal); + console.log('过滤后列表', filterResult); + // 更新视图 + this.props.onSaveState({ searchSlaveData: filterResult }); + + } + handleButtonClick = async (name ) => { if(name === 'BtnRefresh') { const { sModelsType, slaveConfig, masterConfig, employeeConfig, slave0Config, slaveChildConfig}= this.props; @@ -1994,6 +2037,7 @@ export default (ChildComponent) => { onEdit={this.handleEdit} isOutsourcedProcesses={this.isOutsourcedProcesses} onMobileScan={this.handleMobileScan} + onMobileFilterTable={this.handleMobileFilterTable} handleNameToIndex={this.handleNameToIndex} onButtonClick = {this.handleButtonClick} /> diff --git a/src/mobile/common/CommobileViewMaster.js b/src/mobile/common/CommobileViewMaster.js index 6d072a7..03d0ae2 100644 --- a/src/mobile/common/CommobileViewMaster.js +++ b/src/mobile/common/CommobileViewMaster.js @@ -15,6 +15,9 @@ export default class CommobileViewMaster extends Component { handleMobileScan = (fieldConfig, tbName, record, newValue, cancelValue) => { this.props.onMobileScan(fieldConfig, tbName, record, newValue, cancelValue); } + handleMobileFilterTable = (fieldConfig, tbName, record, newValue, cancelValue) => { + this.props.onMobileFilterTable(fieldConfig, tbName, record, newValue, cancelValue); + } handleFocus = (fieldConfig) => { this.props.onFocus(fieldConfig); } @@ -76,6 +79,7 @@ export default class CommobileViewMaster extends Component { onSaveState: this.props.onSaveState, onFieldScan: this.handleMasterFieldScan, onMobileScan: this.handleMobileScan, + onMobileFilterTable:this.handleMobileFilterTable, /* 主表筛选从表 */ bOpenKeyboard, }; if (child.iTag === 1) {