| | |
| | | _mainSearch = fromJS(mainSearch).toJS() |
| | | } |
| | | |
| | | let isEmpty = _mainSearch.filter(item => item.required && (!item.value || item.value.length === 0)).length > 0 |
| | | |
| | | let params = [] |
| | | config.components.forEach(item => { |
| | | if (item.type === 'tabs' || item.type === 'group') return |
| | |
| | | if (!item.format) return |
| | | |
| | | if (item.dataName && (!item.pageable || (item.pageable && !item.setting.laypage)) && item.setting.onload === 'true' && item.setting.sync === 'true') { |
| | | let param = this.getDefaultParam(item, _mainSearch) |
| | | params.push(param) |
| | | if (isEmpty && item.setting.useMSearch === 'true') { |
| | | item.setting.sync = 'false' |
| | | item.setting.onload = 'false' |
| | | } else { |
| | | let searchlist = [] |
| | | if (item.search && item.search.length > 0) { |
| | | searchlist = Utils.initMainSearch(item.search) |
| | | } |
| | | |
| | | let _empty = searchlist.filter(cell => cell.required && (!cell.value || cell.value.length === 0)).length > 0 |
| | | |
| | | if (_empty) { |
| | | item.setting.sync = 'false' |
| | | item.setting.onload = 'false' |
| | | } else { |
| | | if (item.setting.useMSearch === 'true') { |
| | | let keys = searchlist.map(item => item.key) |
| | | _mainSearch.forEach(item => { |
| | | if (!keys.includes(item.key)) { |
| | | searchlist.push(item) |
| | | } |
| | | }) |
| | | } |
| | | params.push(this.getDefaultParam(item, searchlist)) |
| | | } |
| | | } |
| | | } else { |
| | | item.setting.sync = 'false' |
| | | } |
| | |
| | | /** |
| | | * @description 获取系统存储过程 sPC_Get_TableData 的参数 |
| | | */ |
| | | getDefaultParam = (component, mainSearch) => { |
| | | const { columns, search, setting, dataName, format } = component |
| | | |
| | | let searchlist = [] |
| | | if (search && search.length > 0) { |
| | | searchlist = Utils.initMainSearch(search) |
| | | } |
| | | |
| | | if (setting.useMSearch === 'true') { |
| | | let keys = searchlist.map(item => item.key) |
| | | mainSearch.forEach(item => { |
| | | if (!keys.includes(item.key)) { |
| | | searchlist.push(item) |
| | | } |
| | | }) |
| | | } |
| | | getDefaultParam = (component, searchlist) => { |
| | | const { columns, setting, dataName, format } = component |
| | | |
| | | let arr_field = columns.map(col => col.field) |
| | | let _dataresource = setting.dataresource |