| | |
| | | }) |
| | | } |
| | | |
| | | config.components = this.formatSetting(config.components, params, mainSearch, inherit, regs) |
| | | let isEmpty = mainSearch.filter(item => item.required && (!item.value || item.value.length === 0)).length > 0 |
| | | |
| | | config.components = this.formatSetting(config.components, params, mainSearch, inherit, regs, isEmpty) |
| | | |
| | | this.setState({ |
| | | BID: BID, |
| | |
| | | } |
| | | |
| | | // 格式化默认设置 |
| | | formatSetting = (components, params, mainSearch, inherit, regs) => { |
| | | formatSetting = (components, params, mainSearch, inherit, regs, isEmpty) => { |
| | | return components.map(component => { |
| | | if (component.type === 'tabs') { |
| | | component.subtabs = component.subtabs.map(tab => { |
| | |
| | | // dataName 系统生成的数据源名称 |
| | | // pageable 是否分页,组件属性,不分页的组件才可以统一查询 |
| | | if (component.floor === 1 && component.dataName && (!component.pageable || (component.pageable && !component.setting.laypage)) && component.setting.onload === 'true' && component.setting.sync === 'true') { |
| | | let param = this.getDefaultParam(component, mainSearch) |
| | | params.push(param) |
| | | if (isEmpty && component.setting.useMSearch === 'true') { |
| | | component.setting.sync = 'false' |
| | | component.setting.onload = 'false' |
| | | } else { |
| | | let searchlist = [] |
| | | if (component.search && component.search.length > 0) { |
| | | searchlist = Utils.initMainSearch(component.search) |
| | | } |
| | | |
| | | let _empty = searchlist.filter(item => item.required && (!item.value || item.value.length === 0)).length > 0 |
| | | |
| | | if (_empty) { |
| | | component.setting.sync = 'false' |
| | | component.setting.onload = 'false' |
| | | } else { |
| | | if (component.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(component, searchlist)) |
| | | } |
| | | } |
| | | } else if (component.floor === 1) { |
| | | component.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 |